nipreps / fmripost-aroma

Run ICA-AROMA on fMRIPrep derivatives
https://fmripost-aroma.readthedocs.io/
Apache License 2.0
8 stars 2 forks source link

Space iteration notes #34

Open effigies opened 6 months ago

effigies commented 6 months ago

aroma_wf:
  inputnode:
    bold_mni6
    mask_mni6
  outputnode:

#### Calculate aroma
if 'bold_mni6' in found:
  aroma_wf = init_aroma_wf()
  wf.inputs.inputnode.bold_mni6 = found['bold_mni6']
else:
  resample_wf = init_resample_wf()
  resample_wf.inputs....
  wf.connect([
    (resample_wf, aroma_wf, [
      ('outputnode.bold_mni6', 'inputnode.bold_mni6')
]),

#### Apply aroma
iterator_wf = ...
  # anat2std_xfm
  # std_t1w
  # std_mask

xfms = [
  hmc_xfms,
  coreg_xfm
]

all_xfms = Merge(2)
wf.connect(xfms, 'out', all_xfms, 'in1')
wf.connect(iterator_wf, 'outputnode.anat2std', all_xfms, 'in2')

resampler = ...
  # bold.nii
  # fmap.nii
  # fmapreg

wf.connect(xfms, 'out', resampler, 'xfms')

wf.connect(aroma_wf, ..., denoise, ...)
wf.connect(resampler, ..., denoise, ...)

## If resampled data exists

std_buffer = KeySelect(bold=[found[space].bold for space in spaces], keys=spaces)
wf.connect(iterator_wf, 'space', std_buffer, 'key')

wf.connect(aroma_wf, ..., denoise, ...)
wf.connect(std_buffer, 'bold', denoise, 'bold')
tsalo commented 3 months ago

I started working on this in #33, but I couldn't get it working because the space iterator collects the transforms, but resampler does as well.