fMRIPrep Node Error (registration issue?)

Summary of what happened:

I am preprocessing my data with fMRIPrep. Upon review of the subject-wise .html files, it seems that there is a common error throughout: Node Name: fmriprep_23_2_wf.sub_SL001_wf.anat_fit_wf.register_template_wf.registration

Despite this error, the pipeline runs to completion as there is a .../func/*desc-preproc_bold.* for each participant, indicating a fully preprocessed subject.

Any help in ensuring that my data is properly processed would be great.

Command used (and if a helper script was used, a link to the helper script or the command generated):

The script used to run fMRIPrep is located on my Github, here. This script contains the individual commands.

Below is the command to execute the aforementioned script.

sh run_fmriprep_singularity.sh -b /path/to/bids/dir -w /path/to/work/dir

The basic fmriprep command is:

	singularity run --cleanenv -B /data/jdecke5:/data/jdecke5 $HOME/images/fmriprep.simg \
		--work-dir $work_dir_parent/workdir \
		--participant_label "${sub##*/sub-}" \
		--output-spaces T1w \
		--level full \
		--skip-bids-validation \
		--fs-license-file $FREESURFER_HOME/license.txt \
		--cifti-output 91k \
		$bids_dir \
		$bids_dir/derivatives \
		participant

Version:

v23.1.2

Environment (Docker, Singularity / Apptainer, custom installation):

Singularity

Relevant log outputs

# File: /data/jdecke5/projects/honors-thesis/data/bids/derivatives/sub-SL001/log/20240318-105148_2ce66d62-8223-46c7-aeaa-9116724367ac/crash-20240318-111519-jdecke5-registration.a1-dc527342-2b1d-4909-bab3-e2e5571bb651.txt
Working Directory: /data/jdecke5/projects/honors-thesis/data/raw/workdir/workdir/fmriprep_23_2_wf/sub_SL001_wf/anat_fit_wf/register_template_wf/_template_MNI152NLin6Asym/registration
Inputs:
explicit_masking: True
flavor: precise
float: True
initial_moving_transform:
lesion_mask:
moving: T1w
moving_image:
moving_mask:
num_threads: 8
orientation: RAS
reference: T1w
reference_image:
reference_mask:
settings:
template: MNI152NLin2009cAsym
template_resolution:
template_spec:
Traceback (most recent call last):
  File "/opt/conda/envs/fmriprep/lib/python3.10/site-packages/nipype/pipeline/plugins/multiproc.py", line 67, in run_node
    result["result"] = node.run(updatehash=updatehash)
  File "/opt/conda/envs/fmriprep/lib/python3.10/site-packages/nipype/pipeline/engine/nodes.py", line 527, in run
    result = self._run_interface(execute=True)
  File "/opt/conda/envs/fmriprep/lib/python3.10/site-packages/nipype/pipeline/engine/nodes.py", line 645, in _run_interface
    return self._run_command(execute)
  File "/opt/conda/envs/fmriprep/lib/python3.10/site-packages/nipype/pipeline/engine/nodes.py", line 771, in _run_command
    raise NodeExecutionError(msg)
nipype.pipeline.engine.nodes.NodeExecutionError: Exception raised while executing Node registration.

