Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

n4_correct fails for datasets with multi-volume sbrefs #3319

Closed
effigies opened this issue Jul 9, 2024 · 0 comments · Fixed by #3320
Closed

n4_correct fails for datasets with multi-volume sbrefs #3319

effigies opened this issue Jul 9, 2024 · 0 comments · Fixed by #3320
Labels

Comments

@effigies
Copy link
Member

effigies commented Jul 9, 2024

What happened?

Looking into poldracklab/tacc-openneuro#68, I found that N4BiasFieldCorrection fails on 4D images, producing a non-zero exit code but no output. Adding verbosity:

Exception caught: 
itk::ExceptionObject (0x5ffe4b476700)
Location: "unknown" 
File: /home/chris/mambaforge/envs/fmriprep/include/ITK-5.3/itkImageToImageFilter.hxx
Line: 218
Description: ITK ERROR: N4BiasFieldCorrectionImageFilter(0x5ffe4b45b410): Inputs do not occupy the same physical space! 
InputImage Origin: [-9.2676048e+01, -9.8007235e+01, 6.1100900e+01], InputImageMaskImage Origin: [-9.2631440e+01, -9.7714432e+01, 6.8613268e+01]
	Tolerance: 9.6191998e-06
InputImage Direction: -0.0000000e+00 9.9992417e-01 -1.2315087e-02
9.9700160e-01 -9.5299441e-04 -7.7374607e-02
-7.7380978e-02 -1.2278075e-02 -9.9692603e-01
, InputImageMaskImage Direction: 1.0000000e+00 0.0000000e+00 0.0000000e+00
0.0000000e+00 1.0000000e+00 0.0000000e+00
0.0000000e+00 0.0000000e+00 1.0000000e+00

	Tolerance: 1.0000000e-06

By running fslroi $SBREF ./sbref0.nii.gz 0 1, I was able to run it without problems.

I think the correct approach is to run the initial boldref workflow on the sbref before passing it to enhance_and_skullstrip_wf. Need to check whether to that will work with single volume sbrefs or we need to make it conditional.

What command did you use?

NIPYPE_CONFIG_DIR=$PWD/code fmriprep sourcedata/raw . participant --notrack --skip-bids-validation -vv --sloppy --participant-label 114 -w /data/scratch/$( basename $PWD ) --bids-filter-file $PWD/code/bids-filter.json --level minimal

What version of fMRIPrep are you running?

24.0.0

How are you running fMRIPrep?

Local installation ("bare-metal")

Is your data BIDS valid?

Yes

Are you reusing any previously computed results?

No

Please copy and paste any relevant log output.

(fmriprep) church ➜  n4_correct cat command.txt 
N4BiasFieldCorrection --bspline-fitting [ 200 ] -d 3 --input-image /data/testing/fmriprep-24-ds004489/sourcedata/raw/sub-114/ses-1/func/sub-114_ses-1_task-catLoc_run-1_sbref.nii.gz --output sub-114_ses-1_task-catLoc_run-1_sbref_corrected.nii.gz -r --weight-image /data/scratch/fmriprep-24-ds004489/fmriprep_24_0_wf/sub_114_wf/bold_ses_1_task_catLoc_run_1_wf/bold_fit_wf/enhance_and_skullstrip_bold_wf/fix_header/tpl-MNI152NLin2009cAsym_res-01_label-brain_probseg_trans_fixhdr.nii.gz
(fmriprep) church ➜  n4_correct $( cat command.txt ) || echo $?
1
(fmriprep) church ➜  n4_correct $( cat command.txt ) -v 1 || echo $?

Running N4 for 3-dimensional images.

Mask not read.  Using the entire image as the mask.

Original intensity range:  [0, 4912]

***********************************************************
Warning:  Your input image contains nonpositive values
which could cause failure or problematic results.  A
possible workaround would be to:
   1. rescale your image to positive values e.g., [10,100].
   2. run N4 on your rescaled image.
   3. (optional) rescale the N4 output to the original
      intensity range.
***********************************************************

Specified spline distance: 200mm
  original image size:  [84, 84, 51]
  padded image size:  [84, 84, 84]
  number of control points:  [4, 4, 4]

Exception caught: 
itk::ExceptionObject (0x5ffe4b476700)
Location: "unknown" 
File: /home/chris/mambaforge/envs/fmriprep/include/ITK-5.3/itkImageToImageFilter.hxx
Line: 218
Description: ITK ERROR: N4BiasFieldCorrectionImageFilter(0x5ffe4b45b410): Inputs do not occupy the same physical space! 
InputImage Origin: [-9.2676048e+01, -9.8007235e+01, 6.1100900e+01], InputImageMaskImage Origin: [-9.2631440e+01, -9.7714432e+01, 6.8613268e+01]
	Tolerance: 9.6191998e-06
InputImage Direction: -0.0000000e+00 9.9992417e-01 -1.2315087e-02
9.9700160e-01 -9.5299441e-04 -7.7374607e-02
-7.7380978e-02 -1.2278075e-02 -9.9692603e-01
, InputImageMaskImage Direction: 1.0000000e+00 0.0000000e+00 0.0000000e+00
0.0000000e+00 1.0000000e+00 0.0000000e+00
0.0000000e+00 0.0000000e+00 1.0000000e+00

	Tolerance: 1.0000000e-06



1

Additional information / screenshots

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant