I am registering two 3D itk images. The fixed one is 240*240*285 and the moving one is 80*80*17. I have tries using affineTransform to register them, but has found it the difference of size of the images are too huge and the registration did not work. So that I resampled the moving image and set its size to the fixed one using a linear interpolator.
But the problem comes. The speed of registration is very slow now and it requires more than an hour to finish one set of data registration. But I have 40 sets!
Can anyone promote a faster way of registration or I have done anything wrong about the registration?
Here is the code of resampling:
ResampleFilterType::Pointer movingResampler = ResampleFilterType::New();
InterpolatorType::Pointer movingInterpolator = InterpolatorType::New();
movingResampler->SetInput(movingImg);
movingResampler->SetInterpolator(movingInterpolator);
//set the parameters from the fixed image
movingResampler->SetSize(fixedImg->GetLargestPossibleRegion().GetSize());
movingResampler->Update();
Here is the code of optimizer:
optimizer->SetMaximumStepLength(0.01);
optimizer->SetMinimumStepLength(0.0001);
optimizer->SetNumberOfIterations(300);
optimizer->MinimizeOn();
Many thanks, Arvin
Resampling the image should not be needed if you use a decent interpolator (linear is probably already working very well).
What you might want to check is if the images overlap initially in the world coordinate system. Otherwise, you need to perform an initialization to bring them close to each other. Also you need to provide a decent value for the center of rotation point.
If your goal is just to register the images, you might want to consider using elastix (http://elastix.isi.uu.nl/), a command line which, in my experience, is able to register these kind of images in less than a minute. The affine transform in elastix has auto initialization options as well, just checkout the elastix manual to get you started.
If using ITK you might consider using the itk::CenteredTransformInitializer to initialize the transform.