Skip to content

Commit

Permalink
Raise an error if MELODIC fails during AROMA
Browse files Browse the repository at this point in the history
  • Loading branch information
Gab-D-G committed Oct 2, 2023
1 parent 05ea369 commit 4563a31
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
3 changes: 0 additions & 3 deletions rabies/confound_correction_pkg/confound_correction.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,9 +316,6 @@ def _run_interface(self, runtime):
df.to_csv(mc_file)

cleaned_file, aroma_out = exec_ICA_AROMA(inFile, mc_file, brain_mask_file, CSF_mask_file, TR, cr_opts.ica_aroma['dim'], random_seed=cr_opts.ica_aroma['random_seed'])
# if AROMA failed, returns empty outputs
if cleaned_file is None:
return runtime
setattr(self, 'aroma_out', aroma_out)

data_img = sitk.ReadImage(cleaned_file, sitk.sitkFloat32)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,8 @@ def run_ICA_AROMA(outDir,inFile,mc,TR,mask="",mask_csf="",denType="nonaggr",melD
try:
aromafunc.runICA(fslDir, inFile, outDir, melDir, mask, dim, TR, random_seed=random_seed)
melIC = os.path.join(outDir, 'melodic_IC_thr.nii.gz')
except:
print('MELODIC FAILED. RETURNING EMPTY FILES.')
return False, False
except Exception as e:
raise ValueError(f"MELODIC FAILED DURING ICA-AROMA: {e}")

print('Step 2) Automatic classification of the components')

Expand Down

0 comments on commit 4563a31

Please sign in to comment.