Subject: Re: [slicer-devel] [Fwd: Rigid registration of aligned images] From: Stephen Aylward Date: Sun, 8 Mar 2009 10:18:58 -0400 To: millerjv CC: Ron Kikinis , "slicer-devel@bwh.harvard.edu" , Will Schroeder That problem typically occurs the initial parameters values are poor (particularly center of rotation is not being set) and/or when the optimizers scales are too small (thereby allowing large jumps). It can also happen when using too few bins. A philosophy is to set scales so that a unit jump in any feature being optimized moves the image a magnitude of about 25% of the expected mis-alignment in that feature direction. I think my scale for offsets is 1/(4*pixel_spacing[i]) (thereby suggested the expected offset is 16 voxels in each dim i). Center of rotation defaults to center of the image. Expected rotation is 0.1 radians since medical scans typically don't have much rotation = scale of 2.5. Number of bins = 100 Using the one-plus-one optimizer followed by gradient descent. Mainly using default values for them. More details are in the .xml file in RegisterImages/Applications/RegisterImagesSlicer.xml If you're using an old ITK checkout, there was a bug in one-plus-one where it was using the square of the scales - thereby allowing really large jumps. We fixed that 6-9 months ago. I hope this helps, s On Sat, Mar 7, 2009 at 12:48 PM, millerjv wrote: > > Interesting. Andriy's error is a pretty low level error reported from the > > MattesMI. I believe RegisterImages also uses MattesMI, so I want to rule out > > a bug at the level of the MI calculation. > > > > Stephen, do you have a parameter set for RegisterImages that will register > > fixed.nrrd and moving.nrrd in Slicer3/Libs/MRML/Testing/TestData? I have not > > been able to find a parameter set that will produce a good registration of > > the that data with RegisterImages. It is a bit of toy example because the > > images are low resolution but it bothers me that I cannot find a good set of > > parameters. > > > > > > On Mar 5, 2009, at 4:36 PM, Stephen Aylward wrote: > > >> >> Hi, >> >> >> >> Works fine using the RegisterImages module in Slicer. >> >> >> >> RegisterImages croppedLung.nrrd GaussianBlurCroppedLung.nrrd >> >> --registration PipelineRigid --resampledImage out.mha >> >> >> >> I tested your data using every one of the registration forms that >> >> RegisterImages supports (i.e., PipelineRigid, Rigid, PipelineAffine, >> >> Affine, and BSpline), and it worked. >> >> >> >> Documentation is online at: >> >> >> >> http://www.na-mic.org/Wiki/index.php/ITK_Registration_Optimization#Slicer3_Module:_RegisterImages >> >> >> >> Stephen >> >> >> >> On Thu, Mar 5, 2009 at 9:26 AM, Ron Kikinis >> >> wrote: >>> >>> >>> >>> >>> >>> -------- Original Message -------- >>> >>> Subject: [slicer-devel] Rigid registration of aligned images >>> >>> Date: Thu, 5 Mar 2009 09:23:57 -0500 >>> >>> From: Andriy Fedorov >>> >>> To: Slicer Development >>> >>> CC: Miller, James V (GE, Research) >>> >>> >>> >>> Hi all, >>> >>> >>> >>> This is in relation to the previous post from Yanling >>> >>> http://massmail.spl.harvard.edu/pipermail/slicer-devel/2009/002904.html >>> >>> >>> >>> I attach the images Yanling sent to me, which create problems during >>> >>> rigid registration. Note, the second image is simply the first image >>> >>> after Gaussian blur. Both images have the same size, origin, >>> >>> orientation and spacing. >>> >>> >>> >>> If I use the default registration parameters, it fails with "ERROR: >>> >>> MattesMutualInformationImageToImageMetric(0x7f7c34230120): Joint PDF >>> >>> summed to zero" >>> >>> >>> >>> I tried to choose the parameters to adapt to the input data: I reduced >>> >>> the number of samples to the minimum possible (1000), since the images >>> >>> are relatively small (81x77x11), reduced the translation scaling and >>> >>> number of iterations. Here are the parameters: >>> >>> >>> >>> Histogram bins: 30 >>> >>> Spatial samples: 1000 >>> >>> Iterations: 100,100,50,20 >>> >>> Learning rates: default settings >>> >>> Translation scaling: 10 >>> >>> >>> >>> Now registration fails with the message "ERROR: >>> >>> MattesMutualInformationImageToImageMetric(0x7f7c3482fd10): Too many >>> >>> samples map outside moving image buffer: 231 / 1000" >>> >>> >>> >>> How is it possible, if the images seemingly have 100% overlap? >>> >>> >>> >>> I tried different combinations of parameters, but none seems to work >>> >>> for these images. >>> >>> >>> >>> Can anyone explain what is going on? Jim, can you help? >>> >>> >>> >>> Thank you >>> >>> >>> >>> Andriy Fedorov >>> >>> >>> >>> >>> >>> >>> >>> On Tue, Mar 3, 2009 at 1:30 PM, Andriy Fedorov >>> >>> wrote: >>>> >>>> >>>> >>>> Yanling, >>>> >>>> >>>> >>>> The error probably was "ERROR: Failed to align input scans!", not "can >>>> >>>> not be aligned". >>>> >>>> >>>> >>>> This error is a generic error that means rigid registration failed for >>>> >>>> one or another reason. This is explained in the ChangeTracker >>>> >>>> documentation: >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> http://wiki.slicer.org/slicerWiki/index.php/Modules:ChangeTracker-Documentation-3.4 >>>> >>>> >>>> >>>> The parameters for registration in ChangeTracker were tuned for the >>>> >>>> meningioma brain MRI, and if registration fails, there is no mechanism >>>> >>>> to re-adjust the parameters. I understand it should not fail, because >>>> >>>> images are the same, but that is what I believe is happening. >>>> >>>> >>>> >>>> Can you try to run RigidRegistration module with the default >>>> >>>> parameters on that data you have and see if it completes without >>>> >>>> errors? >>>> >>>> >>>> >>>> Please let me know what happens if you try what I suggest. >>>> >>>> >>>> >>>> Andriy Fedorov >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> On Tue, Mar 3, 2009 at 10:51 AM, Yanling Liu wrote: >>>>> >>>>> >>>>> >>>>> Hello, when testing the ChangeTracker module with two input volumes I >>>>> >>>>> get >>>>> >>>>> an >>>>> >>>>> error message says "input scans can not be aligned". The first volume >>>>> >>>>> is >>>>> >>>>> the >>>>> >>>>> original scan with spherical lung tumor. In the second volume I applied >>>>> >>>>> Gaussian filter to grow the tumor a little bit. These two volumes has >>>>> >>>>> same >>>>> >>>>> parameters such as dimension, origin, position and spacings so the >>>>> >>>>> error >>>>> >>>>> message confuses me.... >>>>> >>>>> >>>>> >>>>> Thanks, >>>>> >>>>> Yanling >>>>> >>>>> >>>>> >>>>> _______________________________________________ >>>>> >>>>> slicer-devel mailing list >>>>> >>>>> slicer-devel@bwh.harvard.edu >>>>> >>>>> http://massmail.spl.harvard.edu/mailman/listinfo/slicer-devel >>>>> >>>>> To unsubscribe: send email to >>>>> >>>>> slicer-devel-request@massmail.spl.harvard.edu >>>>> >>>>> with unsubscribe as the subject >>>>> >>>>> >>>> >>>> >>> >>> >>> >>> >>> >>> -- >>> >>> Ron Kikinis, M.D., >>> >>> Professor of Radiology, Harvard Medical School >>> >>> Director, Surgical Planning Laboratory >>> >>> http://www.spl.harvard.edu/~kikinis >>> >>> >>> >>> _______________________________________________ >>> >>> slicer-devel mailing list >>> >>> slicer-devel@bwh.harvard.edu >>> >>> http://massmail.spl.harvard.edu/mailman/listinfo/slicer-devel >>> >>> To unsubscribe: send email to >>> >>> slicer-devel-request@massmail.spl.harvard.edu >>> >>> with unsubscribe as the subject >>> >>> >>> >>> >> >> >> >> >> >> >> >> -- >> >> Stephen R. Aylward, Ph.D. >> >> Chief Medical Scientist >> >> Kitware, Inc. - North Carolina Office >> >> http://www.kitware.com >> >> (518) 371-3971 x300 >> >> _______________________________________________ >> >> slicer-devel mailing list >> >> slicer-devel@bwh.harvard.edu >> >> http://massmail.spl.harvard.edu/mailman/listinfo/slicer-devel >> >> To unsubscribe: send email to >> >> slicer-devel-request@massmail.spl.harvard.edu with unsubscribe as the >> >> subject > > > > -- Stephen R. Aylward, Ph.D. Chief Medical Scientist Kitware, Inc. - North Carolina Office http://www.kitware.com (518) 371-3971 x300