Skip to content

WIP - BF - give sdc_fmb access to ants reg settings (esp initial_moving_transform_com) #1952

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

Closed
wants to merge 2 commits into from

Conversation

WillForan
Copy link

@WillForan WillForan commented Apr 12, 2017

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-io
Copy link

Codecov Report

Merging #1952 into master will decrease coverage by 26.93%.
The diff coverage is 0%.

Impacted file tree graph

@@             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%) ⬇️
#unittests 38.23% <0%> (-31.83%) ⬇️
Impacted Files Coverage Δ
nipype/workflows/dmri/fsl/artifacts.py 7.36% <0%> (-73.92%) ⬇️
nipype/workflows/dmri/fsl/tests/test_epi.py 0% <0%> (-100%) ⬇️
nipype/workflows/dmri/dipy/__init__.py 0% <0%> (-100%) ⬇️
nipype/workflows/dmri/fsl/tests/test_dti.py 0% <0%> (-100%) ⬇️
...pype/workflows/dmri/camino/connectivity_mapping.py 7.51% <0%> (-92.49%) ⬇️
...pype/workflows/dmri/mrtrix/connectivity_mapping.py 7.76% <0%> (-92.24%) ⬇️
nipype/interfaces/fsl/tests/test_preprocess.py 9.18% <0%> (-90.82%) ⬇️
nipype/algorithms/tests/test_modelgen.py 9.91% <0%> (-90.09%) ⬇️
nipype/interfaces/tests/test_base.py 7.2% <0%> (-89.47%) ⬇️
nipype/interfaces/fsl/tests/test_maths.py 11.06% <0%> (-88.94%) ⬇️
... and 860 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 87d3848...a4b758a. Read the comment docs.

'winsorize_upper_quantile': 0.995,
}
defaults.update(alternatives)
for k,v in defaults.iteritems():
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i believe this for loop can be replaced with: fmb20.inputs.trait_set(**defaults)

@oesteban
Copy link
Contributor

@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_file initialization 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.sh script. 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_parameters since 1.0 is probably too large.

@oesteban
Copy link
Contributor

@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.

@satra
Copy link
Member

satra commented May 6, 2017

@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.

@oesteban
Copy link
Contributor

oesteban commented May 6, 2017

@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?

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

Successfully merging this pull request may close these issues.

7 participants