Skip to content

Commit

Permalink
rf: Use ResampleSeries to resample fieldmap
Browse files Browse the repository at this point in the history
  • Loading branch information
effigies committed Jan 14, 2025
1 parent 375ce6e commit cd35a9e
Showing 1 changed file with 19 additions and 16 deletions.
35 changes: 19 additions & 16 deletions src/fmripost_aroma/workflows/resample.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,33 +146,36 @@ def init_bold_volumetric_resample_wf(
if not fieldmap_id:
return workflow

Check warning on line 147 in src/fmripost_aroma/workflows/resample.py

View check run for this annotation

Codecov / codecov/patch

src/fmripost_aroma/workflows/resample.py#L147

Added line #L147 was not covered by tests

# Warp desc-preproc_fieldmap to boldref space
# Warp the mask as well
fieldmap_to_boldref = pe.Node(
ApplyTransforms(),
name='fieldmap_to_boldref',
)
workflow.connect([
(inputnode, fieldmap_to_boldref, [
('fmap', 'input_image'), # XXX: not right
('fmap2boldref', 'transforms'),
('bold_mask_native', 'reference_image'),
]),
]) # fmt:skip

distortion_params = pe.Node(

Check warning on line 149 in src/fmripost_aroma/workflows/resample.py

View check run for this annotation

Codecov / codecov/patch

src/fmripost_aroma/workflows/resample.py#L149

Added line #L149 was not covered by tests
DistortionParameters(metadata=metadata),
name='distortion_params',
run_without_submitting=True,
)
fmap2target = pe.Node(niu.Merge(2), name='fmap2target', run_without_submitting=True)
inverses = pe.Node(

Check warning on line 155 in src/fmripost_aroma/workflows/resample.py

View check run for this annotation

Codecov / codecov/patch

src/fmripost_aroma/workflows/resample.py#L154-L155

Added lines #L154 - L155 were not covered by tests
niu.Function(function=_gen_inverses),
name='inverses',
run_without_submitting=True,
)
fmap_resample = pe.Node(ResampleSeries(jacobian=False), name='fmap_resample')

Check warning on line 160 in src/fmripost_aroma/workflows/resample.py

View check run for this annotation

Codecov / codecov/patch

src/fmripost_aroma/workflows/resample.py#L160

Added line #L160 was not covered by tests

workflow.connect([

Check warning on line 162 in src/fmripost_aroma/workflows/resample.py

View check run for this annotation

Codecov / codecov/patch

src/fmripost_aroma/workflows/resample.py#L162

Added line #L162 was not covered by tests
(inputnode, distortion_params, [('bold_file', 'in_file')]),
# Resample fieldmap to target space
(inputnode, fmap2target, [('boldref2fmap_xfm', 'in1')]),
(boldref2target, fmap2target, [('out', 'in2')]),
(boldref2target, inverses, [('out', 'inlist')]),
(inputnode, fmap_resample, [('fmap', 'in_file')]),
(gen_ref, fmap_resample, [('out_file', 'ref_file')]),
(fmap2target, fmap_resample, [('out', 'transforms')]),
(inverses, fmap_resample, [('out', 'inverse')]),

# Inject fieldmap correction into resample node
(fieldmap_to_boldref, resample, [('fmap', 'fieldmap')]),
(inputnode, distortion_params, [('bold_file', 'in_file')]),
(distortion_params, resample, [
('readout_time', 'ro_time'),
('pe_direction', 'pe_dir'),
]),
(fmap_resample, resample, [('out_file', 'fieldmap')]),
]) # fmt:skip

return workflow

Check warning on line 181 in src/fmripost_aroma/workflows/resample.py

View check run for this annotation

Codecov / codecov/patch

src/fmripost_aroma/workflows/resample.py#L181

Added line #L181 was not covered by tests
Expand Down

0 comments on commit cd35a9e

Please sign in to comment.