[Insight-users] image Registration!

Lydia Ng lng@insightful.com
Tue May 11 19:04:54 EDT 2004


Xuif,

Here are some suggestions that might help:

[1]
You seem to have set your initial parameters to all zero
>         for i in range(transform.GetNumberOfParameters()):
>             initialParameters.SetElement(i,0.0)

Try starting with the identity transform i.e. [0,0,0,1,0,0,0]

[2]
You seem to have set your scales to all ones
>         for i in range(6):
>             scales.SetElement(i,1.0)

To get better behavior you need to scale the rotation components =
differently
to the translation components
i.e. scales begin [1.0,1.0,1.0,1.0,s,s,s]

In the past I have typically used s =3D 1/(largest dimension in mm)^2

[3]
Your learning rate is set to zero.
>         optimizer.SetLearningRate(0.0)

This means the optimizer can not move the parameters anywhere.
You will need do some experiment to find an appropriate learning rate.
Start by using something small say 1e-4 and attached an observer to the
optimizer to see if making sufficient progress.

I believe Examples/Registration/ImageRegistration3.py illustrates how to
attach an observer.

[4]
Consider normalizing your images to mean zero and unit standard =
deviation.
Else you would need to experiment what appropriate
FixedImageStandardDeviation and MovingImageStandardDeviation is needed.

[5]
Also if you haven't done so already, there is a lot of useful =
information in
the registration section of the software guide.

-Lydia

> -----Original Message-----
> From: xujf [mailto:xujf@sjtu.edu.cn]
> Sent: Tuesday, May 11, 2004 8:02 AM
> To: insight-users@itk.org
> Subject: [Insight-users] image Registration!
>=20
> Hi,everyone:
>=20
>    I am using itkImageRegistrationMethodF3F3_New() to implement image
> Registration,
> however ,no progress haven\'t made for many days. so ,I have to ask =
for
> your help.
>    5 different itk classes are used in my code:
>=20
>         registration =3D itk.itkImageRegistrationMethodF3F3_New()
> #line1
>         imageMetric  =3D
> itk.itkMutualInformationImageToImageMetricF3F3_New()            #line2
>         transform     =3Ditk.itkQuaternionRigidTransform_New()
> #line3
>         optimizer    =3D
> itk.itkQuaternionRigidTransformGradientDescentOptimizer_New()   #line4
>         interpolator =3D =
itk.itkLinearInterpolateImageFunctionF3D_New()
> #line5
>=20
>   then I set the parametres as follows:
>=20
>         imageMetric.SetFixedImageStandardDeviation(0.5)
>         imageMetric.SetMovingImageStandardDeviation(0.5)
>         imageMetric.SetNumberOfSpatialSamples(200)
>=20
>=20
>         registration.SetOptimizer(optimizer.GetPointer())
>         registration.SetTransform(transform.GetPointer())
>         registration.SetInterpolator(interpolator.GetPointer())
>         registration.SetMetric(imageMetric.GetPointer())
>         registration.SetFixedImage(imagefixed)
>         registration.SetMovingImage(self.imagemoving)
>=20
>         =
registration.SetFixedImageRegion(imagefixed.GetBufferedRegion())
>=20
>         transform.SetIdentity()
>         initialParameters=3Dtransform.GetParameters()
>=20
>         for i in range(transform.GetNumberOfParameters()):
>             initialParameters.SetElement(i,0.0)
>=20
>         registration.SetInitialTransformParameters(initialParameters )
>=20
>         scales=3Dtransform.GetParameters()
>=20
>         for i in range(6):
>             scales.SetElement(i,1.0)
>=20
>         optimizer.SetNumberOfIterations(400)
>         optimizer.SetScales(scales)
>         optimizer.SetLearningRate(0.0)
>         optimizer.MaximizeOn()
>=20
>         registration.SetMovingImage(self.imagemoving)
>         registration.StartRegistration()
>=20
> when the code runs here, an error appears:
>       itk::ERROR: MutualInformationImageToImageMetric(0C03BF40): All =
the
> sampled point
>        mapped to outside of the moving image
>=20
>=20
>=20
> I don\'t know what\'s wrong with my code? Also,I don\'t know if the 5
> classes I used in the
> line1 - line5.
>=20
> Thanks in advance!
> xujf



More information about the Insight-users mailing list