[Insight-users] Re: VersorRigid3DTransform
Radhika Sivaramakrishna
Radhika Sivaramakrishna" <radshashi at earthlink.net
Wed, 31 Dec 2003 14:00:16 -0800
Hi Luis,
I decided to run the example in ImageRegistration8.cxx under examples to
register two 3D images where the moving image is created from the fixed one
by rotating by 10 degrees about the slice direction (so effectively, every
slice is rotated by 10 degrees). When creating the second image, I chose the
goemetircal center as the center of rotation and not the center of mass.
My question was related to the parameters set for the optimizer.
1) Is the RegularStepGradientDescentOptimizer the correct one for this
problem.
2) Is the optimizerScales set correctly? How do I decide what factor of
division to use for the translation parameters and center of rotation? How
is this related to the amount of translation and rotation expected in my
cases? What else does it depend on?
3) How do I decide what values to use for SetMaximumStepLength and
SetMinimumStepLength?
For example in my case, the rotation was 10 degrees. What would have been
the appropriate values to set in this case?
4) I am currently running this and I find even after 7 iterations (each
iteration is very slow on my computer), the metric value has not changed at
all and the other parameters marginally, so its obvious that the parameters
to optimizer are probably not set correctly, though I am not sure how to set
them optimally.
Thanks
Radhika
----- Original Message -----
From: "Luis Ibanez" <luis.ibanez at kitware.com>
To: "Radhika Sivaramakrishna" <radshashi at earthlink.net>
Cc: <insight-users at itk.org>
Sent: Wednesday, December 31, 2003 11:42 AM
Subject: Re: VersorRigid3DTransform
>
> Hi Radhika,
>
> A) The memory problem that you are encountering is
> due to the fact that the "ParameterType" used by
> ITK transform for representing the array of
> parameters is indeed a vnl_vector<>.
>
> This is a variable size vector that by default has
> size=0. You must replace the declaration:
>
> TransformType::ParametersType finalParameters;
>
> with something like:
>
> TransformType::ParametersType finalParameters(
> transform->GetNumberOfParameters() );
>
> or something like:
>
> TransformType::ParametersType finalParameters =
> transform->GetParameters();
>
> In both cases the vector-size of finalParameters
> will take the correct value.
>
>
>
> B) The value that you provided for the parameter[0]
> doesn't correspond to 10 degrees. A Versors is
> a unit quaternion. The magnitude of the three
> versor components is equal to sin(angle/2).
>
> You probably computed
>
> parameter[0] = 0.174532 = sin( 10 )
>
> while you should do
>
> parameter[0] = 0.087155 = sin( 10 / 2 )
>
>
> C) Yes there is a better way of initializing the transform.
> Please look at the methods of the Versor class:
> http://www.itk.org/Insight/Doxygen/html/classitk_1_1Versor.html
>
> You can simply do:
>
> TransformType::VersorType versor;
> versor.SetRotationAroundX( 10.0 * PI / 180.0 );
> transform->SetRotation( versor );
>
> or you could do
>
> TransformType::AxisType axis;
> axis[0] = 1.0;
> axis[1] = 0.0;
> axis[2] = 0.0;
>
> transform->SetRotation( axis, 10.0 * PI / 180.0 );
>
>
>
> Please let us know if you have further questions,
>
>
> Thanks
>
>
> Luis
>
>
> -------------------------------
> Radhika Sivaramakrishna wrote:
>
> > Hi Luis,
> > I was trying to use the VersorRigid3DTransform to artificially transform
a
> > given image by 10 degrees about the center of the image only in the
> > X-direction (ie no rotation in Y and Z) and no translation either. I am
> > doing this to get a better understanding of this transform because I
will
> > need to use it to register a large number of unknown cases.
Unfortunately, I
> > am running into some problems.
> > I modified the example in ImageRegistration8.cxx to do this.
> >
> > Here is what I did:
> >
> > I read in the fixed and moving image (in my case both are from the same
> > file). Since no registration is required this time, I only defined a
> > Transform of type VersorRigid3DTransform.
> >
> > I then set the finalparameters of my transform directly in the following
> > way:
> >
> > TransformType::ParametersType finalParameters;
> >
> >
> >
> > finalParameters[0] = 0.174532;
> > finalParameters[1] = 0;
> > finalParameters[2] = 0;
> > finalParameters[3] = 128.0;
> > finalParameters[4] = 128.0;
> > finalParameters[5] = 82;
> > finalParameters[6] = 0;
> > finalParameters[7] = 0;
> > finalParameters[8] = 0;
> >
> > since I want a 10 degree rotation in X, my image is of size 256x256x164.
> >
> > I then did the usual resampling and casting to create my final image.
> > However a memory error is reported when I try to set the finalParameters
> > directly. Can you tell me what the problem is?
> >
> > Is there a better way of artificially creating a known transformation?
> >
> > Also, when I get to the actual image registration stage, what is the
best
> > optimizer for this transform? Is it the VersorTransformOptimizer?
> >
> > Thanks
> > Radhika
> >
> >
> >
>
>
>