Hi,
I was comparing v3 and v4 registration performance on a set of 3D images. In few cases, I noticed that v4 registration is diverging while v3 converges to a reasonable result without any problem. I wonder if you have ever noticed a problem with v4 optimizer that could cause similar issues. I copied my code for v3 and v4 registration below. I tried to keep the registration configuration very similar in both versions. In v3 I set the NumberOfSpatialSamples to 380000 which is about 10% of voxels. I also tried with full sampling but the behavior stays the same. In the attached csv file you can see the metric value at each iteration of the optimizer for both v3 and v4 version. It is clear that v3 converges smoothly, but v4 makes the initial metric value worse after too many iterations. Thanks a lot in advance. Regards, Sepide auto interpolator = itk::LinearInterpolateImageFunction<ImageType, double>::New(); auto transform = itk::AffineTransform<double>::New(); transform->SetIdentity(); itk::Array<double> scales; scales.SetSize(12); scales.Fill(1.0); scales[9] = 0.001; //translation parameters scales scales[10] = 0.001; scales[11] = 0.001; // Registration V3 ----------------------- : auto metric = itk::MattesMutualInformationImageToImageMetric<ImageType, ImageType>::New(); auto optimizer = itk::RegularStepGradientDescentOptimizer::New(); auto registration = itk::ImageRegistrationMethod<ImageType, ImageType>::New(); int NumberOfSpatialSamples = 380000; metric->SetNumberOfSpatialSamples(NumberOfSpatialSamples); optimizer->SetScales(scales); registration->SetMetric(metric); registration->SetOptimizer(optimizer); registration->SetInterpolator(interpolator); registration->SetTransform(transform); registration->SetFixedImage(fixedImage); registration->SetMovingImage(movingImage); registration->SetFixedImageRegion(fixedImage->GetBufferedRegion()); registration->SetInitialTransformParameters(transform->GetParameters()); registration->Update(); // Registration V4 ----------------------- : auto metric = itk::MattesMutualInformationImageToImageMetricv4<ImageType, ImageType>::New(); auto optimizer = itk::RegularStepGradientDescentOptimizerv4::New(); auto registration = itk::ImageRegistrationMethodv4<ImageType, ImageType>::New(); optimizer->SetScales(scales); optimizer->SetDoEstimateScales(false); optimizer->SetDoEstimateLearningRateAtEachIteration(false); optimizer->SetDoEstimateLearningRateOnce(false); optimizer->SetMetric(metric); registration->SetNumberOfLevels(1); registration->SetSmoothingSigmasPerLevel(0); registration->SetShrinkFactorsPerLevel(1); registration->SetMetricSamplingPercentagePerLevel(0.1); registration->SetMetric(metric); registration->SetOptimizer(optimizer); registration->SetFixedImage(fixedImage); registration->SetMovingImage(movingImage); registration->SetMetricSamplingStrategy(RegistrationType::REGULAR); registration->SetInitialTransform(transform); registration->Update();
Iteration,V3-StepSize,V3-MetricValue,,V4-StepSize,V4-MetricValue 1,1,-0.358542344,,0.5,-0.355641131 2,0.5,-0.406690133,,0.5,-0.35874025 3,0.5,-0.442895131,,0.5,-0.362507728 4,0.5,-0.471215621,,0.5,-0.365338001 5,0.25,-0.513460569,,0.5,-0.366561618 6,0.125,-0.529758958,,0.5,-0.366227936 7,0.125,-0.537278449,,0.5,-0.365776647 8,0.125,-0.538503209,,0.5,-0.365492486 9,0.0625,-0.535698763,,0.5,-0.365046387 10,0.0625,-0.538768297,,0.5,-0.364585705 11,0.03125,-0.538452675,,0.5,-0.36409829 12,0.015625,-0.538916975,,0.5,-0.363976526 13,0.015625,-0.538966701,,0.5,-0.363772942 14,0.015625,-0.538906477,,0.5,-0.363471673 15,0.015625,-0.538966274,,0.5,-0.362194401 16,0.015625,-0.538961265,,0.5,-0.361712634 17,0.0078125,-0.538682472,,0.5,-0.357885906 18,0.0078125,-0.538863442,,0.5,-0.359383288 19,0.00390625,-0.538944964,,0.5,-0.324031208 20,0.001953125,-0.538913652,,0.5,-0.339537743 21,0.001953125,-0.538909418,,0.5,-0.349783416 22,0.001953125,-0.53890616,,0.5,-0.33961332 23,0.001953125,-0.538906373,,0.25,-0.346902168 24,,,,0.125,-0.33869736 25,,,,0.125,-0.342419159 26,,,,0.125,-0.344594523 27,,,,0.125,-0.345080954 28,,,,0.125,-0.343538327 29,,,,0.125,-0.344549356 30,,,,0.125,-0.341616083 31,,,,0.125,-0.343780045 32,,,,0.125,-0.343965577 33,,,,0.125,-0.342201682 34,,,,0.125,-0.343865065 35,,,,0.125,-0.340107217 36,,,,0.125,-0.343055853 37,,,,0.0625,-0.343844541 38,,,,0.03125,-0.341606817 39,,,,0.03125,-0.342270153 40,,,,0.03125,-0.342793007 41,,,,0.03125,-0.343175583 42,,,,0.03125,-0.34342446 43,,,,0.03125,-0.343491827 44,,,,0.03125,-0.343496312 45,,,,0.03125,-0.343508973 46,,,,0.03125,-0.343513032 47,,,,0.03125,-0.34352005 48,,,,0.03125,-0.343528625 49,,,,0.03125,-0.343539861 50,,,,0.03125,-0.343553581 51,,,,0.03125,-0.343567354 52,,,,0.03125,-0.343579758 53,,,,0.03125,-0.343591282 54,,,,0.03125,-0.343600371 55,,,,0.03125,-0.343610817 56,,,,0.03125,-0.343623378 57,,,,0.03125,-0.343635902 58,,,,0.03125,-0.343649696 59,,,,0.03125,-0.343663435 60,,,,0.03125,-0.343678089 61,,,,0.03125,-0.343691409 62,,,,0.03125,-0.343699872 63,,,,0.03125,-0.343710415 64,,,,0.03125,-0.343716715 65,,,,0.03125,-0.343726917 66,,,,0.03125,-0.343734699 67,,,,0.03125,-0.343746789 68,,,,0.03125,-0.343754721 69,,,,0.03125,-0.343767811 70,,,,0.03125,-0.343771549 71,,,,0.03125,-0.343788123 72,,,,0.03125,-0.343782891 73,,,,0.03125,-0.343807449 74,,,,0.03125,-0.343774059 75,,,,0.03125,-0.343833723 76,,,,0.03125,-0.343711888 77,,,,0.03125,-0.343883244 78,,,,0.03125,-0.343529285 79,,,,0.03125,-0.343867778 80,,,,0.03125,-0.343605442 81,,,,0.03125,-0.343885643 82,,,,0.03125,-0.343487163 83,,,,0.03125,-0.343830367 84,,,,0.03125,-0.343635272 85,,,,0.03125,-0.343871799 86,,,,0.03125,-0.343428882 87,,,,0.03125,-0.343793785 88,,,,0.03125,-0.343606598 89,,,,0.03125,-0.34384741 90,,,,0.03125,-0.343333175 91,,,,0.03125,-0.3437613 92,,,,0.03125,-0.343612364 93,,,,0.03125,-0.343859643 94,,,,0.03125,-0.34311321 95,,,,0.03125,-0.343644562 96,,,,0.03125,-0.34385993 97,,,,0.03125,-0.343069565 98,,,,0.03125,-0.343634731 99,,,,0.03125,-0.34389596 100,,,,0.015625,-0.342956926 101,,,,0.015625,-0.343282706 102,,,,0.015625,-0.343558815 103,,,,0.015625,-0.343749745 104,,,,0.015625,-0.343816104 105,,,,0.015625,-0.343770586 106,,,,0.015625,-0.343820339 107,,,,0.015625,-0.343782634 108,,,,0.015625,-0.343832393 109,,,,0.015625,-0.343799981 110,,,,0.015625,-0.343848811 111,,,,0.015625,-0.343814513 112,,,,0.015625,-0.343869742 113,,,,0.015625,-0.343797885 114,,,,0.015625,-0.343903331 115,,,,0.015625,-0.34377385 116,,,,0.015625,-0.343916336 117,,,,0.015625,-0.343764545 118,,,,0.015625,-0.343937954 119,,,,0.015625,-0.3437841 120,,,,0.015625,-0.343955369 121,,,,0.015625,-0.343748618 122,,,,0.015625,-0.343946588 123,,,,0.015625,-0.343786423 124,,,,0.015625,-0.343966369 125,,,,0.015625,-0.343809956 126,,,,0.015625,-0.343981677 127,,,,0.015625,-0.343823923 128,,,,0.015625,-0.343990391 129,,,,0.015625,-0.343851375 130,,,,0.015625,-0.344005623 131,,,,0.015625,-0.343861234 132,,,,0.015625,-0.344007686 133,,,,0.015625,-0.343916921 134,,,,0.015625,-0.344035274 135,,,,0.015625,-0.343878512 136,,,,0.015625,-0.344010154 137,,,,0.015625,-0.343977291 138,,,,0.015625,-0.344049302 139,,,,0.0078125,-0.34389287 140,,,,0.0078125,-0.343956922 141,,,,0.0078125,-0.344000145 142,,,,0.0078125,-0.343996441 143,,,,0.0078125,-0.343998421 144,,,,0.0078125,-0.343993432 145,,,,0.0078125,-0.343992889 146,,,,0.0078125,-0.343988034 147,,,,0.0078125,-0.343985899 148,,,,0.0078125,-0.343981315 149,,,,0.0078125,-0.343978337 150,,,,0.0078125,-0.343974081 151,,,,0.0078125,-0.343970643 152,,,,0.0078125,-0.34396663 153,,,,0.0078125,-0.34396315 154,,,,0.0078125,-0.343959281 155,,,,0.0078125,-0.343955678 156,,,,0.0078125,-0.343951971 157,,,,0.0078125,-0.34394827 158,,,,0.0078125,-0.343944215 159,,,,0.0078125,-0.343940321 160,,,,0.0078125,-0.34393584 161,,,,0.0078125,-0.343931487 162,,,,0.0078125,-0.343926425 163,,,,0.0078125,-0.343920978 164,,,,0.0078125,-0.343915438 165,,,,0.0078125,-0.343909607 166,,,,0.0078125,-0.343903517 167,,,,0.0078125,-0.34389731 168,,,,0.0078125,-0.343891153 169,,,,0.0078125,-0.343885275 170,,,,0.0078125,-0.343879556 171,,,,0.0078125,-0.343873786 172,,,,0.0078125,-0.343867868 173,,,,0.0078125,-0.343862063 174,,,,0.0078125,-0.343856299 175,,,,0.0078125,-0.343850585 176,,,,0.0078125,-0.343845371 177,,,,0.0078125,-0.34384019 178,,,,0.0078125,-0.34383484 179,,,,0.0078125,-0.34382969 180,,,,0.0078125,-0.343824566 181,,,,0.0078125,-0.343819661 182,,,,0.0078125,-0.343815034 183,,,,0.0078125,-0.343810514 184,,,,0.0078125,-0.343805697 185,,,,0.0078125,-0.34380077 186,,,,0.0078125,-0.343795553 187,,,,0.0078125,-0.343790091 188,,,,0.0078125,-0.343784405 189,,,,0.0078125,-0.34377831 190,,,,0.0078125,-0.343772033 191,,,,0.0078125,-0.343765037 192,,,,0.0078125,-0.343757571 193,,,,0.0078125,-0.343749428 194,,,,0.0078125,-0.343740819 195,,,,0.0078125,-0.343731499 196,,,,0.0078125,-0.34372148 197,,,,0.0078125,-0.343711226 198,,,,0.0078125,-0.343700952 199,,,,0.0078125,-0.343690822
_______________________________________________ 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