nipype
nipype copied to clipboard
WIP - BF - give sdc_fmb access to ants reg settings (esp initial_moving_transform_com)
Running sdc_fmb where in_file and bmap_mag or phase are not close in coordinate space results in error running ants
Description: itk::ERROR: MattesMutualInformationImageToImageMetricv4(0x2600ad0): Too many samples map outside moving image buffer. There are only 151 valid points out of 2473 total points. The images do not sufficiently overlap. They need to be initialized to have more overlap before this metric will work. For instance, you can align the image centers by translation.
Setting initial_moving_transform_com = 1 resolves this error.
This pull request creates a new function antreg_fmm2b0 where ant settings can be changed or added. sdc_fmb is parameterized to to use the new function.
Codecov Report
Merging #1952 into master will decrease coverage by
26.93%. The diff coverage is0%.
@@ Coverage Diff @@
## master #1952 +/- ##
===========================================
- Coverage 72.51% 45.57% -26.94%
===========================================
Files 1063 1063
Lines 54209 54196 -13
Branches 7825 7826 +1
===========================================
- Hits 39307 24701 -14606
- Misses 13680 29446 +15766
+ Partials 1222 49 -1173
| Flag | Coverage Δ | |
|---|---|---|
| #smoketests | 45.57% <0%> (-26.94%) |
:arrow_down: |
| #unittests | 38.23% <0%> (-31.83%) |
:arrow_down: |
| Impacted Files | Coverage Δ | |
|---|---|---|
| nipype/workflows/dmri/fsl/artifacts.py | 7.36% <0%> (-73.92%) |
:arrow_down: |
| nipype/workflows/dmri/fsl/tests/test_epi.py | 0% <0%> (-100%) |
:arrow_down: |
| nipype/workflows/dmri/dipy/__init__.py | 0% <0%> (-100%) |
:arrow_down: |
| nipype/workflows/dmri/fsl/tests/test_dti.py | 0% <0%> (-100%) |
:arrow_down: |
| ...pype/workflows/dmri/camino/connectivity_mapping.py | 7.51% <0%> (-92.49%) |
:arrow_down: |
| ...pype/workflows/dmri/mrtrix/connectivity_mapping.py | 7.76% <0%> (-92.24%) |
:arrow_down: |
| nipype/interfaces/fsl/tests/test_preprocess.py | 9.18% <0%> (-90.82%) |
:arrow_down: |
| nipype/algorithms/tests/test_modelgen.py | 9.91% <0%> (-90.09%) |
:arrow_down: |
| nipype/interfaces/tests/test_base.py | 7.2% <0%> (-89.47%) |
:arrow_down: |
| nipype/interfaces/fsl/tests/test_maths.py | 11.06% <0%> (-88.94%) |
:arrow_down: |
| ... and 860 more |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact),ø = not affected,? = missing dataPowered by Codecov. Last update 87d3848...a4b758a. Read the comment docs.
@WillForan, a couple of suggestions here:
-
I think we should start shipping some default settings for ants with nipype and load them with the
from_fileinitialization argument. The same way we are doing in niworkflows (e.g. settings file). Then:fmm2b0 = pe.Node(ants.Registration(output_warped_image=True, from_file=your_settings.json), name="FMm_to_B0") -
The original problem (
itk::ERROR: MattesMutualInformationImageToImageMetricv4) typically happens for the confluence of two reasons. First, as you said, a bad initialization. Second, the gradient scales/smoothing/etc. is too large.- For the bad initialization, we could/should use this new interface that will be integrated soon (I hope). This is what the authors of ANTs use in their incredibly solid
antsBrainExtraction.shscript. It is rather straightforward to use (default parameters should work). The only caveat is to pass in masked fixed and moving images. - For the scaling of the optimizer step, I'd suggest revising the
transform_parameterssince 1.0 is probably too large.
- For the bad initialization, we could/should use this new interface that will be integrated soon (I hope). This is what the authors of ANTs use in their incredibly solid
@satra: WDYT about shipping some settings for ANTS?, so that users can start off reliable options and experts from the ITK/ANTs world can vet them.
@oesteban - i think any settings that are helpful would be nice. although ants folks thinks of ants as a framework and one may need to optimize settings for each use case. so i don't know whether we should include them or simply create a set of json files that people could use for various ants needs.
@satra I think settings like the ones you showed me once for T1w to MNI registration (which are pretty close -if not the same- to those they use in the antsBrainExtraction.sh) would be really useful.
Then, some other settings like this registration here, you are to release the workflow with a certain set of parameters anyway, so why don't you give them a better place and make them available to other workflows and interfaces?