[Insight-users] Fwd: deform registration
Luis Ibanez
luis . ibanez at kitware . com
Wed, 29 Oct 2003 18:09:11 -0500
Hi Tina,
I'm using the default configuration file available in
Insight/Examples/Data/
FiniteElementsRegistrationParameters1.txt
You shouldn't expect particular features of the resampled
image to be perfectly fitted to the fixed image. The computation
of the deformation fields in this example performs a sort of
globalized evaluation of the image matching. This necessarily
implies that small mismatches in some regions may be tolerated
for the sake of reducing larger mismatches in other regions.
This is an energy minimizing approach and it is necessarily
global.
The particular structure that you mention in the stomach
doesn't have any prerence (as far as the metric is concerned)
over let's say one of the ribs or the articulation of the
shoulder.
If you look at the component Y of the deformation fields
you will see that the mayor movement (as expected) is a
vertical movement on the region of the diaphragm. Which
corresponds to the respiratory motion.
The physical parameters of the model (e.g. elasticity)
constrains how much the moving image will be deformed in
order to match the fixed image. You can play modifying
these physical parameters in order to get a more flexible
material (more deformable) but then you should also expect
a noiser deformation fields. Local mismatch is the price
to pay for global smoothness. You can change the elasticity
parameter in line 24 (of the example file) where you find
the comment:
% Elasticity (E)
Changing from 1e4 to 1e5 results in a much smoother
deformation field, but with smaller deformations everywhere.
Increasing the RhoC factor will have a similar effect since
you will be simulating a denser material.
You could also make your model more flexible by increasing
the number of nodes per dimension (the current default is
32 nodes, one every 4 pixels as defined in line 23). This
will increase the computation time but give more freedom to
the individual nodes to displace and adapt to local shapes.
For example, the structure that you mention in the stomach
requires to be dilated when you try to match the moving image
into the fixed image. For this, you will need a grid density
of at least nine nodes (3x3) covering this structure in order
to get a reasonable shaped dilation.
The fact that some metrics will stop the optimization faster
than other reflect the characteristics of their capture region,
as well as the equilibrium resulting from the physical-like
parameters of your simulation. E.g. lower elasticity values
will allow the material to have larger deformations and therefore
will may require more iterations for achieving convergence.
If you look at the profile of the metrics, you will find
that MeanSquare is typicall very flat in the maximum
(minimum), and has a large capture radius. This may explain
why it takes longer to converge. Normalized correlation
has a more pointy profile. You will find a nice description
of these characteristics in the Registration overview presented
at the ITK tutorial.
http://www . itk . org/CourseWare/Training/RegistrationMethodsOverview . pdf
Look at the profiles in pages 39,41 and 50 for example.
Note that each metric reports values in a very different scale
range. E.g. MI is from -1 to 1 while NormCorrelation is from 0 to 1,
and MeanSquares is from 0 to inf. The scale of the metric
defines the intensity of the image-based forces applied on
the nodes of the FEM mesh.
MutualInformation is not well suited for this problem, unless
you enlarge the area over which the metric is computed.
Note that the forces applied in the nodes are taken from the
derivatives of the metic as evaluated in the node. However,
the metric *must* be evaluated in a regions of a certain size.
the larger this size the more reliable the metric will be,
but also the larger the computation time will be.
The parameter "WidthOfMetricRegion" controls how big this
evaluation region will be.
From the tests, it seems that PatternIntensity and Normalized
correlation are the best metrics for this particular case.
After them, MeanSquares is a good option, and as a last resort
MutualInformation.
Note that you can also play with the scaling of the image energy.
This basically scales the magnitude of the forces excerted
by the image metrics over the rubber-like material. Higher
values of the scaling will make the forces bigger with respect
to the internal forces of the material (e.g. the forced generated
by elasticity properties in response to local deformations).
For example, making the scaling = 6, instead of 1 in the
case of NormalizedCorrelation results in changing the maximal
deformation from 0.01 to 1.75 pixel units.
Keep in mind that there is no "reality" here. There is no
"right answer" to the deformation. This method is modeling
the image as piece of rubber into which you have stiked
32x32 pins, and on each one you are exerting forces derived from
the local better fitting of the image metric. So, in practice,
the deformable registration is only an instrument that will
allow you to fabricate a deformation field that satisfy your
needs.
I'm sending you the results of my tests in a separate email
since it contains the images.
Regards,
Luis
-------------------
Tina Wang wrote:
> Luis,
> I am glad that it works for you.
> There is a hole below the diaphragm and close to stomach in both images,
> in which the size is different and easy to see by eye. The deformed
> image supposed to have both in same size.
> I retried it again, and used max of DescentDirection for mean square
> metric(0,0.99), all Ncc, pattern and MI I used the min of
> DescentDirection with 80 iteration times.
> The mean square iterates all 80 loops and it seems that there are some
> deformation, but the rest of them stopped after looping 3 times.
>
> Could you send me the configure file you used, as well as the aligned
> image from MI metric ( or put in somewhere I can download it)?
>
> I really want to get this worked.
>
> Thanks a lot.
>
> tina
>
>
>
>
>
> */Luis Ibanez <luis . ibanez at kitware . com>/* wrote:
>
>
> Hi Tina,
>
> I just tested the DeformableRegistration1 example,
> and it does produce slightly different results when you
> change the metric.
>
> Note that the variations in the image will not be
> visible to the naked eye. The deformations of the
> registration are about 2 pixel maximum. So, by simply
> looking at the images you will not see any difference.
> We are talking about the respiratory motion of a mouse
> that was trapped in an micro MRI machine... so there is
> no much room for changes between the fixed and moving
> images in this particular case.
>
>
> If you use the "diff" command you will find differences
> in the two registered images. In particular if you
> compare the raw data files:
>
> RatLung_result10.img
>
> as they are produced with each metric.
>
>
> An easy way to look at the actual differences between
> the regi! stration results is to look at the deformation
> fields in each case. The x and y components of the
> deformation field are saved as images in analyze format,
> as:
>
> component X of the deformation field:
>
> RatLung_dispxvec.hdr
> RatLung_dispxvec.img
>
> component Y of the deformation field:
>
> RatLung_dispyvec.hdr
> RatLung_dispyvec.img
>
>
> The deformation field obtained with Normalized correlation
> is much smoother that the one produced by MeanSquares, for
> example. You could use a tool like ParaView (which is also
> open source) for visualizing deformation fields.
> http://www . paraview . org/HTML/Index . html
>
>
> Another easy way to note differences from both registrations
> is to subtract the images resulting from the use of two
> different metrics.
>
>
> Please look closer at the results of the registration
> and let us know if you find any problems.
>
>
> Thanks
>
>
> Luis
>
>
>
> ----------------------
> Tina Wang wrote:
> >
> > I am running the sample program ( deformableRegistration1) with
> sample
> > images (RatLungslic1 and 2), the output image did not change at
> all by
> > using any metric function. Attached is the parameters I used.
> Please help!!
> >
> > Thanks,
> >
> > tina
> >
> >
> > % Configuration file #1 for DeformableRegistration1.cxx
> > %
> > % This example demonstrates the setup of a basic registration
> > % problem that does NOT use multi-resolution strategies. As a
> > % result, only one value for the parameters between
> > % (# of pixels per element) and (maximum iterations) is necessary.
> > % If you were using multi-resolution, you would have to specify
> > % values for those parameters at each level of the pyramid.
> > %
> > % Note: the paths in the parameters assume you have the traditional
> > % ITK file hierarchy as shown below:
> > %
> > % ITK/Insight/Examples/Registration/DeformableRegistration1.cxx
> > % ITK/Insight/Examples/Data/RatLungSlice*
> > % ITK/Insight-Bin/bin/DeformableRegistration1
> > %
> > % ---------------------------------------------------------
> > % Parameters for the single- or multi-resolution techniques
> > % ---------------------------------------------------------
> > 1 % Number of levels in the multi-res pyramid (1 = single-res)
> > 1 % Highest level to use in the pyramid
> > 1 1 % Scaling at lowest level of pyramid
> > 4 % Number of pixels per element
> > 1.e4 % Elasticity (E)
> > 1.e4 % Density x capacity (RhoC)
> > 1 % Image energy scaling (gamma) - sets gradient step size
> > 2 % NumberOfIntegrationPoints
> > 1 % WidthOfMetricRegion
> > 50 % MaximumIterations
> > % -------------------------------
> > % Parameters for the registration
> > % -------------------------------
> > 0 0.99 % Similarity metric! (0=mean sq, 1=ncc, 2=patern, 3=MI,
> 5=demons)
> > 1.0 % Alpha
> > 0 % DescentDirection (1 = max, 0 = min)
> > 0 % DoLineSearch (0=never, 1=always, 2=if needed)
> > 1.e1 % TimeStep
> > 0.5 % Landmark variance
> > 0 % Employ regridding / enforce diffeomorphism ( >= 1 -> true)
> > % ----------------------------------
> > % Information about the image inputs
> > % ----------------------------------
> > 128 % Nx (image x dimension)
> > 128 % Ny (image y dimension)
> > 0 % Nz (image z dimension - not used if 2D)
> > y:\imagepool\general-images\RatLungSlice1.hdr % ReferenceFileName
> > y:\imagepool\general-images\RatLungSlice2.hdr % TargetFileName
> > % -------------------------------------------------------------------
> > % The actions below depend on the values of the flags preceding them.
> > % For example, to write out the displacement fields, you have to set
> > % the value of WriteDisplacementField to 1.*> %
> -------------------------------------------------------------------
> > 0 % UseLandmarks? - read the file name below if this is true
> > - % LandmarkFileName
> > y:\imagepool\general-images\RS_deform2-1.hdr % ResultsFileName
> (prefix only)
> > 1 % WriteDisplacementField?
> > y:\imagepool\general-images\RatLung_disp % DisplacementsFileName
> (prefix only)
> > 0 % ReadMeshFile?
> > - % MeshFileName
> > END
> >
> >
> >
> ------------------------------------------------------------------------
> >
> > This mail is probably spam. The original message has been attached
> > along with this report, so you can recognize or block similar
> unwanted
> > mail in future. See http://spamassassin . org/tag/ for more details.
> >
> > Content preview: --0-531238825-1066935895=:79463 Content-Type:
> > text/plain; charset=us-ascii Note: forwarded message attached. Do you
> > Yahoo!? The New Yahoo! Shopping - with improved ! product search
> > --0-531238825-1066935895=:79463 Content-Type: text/html;
> > charset=us-ascii [...]
> >
> > Content analysis details: (3.10 points, 3 required)
> > FROM_WEBMAIL_ENDS_IN_NUMS6 (0.9 points) From address is webmail,
> and ends in lots of numbers
> > FROM_ENDS_IN_NUMS (0.6 points) From: ends in numbers
> > HTML_MESSAGE (0.1 points) BODY: HTML included in message
> > HTML_00_10 (1.4 points) BODY: Message is 0% to 10% HTML
> > MAILTO_TO_SPAM_ADDR (0.6 points) URI: Includes a link to a likely
> spammer email address
> > KNOWN_MAILING_LIST (-0.5 points) Email came from some known
> mailing list software
> >
> >
>
>
>
> *
>
> ------------------------------------------------------------------------
> *Do you Yahoo!?
> Exclusive Video Premiere - Britney Spears
> <http://launch . yahoo . com/video/?1093432&fs=1&redirectURL=http://launch . yahoo . com/promos/britneyspears/>
> *