Skip to content

Make suffixes and datatypes configurable, if possible #405

@tsalo

Description

@tsalo

What would you like to see added in this software?

I am trying to replace an internal, outdated copy of SDCFlows in ASLPrep with the current version. However, since asl and m0scan are not supported suffixes for PEPOLAR or fieldmap-less distortion correction, I cannot use SDCFlows as a dependency without making changes to the codebase, getting those changes merged in, and getting a new release minted.

It seems like this restriction could be alleviated if suffixes and datatypes could be configured outside of the functions and classes.

Do you have any interest in helping implement the feature?

Yes

Additional information / screenshots

For example, there's a constant in sdcflows.fieldmaps called MODALITIES that I could override with a context manager when I use FieldmapFile in ASLPrep:

MODALITIES = {
"bold": EstimatorType.PEPOLAR,
"dwi": EstimatorType.PEPOLAR,
"epi": EstimatorType.PEPOLAR,
"fieldmap": EstimatorType.MAPPED,
"magnitude": None,
"magnitude1": None,
"magnitude2": None,
"phase1": EstimatorType.PHASEDIFF,
"phase2": EstimatorType.PHASEDIFF,
"phasediff": EstimatorType.PHASEDIFF,
"sbref": EstimatorType.PEPOLAR,
"T1w": EstimatorType.ANAT,
"T2w": EstimatorType.ANAT,
}

However, FieldmapFile then has suffixes hardcoded throughout, so, even if I modified MODALITIES it still wouldn't recognize the suffixes I need. For example:

# Check for REQUIRED metadata (depends on suffix.)
if self.suffix in ("bold", "dwi", "epi", "sbref"):
if "PhaseEncodingDirection" not in self.metadata:
raise MetadataError(
f"Missing 'PhaseEncodingDirection' for <{self.path}>."
)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions