本文整理匯總了Python中dicom.dataset.Dataset.SegmentationFractionalType方法的典型用法代碼示例。如果您正苦於以下問題:Python Dataset.SegmentationFractionalType方法的具體用法?Python Dataset.SegmentationFractionalType怎麽用?Python Dataset.SegmentationFractionalType使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類dicom.dataset.Dataset
的用法示例。
在下文中一共展示了Dataset.SegmentationFractionalType方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: instance
# 需要導入模塊: from dicom.dataset import Dataset [as 別名]
# 或者: from dicom.dataset.Dataset import SegmentationFractionalType [as 別名]
file_meta.MediaStorageSOPClassUID = '1.2.840.10008.5.1.4.1.1.66.4' # Segmentation SOP Class
file_meta.MediaStorageSOPInstanceUID = "1.2.840.10008.5.1.4.1.1.66.4" # !! Need valid UID here for real work
file_meta.ImplementationClassUID = "1.2.840.10008.5.1.4.1.1.66.4" # !!! Need valid UIDs here
# Required for Segmentation IOD
file_meta.Modality = 'SEG'
file_meta.SeriesNumber = '001'
file_meta.ImageType = '1' # Derived = 1, Primary = 2
file_meta.SamplesPerPixel = '1'
file_meta.PhotometricInterpretation = 'MONOCHROME2'
file_meta.PixelRepresentation = 0
file_meta.BitsAllocated = 8 # Binary = 1
file_meta.BitsStored = 8 # Binary = 1
file_meta.HighBit = 7 # Binary = 0
file_meta.SegmentationType = 'FRACTIONAL' #FRACTIONAL or BINARY
file_meta.SegmentationFractionalType = 'OCCUPANCY' #Can be OCCUPANCY or PROBABILITY
file_meta.MaximumFractionalValue = 116 # 116 is the number of labels in AAL
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"