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

how to speed-up registration #850

Closed
Borda opened this issue Sep 20, 2019 · 5 comments
Closed

how to speed-up registration #850

Borda opened this issue Sep 20, 2019 · 5 comments

Comments

@Borda
Copy link

Borda commented Sep 20, 2019

Is your feature request related to a problem? Please describe.
We are registering large microscopy images using this package with the following parameters which works fine meaning the alignment is reasonably good but it takes a very long time...

Describe the solution you'd like
Could you give some recommendations on what parameters could I change to gain some speed? I was thinking about convergence, smoothing-sigmas, shrink-factors

Additional context
We are using ANTsPy for registering images from ANHIR dataset of average image size 12k x 10k and the resulting alignment is quite fine, but it takes horribly long, about 2hours per image pair.

@ntustison
Copy link
Member

Continued. Okay, here's an easy way to start finding a set of workable parameters. Try using the script antsRegistrationSyNQuick.sh on your data. It's a highly simplified interface for the antsRegistration tool. That will give us a launching point for further parameter exploration. Specifically, one of the first items that is printed to the screen is the actual antsRegistration call. Copy and paste that call to a bash script and I can then point you to some things you might want to try changing to speed things up.

@stnava
Copy link
Member

stnava commented Oct 25, 2019

the right way to optimize is by empirical validation study. you would optimize the number of levels / iterations / smoothing per level - while keeping the CC sampling dense - then proceed with limiting the CC sampling. that being said, I don't think that random sampling in CC will speed anything up. the implementation is optimized for dense sampling and random sampling will lose that additional speedup possibly to the point of actually making it slower. anyway, I would start with something like:

--metric CC[ %(target-image)s, %(source-image)s, 1 , 2 ]
--transform SyN[ 0.15, 3, 0. ]              # or  SyN[ 0.15, 3, 0.5 ] for more regularization
--convergence [ 50x50x0x0x0, 1e-5, 5 ]   # b/c you have large images
--smoothing-sigmas 8x4x2x1x0.5x0mm   # or whatever you think it should be - is mm correct for your data?  Vox maybe?
--shrink-factors 32x16x8x4x2x1

note that your default parameters are already very divergent from anything we would recommend.

you would want to do the same type of thing for the affine step but keep the random sampling.

@Borda
Copy link
Author

Borda commented Oct 25, 2019

Thank you for your fast reply :) I believe that I am fine with it for now, so I will close this task...

@Borda Borda closed this as completed Oct 25, 2019
@ntustison
Copy link
Member

Also, just an FYI, there are three B-spline registration algorithms: BSpline a more traditional implementation, BSplineDisplacementField based on this paper, and BSplineSyN a SyN extension.

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

No branches or pull requests

3 participants