本文整理匯總了Python中dicom.dataset.Dataset.Modality方法的典型用法代碼示例。如果您正苦於以下問題:Python Dataset.Modality方法的具體用法?Python Dataset.Modality怎麽用?Python Dataset.Modality使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類dicom.dataset.Dataset
的用法示例。
在下文中一共展示了Dataset.Modality方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: Dataset
# 需要導入模塊: from dicom.dataset import Dataset [as 別名]
# 或者: from dicom.dataset.Dataset import Modality [as 別名]
filename = r"c:\temp\test.dcm"
filename2 = r"c:\temp\test-explBig.dcm"
else:
homedir = os.path.expanduser("~")
filename = os.path.join(homedir + "/Documents/UW/GrantApps/Neuroimaging-Ontology/nii2dcm", "test.dcm")
filename2 = os.path.join(homedir+"/Documents/UW/GrantApps/Neuroimaging-Ontology/nii2dcm", "test-explBig.dcm")
print "Setting file meta information..."
# Populate required values for file meta information
file_meta = Dataset()
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
示例2: check_send_dicom_from_remoteAE
# 需要導入模塊: from dicom.dataset import Dataset [as 別名]
# 或者: from dicom.dataset.Dataset import Modality [as 別名]
def check_send_dicom_from_remoteAE(self,assoc):
d = Dataset()
d.PatientsName = self.patient_search
d.QueryRetrieveLevel = "PATIENT"
d.PatientID = "*"
patients = [x[1] for x in assoc.PatientRootFindSOPClass.SCU(d, 1)][:-1]
self.log.info("Checking %d Exams ",len(patients))
# loop on patients
for pp in patients:
if pp.PatientName=="Service Patient":
print "skiping Service Patient"
continue
#self.log.info("Checking %s ",pp.PatientName)
# find studies
d = Dataset()
d.PatientID = pp.PatientID
d.QueryRetrieveLevel = "STUDY"
d.PatientName = ""
d.StudyInstanceUID = ""
d.StudyDate = ""
d.StudyTime = ""
d.StudyID = ""
d.ModalitiesInStudy = ""
d.StudyDescription = ""
d.NumberOfStudyRelatedInstances=""
studies = [x[1] for x in assoc.PatientRootFindSOPClass.SCU(d, 1)][:-1]
# loop on studies
for st in studies:
#print " %s - %s %s ||| %s " % (st.StudyDescription, st.StudyDate, st.StudyTime,st.NumberOfStudyRelatedInstances)
d = Dataset()
d.QueryRetrieveLevel = "SERIES"
d.StudyInstanceUID = st.StudyInstanceUID
d.PatientID = "" # st.PatientID #rrr
d.StudyDescription = ""
d.StudyDate = ""
d.PatientName = ""
d.StudyID = ""
d.AcquisitionDate = ""
d.SeriesInstanceUID = ""
d.InstanceNumber = ""
d.Modality = ""
d.SeriesNumber = ""
d.SeriesDescription = ""
d.SeriesDate = ""
d.SeriesTime = ""
d.SeriesID = ""
d.NumberOfSeriesRelatedInstances = ""
series = [x[1] for x in assoc.PatientRootFindSOPClass.SCU(d, 1)][:-1]
# print series uid and number of instances
for se in series:
if se.NumberOfSeriesRelatedInstances==0 :
log.info('Empyt Serie in %s_%s',se.StudyDescription,se.PatientName)
else:
(exa,suj,ser) = self.get_exam_suj_ser_from_dicom_dataset(se)
dic_dir = os.path.join(self.rootdir,exa,suj,ser)
if not os.path.isdir(dic_dir):
dic_dir+='_phase'
if not os.path.isdir(dic_dir):
(exa,suj,ser) = self.get_exam_suj_ser_from_dicom_dataset_new(se)
dic_dir = os.path.join(self.rootdir,exa,suj,ser)
if not os.path.isdir(dic_dir):
# i can not ask image instance level so do not kwon about IMAGETYPE so I check i _phase exist
dic_dir_p = os.path.join(self.rootdir,exa,suj,ser+'_phase')
if os.path.isdir(dic_dir_p):
dic_dir=dic_dir_p
if os.path.isdir(dic_dir) :
nbdic = glob.glob(os.path.join(dic_dir,"*dic"))
#print "nbd %d nbi %s" %(len(nbdic),se.NumberOfSeriesRelatedInstances)
if len(nbdic) != se.NumberOfSeriesRelatedInstances:
self.log.warning(" MISSING DICOMS found %d instead of %s in %s",len(nbdic),se.NumberOfSeriesRelatedInstances,dic_dir)
else :
self.log.warning(" MISSING SERIES : %s",dic_dir)