sdcflows.fieldmaps module¶
Utilities for fieldmap estimation.
- class sdcflows.fieldmaps.EstimatorType(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶
Bases:
Enum
Represents different types of fieldmap estimation approach.
- class sdcflows.fieldmaps.FieldmapEstimation(sources=None, *, bids_id: str = None)[source]¶
Bases:
object
Represent fieldmap estimation strategies.
This class provides a consistent interface to all types of fieldmap estimation strategies. The actual type of method for estimation is inferred from the
sources
input, and collects all the available metadata.- bids_id¶
The unique
B0FieldIdentifier
field of this fieldmap.
- get_workflow(set_inputs=True, **kwargs)[source]¶
Build the estimation workflow corresponding to this instance.
- method¶
Flag indicating the estimator type inferred from the input sources.
- sanitized_id¶
Sanitized version of the bids_id with special characters replaced by underscores.
- sources¶
File path or list of paths indicating the source data to estimate a fieldmap.
- class sdcflows.fieldmaps.FieldmapFile(path, *, metadata=NOTHING, find_meta: bool = True)[source]¶
Bases:
object
Represent a file that can be used in some fieldmap estimation method.
The class will read metadata from a sidecar JSON with filename matching that of the file. This class may receive metadata as a keyword argument at initialization.
Examples
>>> f = FieldmapFile(dsA_dir / "sub-01" / "anat" / "sub-01_T1w.nii.gz") >>> f.suffix 'T1w'
>>> FieldmapFile( ... dsA_dir / "sub-01" / "fmap" / "sub-01_dir-LR_epi.nii.gz", ... find_meta=False ... ) Traceback (most recent call last): MetadataError:
>>> f = FieldmapFile( ... dsA_dir / "sub-01" / "fmap" / "sub-01_dir-LR_epi.nii.gz", ... ) >>> f.metadata['TotalReadoutTime'] 0.005
>>> f = FieldmapFile( ... dsA_dir / "sub-01" / "fmap" / "sub-01_dir-LR_epi.nii.gz", ... metadata={"TotalReadoutTime": None}, ... ) Traceback (most recent call last): MetadataError:
>>> f = FieldmapFile( ... dsA_dir / "sub-01" / "fmap" / "sub-01_dir-LR_epi.nii.gz", ... metadata={'TotalReadoutTime': 0.006} ... ) >>> f.metadata['TotalReadoutTime'] 0.006
>>> FieldmapFile( ... dsA_dir / "sub-01" / "fmap" / "sub-01_phasediff.nii.gz", ... find_meta=False ... ) Traceback (most recent call last): MetadataError:
>>> f = FieldmapFile( ... dsA_dir / "sub-01" / "fmap" / "sub-01_phasediff.nii.gz" ... ) >>> f.metadata['EchoTime2'] 0.00746
>>> FieldmapFile( ... dsA_dir / "sub-01" / "fmap" / "sub-01_phase2.nii.gz", ... find_meta=False ... ) Traceback (most recent call last): MetadataError:
>>> f = FieldmapFile( ... dsA_dir / "sub-01" / "fmap" / "sub-01_phase2.nii.gz" ... ) >>> f.metadata['EchoTime'] 0.00746
>>> FieldmapFile( ... dsA_dir / "sub-01" / "fmap" / "sub-01_fieldmap.nii.gz", ... find_meta=False ... ) Traceback (most recent call last): MetadataError:
>>> f = FieldmapFile( ... dsA_dir / "sub-01" / "fmap" / "sub-01_fieldmap.nii.gz" ... ) >>> f.metadata['Units'] 'rad/s'
- bids_root¶
Path of the BIDS root.
- entities¶
BIDS entities extracted from filepath.
- find_meta¶
Enable/disable automated search for corresponding metadata.
- metadata¶
Metadata associated to this file. When provided as keyword argument in initialization, will overwrite metadata read from sidecar JSON.
- path¶
Path to a fieldmap file.
- suffix¶
Extracted suffix from input file.
- exception sdcflows.fieldmaps.MetadataError[source]¶
Bases:
ValueError
A better name for a specific value error.