Skip to content

ENH: Upstream Clip and Label2Mask math interfaces from fMRIPrep #1027

Description

@oesteban

Summary

fMRIPrep contains two general-purpose image math interfaces in `fmriprep/interfaces/maths.py`:

`Clip` (lines 21-52)

Clips NIfTI image values to a specified min/max range. If no values are outside bounds, passes through without copying.

`Label2Mask` (lines 64-84)

Extracts a binary mask from a multi-label segmentation for a specific label value.

Both are completely general image operations with no fMRI specificity. They could live in `niworkflows.interfaces.nibabel` or a new `niworkflows.interfaces.maths` module.

Code to upstream

  • `Clip` in `fmriprep/interfaces/maths.py`
  • `Label2Mask` in `fmriprep/interfaces/maths.py`

Rationale

  • General-purpose NIfTI manipulation needed by any tool working with parametric maps or segmentation labels
  • Used in fMRIPrep's T2* reporting but applicable across modalities

Priority

MEDIUM.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions