Summary of what happened:
I’m trying to compare the synthetic fieldmap and real fieldmaps for subjects with all fieldmap data. Despite having all the fieldmap information, running subjects on their fieldmaps is giving me errors that magnitude files can’t be found (ERROR and FILE TREE below).
Running subjects forcing synthetic fieldmaps is giving me errors that ‘Units’ can’t be found. But, my fieldmaps are _phasediff, _magnitude1 and _magnitude2, so they shouldn’t require units. [ERROR BELOW] Also the error output references this nonexistent file: /data/projects/f_ah1491_1/open_data/NAPLS3/synmap_test/derivatives/sub-04S0335/ses-1/fmap/sub-04S0335_ses-1_acq-fm2_fmapid-auto00000_desc-magnitude_fieldmap.nii.gz
. Also, the folder synmap_test/derivatives/sub-04S0335
/ is empty.
Note: I’m using --skip-bids-validation because I was getting an error
TypeError: ‘NoneType’ object is not subscriptable
which may have been because of bids validation, according to this thread fmriPrep error codes? - #2 by JUSTIN_SMITH. When running without --skip-bids-validation, I get this error, even though IntendedFor fields are fully filled in pointing to real files:
Traceback (most recent call last):
File "/opt/conda/bin/fmriprep", line 8, in <module>
sys.exit(main())
File "/opt/conda/lib/python3.9/site-packages/fmriprep/cli/run.py", line 43, in main
parse_args()
File "/opt/conda/lib/python3.9/site-packages/fmriprep/cli/parser.py", line 775, in parse_args
config.from_dict({})
File "/opt/conda/lib/python3.9/site-packages/fmriprep/config.py", line 675, in from_dict
execution.load(settings, init=initialize('execution'), ignore=ignore)
File "/opt/conda/lib/python3.9/site-packages/fmriprep/config.py", line 232, in load
cls.init()
File "/opt/conda/lib/python3.9/site-packages/fmriprep/config.py", line 476, in init
cls._layout = BIDSLayout(
File "/opt/conda/lib/python3.9/site-packages/bids/layout/layout.py", line 154, in __init__
indexer(self)
File "/opt/conda/lib/python3.9/site-packages/bids/layout/index.py", line 151, in __call__
self._index_metadata()
File "/opt/conda/lib/python3.9/site-packages/bids/layout/index.py", line 429, in _index_metadata
for target in intended:
TypeError: 'NoneType' object is not iterable
My dataset passes bids-validation without errors, though it has some warnings (pasted below)
Command used (and if a helper script was used, a link to the helper script or the command generated):
# For using real fieldmaps
SINGULARITY_CMD="singularity run --cleanenv -B $BIDS_DIR:/data -B ${TEMPLATEFLOW_HOST_HOME}:${SINGULARITYENV_TEMPLATEFLOW_HOME} -B $SCRATCH/work/:/work -B ${LOCAL_FREESURFER_DIR}:/fsdir /projects/community/singularity.images/fMRIPrep/fmriprep_23.0.1.sif"
cmd="${SINGULARITY_CMD} /data /data/${DERIVS_DIR} participant --participant-label $subject -w /work/ -vv --nthreads 8 --mem_mb 32000 --output-spaces MNI152NLin2009cAsym:res-2 anat fsnative fsaverage5 --use-aroma --fs-subjects-dir /fsdir --skip-bids-validation"
# For using synthetic fieldmaps
cmd="${SINGULARITY_CMD} /data /data/${DERIVS_DIR} participant --participant-label $subject -w /work/ -vv --nthreads 8 --mem_mb 32000 --output-spaces MNI152NLin2009cAsym:res-2 anat fsnative fsaverage5 --use-aroma --fs-subjects-dir /fsdir --use-syn-sdc --ignore fieldmaps --force-syn --skip-bids-validation"
Version:
23.0.1.sif
Environment (Docker, Singularity / Apptainer, custom installation):
Singularity
Data formatted according to a validatable standard? Please provide the output of the validator:
No bids errors, just warnings
Warning 1: [Code 13] SLICE_TIMING_NOT_DEFINED
You should define 'SliceTiming' for this file. If you don't provide this information slice time correction will not be possible. 'Slice Timing' is the time at which each slice was acquired within each volume (frame) of the acquisition. Slice timing is not slice order -- rather, it is a list of times containing the time (in seconds) of each slice acquisition in relation to the beginning of volume acquisition.9 files
Warning 2: [Code 38] INCONSISTENT_SUBJECTS
Not all subjects contain the same files. Each subject should contain the same number of files with the same naming unless some files are known to be missing.12074 files
Warning 3: [Code 39] INCONSISTENT_PARAMETERS
Not all subjects/sessions/runs have the same scanning parameters.209 files
Warning 4: [Code 92] MISSING_MAGNITUDE1_FILE
Each _phasediff.nii[.gz] file should be associated with a _magnitude1.nii[.gz] file.1 file
Warning 5: [Code 97] MISSING_SESSION
Not all subjects contain the same sessions.207 files
Warning 6: [Code 101] README_FILE_MISSING
Relevant log outputs (up to 20 lines):
When running using the real fieldmaps:
# Err file end
ValueError: A fieldmap or phase-difference estimation type was found, but an anatomical reference (magnitude file) is missing.
When running the force synthetic-fieldmap command
Traceback (most recent call last):
File "/opt/conda/lib/python3.9/multiprocessing/process.py", line 315, in _bootstrap
self.run()
File "/opt/conda/lib/python3.9/multiprocessing/process.py", line 108, in run
self._target(*self._args, **self._kwargs)
File "/opt/conda/lib/python3.9/site-packages/fmriprep/cli/workflow.py", line 115, in build_workflow
retval["workflow"] = init_fmriprep_wf()
File "/opt/conda/lib/python3.9/site-packages/fmriprep/workflows/base.py", line 92, in init_fmriprep_wf
single_subject_wf = init_single_subject_wf(subject_id)
File "/opt/conda/lib/python3.9/site-packages/fmriprep/workflows/base.py", line 381, in init_single_subject_wf
fmap_estimators = find_estimators(
File "/opt/conda/lib/python3.9/site-packages/sdcflows/utils/wrangler.py", line 345, in find_estimators
fm.FieldmapFile(fmap.path, metadata=fmap.get_metadata())
File "<attrs generated init sdcflows.fieldmaps.FieldmapFile>", line 12, in __init__
self.__attrs_post_init__()
File "/opt/conda/lib/python3.9/site-packages/sdcflows/fieldmaps.py", line 260, in __attrs_post_init__
raise MetadataError(f"Missing 'Units' for <{self.path}>.")
sdcflows.fieldmaps.MetadataError: Missing 'Units' for </data/projects/f_ah1491_1/open_data/NAPLS3/synmap_test/derivatives/sub-04S0335/ses-1/fmap/sub-04S0335_ses-1_acq-fm2_fmapid-auto00000_desc-magnitude_fieldmap.nii.gz>.
When running either real-fieldmap or synthetic-fieldmap, the outfile ended like this:
Building fMRIPrep's workflow:
* BIDS dataset path: /data.
* Participant list: ['04S0335'].
* Run identifier: 20241004-111744_21b1e5da-e4ca-41ff-a8f8-8bfb8d24ee51.
* Output spaces: MNI152NLin2009cAsym:res-2 anat fsnative fsaverage:den-10k.
* Pre-run FreeSurfer's SUBJECTS_DIR: /fsdir.
sub-04S0335 1 echo Finished tasks with exit code 1
Screenshots / relevant information:
Tree for this sub:
├── ses-1
│ ├── anat
│ │ ├── sub-04S0335_ses-1_acq-spc2_run-3_T2w.json
│ │ ├── sub-04S0335_ses-1_acq-spc2_run-3_T2w.nii.gz
│ │ ├── sub-04S0335_ses-1_acq-tfl3_run-2_T1w.json
│ │ └── sub-04S0335_ses-1_acq-tfl3_run-2_T1w.nii.gz
│ ├── dwi
│ │ ├── sub-04S0335_ses-1_acq-epb0_dir-AP_run-13_dwi.bval
│ │ ├── sub-04S0335_ses-1_acq-epb0_dir-AP_run-13_dwi.bvec
│ │ ├── sub-04S0335_ses-1_acq-epb0_dir-AP_run-13_dwi.json
│ │ ├── sub-04S0335_ses-1_acq-epb0_dir-AP_run-13_dwi.nii.gz
│ │ ├── sub-04S0335_ses-1_acq-epb0_dir-AP_run-6_dwi.bval
│ │ ├── sub-04S0335_ses-1_acq-epb0_dir-AP_run-6_dwi.bvec
│ │ ├── sub-04S0335_ses-1_acq-epb0_dir-AP_run-6_dwi.json
│ │ └── sub-04S0335_ses-1_acq-epb0_dir-AP_run-6_dwi.nii.gz
│ ├── fmap
│ │ ├── sub-04S0335_ses-1_acq-fm2_magnitude1.json
│ │ ├── sub-04S0335_ses-1_acq-fm2_magnitude1.nii.gz
│ │ ├── sub-04S0335_ses-1_acq-fm2_magnitude2.json
│ │ ├── sub-04S0335_ses-1_acq-fm2_magnitude2.nii.gz
│ │ ├── sub-04S0335_ses-1_acq-fm2_phasediff.json
│ │ └── sub-04S0335_ses-1_acq-fm2_phasediff.nii.gz
│ └── func
│ ├── sub-04S0335_ses-1_task-rest_acq-epfid2_dir-AP_run-12_bold.json
│ └── sub-04S0335_ses-1_task-rest_acq-epfid2_dir-AP_run-12_bold.nii.gz
├── ses-2
│ ├── anat
│ │ ├── sub-04S0335_ses-2_acq-spc2_run-6_T2w.json
│ │ ├── sub-04S0335_ses-2_acq-spc2_run-6_T2w.nii.gz
│ │ ├── sub-04S0335_ses-2_acq-tfl3_run-5_T1w.json
│ │ └── sub-04S0335_ses-2_acq-tfl3_run-5_T1w.nii.gz
│ ├── dwi
│ │ ├── sub-04S0335_ses-2_acq-epb0_dir-AP_run-16_dwi.bval
│ │ ├── sub-04S0335_ses-2_acq-epb0_dir-AP_run-16_dwi.bvec
│ │ ├── sub-04S0335_ses-2_acq-epb0_dir-AP_run-16_dwi.json
│ │ ├── sub-04S0335_ses-2_acq-epb0_dir-AP_run-16_dwi.nii.gz
│ │ ├── sub-04S0335_ses-2_acq-epb0_dir-AP_run-9_dwi.bval
│ │ ├── sub-04S0335_ses-2_acq-epb0_dir-AP_run-9_dwi.bvec
│ │ ├── sub-04S0335_ses-2_acq-epb0_dir-AP_run-9_dwi.json
│ │ └── sub-04S0335_ses-2_acq-epb0_dir-AP_run-9_dwi.nii.gz
│ ├── fmap
│ │ ├── sub-04S0335_ses-2_acq-fm2_magnitude1.json
│ │ ├── sub-04S0335_ses-2_acq-fm2_magnitude1.nii.gz
│ │ ├── sub-04S0335_ses-2_acq-fm2_magnitude2.json
│ │ ├── sub-04S0335_ses-2_acq-fm2_magnitude2.nii.gz
│ │ ├── sub-04S0335_ses-2_acq-fm2_phasediff.json
│ │ └── sub-04S0335_ses-2_acq-fm2_phasediff.nii.gz
│ └── func
│ ├── sub-04S0335_ses-2_task-rest_acq-epfid2_dir-AP_run-15_bold.json
│ ├── sub-04S0335_ses-2_task-rest_acq-epfid2_dir-AP_run-15_bold.nii.gz
│ ├── sub-04S0335_ses-2_task-rest_acq-epfid2m5_dir-AP_run-22_bold.json
│ └── sub-04S0335_ses-2_task-rest_acq-epfid2m5_dir-AP_run-22_bold.nii.gz
└── ses-4
├── anat
│ ├── sub-04S0335_ses-4_acq-spc2_run-6_T2w.json
│ ├── sub-04S0335_ses-4_acq-spc2_run-6_T2w.nii.gz
│ ├── sub-04S0335_ses-4_acq-tfl3_run-5_T1w.json
│ └── sub-04S0335_ses-4_acq-tfl3_run-5_T1w.nii.gz
├── dwi
│ ├── sub-04S0335_ses-4_acq-epb0_dir-AP_run-16_dwi.bval
│ ├── sub-04S0335_ses-4_acq-epb0_dir-AP_run-16_dwi.bvec
│ ├── sub-04S0335_ses-4_acq-epb0_dir-AP_run-16_dwi.json
│ ├── sub-04S0335_ses-4_acq-epb0_dir-AP_run-16_dwi.nii.gz
│ ├── sub-04S0335_ses-4_acq-epb0_dir-AP_run-9_dwi.bval
│ ├── sub-04S0335_ses-4_acq-epb0_dir-AP_run-9_dwi.bvec
│ ├── sub-04S0335_ses-4_acq-epb0_dir-AP_run-9_dwi.json
│ └── sub-04S0335_ses-4_acq-epb0_dir-AP_run-9_dwi.nii.gz
├── fmap
│ ├── sub-04S0335_ses-4_acq-fm2_magnitude1.json
│ ├── sub-04S0335_ses-4_acq-fm2_magnitude1.nii.gz
│ ├── sub-04S0335_ses-4_acq-fm2_magnitude2.json
│ ├── sub-04S0335_ses-4_acq-fm2_magnitude2.nii.gz
│ ├── sub-04S0335_ses-4_acq-fm2_phasediff.json
│ └── sub-04S0335_ses-4_acq-fm2_phasediff.nii.gz
└── func
├── sub-04S0335_ses-4_task-rest_acq-epfid2_dir-AP_run-15_bold.json
├── sub-04S0335_ses-4_task-rest_acq-epfid2_dir-AP_run-15_bold.nii.gz
├── sub-04S0335_ses-4_task-rest_acq-epfid2m5_dir-AP_run-22_bold.json
└── sub-04S0335_ses-4_task-rest_acq-epfid2m5_dir-AP_run-22_bold.nii.gz
15 directories, 64 files