Browse Source

Having preprocess.py sensitive to needsResampling flag in Imaging1 dataset

Andrej Studen 7 months ago
parent
commit
4ac0852fb0
1 changed files with 8 additions and 2 deletions
  1. 8 2
      pythonScripts/preprocess.py

+ 8 - 2
pythonScripts/preprocess.py

@@ -156,7 +156,6 @@ def main(parameterFile):
         seqNo=row['SequenceNum']
         seqNo=row['SequenceNum']
         print("Starting row id:{} seq:{}".format(pId,seqNo))
         print("Starting row id:{} seq:{}".format(pId,seqNo))
 
 
-
         #interesting files are processedDir/studyName_CT_notCropped_2mmVoxel.nii
         #interesting files are processedDir/studyName_CT_notCropped_2mmVoxel.nii
         #asn processedDir/studyName_PET_notCropped_2mmVoxel.nii
         #asn processedDir/studyName_PET_notCropped_2mmVoxel.nii
         volumeFileNames={im:\
         volumeFileNames={im:\
@@ -179,8 +178,15 @@ def main(parameterFile):
         for f in gzRemoteFiles.values():
         for f in gzRemoteFiles.values():
             print("[{}]: [{}]".format(f,fb.entryExists(f)))
             print("[{}]: [{}]".format(f,fb.entryExists(f)))
 
 
+        #force preprocessing if needsResampling is set to true
+        overloadFlag='needsResampling'
+        try:
+            sampleOK=not row[overloadFlag]
+            print(f'Using {overloadFlag} -> sampleOK={sampleOK}')
+        except KeyError:
+            sampleOK=True
 
 
-        if all(remoteFilePresent):
+        if sampleOK and all(remoteFilePresent):
             print("Entry for row done.")
             print("Entry for row done.")
             updateRow(db,project,dataset,row,imageResampledField,\
             updateRow(db,project,dataset,row,imageResampledField,\
                 gzFileNames,participantField)
                 gzFileNames,participantField)