Hello, There should be a way to set the seed to a fixed value. Sorry I don’t have anything more specific, but grep through ITK for “SetSeed” and there should be some tests or examples which do this. If you set a consistent seed before performing a registration ( inside your Register method ) it may solve your problem.
HTH, Brad > On Aug 29, 2016, at 1:54 PM, sepideh movaghati <sepideh.movagh...@gmail.com> > wrote: > > Hi, > > I posted the same issue on insight-users initially but then I thought it > would be more relevant to developers mailing list. > > I was observing an unexpected non-deterministic behavior while changing the > order of completely unrelated registrations. In the following example, my > test revealed that transform and transform' are not identical: > > transform = Register(image1, image2); > > vs. > > transform-foo = Register(image-foo1, image-foo2); > transform' = Register(image1, image2); > > > I looked into the source of this non-deterministic behavior while making sure > the metric sampling strategy has been set to Regular. > Eventually I found the cause of the problem in > itkRegistrationParametersScaleEstimator class. In this class there are two > functions SetScaleSamplingStrategy and SetStepScaleSamplingStrategy. In both > the sampling strategy is chosen based on the Transformation type. For example > if the transformation is of type displacement field or BSpline, it uses all > of the samples. If transformation is any regular affine or rigid > transformation (child of class MatrixOffsetTransformBase) it performs corner > sampling. However, if the transformation is none of the known ones, it uses > Random Sampling. > > In my test I was using one level rigid transformation (v4). But here is were > the problem happens: in itkImageRegistrationMethodv4.hxx the Metric > transformation (MovingTransform) always set to a CompositeTransform! > Therefore, ScaleEstimator cannot detect the transformation type and it always > fall into "else" which is using Random Sampling! It does not matter if you do > a multilevel registration or not. The transformation is always of type > CompositeTransform. > > By changing the sampling strategy in ScaleEstimator class from Random to a > regular sampling, the non-deterministic behavior is gone and transform and > transform' in the above example become identical. > > I would appreciate if you let me know if I was correct about this issue and > whether we can consider this a bug and hope to get it fixed for the upcoming > versions. > > Thanks a lot for your consideration in advance, > Sepide > _______________________________________________ > Powered by www.kitware.com > > Visit other Kitware open-source projects at > http://www.kitware.com/opensource/opensource.html > > Kitware offers ITK Training Courses, for more information visit: > http://kitware.com/products/protraining.php > > Please keep messages on-topic and check the ITK FAQ at: > http://www.itk.org/Wiki/ITK_FAQ > > Follow this link to subscribe/unsubscribe: > http://public.kitware.com/mailman/listinfo/insight-developers _______________________________________________ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Kitware offers ITK Training Courses, for more information visit: http://kitware.com/products/protraining.php Please keep messages on-topic and check the ITK FAQ at: http://www.itk.org/Wiki/ITK_FAQ Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/insight-developers