Browse Source

Rounding nvoxels to nearest integer, adding ERROR to lines reporting difficulties with upload, and reporting segmentation dataset when in getSegmentations for statUtils.py

nixWorker 11 months ago
parent
commit
15bde3a8c0
1 changed files with 3 additions and 2 deletions
  1. 3 2
      pythonScripts/statUtils.py

+ 3 - 2
pythonScripts/statUtils.py

@@ -66,6 +66,7 @@ def getImage(setup, row, field, extraPath=None):
 
 
 def getSegmentations(setup,row):
 def getSegmentations(setup,row):
     segName=setup.get('segmentationDataset','Segmentations')
     segName=setup.get('segmentationDataset','Segmentations')
+    print(f'Using segmentation dataset {segName}')
     idField=setup['idField']
     idField=setup['idField']
     visitField=setup['visitField']
     visitField=setup['visitField']
     qFilter=[{'variable':x,'value':row[x],'oper':'eq'} for x in [idField,visitField]]
     qFilter=[{'variable':x,'value':row[x],'oper':'eq'} for x in [idField,visitField]]
@@ -156,7 +157,7 @@ def getCOM(vals):
     return vals['diagnostics_Mask-original_CenterOfMassIndex']
     return vals['diagnostics_Mask-original_CenterOfMassIndex']
 
 
 def getNVoxels(vals):
 def getNVoxels(vals):
-    return drop_array(vals['original_shape_VoxelVolume']/8)
+    return round(drop_array(vals['original_shape_VoxelVolume']/8))
 
 
 def getValue(vals,valueName):
 def getValue(vals,valueName):
     if valueName=='SUVmean':
     if valueName=='SUVmean':
@@ -239,7 +240,7 @@ def updateDatasetRows(db,project,dataset,rows,filterVars=['ParticipantId','Seque
         #encoding=chardet.detect(resp)['encoding']
         #encoding=chardet.detect(resp)['encoding']
         #respJSON=json.loads(resp.decode(encoding))
         #respJSON=json.loads(resp.decode(encoding))
         try:
         try:
-            print(resp['exception'])
+            print('[ERROR]: {}'.format(resp['exception']))
             print(f'Using mode={mode}')
             print(f'Using mode={mode}')
         except KeyError:
         except KeyError:
             pass
             pass