Traceback:
	Traceback (most recent call last):
	  File "/opt/conda/envs/fmriprep/lib/python3.10/site-packages/nipype/interfaces/base/core.py", line 397, in run
	    runtime = self._run_interface(runtime)
	  File "/opt/conda/envs/fmriprep/lib/python3.10/site-packages/niworkflows/interfaces/norm.py", line 182, in _run_interface
	    ants_args = self._get_ants_args()
	  File "/opt/conda/envs/fmriprep/lib/python3.10/site-packages/niworkflows/interfaces/norm.py", line 457, in _get_ants_args
	    args["fixed_image"] = mask(
	  File "/opt/conda/envs/fmriprep/lib/python3.10/site-packages/niworkflows/interfaces/norm.py", line 506, in mask
	    data = in_nii.get_fdata()
	  File "/opt/conda/envs/fmriprep/lib/python3.10/site-packages/nibabel/dataobj_images.py", line 373, in get_fdata
	    data = np.asanyarray(self._dataobj, dtype=dtype)
	  File "/opt/conda/envs/fmriprep/lib/python3.10/site-packages/nibabel/arrayproxy.py", line 439, in __array__
	    arr = self._get_scaled(dtype=dtype, slicer=())
	  File "/opt/conda/envs/fmriprep/lib/python3.10/site-packages/nibabel/arrayproxy.py", line 406, in _get_scaled
	    scaled = apply_read_scaling(self._get_unscaled(slicer=slicer), scl_slope, scl_inter)
	  File "/opt/conda/envs/fmriprep/lib/python3.10/site-packages/nibabel/arrayproxy.py", line 376, in _get_unscaled
	    return array_from_file(
	  File "/opt/conda/envs/fmriprep/lib/python3.10/site-packages/nibabel/volumeutils.py", line 472, in array_from_file
	    raise OSError(
	OSError: Expected 14442064 bytes, got 1043566 bytes from object
	 - could the file be damaged?Relevant log outputs (up to 20 lines):

Hi @Will_Decker and welcome to neurostars!

Can you please share the BIDS validation report for the dataset? Also try upgrading to version 23.2.1 (the most recent at this time)? Be sure to use a new working directory after upgrading.

Best,
Steven

Hi @Steven, thanks for your reply. Is the BIDS validation report generated during fMRIPrep or is that something I must/can do seperately (e.g., with the bids-validator)? I have run --skip-bids-validation as part of my script, so this may be an issue.

-Will

Hi @Will_Decker,

You can remove that flag and it will be the first thing that is run, but you can also use something like singularity exec -e -B /yourdrive $IMG bids-validator $BIDSROOT.

singularity exec -e -B /data/jdecke5:/data/jdecke5 $HOME/images/fmriprep.simg bids-validator $bdir
bids-validator@1.14.1
(node:2832232) Warning: Closing directory handle on garbage collection
(Use `node --trace-warnings ...` to show where the warning was created)
	1: [ERR] Files with such naming scheme are not part of BIDS specification. This error is most commonly caused by typos in file names that make them not BIDS compatible. Please consult the specification and make sure your files are named correctly. If this is not a file naming issue (for example when including files not yet covered by the BIDS specification) you should include a ".bidsignore" file in your dataset (see https://github.com/bids-standard/bids-validator#bidsignore for details). Please note that derived (processed) data should be placed in /derivatives folder and source data (such as DICOMS or behavioural logs in proprietary formats) should be placed in the /sourcedata folder. (code: 1 - NOT_INCLUDED)
		./workdir/20240308-115051_1dd66bbb-0991-4e1a-8963-58816ade9c79/bids_db/layout_index.sqlite
			Evidence: layout_index.sqlite
		./workdir/workdir/20240317-160506_21007df4-ff40-4678-9d24-181851c71f74/bids_db/layout_index.sqlite
			Evidence: layout_index.sqlite
		./workdir/workdir/20240317-160512_cf2ac74e-7c38-4e1a-b1a0-56e27a0d631c/bids_db/layout_index.sqlite
			Evidence: layout_index.sqlite

	Please visit https://neurostars.org/search?q=NOT_INCLUDED for existing conversations about this issue.

	1: [WARN] 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. (code: 38 - INCONSISTENT_SUBJECTS)
		./sub-SL002/func/sub-SL002_task-rest_bold.json
			Evidence: Subject: sub-SL002; Missing file: sub-SL002_task-rest_bold.json
		./sub-SL002/func/sub-SL002_task-rest_bold.nii.gz
			Evidence: Subject: sub-SL002; Missing file: sub-SL002_task-rest_bold.nii.gz
		./sub-SL002/func/sub-SL002_task-rest_events.tsv
			Evidence: Subject: sub-SL002; Missing file: sub-SL002_task-rest_events.tsv

	Please visit https://neurostars.org/search?q=INCONSISTENT_SUBJECTS for existing conversations about this issue.

	2: [WARN] Not all subjects/sessions/runs have the same scanning parameters. (code: 39 - INCONSISTENT_PARAMETERS)
		./sub-SL001/dwi/sub-SL001_dwi.nii.gz
		./sub-SL002/dwi/sub-SL002_dwi.nii.gz
		./sub-SL009/dwi/sub-SL009_dwi.nii.gz
		./sub-SL012/dwi/sub-SL012_dwi.nii.gz

	Please visit https://neurostars.org/search?q=INCONSISTENT_PARAMETERS for existing conversations about this issue.

	3: [WARN] Tabular file contains custom columns not described in a data dictionary (code: 82 - CUSTOM_COLUMN_WITHOUT_DESCRIPTION)
		./sub-SL001/func/sub-SL001_task-rest_events.tsv
			Evidence: Columns: TODO -- fill in rows and add more tab-separated columns if desired not defined, please define in: /events.json, /task-rest_events.json,/sub-SL001/sub-SL001_events.json,/sub-SL001/sub-SL001_task-rest_events.json,/sub-SL001/func/sub-SL001_events.json,/sub-SL001/func/sub-SL001_task-rest_events.json
		./sub-SL001/func/sub-SL001_task-statlearning_events.tsv
			Evidence: Columns: TODO -- fill in rows and add more tab-separated columns if desired not defined, please define in: /events.json, /task-statlearning_events.json,/sub-SL001/sub-SL001_events.json,/sub-SL001/sub-SL001_task-statlearning_events.json,/sub-SL001/func/sub-SL001_events.json,/sub-SL001/func/sub-SL001_task-statlearning_events.json
		./sub-SL002/func/sub-SL002_task-statlearning_events.tsv
			Evidence: Columns: TODO -- fill in rows and add more tab-separated columns if desired not defined, please define in: /events.json, /task-statlearning_events.json,/sub-SL002/sub-SL002_events.json,/sub-SL002/sub-SL002_task-statlearning_events.json,/sub-SL002/func/sub-SL002_events.json,/sub-SL002/func/sub-SL002_task-statlearning_events.json
		./sub-SL003/func/sub-SL003_task-rest_events.tsv
			Evidence: Columns: TODO -- fill in rows and add more tab-separated columns if desired not defined, please define in: /events.json, /task-rest_events.json,/sub-SL003/sub-SL003_events.json,/sub-SL003/sub-SL003_task-rest_events.json,/sub-SL003/func/sub-SL003_events.json,/sub-SL003/func/sub-SL003_task-rest_events.json
		./sub-SL003/func/sub-SL003_task-statlearning_events.tsv
			Evidence: Columns: TODO -- fill in rows and add more tab-separated columns if desired not defined, please define in: /events.json, /task-statlearning_events.json,/sub-SL003/sub-SL003_events.json,/sub-SL003/sub-SL003_task-statlearning_events.json,/sub-SL003/func/sub-SL003_events.json,/sub-SL003/func/sub-SL003_task-statlearning_events.json
		./sub-SL004/func/sub-SL004_task-rest_events.tsv
			Evidence: Columns: TODO -- fill in rows and add more tab-separated columns if desired not defined, please define in: /events.json, /task-rest_events.json,/sub-SL004/sub-SL004_events.json,/sub-SL004/sub-SL004_task-rest_events.json,/sub-SL004/func/sub-SL004_events.json,/sub-SL004/func/sub-SL004_task-rest_events.json
		./sub-SL004/func/sub-SL004_task-statlearning_events.tsv
			Evidence: Columns: TODO -- fill in rows and add more tab-separated columns if desired not defined, please define in: /events.json, /task-statlearning_events.json,/sub-SL004/sub-SL004_events.json,/sub-SL004/sub-SL004_task-statlearning_events.json,/sub-SL004/func/sub-SL004_events.json,/sub-SL004/func/sub-SL004_task-statlearning_events.json
		./sub-SL005/func/sub-SL005_task-rest_events.tsv
			Evidence: Columns: TODO -- fill in rows and add more tab-separated columns if desired not defined, please define in: /events.json, /task-rest_events.json,/sub-SL005/sub-SL005_events.json,/sub-SL005/sub-SL005_task-rest_events.json,/sub-SL005/func/sub-SL005_events.json,/sub-SL005/func/sub-SL005_task-rest_events.json
		./sub-SL005/func/sub-SL005_task-statlearning_events.tsv
			Evidence: Columns: TODO -- fill in rows and add more tab-separated columns if desired not defined, please define in: /events.json, /task-statlearning_events.json,/sub-SL005/sub-SL005_events.json,/sub-SL005/sub-SL005_task-statlearning_events.json,/sub-SL005/func/sub-SL005_events.json,/sub-SL005/func/sub-SL005_task-statlearning_events.json
		./sub-SL006/func/sub-SL006_task-rest_events.tsv
			Evidence: Columns: TODO -- fill in rows and add more tab-separated columns if desired not defined, please define in: /events.json, /task-rest_events.json,/sub-SL006/sub-SL006_events.json,/sub-SL006/sub-SL006_task-rest_events.json,/sub-SL006/func/sub-SL006_events.json,/sub-SL006/func/sub-SL006_task-rest_events.json
		... and 27 more files having this issue (Use --verbose to see them all).

	Please visit https://neurostars.org/search?q=CUSTOM_COLUMN_WITHOUT_DESCRIPTION for existing conversations about this issue.

	4: [WARN] The recommended file /README is very small. Please consider expanding it with additional information about the dataset. (code: 213 - README_FILE_SMALL)
		./README

	Please visit https://neurostars.org/search?q=README_FILE_SMALL for existing conversations about this issue.

        Summary:                 Available Tasks:                             Available Modalities: 
        255 Files, 1.98GB        rest                                         MRI                   
        19 - Subjects            statlearning                                                       
        1 - Session              TODO: full task name for rest                                      
                                 TODO: full task name for statlearning                              


	If you have any questions, please post on https://neurostars.org/tags/bids.

Hi @Will_Decker,

Thanks. BIDS validation looks good. Let us know if upgrading + new work directory does the trick. Also, how much memory/cpu are you devoting to the job?

Best,
Steven

@Steven that worked! Thanks.

1 Like