Comments (7)
You should be able too look up all the Elastix parameters here, but the page is not working for me right now. @N-Dekker @ViktorvdValk Is that just me, or is the page really down?
from itkelastix.
You should be able too look up all the Elastix parameters here, but the page is not working for me right now. @N-Dekker @ViktorvdValk Is that just me, or is the page really down?
Thanks for reporting this problem @dzenanz It's hopefully back online soon. For the time being, you may use the Internet Archive: https://web.archive.org/web/20230204115458/https://elastix.lumc.nl/doxygen/parameter.html
from itkelastix.
Thank you both for your comments. Really appreciate the support.
How about
parameter_map['RandomSeed'] = ['30101983']
? In the parameter file that might be(RandomSeed 30101983)
.
@dzenanz The parameter RandomSeed
sounds like an obvious answer to the problem but in practice it doesn't seem to do anything. I found a couple of posts on the SimpleElastix GitHub reporting similar behaviour.
Make SimpleElastix more deterministic by setting RandomSeed #460
multiple SimpleElastix instances/runs ignore RandomSeed in ParameterFile #122
@Pedro-Filipe Thanks for asking! It may be helpful to reset the global ITK random number generator before each registration.
Which version of
itk-elastix
do you have installed? ITK v5.4rc02 introduces a new function,MersenneTwisterRandomVariateGenerator.ResetNextSeed()
, which should be of help. I think it should be available with the latestitk-elastix
release.The idea is to call
MersenneTwisterRandomVariateGenerator.ResetNextSeed()
before each registration. Please let us know if that does indeed solve the problem!
@N-Dekker I have these versions currently installed:
itk 5.4rc2
itk-core 5.4rc2
itk-elastix 0.19.1
itk-filtering 5.4rc2
itk-io 5.4rc2
itk-numerics 5.4rc2
itk-registration 5.4rc2
itk-segmentation 5.4rc2
I have added this line of code before calling each registration:
itk.MersenneTwisterRandomVariateGenerator.ResetNextSeed()
It does reduce significantly the variation, although unfortunately not 100%. The values of the registered images differ after a few decimal places.
from itkelastix.
How about parameter_map['RandomSeed'] = ['30101983']
? In the parameter file that might be (RandomSeed 30101983)
.
from itkelastix.
@Pedro-Filipe Thanks for asking! It may be helpful to reset the global ITK random number generator before each registration.
Which version of itk-elastix
do you have installed? ITK v5.4rc02 introduces a new function, MersenneTwisterRandomVariateGenerator.ResetNextSeed()
, which should be of help. I think it should be available with the latest itk-elastix
release.
The idea is to call MersenneTwisterRandomVariateGenerator.ResetNextSeed()
before each registration. Please let us know if that does indeed solve the problem!
from itkelastix.
@Pedro-Filipe I'm glad to hear that ResetNextSeed()
reduces the variation significantly. You might consider to also do a SetSeed
(while calling ResetNextSeed()
as well), using a fixed constant seed, something like:
itk.MersenneTwisterRandomVariateGenerator.GetInstance().SetSeed(1)
(Not 100% sure about the syntax.) Does that further reduce the variation?
Another cause of variation could be multi-threading. You see, internally, elastix may do some floating point operations in a different order, depending on the order in which the threads process the work units. Mathematically, it should not matter, but the order of those floating point operations might affect the floating point rounding errors. You may eliminate those effects by setting the number of threads to one, globally:
itk.MultiThreaderBase.SetGlobalMaximumNumberOfThreads(1)
Obviously this may slow down the registration process. But it might still be interesting to know if that will totally eliminate all variations... I'm interested to hear what you will find!
from itkelastix.
Thanks for the additional suggestions @N-Dekker .
Results
Also using itk.MersenneTwisterRandomVariateGenerator.GetInstance().SetSeed(1)
Syntax seems OK, but didn't seem to have a significant effect.
Reducing threads with itk.MultiThreaderBase.SetGlobalMaximumNumberOfThreads(1)
Slows down registration as expected, but no effect on the randomness. I was sort of expecting this, as I use multithreading with the parameter (ImageSampler "Full")
and I get reproducible results.
So at the moment, if I want deterministic results I can use:
(ImageSampler "Full")
although you get a slower registration even with multithreading.(ImageSampler "Grid")
registration faster thanfull
as expected.
from itkelastix.
Related Issues (20)
- Latest ITKElastix crashes HOT 6
- How to minimise non-rigid distortion when using groupwise registration HOT 3
- pip install itk-elastix does not work HOT 3
- register these two dicom file HOT 1
- Extraction deformation field after 3D registration.
- Error loading initial transform and applying mask
- Error when multiprocessing coregistration HOT 1
- Groupwise registration of 4D objects and registration with mask
- Applying series of registrations to moving image label map HOT 4
- Data format differs from the example HOT 1
- Data format differs from the example HOT 1
- itk.ParameterObject -> seg fault in fresh env HOT 5
- Issue with image format HOT 1
- Elastix Model Zoo site cannot be opened HOT 1
- Inverse transform HOT 11
- ErodeMask and dilating mask
- GroupwiseRegistration notebook: ERROR: the direction cosines matrix of the fixed image is invalid! HOT 2
- Transform coordinates from moving images space to fixed images space HOT 1
- Error of multi-metric and multi-channel image registration HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from itkelastix.