Skip to content

Commit

Permalink
Directly use fMRIPrep confounds.
Browse files Browse the repository at this point in the history
  • Loading branch information
tsalo committed May 7, 2024
1 parent 2821b0d commit cd14ae0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
4 changes: 2 additions & 2 deletions src/fmripost_aroma/interfaces/aroma.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@


class _AROMAClassifierInputSpec(BaseInterfaceInputSpec):
motpars = File(exists=True, desc="motion parameters")
motpars = File(exists=True, desc="motion parameters or general confounds file")
mixing = File(exists=True, desc="mixing matrix")
component_maps = File(exists=True, desc="thresholded z-statistic component maps")
TR = traits.Float(desc="repetition time in seconds")
Expand All @@ -38,7 +38,7 @@ class AROMAClassifier(SimpleInterface):

def _run_interface(self, runtime):
TR = self.inputs.TR
motion_params = utils.load_motpars(self.inputs.motpars, source="FSL")
motion_params = utils.load_motpars(self.inputs.motpars, source="fmriprep")
mixing = np.loadtxt(self.inputs.mixing) # T x C
component_maps = nb.load(self.inputs.component_maps) # X x Y x Z x C
if mixing.shape[1] != component_maps.shape[3]:
Expand Down
18 changes: 10 additions & 8 deletions src/fmripost_aroma/workflows/aroma.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

from nipype.interfaces import utility as niu
from nipype.pipeline import engine as pe
from niworkflows.interfaces.confounds import NormalizeMotionParams

from fmripost_aroma import config
from fmripost_aroma.interfaces.bids import DerivativesDataSink
Expand Down Expand Up @@ -78,6 +79,7 @@ def init_ica_aroma_wf(
Parameters
----------
bold_file
BOLD series used as name source for derivatives
metadata : :obj:`dict`
BIDS metadata for BOLD file
susan_fwhm : :obj:`float`
Expand All @@ -86,12 +88,15 @@ def init_ica_aroma_wf(
Inputs
------
bold_std
BOLD series in template space
bold_mask_std
BOLD series mask in template space
confounds
fMRIPrep-formatted confounds file, which must include the following columns:
"trans_x", "trans_y", "trans_z", "rot_x", "rot_y", "rot_z".
skip_vols
number of non steady state volumes
bold_mask
BOLD series mask in template space
movpar_file
SPM-formatted motion parameters file
Outputs
-------
Expand Down Expand Up @@ -156,9 +161,6 @@ def init_ica_aroma_wf(
name="outputnode",
)

# TODO: Convert confounds to FSL motpars file.
...

rm_non_steady_state = pe.Node(
niu.Function(function=_remove_volumes, output_names=["bold_cut"]),
name="rm_nonsteady",
Expand Down Expand Up @@ -237,7 +239,7 @@ def init_ica_aroma_wf(
# Run the ICA-AROMA classifier
ica_aroma = pe.Node(AROMAClassifier(TR=metadata["RepetitionTime"]))
workflow.connect([
(inputnode, ica_aroma, [("movpar_file", "motion_parameters")]),
(inputnode, ica_aroma, [("confounds", "motion_parameters")]),
(select_melodic_files, ica_aroma, [
("mixing", "mixing"),
("component_maps", "component_maps"),
Expand Down

0 comments on commit cd14ae0

Please sign in to comment.