PennLINC / qsiprep

Preprocessing of diffusion MRI
http://qsiprep.readthedocs.io
BSD 3-Clause "New" or "Revised" License
139 stars 56 forks source link

Node _t1_conform0 failed to run #43

Closed WillForan closed 4 years ago

WillForan commented 4 years ago

_t1_conform0 and _t1_conform1 throw errors that don't seem to be fatal. qsiprep continues, running eddy.

The offending assert checks orig_img.affine.dot(transform) is np.allcose to target_affine.

For those two we have the matrices:

(array([[   1.        ,    0.        ,    0.        ,  -87.5       ],
       [   0.        ,   -1.        ,    0.        ,  146.6443634 ],
       [   0.        ,    0.        ,    1.        , -156.40016174],
       [   0.        ,    0.        ,    0.        ,    1.        ]]), array([[  -1.        ,    0.        ,    0.        ,   87.5       ],
       [   0.        ,   -1.        ,    0.        ,  146.6443634 ],
       [   0.        ,    0.        ,    1.        , -156.40016174],
       [   0.        ,    0.        ,    0.        ,    1.        ]]))

(array([[   1.        ,    0.        ,    0.        ,  -85.32082367],
       [   0.        ,   -1.        ,    0.        ,  150.50846863],
       [   0.        ,    0.        ,    1.        , -125.54721069],
       [   0.        ,    0.        ,    0.        ,    1.        ]]), array([[  -1.        ,    0.        ,    0.        ,   89.67917633],
       [   0.        ,   -1.        ,    0.        ,  150.50846863],
       [   0.        ,    0.        ,    1.        , -125.54721069],
       [   0.        ,    0.        ,    0.        ,    1.        ]]))

But I'm not sure what these are, how bad it is they are not close, or how we'd better align them.

out/qsiprep/sub-11550/log/20191024-201223_a65f2775-c6ef-4ed5-8de5-6a0e4df8ef53/crash-20191024-201310-root-_t1_conform0-3ad0eb2e-6400-45cf-a238-baad0d2048b3.txt

Node: _t1_conform0 Working directory: /work/qsiprep_wf/single_subject_11550_wf/anat_preproc_wf/anat_template_wf/t1_conform/mapflow/_t1_conform0

Node inputs:

in_file = /data/sub-11550/ses-20160617/anat/sub-11550_ses-20160617_acq-1ADNIG2_run-2_T1w.nii.gz target_shape = (176, 240, 256) target_zooms = (1.0, 1.0, 1.0)

Traceback (most recent call last): File "/usr/local/miniconda/lib/python3.7/site-packages/nipype/pipeline/plugins/multiproc.py", line 69, in run_node result['result'] = node.run(updatehash=updatehash) File "/usr/local/miniconda/lib/python3.7/site-packages/nipype/pipeline/engine/nodes.py", line 473, in run result = self._run_interface(execute=True) File "/usr/local/miniconda/lib/python3.7/site-packages/nipype/pipeline/engine/nodes.py", line 557, in _run_interface return self._run_command(execute) File "/usr/local/miniconda/lib/python3.7/site-packages/nipype/pipeline/engine/nodes.py", line 637, in _run_command result = self._interface.run(cwd=outdir) File "/usr/local/miniconda/lib/python3.7/site-packages/nipype/interfaces/base/core.py", line 375, in run runtime = self._run_interface(runtime) File "/usr/local/miniconda/lib/python3.7/site-packages/qsiprep/interfaces/images.py", line 330, in _run_interface assert np.allclose(orig_img.affine.dot(transform), target_affine) AssertionError

The command

docker run --rm -it \
   -v $FREESURFER_HOME:$FREESURFER_HOME:ro \
   -v /Volumes:/Volumes:ro \
   -v /Volumes/Hera/Projects/mMR_PETDA/qsi/BIDS:/data:ro \
   -v /Volumes/Hera/Projects/mMR_PETDA/qsi/out:/out \
   -v /Volumes/Hera/Projects/mMR_PETDA/qsi/work:/work \
   pennbbl/qsiprep:0.6.1 \
     --bids-dir /data --output-dir /out -w /work \
     --analysis-level participant \
     --fs-license-file  $FREESURFER_HOME/license.txt \
     --output-resolution 2.3

mentions the error like

