Cerebellum is cut off across multiple participants. This is not happening for most participants, but around 10 out of 200. I have tried rerunning after deleting working directory files and all other related files. I am not getting any error messages associated with this issue. Thank you in advance for any help you can provide.
Command used (and if a helper script was used, a link to the helper script or the command generated):
What kind of T1w image are you using? 7T data? You may want to provide your own brain mask as it looks like the brain mask calculated by fmriprep on these datasets is cutting out the cerebellum. You could try to give your own skull stripped image and use --skull-strip-t1w skip in your fmriprep call. I am not entirely sure that this will improve the anatomical segmentation.
Thank you, @jsein! I tried implementing using my own brain mask using SPM segmentation and combining the GM and WM images. I am now getting this error message:
Node: fmriprep_23_2_wf.sub_3024_wf.anat_fit_wf.apply_mask
Working directory: /isilon/datalake/ptcrc_meadelab/CONNECT/MRI/data_processed/BIDS/fmriprep_workingdir_v23/fmriprep_23_2_wf/sub_3024_wf/anat_fit_wf/apply_mask
Node inputs:
in_file = <undefined>
in_mask = /isilon/datalake/ptcrc_meadelab/CONNECT/MRI/data_processed/BIDS/data_BIDS_v23/baseline/mymask/sub-3024/anat/sub-3024_desc-brain_mask.nii.gz
threshold = 0.5
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 apply_mask.
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/nibabel.py", line 75, in _run_interface
raise ValueError("Image and mask affines are not similar enough.")
ValueError: Image and mask affines are not similar enough.
Any ideas on what might be going on? I do see that the in_file label is “undefined”. Might that be the issue?
Hi @rbell , the message “Image and mask affines are not similar enough” makes me think that you would need to resample your mask into your input T1w space to be sure that the mask and the input T1w have the same dimensions and orientation. You should verify also that they do overlap well!
Thank you for this information. This is indeed always a bit tricky.
This is the qform affine. You may want to check also the storm affine, especially when you use SPM that store transformation in one of the affine matrice.
When looking at the error message, you can see that it is coming from this piece of code:
if not np.allclose(img.affine, msknii.affine):
raise ValueError("Image and mask affines are not similar enough.")
You could just run these lines with your two images to see if that gives the same error message. If not, this means that you are not looking at the same images as fmriprep when this check occurs.
Really appreciate your help with this. Storm affines are also the same. My question is whether it is failing on the submitted T1w image or the noise corrected T1?
I see that the “in_file” is the noise corrected T1w. When I view this image it is in a different orientation (neurological vs. radiological) relative to the mask. Could this be the issue?
As an update, if I register to the T1w noise correct file listed above I no longer receive the error message regarding image and mask affines not being similar enough. However, I do get the following error message now:
Stderr:
Exception caught during reference file reading
itk::ImageFileReaderException (0x5640d0c4c6a0)
Location: "unknown"
File: /opt/conda/envs/fmriprep/include/ITK-5.3/itkImageFileReader.hxx
Line: 132
Description: Could not create IO object for reading file /isilon/datalake/ptcrc_meadelab/CONNECT/MRI/data_processed/BIDS/data_BIDS_v23/baseline/mymask/sub-3024/anat/sub-3024_ses-baseline_desc-brain_mask.nii.gz
Tried to create one of the following:
BMPImageIO
BioRadImageIO
Bruker2dseqImageIO
GDCMImageIO
GE4ImageIO
GE5ImageIO
GiplImageIO
HDF5ImageIO
JPEGImageIO
JPEG2000ImageIO
LSMImageIO
MGHImageIO
MINCImageIO
MRCImageIO
MetaImageIO
NiftiImageIO
NrrdImageIO
PNGImageIO
StimulateImageIO
TIFFImageIO
VTKImageIO
You probably failed to set a file suffix, or
set the suffix to an unsupported type.