本文整理匯總了Python中dicom.dataset.Dataset.PatientsName方法的典型用法代碼示例。如果您正苦於以下問題:Python Dataset.PatientsName方法的具體用法?Python Dataset.PatientsName怎麽用?Python Dataset.PatientsName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類dicom.dataset.Dataset
的用法示例。
在下文中一共展示了Dataset.PatientsName方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: setUp
# 需要導入模塊: from dicom.dataset import Dataset [as 別名]
# 或者: from dicom.dataset.Dataset import PatientsName [as 別名]
def setUp(self):
# Create simple dataset for all tests
ds = Dataset()
ds.PatientsName = "Name^Patient"
# Set up a simple nested sequence
# first, the innermost sequence
subitem1 = Dataset()
subitem1.ContourNumber = 1
subitem1.ContourData = [2,4,8,16]
subitem2 = Dataset()
subitem2.ContourNumber = 2
subitem2.ContourData = [32,64,128,196]
sub_ds = Dataset()
sub_ds.Contours = Sequence((subitem1, subitem2)) # XXX in 0.9.5 will need sub_ds.ContourSequence
# Now the top-level sequence
ds.ROIContours = Sequence((sub_ds,)) # Comma necessary to make it a one-tuple
# Store so each test can use it
self.ds = ds
示例2: Dataset
# 需要導入模塊: from dicom.dataset import Dataset [as 別名]
# 或者: from dicom.dataset.Dataset import PatientsName [as 別名]
RemoteAE = {'Address': 'localhost', 'Port': 2001, 'AET': 'AE1'}
# create association with remote AE
print "Request association"
assoc = MyAE.RequestAssociation(RemoteAE)
# perform a DICOM ECHO
print "DICOM Echo ... ",
st = assoc.VerificationSOPClass.SCU(1)
print 'done with status "%s"' % st
# send dataset using RTPlanStorageSOPClass
print "DICOM FindSCU ... ",
d = Dataset()
d.PatientsName = '*'
d.QueryRetrieveLevel = "PATIENT"
st = assoc.PatientRootFindSOPClass.SCU(d, 1)
print 'done with status "%s"' % st
print "Results"
for ss in st:
print
print ss
print "Release association"
assoc.Release(0)
# done
MyAE.Quit()
示例3: dict
# 需要導入模塊: from dicom.dataset import Dataset [as 別名]
# 或者: from dicom.dataset.Dataset import PatientsName [as 別名]
# remote application entity
RemoteAE = dict(Address=args.remotehost, Port=args.remoteport, AET=args.aec)
# create association with remote AE
print "Request association"
assoc = MyAE.RequestAssociation(RemoteAE)
# perform a DICOM ECHO
print "DICOM Echo ... ",
st = assoc.VerificationSOPClass.SCU(1)
print 'done with status "%s"' % st
print "DICOM FindSCU ... ",
d = Dataset()
d.PatientsName = args.searchstring
d.QueryRetrieveLevel = "PATIENT"
d.PatientID = "*"
st = assoc.PatientRootFindSOPClass.SCU(d, 1)
print 'done with status "%s"' % st
for ss in st:
if not ss[1]:
continue
# print ss[1]
try:
d.PatientID = ss[1].PatientID
except:
continue
print "Moving"
print d
示例4: check_send_dicom_from_remoteAE
# 需要導入模塊: from dicom.dataset import Dataset [as 別名]
# 或者: from dicom.dataset.Dataset import PatientsName [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)
示例5: __downloadFromDali
# 需要導入模塊: from dicom.dataset import Dataset [as 別名]
# 或者: from dicom.dataset.Dataset import PatientsName [as 別名]
def __downloadFromDali(self, foldername,
ptid,
series_description,
accession_number):
print "making dir ", os.path.join(
constants.dicom_dir, foldername)
os.mkdir(os.path.join(
constants.dicom_dir, foldername))
def OnAssociateResponse(association):
print "Association response received"
def OnReceiveStore(SOPClass, DS):
file_meta = Dataset()
file_meta.MediaStorageSOPClassUID = DS.SOPClassUID
file_meta.MediaStorageSOPInstanceUID = DS.SOPInstanceUID
file_meta.ImplementationClassUID = DS.SOPClassUID
filename = os.path.join(
constants.dicom_dir, foldername, DS.SOPInstanceUID + ".dcm")
print "making file ", filename
ds = FileDataset(
filename, {}, file_meta=file_meta, preamble="\0" * 128)
ds.update(DS)
ds.is_little_endian = True
ds.is_implicit_VR = True
ds.save_as(filename)
# print "File %s written" % filename
# must return appropriate status
return SOPClass.Success
self.MyAE.OnAssociateResponse = OnAssociateResponse
self.MyAE.OnReceiveStore = OnReceiveStore
# perform a DICOM ECHO
try:
print "DICOM Echo ... ",
st = self.assoc.VerificationSOPClass.SCU(1)
print 'done with status "%s"' % st
except Exception as e:
raise RuntimeError(
"Error when testing connectiont to DALI: %s" % e)
try:
print "DICOM FindSCU ... ",
d = Dataset()
d.PatientsName = '*'
d.PatientID = ptid
d.SeriesDescription = series_description
d.AccessionNumber = accession_number
d.StudyInstanceUID = "*"
d.SeriesInstanceUID = "*"
d.QueryRetrieveLevel = "SERIES"
st = self.assoc.PatientRootFindSOPClass.SCU(d, 1)
print 'done with status "%s"' % st
except Exception as e:
raise RuntimeError(
"Error when searching patient data from DALI: %s" % e)
try:
SSUIDs = [(d[1].StudyInstanceUID, d[1].SeriesInstanceUID)
for d in st
if isinstance(d[1],
Dataset) and d[1].keys() != []]
print SSUIDs
if(SSUIDs == []):
raise RuntimeError("No patient data matching query")
except Exception as e:
raise RuntimeError("Error when quering DALI: %s" % e)
# send dataset using RTPlanStorageSOPClass
for SSUID in SSUIDs[0:1]:
try:
print "DICOM GetSCU ... ",
d = Dataset()
d.QueryRetrieveLevel = "SERIES"
d.StudyInstanceUID = SSUID[0]
d.SeriesInstanceUID = SSUID[1]
d.SeriesDescription = series_description
d.SeriesDescription = accession_number
d.PatientID = ptid
st = self.assoc.PatientRootGetSOPClass.SCU(d, 1)
except Exception as e:
raise RuntimeError(
"Error when retrieving patient data from DALI: %s" % e)