-
Notifications
You must be signed in to change notification settings - Fork 119
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
Speed up ImageFullSampler
, ImageGridSampler
, and ImageRandomSamplerSparseMask
, using a local sampleVector
variable
#960
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Avoided redundant `this->GetCroppedInputImageRegion()` calls.
Nicely declared those `iter` variables in the _init-statement_ of the corresponding `for` loops. Note that the constructor of `itk::ImageRegionConstIteratorWithIndex' already places the iterator at the begin of the specified image region.
Prefer Standard C++ library functions to hand-made functions, if the functionality is basically the same.
Suggested by C++ Resharper.
For consistency between ImageGridSampler and ImageFullSampler.
Did speed up `ImageFullSampler`, `ImageGridSampler`, and `ImageRandomSamplerSparseMask` by doing the `push_back`'s of samples to a local `std::vector` of samples (instead of directly to the sample container), and then eventually swapping the vector "into" the sample container. When using `ImageFullSampler` on a 4096 x 4096 input image, a `sampler.Update()` call originally took more than 0.38 seconds, but it went down to almost 0.20 seconds with this commit, as observed using Visual C++ 2019 (Release configuration).
N-Dekker
added a commit
to N-Dekker/ITKElastix
that referenced
this pull request
Sep 15, 2023
Supports passing a transform retrieved by `GetCombinationTransform()` or `GetNthTransform(n)` to `ConvertToItkTransform`, when an _external_ initial transform was specified before running the registration. Also including various performance improvements. Including: pull request SuperElastix/elastix#946 commit SuperElastix/elastix@7bcb2b3 ENH: Write external initial transforms to ITK transform file pull request SuperElastix/elastix#949 commit SuperElastix/elastix@601f465 ENH: `ConvertToItkTransform` should support external initial transform pull request SuperElastix/elastix#950 commit SuperElastix/elastix@7e883bf ENH: Add GetInitialTransform() and GetExternalInitialTransform() pull request SuperElastix/elastix#959 commit SuperElastix/elastix@3979978 PERF: Speed up ComputeJacobianTerms access to `vnl_sparse_matrix` pull request SuperElastix/elastix#960 commit SuperElastix/elastix@4d028f7 PERF: Speed up full, grid, sparse mask samplers by a local sampleVector
N-Dekker
added a commit
to N-Dekker/ITKElastix
that referenced
this pull request
Sep 18, 2023
Supports passing a transform retrieved by `GetCombinationTransform()` or `GetNthTransform(n)` to `ConvertToItkTransform`, when an _external_ initial transform was specified before running the registration. Also including various performance improvements. Including: pull request SuperElastix/elastix#946 commit SuperElastix/elastix@7bcb2b3 ENH: Write external initial transforms to ITK transform file pull request SuperElastix/elastix#949 commit SuperElastix/elastix@601f465 ENH: `ConvertToItkTransform` should support external initial transform pull request SuperElastix/elastix#950 commit SuperElastix/elastix@7e883bf ENH: Add GetInitialTransform() and GetExternalInitialTransform() pull request SuperElastix/elastix#959 commit SuperElastix/elastix@3979978 PERF: Speed up ComputeJacobianTerms access to `vnl_sparse_matrix` pull request SuperElastix/elastix#960 commit SuperElastix/elastix@4d028f7 PERF: Speed up full, grid, sparse mask samplers by a local sampleVector
dzenanz
pushed a commit
to InsightSoftwareConsortium/ITKElastix
that referenced
this pull request
Sep 19, 2023
Supports passing a transform retrieved by `GetCombinationTransform()` or `GetNthTransform(n)` to `ConvertToItkTransform`, when an _external_ initial transform was specified before running the registration. Also including various performance improvements. Including: pull request SuperElastix/elastix#946 commit SuperElastix/elastix@7bcb2b3 ENH: Write external initial transforms to ITK transform file pull request SuperElastix/elastix#949 commit SuperElastix/elastix@601f465 ENH: `ConvertToItkTransform` should support external initial transform pull request SuperElastix/elastix#950 commit SuperElastix/elastix@7e883bf ENH: Add GetInitialTransform() and GetExternalInitialTransform() pull request SuperElastix/elastix#959 commit SuperElastix/elastix@3979978 PERF: Speed up ComputeJacobianTerms access to `vnl_sparse_matrix` pull request SuperElastix/elastix#960 commit SuperElastix/elastix@4d028f7 PERF: Speed up full, grid, sparse mask samplers by a local sampleVector
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Did speed up
ImageFullSampler
,ImageGridSampler
, andImageRandomSamplerSparseMask
by doing thepush_back
's of samples to a localstd::vector
of samples (instead of directly to the sample container), and then eventually swapping the vector "into" the sample container.When using
ImageFullSampler
on a 4096 x 4096 input image, asampler.Update()
call originally took more than 0.38 seconds, but it went down to almost 0.20 seconds with this commit, as observed using Visual C++ 2019 (Release configuration).This pull request also includes various coding style improvements of the implementation of the samplers.