|
@@ -24,7 +24,7 @@ def main(parameterFile):
|
|
with open(fsetup,'r') as f:
|
|
with open(fsetup,'r') as f:
|
|
setup=json.load(f)
|
|
setup=json.load(f)
|
|
|
|
|
|
- sys.path.insert(0,setup['paths']['nixWrapper'])2
|
|
|
|
|
|
+ sys.path.insert(0,setup['paths']['nixWrapper'])
|
|
import nixWrapper
|
|
import nixWrapper
|
|
|
|
|
|
nixWrapper.loadLibrary("labkeyInterface")
|
|
nixWrapper.loadLibrary("labkeyInterface")
|
|
@@ -82,33 +82,22 @@ def main(parameterFile):
|
|
sdata=odb.getStudyData(s)
|
|
sdata=odb.getStudyData(s)
|
|
sdicom=sdata['MainDicomTags']
|
|
sdicom=sdata['MainDicomTags']
|
|
sid=sdicom['StudyInstanceUID']
|
|
sid=sdicom['StudyInstanceUID']
|
|
- print('\tStudy: {}/{}'.format(s,sid))
|
|
|
|
#print('Data: {}'.format(sdata))
|
|
#print('Data: {}'.format(sdata))
|
|
#this is try/except protetcted in previous version...
|
|
#this is try/except protetcted in previous version...
|
|
sdate="19700101"
|
|
sdate="19700101"
|
|
try:
|
|
try:
|
|
- sdicom['StudyDate']
|
|
|
|
|
|
+ sdate=sdicom['StudyDate']
|
|
except KeyError:
|
|
except KeyError:
|
|
pass
|
|
pass
|
|
#continue
|
|
#continue
|
|
|
|
|
|
|
|
+ print('\tStudy[{}]: {}/{}'.format(sdate,s,sid))
|
|
|
|
|
|
for se in sdata['Series']:
|
|
for se in sdata['Series']:
|
|
|
|
|
|
- qfilter={'variable':'orthancSeries','value':se,'oper':'eq'}
|
|
|
|
- ds=db.selectRows(project,opars['schemaName'],\
|
|
|
|
- opars['queryName'],[qfilter])
|
|
|
|
- if len(ds['rows'])>0:
|
|
|
|
- continue
|
|
|
|
-
|
|
|
|
- #count existing entries for patient
|
|
|
|
- qfilter={'variable':participantField,'value':patientId,'oper':'eq'}
|
|
|
|
- ds=db.selectRows(project,opars['schemaName'],\
|
|
|
|
- opars['queryName'],[qfilter])
|
|
|
|
- seqNum=len(ds['rows'])
|
|
|
|
-
|
|
|
|
sedata=odb.getSeriesData(se)
|
|
sedata=odb.getSeriesData(se)
|
|
sedicom=sedata['MainDicomTags']
|
|
sedicom=sedata['MainDicomTags']
|
|
|
|
+
|
|
seid=sedicom['SeriesInstanceUID']
|
|
seid=sedicom['SeriesInstanceUID']
|
|
#print('Data: {}'.format(sedata))
|
|
#print('Data: {}'.format(sedata))
|
|
seDesc="NONE"
|
|
seDesc="NONE"
|
|
@@ -126,16 +115,38 @@ def main(parameterFile):
|
|
|
|
|
|
print('\t\tSeries[{}]: {}/{}'.format(seDesc,se,seid))
|
|
print('\t\tSeries[{}]: {}/{}'.format(seDesc,se,seid))
|
|
|
|
|
|
- row={}
|
|
|
|
- row[participantField]=patientId
|
|
|
|
- row['sequenceNum']=seqNum
|
|
|
|
|
|
+ qfilter={'variable':'orthancSeries','value':se,'oper':'eq'}
|
|
|
|
+ ds=db.selectRows(project,opars['schemaName'],\
|
|
|
|
+ opars['queryName'],[qfilter])
|
|
|
|
+
|
|
|
|
+ mode='insert'
|
|
|
|
+
|
|
|
|
+ if len(ds['rows'])>0:
|
|
|
|
+ mode='update'
|
|
|
|
+ #use existing row data
|
|
|
|
+ row=ds['rows'][0]
|
|
|
|
+
|
|
|
|
+ else:
|
|
|
|
+
|
|
|
|
+ #count existing entries for patient
|
|
|
|
+ qfilter={'variable':participantField,'value':patientId,'oper':'eq'}
|
|
|
|
+ ds=db.selectRows(project,opars['schemaName'],\
|
|
|
|
+ opars['queryName'],[qfilter])
|
|
|
|
+ seqNum=len(ds['rows'])
|
|
|
|
+
|
|
|
|
+ #create new row
|
|
|
|
+ row={}
|
|
|
|
+ row[participantField]=patientId
|
|
|
|
+ row['sequenceNum']=seqNum
|
|
|
|
+ row['orthancSeries']=se
|
|
|
|
+
|
|
|
|
+
|
|
row['dicomStudy']=sid
|
|
row['dicomStudy']=sid
|
|
row['orthancStudy']=s
|
|
row['orthancStudy']=s
|
|
row['dicomSeries']=seid
|
|
row['dicomSeries']=seid
|
|
- row['orthancSeries']=se
|
|
|
|
row['studyDate']=sdate
|
|
row['studyDate']=sdate
|
|
row['seriesDescription']=seDesc
|
|
row['seriesDescription']=seDesc
|
|
- db.modifyRows('insert',project,opars['schemaName'],\
|
|
|
|
|
|
+ db.modifyRows(mode,project,opars['schemaName'],\
|
|
opars['queryName'],[row])
|
|
opars['queryName'],[row])
|
|
|
|
|
|
|
|
|