voxelops.utils package
Utility functions for post-processing and BIDS compliance.
BIDS Utilities
Post-processing for HeudiConv output: IntendedFor injection,
fieldmap validation, and cleanup of spurious .bvec/.bval files.
BIDS post-processing utilities for HeudiConv output.
- add_intended_for_to_fmaps(participant_dir: Path, session: str | None = None, dry_run: bool = False) Dict[str, Any][source]
Add IntendedFor fields to fieldmap JSON files.
Maps fieldmaps to target files based on acquisition type:
acq-dwi*_epi.json-> alldwi/*_dwi.nii.gzfilesacq-func*_epi.json-> allfunc/*_bold.nii.gzfiles
- Parameters:
- Returns:
Dictionary with processing results.
- Return type:
Dict[str, Any]
- post_process_heudiconv_output(bids_dir: Path, participant: str, session: str | None = None, dry_run: bool = False) Dict[str, Any][source]
Post-process HeudiConv output to ensure BIDS compliance.
Orchestrates all post-processing steps:
Verify fieldmap EPI files exist
Add IntendedFor fields to fmap JSONs
Hide bval/bvec from fmap directories (rename with dot prefix)
- Parameters:
- Returns:
A dictionary with results:
’success’: bool
’verification’: dict
’intended_for’: dict
’cleanup’: dict
’errors’: list
- Return type:
Dict[str, Any]
- remove_bval_bvec_from_fmaps(participant_dir: Path, session: str | None = None, dry_run: bool = False) Dict[str, Any][source]
Hide .bvec and .bval files from fmap directories by renaming with dot prefix.
These files are incorrectly generated by dcm2niix for fieldmaps and are not BIDS-compliant for EPI fieldmaps. Instead of deleting, we rename them with a leading dot to hide them (e.g.,
.filename.bvec).- Parameters:
- Returns:
Dictionary with cleanup results.
- Return type:
Dict[str, Any]
Module contents
Utility modules for VoxelOps.