[Insight-users] registration and spacing
Lydia Ng
lng at insightful . com
Thu, 10 Jul 2003 14:56:04 -0700
Hi Michael,
I don't see any thing obvious problem in the code.
Now that we've verify that the resampling is correct, let's play around
with some of the optimizer's parameters.
Say for your PNG example, what you say the registration doesn't work for
FACTOR > 4 - what is actually happening?
No converging to the solution but heading towards it or has the
optimization move wildly away?
If is the former, perhaps you could try increasing the parameters to
FACTOR * FACTOR * minStep and FACTOR * FACTOR * maxStep?
Since the metric derivative have reduced due to reduction in image
derivative as a result in the increase spacing - on the other hand the
optimization now also have twice as far to move?
- Lydia
> -----Original Message-----
> From: Michael Kuhn [mailto:michakuhn at gmx . ch]
> Sent: Thursday, July 10, 2003 11:27 AM
> To: Lydia Ng
> Cc: stepmose at ee . ethz . ch
> Subject: Re: [Insight-users] registration and spacing
>=20
> Hi Lydia,
>=20
> thanks for the reply. I've attached the whole code that I'm using. It
is
> able to process png images and aim images (a 3D data type used for CT
> images by some people).
>=20
> There are some classes included which you don't have (vtkUtility,
> vtkAIMReader). Therefore it won't compile for you. However, I could
> rewrite it such that it should compile without these classes for png
> images if necessary.
>=20
> I've meanwhile written out the images and they seem to be ok. I had to
> introduce a RescaleIntesityImageFilter to cast from short to unsigned
> char/short, since, obviously, short isn't supported for writing PNG
> images (at least I got an exception telling me so). First I tried to
> change PixelType (right at the beginning of main()) to unsigned short,
> however, the registration didn't work properly anymore then.
>=20
> Anyway, the images (in the case of png) seem to be ok for me before
> feeding them into the registration for different FACTORs (FACTOR is
> defined using a #define statement directely after the #include
> statements). However, the registration doesn't always work properly:
If
> FACTOR is larger than about 4, the registration produces results that
> don't make sense. If FACTOR is smaller that 0.1, the registration
> doesn't iterate but creates an end event immediately after the start
> event and results in the initial parameters. In case of my 3D AIM
data,
> the behaviour was slightly different. There, it didn't produce any
> reasonable results for FACTORs of 1.1 or 0.9 already, but always
iterated.
>=20
> I hope this informations help you to understand the problem.
>=20
> Thanks,
>=20
> Michael
>=20
>=20
> Lydia Ng wrote:
>=20
> >Hi Michael,
> >
> >>From you email I understand you are doing the following:
> >
> >- You have one input image (A)
> >- You feed (A) into a ResampleImageFilter with a TranslationTransform
> >and
> > you get image (B)
> >- Then you register (A) and (B)
> >
> >And everything works for spacing of 1.0 in every dimension.
> >
> >You said that you scale the spacing by a FACTOR, could you describe
how
> >you did this? I am wondering if the parameters of the
> >ResampleImageFilter are set correctly. In particular, you would have
to
> >set the spacing of the output to be FACTOR also? Are you able write
out
> >the images (just before registration) to file just to check they are
> >okay?
> >
> >- Lydia
> >
> >
> >
> >>-----Original Message-----
> >>From: Michael Kuhn [mailto:michakuhn at gmx . ch]
> >>Sent: Thursday, July 10, 2003 8:49 AM
> >>To: insight-users at itk . org
> >>Subject: [Insight-users] registration and spacing
> >>
> >>Hi,
> >>
> >>I'm trying to do a registration using 3D Data (pixel type short).
The
> >>general setup is as follows:
> >>
> >>The input consists of one file containing the data. The data is then
> >>transformed using a ResampleImageFilter which applies a translation
to
> >>it. Afterwards, the original as well as the transformed image are
fed
> >>into a ImageRegistrationMethod as fixed (original) and moving
> >>(translated) image respectively.
> >>
> >>If the spacing of both data sets is set to 1.0 (in every direction),
> >>
> >>
> >the
> >
> >
> >>registration works fine. However if I scale the spacings as well as
> >>
> >>
> >the
> >
> >
> >>translation vector (for the translation itself as well as the
> >>initalParameters for the registration) and the minimum/maximum step
> >>length with the same factor, the registration doesn't work any
longer
> >>(i.e. produces incorrect results). The origin of the data was set to
> >>[0,0,0].
> >>
> >>I would expect that the registration works for any common scaling of
> >>these parameters, however, it doesn't. Can somebody explain me why?
> >>
> >>My dataset has a size of [40,40,40] and I translate it with
parameters
> >>FACTOR * [-1, -2, 0]. The initial parameters are set to FACTOR *
> >>
> >>
> >[2,2,0]
> >
> >
> >>(where FACTOR is the common scaling factor mentioned above). The max
> >>
> >>
> >and
> >
> >
> >>min step length are set to FACTOR * 4.0 and FACTOR * 0.01
> >>
> >>
> >respectively.
> >
> >
> >>For the initial transform as well as the registration I use a
> >>TranslateTransform<double, 3> and a
> >>LinearInterpolateImageFunction<ImageType, double>. The registration
is
> >>done using a RegularStepGradientDescentOptimzer and a
> >>MeanSquaresImageToImageMetric.
> >>
> >>Thanks,
> >>
> >>Michael
> >>
> >>_______________________________________________
> >>Insight-users mailing list
> >>Insight-users at itk . org
> >>http://www . itk . org/mailman/listinfo/insight-users
> >>
> >>
> >
> >
> >
> >