Description
What happened?
I've been debugging an Atropos crash that occurs for brain_extraction_wf
in niworkflows 1.3.x (LTS) and 1.12.x (dev) but does not occur for antsBrainExtraction.sh
in ANTs 2.3.4 (LTS) or 2.5.4 (latest).
Walking through step-by-step, here are the abbreviated inputs to Atropos:
antsBrainExtraction.sh
:
graph TD;
T1w --"TruncateImageIntensity"--> maskedN4Truncated0.nii.gz --N4--> maskedN4Corrected0.nii.gz --> Atropos
probseg --"resample and threshold"---> maskedBrainExtractionPriorWarped.nii.gz --> Atropos
brain_extraction_wf
:
graph TD;
T1w --"TruncateImageIntensity"--> trunc --N4--> inu_n4
T1w --N4----> inu_n4_final --> Atropos
thr_brainmask --N4--> inu_n4_final
probseg --resample--> map_brainmask --threshold--> thr_brainmask --> Atropos
There is no equivalent to inu_n4_final
in the antsBrainExtraction.sh
workflow, so that seemed to be the most likely culprit. Re-running with verbose:
Running Atropos for 3-dimensional images.
Progress:
itk::ExceptionObject (0x561d6f98af30)
Location: "unknown"
File: /home/conda/feedstock_root/build_artifacts/ants_1732704629105/work/ImageSegmentation/antsGaussianListSampleFunction.hxx
Line: 100
Description: ITK ERROR: GaussianListSampleFunction(0x561d6f98c2b0): Covariance is singular (determinant = 8.91523e-07 < 1.0e-6)
If I switch the inu_n4_final
image for inu_n4
in the same shell command, the run succeeds. By taking the difference of the original image and the truncated image, and using the mask passed to atropos, we can see that an extreme value lies just inside the mask:
None of the extreme values occur inside brain tissue, so it does not seem problematic to pass the truncated image to inu_n4_final
, like:
graph TD;
T1w --"TruncateImageIntensity"--> trunc --N4--> inu_n4
trunc --N4---> inu_n4_final --> Atropos
thr_brainmask --N4--> inu_n4_final
probseg --resample--> map_brainmask --threshold--> thr_brainmask --> Atropos
I will make this minimal patch updating the input image to inu_n4_final
. If that resolves the issue I will propose it to the LTS branch and the dev branch.
What command did you use?
See above.
What version of the software are you running?
LTS and latest
How are you running this software?
Docker
Is your data BIDS valid?
Yes
Are you reusing any previously computed results?
No
Please copy and paste any relevant log output.
Additional information / screenshots
No response