|
@@ -49,11 +49,16 @@ def main(parFile='../templates/statistics.json'):
|
|
|
|
|
|
setup['SUVdataset']='SUVanalysis_SUVmax'
|
|
|
suvMaxDone=checkData(setup,r)
|
|
|
+
|
|
|
+ setup['SUVdataset']='SUVanalysis_liver1p5'
|
|
|
+ liver1p5Done=checkData(setup,r)
|
|
|
+
|
|
|
|
|
|
- if liverDone and suvMaxDone:
|
|
|
+ if liverDone and suvMaxDone and liver1p5Done:
|
|
|
print('Skipping {} {}'.format(r['ParticipantId'],r['visitCode']))
|
|
|
continue
|
|
|
-
|
|
|
+ doneCode=f'({liverDone}/{liver1p5Done}/{suvMaxDone})'
|
|
|
+ print(f'Done: (liver/liver1p5/suvMax): {doneCode}')
|
|
|
#PET
|
|
|
for q in ['petResampled']:
|
|
|
localPath=statUtils.getImage(setup,r,q)
|
|
@@ -95,6 +100,9 @@ def main(parFile='../templates/statistics.json'):
|
|
|
liverThreshold={x:outputs[x].get(liverId,default)['SUVmean']
|
|
|
+2*outputs[x].get(liverId,default)['SUVSD']
|
|
|
for x in outputs}
|
|
|
+ liver1p5Threshold={x:outputs[x].get(liverId,default)['SUVmean']
|
|
|
+ +1.5*outputs[x].get(liverId,default)['SUVSD']
|
|
|
+ for x in outputs}
|
|
|
lesionId=4
|
|
|
bmId=3
|
|
|
suvMax={x:numpy.max([outputs[x].get(lesionId,default)['SUVmax'],
|
|
@@ -103,28 +111,24 @@ def main(parFile='../templates/statistics.json'):
|
|
|
suvMaxThreshold={x:0.41*suvMax[x] for x in suvMax}
|
|
|
|
|
|
|
|
|
- print('thr[liver]={} thr(suvmax)={}'.format(liverThreshold,suvMaxThreshold))
|
|
|
+ print('thr[liver]={} thr[liver/1.5]={} thr(suvmax)={}'.format(liverThreshold,liver1p5Threshold,suvMaxThreshold))
|
|
|
|
|
|
- #thresholds are by user
|
|
|
- liverOutputs={}
|
|
|
- for s in liverThreshold:
|
|
|
- #update radiomics setting
|
|
|
- setup['radiomics']['setting']['resegmentRange']=[liverThreshold[s]]
|
|
|
- setup['radiomics']['setting']['resegmentShape']=True
|
|
|
- liverOutputs[s]=getValuesForSegmentation(setup,r,pet,seg[s])
|
|
|
-
|
|
|
- _=[liverOutputs[s][y].update({'threshold':liverThreshold[s]}) for y in liverOutputs[s]]
|
|
|
- setup['SUVdataset']='SUVanalysis_liver'
|
|
|
- uploadData(setup,r,liverOutputs)
|
|
|
|
|
|
- suvMaxOutputs={}
|
|
|
- for s in suvMaxThreshold:
|
|
|
- setup['radiomics']['setting']['resegmentRange']=[suvMaxThreshold[s]]
|
|
|
- setup['radiomics']['setting']['resegmentShape']=True
|
|
|
- suvMaxOutputs[s]=getValuesForSegmentation(setup,r,pet,seg[s])
|
|
|
- _=[suvMaxOutputs[s][y].update({'threshold':suvMaxThreshold[s]}) for y in suvMaxOutputs[s]]
|
|
|
- setup['SUVdataset']='SUVanalysis_SUVmax'
|
|
|
- uploadData(setup,r,suvMaxOutputs)
|
|
|
+ if not liverDone:
|
|
|
+ setup['SUVdataset']='SUVanalysis_liver'
|
|
|
+ liverOutputs=thresholdAnalysis(setup,r,pet,seg,liverThreshold)
|
|
|
+ uploadData(setup,r,liverOutputs)
|
|
|
+
|
|
|
+ #also for threshold=1.5
|
|
|
+ if not liver1p5Done:
|
|
|
+ setup['SUVdataset']='SUVanalysis_liver1p5'
|
|
|
+ liver1p5Outputs=thresholdAnalysis(setup,r,pet,seg,liver1p5Threshold)
|
|
|
+ uploadData(setup,r,liver1p5Outputs)
|
|
|
+
|
|
|
+ if not suvMaxDone:
|
|
|
+ setup['SUVdataset']='SUVanalysis_SUVmax'
|
|
|
+ suvMaxOutputs=thresholdAnalysis(setup,r,pet,seg,suvMaxThreshold)
|
|
|
+ uploadData(setup,r,suvMaxOutputs)
|
|
|
|
|
|
#skip threshold of 4
|
|
|
doThreshold4=False
|
|
@@ -146,6 +150,20 @@ def main(parFile='../templates/statistics.json'):
|
|
|
for x in segPaths:
|
|
|
os.remove(segPaths[x])
|
|
|
|
|
|
+
|
|
|
+def thresholdAnalysis(setup,r,pet,seg,thrs):
|
|
|
+ #thresholds thrs are by participant and region
|
|
|
+ outputs={}
|
|
|
+ for s in thrs:
|
|
|
+ #update radiomics setting
|
|
|
+ setup['radiomics']['setting']['resegmentRange']=[thrs[s]]
|
|
|
+ setup['radiomics']['setting']['resegmentShape']=True
|
|
|
+ outputs[s]=getValuesForSegmentation(setup,r,pet,seg[s])
|
|
|
+
|
|
|
+ _=[outputs[s][y].update({'threshold':thrs[s]}) for y in outputs[s]]
|
|
|
+ return outputs
|
|
|
+
|
|
|
+
|
|
|
def getValues(setup,row,pet,seg):
|
|
|
|
|
|
rFile='radiomics.json'
|