191024-20:12:57,848 nipype.workflow INFO: [Node] Finished "qsiprep_wf.single_subject_11550_wf.bidssrc". 191024-20:13:00,990 nipype.workflow INFO: [Node] Setting-up "qsiprep_wf.single_subject_11550_wf.anat_preproc_wf.anat_template_wf.t1_template_dimensions" in "/work/qsiprep_wf/single_subject_11550_wf/anat_preproc_wf/anat_template_wf/t1_template_dimensions". 191024-20:13:00,991 nipype.workflow INFO: [Node] Outdated cache found for "qsiprep_wf.single_subject_11550_wf.anat_preproc_wf.anat_template_wf.t1_template_dimensions". 191024-20:13:01,220 nipype.workflow INFO: [Node] Running "t1_template_dimensions" ("qsiprep.niworkflows.interfaces.images.TemplateDimensions") 191024-20:13:01,829 nipype.workflow INFO: [Node] Finished "qsiprep_wf.single_subject_11550_wf.anat_preproc_wf.anat_template_wf.t1_template_dimensions". 191024-20:13:04,672 nipype.workflow INFO: [Node] Setting-up "_t1_conform0" in "/work/qsiprep_wf/single_subject_11605_wf/anat_preproc_wf/anat_template_wf/t1_conform/mapflow/_t1_conform0". 191024-20:13:04,687 nipype.workflow INFO: [Node] Setting-up "qsiprep_wf.single_subject_11550_wf.anat_preproc_wf.anat_derivatives_wf.t1_name" in "/work/qsiprep_wf/single_subject_11550_wf/anat_preproc_wf/anat_derivatives_wf/t1_name". 191024-20:13:04,687 nipype.workflow INFO: [Node] Outdated cache found for "qsiprep_wf.single_subject_11550_wf.anat_preproc_wf.anat_derivatives_wf.t1_name". 191024-20:13:06,60 nipype.workflow INFO: [Node] Running "_t1_conform0" ("qsiprep.interfaces.images.Conform") 191024-20:13:06,81 nipype.workflow INFO: [Node] Running "t1_name" ("nipype.interfaces.utility.wrappers.Function") 191024-20:13:06,214 nipype.workflow INFO: [Node] Finished "qsiprep_wf.single_subject_11550_wf.anat_preproc_wf.anat_derivatives_wf.t1_name". 191024-20:13:07,151 nipype.workflow WARNING: [Node] Error on "_t1_conform0" (/work/qsiprep_wf/single_subject_11605_wf/anat_preproc_wf/anat_template_wf/t1_conform/mapflow/_t1_conform0) 191024-20:13:08,354 nipype.workflow ERROR: Node _t1_conform0 failed to run on host b817b64e3492. 191024-20:13:08,359 nipype.workflow ERROR: Saving crash info to /out/qsiprep/sub-11605/log/20191024-201223_a65f2775-c6ef-4ed5-8de5-6a0e4df8ef53/crash-20191024-201308-root-_t1_conform0-a47a2103-a57f-4c98-88f0-6bfd0e65d8b2.txt

mattcieslak commented 4 years ago

There was also a bug like this in fmriprep that I believe they solved. I'll see if I can find it and fix here too. This isn't a critical problem with your data, though.

mattcieslak commented 4 years ago

Do you know if the T1s you're processing have the same number of voxels in each dimension?

WillForan commented 4 years ago

Thanks for the quick reply! The T1 matrix shape is 176 240 256 (of 1mm^3 voxels)

Here's a session folder (anat, dwi, fm -- but without intendedFor json) for one throwing errors https://pitt.box.com/s/zmz0x0hlsd6fur1l40qu9cdpmgymmkir

mattcieslak commented 4 years ago

Thanks! Downloaded and debugging now.

mattcieslak commented 4 years ago

I got this working and there will be a patch later tonight. This is a DSI dataset, so you definitely don't want to be using eddy for motion correction. I'd recommend using --hmc-model 3dSHORE. The bvals also look like they're incorrectly scaled in 2 directions:

sub-11550_ses-20160617_sampling_scheme

Is this expected?

WillForan commented 4 years ago

No conform errors! But breaking out of docker put focus on outdated packages (namely ANTs), so I haven't yet run a full pass.

I don't know much (anything) about what the bvecs should look like! Thank you for drawing attention to it!

They were likely generated with a 2016 version of dcm2niix. using v1.0.20190410 there are now half as many significant digits. Though it doesn't seem like that was the problem.

mattcieslak commented 4 years ago

The digits in the bvecs shouldn't matter here, it would be the bvals that are off in the L/R direction. Can you confirm with the MR operator that these are correct? If so you won't be able to do traditional DSI reconstruction on it. Closing this issue since the main problem is fixed (closed by #46)