示例#1
0
文件: nii2dcm.py 项目: nicholsn/pyAIM
        file_meta.SegmentSequence = 'AAL' # List of segments?
        file_meta.SegmentNumber = 1 #Number identifying the segment



    print "Setting dataset values..."

    # Create the FileDataset instance (initially no data elements, but file_meta supplied)
    ds = FileDataset(filename, {}, file_meta=file_meta, preamble="\0"*128)

    # Add the data elements -- not trying to set all required here. Check DICOM standard
    ds.PatientsName = "Test^Firstname"
    ds.PatientID = "123456"

    # Populate required values for file meta information
    ds.MediaStorageSOPClassUID = '1.2.840.10008.5.1.4.1.1.66.4' # Segmentation SOP Class
    ds.MediaStorageSOPInstanceUID = "1.2.840.10008.5.1.4.1.1.66.4" # !! Need valid UID here for real work
    ds.ImplementationClassUID = "1.2.840.10008.5.1.4.1.1.66.4" # !!! Need valid UIDs here

    # Required for Segmentation IOD
    ds.Modality = 'SEG'
    ds.SeriesNumber = '001'
    ds.ImageType = '1' # Derived = 1, Primary = 2

    #Set image parameters
    ds.SpacingBetweenSlices = '2.0'
    ds.ImageOrientationPatient = ['-1', '0', '0', '0', '-1', '0']
    ds.SamplesPerPixel = 1
    ds.PhotometricInterpretation = 'MONOCHROME2'
    ds.Rows = 109
    ds.Columns = 91