[Insight-users] 2D/3D Image stitching with itk

Rupert Brooks rupe.brooks at gmail.com
Mon Oct 15 15:19:53 EDT 2007


Hi Luis, Adrian,

Just to follow up on this, while i see clearly how to use ITK for the
registration part, what about the stitching?  Its not immediately
obvious to me how to merge the images afterwards using ITK.

I'd be very interested in knowing how it was done, or being pointed at
an InsightApplication if one is available.

Rupert B.

Message: 3
Date: Thu, 11 Oct 2007 10:21:25 -0400
From: Luis Ibanez <luis.ibanez at kitware.com>
Subject: Re: [Insight-users] 2D/3D Image stitching with itk
To: Adrian John <adrjohn at gmail.com>
Cc: insight-users at itk.org
Message-ID: <470E3165.5020705 at kitware.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed


Hi Adrian,

We don't have specific examples on how to do stitching but we have used
ITK for this task, in particular for doing 3D stitching in confocal
microscopy applications.


  "How much overlap you need ?"

   This is is a very gray question...
   so it gets a gray answer...

   It depends on how much details there are in the borders
   of your images and how specific those details are.
   The image metric will have to be computed using only a
   band on the border of the image, so if that band is almost
   empty, you are in trouble. If the band is rich in texture
   and large structures that have non-symmetrical shapes,
   you will have better chances of registering the images.


Yes,
the ITK registration framework is suitable for performing stitching,
you should start by paying a lot of attention to:

   a) Selecting a FixedImageRegion restricted to the potential
      border of the FixedImage that overlaps the MovingImage
   b) Verify that the image reported correct Physical space origin.
   b) Provide a good initialization for the Transform.


Stitching images of 512x512x512 actually becomes registering
images of 20x512x512 (e.g. assuming that the overlapping regions
turned out to be about 20 pixels wide).

What is your visual estimation of the current image overlap width ?

Note that you may have you image acquisition protocol in order to
provide overlapping regions of decent size. E.g. 2 pixels of overlap
will not do the trick...

Registering these images should take about 1 minute in a modern
desktop computer.


   Regards,


      Luis


On 10/11/07, insight-users-request at itk.org
<insight-users-request at itk.org> wrote:
> Send Insight-users mailing list submissions to
>        insight-users at itk.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
>        http://www.itk.org/mailman/listinfo/insight-users
> or, via email, send a message with subject or body 'help' to
>        insight-users-request at itk.org
>
> You can reach the person managing the list at
>        insight-users-owner at itk.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of Insight-users digest..."
>
>
> Today's Topics:
>
>   1. Re: Insight-users Digest, Vol 42, Issue 23 (Desikachari Nadadur)
>   2. Re: How to label the output of binary threshold filter
>      (Ga?tan Lehmann)
>   3. Re: 2D/3D Image stitching with itk (Luis Ibanez)
>   4. RE: How to label the output of binary threshold filter (Ali -)
>   5. Volume not perfectly rotated (Nic)
>   6. RE: How to label the output of binary threshold filter (Ali -)
>   7. Re: Volume not perfectly rotated (Luis Ibanez)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Thu, 11 Oct 2007 10:19:53 -0400
> From: Desikachari Nadadur <dnadadur at abla-tx.com>
> Subject: [Insight-users] Re: Insight-users Digest, Vol 42, Issue 23
> To: <insight-users at itk.org>
> Message-ID: <927683194 at mail.dmill.com>
> Content-Type: text/plain; charset="utf-8"
>
> Hello!
>
> Thank you for your message. I am on a business trip. My email access will be sporadic. I will contact you as soon as I am able to.
>
> Thank you very much for your patience.
>
> Sincerely,
> Desika
>
> --
> Desikachari Nadadur, Ph.D.
> Sr. Staff Scientist
> Abla-Tx, Inc.,
> dnadadur at abla-tx.com
> http://www.abla-tx.com/
>
>
>
> ------------------------------
>
> Message: 2
> Date: Thu, 11 Oct 2007 16:20:33 +0200
> From: Ga?tan Lehmann <gaetan.lehmann at jouy.inra.fr>
> Subject: Re: [Insight-users] How to label the output of binary
>        threshold filter
> To: Ali - <saveez at hotmail.com>
> Cc: ITK <insight-users at itk.org>
> Message-ID: <4B09A4CA-897D-4ADA-8578-CF5B313A75DB at jouy.inra.fr>
> Content-Type: text/plain; charset="iso-8859-1"
>
>
> Hi Ali,
>
> Please look at the contribution I made recently : http://insight-
> journal.org/InsightJournalManager/view_reviews.php?
> back=index.php&pubid=176
> I'm using it extensively currently, with WrapITK.
>
> Gaëtan
>
>
> Le 11 oct. 07 à 16:18, Ali - a écrit :
>
> > Hi,
> >
> > How is it possible to have a watershed-output-like for the output
> > of a binary threshold filter, that is, how to access the individual
> > regoins of the output of a binary threshold filter for further
> > manipulation?
> >
> > The next generation of MSN Hotmail has arrived - Windows Live Hotmail
> > _______________________________________________
> > Insight-users mailing list
> > Insight-users at itk.org
> > http://www.itk.org/mailman/listinfo/insight-users
>
> --
> Gaëtan Lehmann
> Biologie du Développement et de la Reproduction
> INRA de Jouy-en-Josas (France)
> tel: +33 1 34 65 29 66    fax: 01 34 65 29 09
> http://voxel.jouy.inra.fr
>
>
>
> -------------- next part --------------
> A non-text attachment was scrubbed...
> Name: PGP.sig
> Type: application/pgp-signature
> Size: 186 bytes
> Desc: =?ISO-8859-1?Q?Ceci_est_une_signature_=E9lectronique_PGP?=
> Url : http://public.kitware.com/pipermail/insight-users/attachments/20071011/af06d143/PGP-0001.pgp
>
> ------------------------------
>
> Message: 3
> Date: Thu, 11 Oct 2007 10:21:25 -0400
> From: Luis Ibanez <luis.ibanez at kitware.com>
> Subject: Re: [Insight-users] 2D/3D Image stitching with itk
> To: Adrian John <adrjohn at gmail.com>
> Cc: insight-users at itk.org
> Message-ID: <470E3165.5020705 at kitware.com>
> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>
>
> Hi Adrian,
>
> We don't have specific examples on how to do stitching but we have used
> ITK for this task, in particular for doing 3D stitching in confocal
> microscopy applications.
>
>
>   "How much overlap you need ?"
>
>    This is is a very gray question...
>    so it gets a gray answer...
>
>    It depends on how much details there are in the borders
>    of your images and how specific those details are.
>    The image metric will have to be computed using only a
>    band on the border of the image, so if that band is almost
>    empty, you are in trouble. If the band is rich in texture
>    and large structures that have non-symmetrical shapes,
>    you will have better chances of registering the images.
>
>
> Yes,
> the ITK registration framework is suitable for performing stitching,
> you should start by paying a lot of attention to:
>
>    a) Selecting a FixedImageRegion restricted to the potential
>       border of the FixedImage that overlaps the MovingImage
>    b) Verify that the image reported correct Physical space origin.
>    b) Provide a good initialization for the Transform.
>
>
> Stitching images of 512x512x512 actually becomes registering
> images of 20x512x512 (e.g. assuming that the overlapping regions
> turned out to be about 20 pixels wide).
>
> What is your visual estimation of the current image overlap width ?
>
> Note that you may have you image acquisition protocol in order to
> provide overlapping regions of decent size. E.g. 2 pixels of overlap
> will not do the trick...
>
> Registering these images should take about 1 minute in a modern
> desktop computer.
>
>
>    Regards,
>
>
>       Luis
>
>
> -------------------
> Adrian John wrote:
> > I only have little experience with itk and would like to stitch
> > overlapping 2D Images to a single 2D panorama image and 3D volume blocks
> > to a single 3D panorama volume block.
> > Concerning this matter I have some questions:
> > - Are any examples available?
> > - How much overlap I need for a reliable result?
> > - Is the itk registration framework suitable for image stitching or
> > should i better try feature based approaches such as SIFT/SURF?
> > - If there are no examples available it would be nice if somebody with
> > more experience could give me small hint which itk classes I can use for
> > this task.
> > - Is it a question if seconds or minutes to stitch two  512x512x512
> > volume blocks with itk?
> >
> > Thanks a lot and best regards
> > Adrian
> >
> >
> > ------------------------------------------------------------------------
> >
> > _______________________________________________
> > Insight-users mailing list
> > Insight-users at itk.org
> > http://www.itk.org/mailman/listinfo/insight-users
>
>
> ------------------------------
>
> Message: 4
> Date: Thu, 11 Oct 2007 15:41:03 +0100
> From: Ali - <saveez at hotmail.com>
> Subject: RE: [Insight-users] How to label the output of binary
>        threshold filter
> To: Ga?tan Lehmann <gaetan.lehmann at jouy.inra.fr>
> Cc: ITK <insight-users at itk.org>
> Message-ID: <BAY136-W399636E36277B62AAF1C05D1A70 at phx.gbl>
> Content-Type: text/plain; charset="iso-8859-1"
>
> Gaëtan,
>
> Thank you, that was useful. I noticed that you have also used itk::LabelToRGBImageFilter, I am using the WrapITK binary provided by Charlie Botha (http://cpbotha.net/2007/08/02/python-enabled-vtk-51-and-itk-32-windows-binaries/) and as far as I checked that labeling filter was not wrapped.
>
> It would be good if, like vtk, there were some binary distributions for WrapITK as building such binaries is not a trivial task for non-state-of-the-art-spec computers.
>
>
>
> > CC: insight-users at itk.org
> > From: gaetan.lehmann at jouy.inra.fr
> > Subject: Re: [Insight-users] How to label the output of binary threshold filter
> > Date: Thu, 11 Oct 2007 16:20:33 +0200
> > To: saveez at hotmail.com
> >
> >
> > Hi Ali,
> >
> > Please look at the contribution I made recently : http://insight-
> > journal.org/InsightJournalManager/view_reviews.php?
> > back=index.php&pubid=176
> > I'm using it extensively currently, with WrapITK.
> >
> > Gaëtan
> >
> >
> > Le 11 oct. 07 à 16:18, Ali - a écrit :
> >
> > > Hi,
> > >
> > > How is it possible to have a watershed-output-like for the output
> > > of a binary threshold filter, that is, how to access the individual
> > > regoins of the output of a binary threshold filter for further
> > > manipulation?
> > >
> > > The next generation of MSN Hotmail has arrived - Windows Live Hotmail
> > > _______________________________________________
> > > Insight-users mailing list
> > > Insight-users at itk.org
> > > http://www.itk.org/mailman/listinfo/insight-users
> >
> > --
> > Gaëtan Lehmann
> > Biologie du Développement et de la Reproduction
> > INRA de Jouy-en-Josas (France)
> > tel: +33 1 34 65 29 66    fax: 01 34 65 29 09
> > http://voxel.jouy.inra.fr
> >
> >
> >
>
> _________________________________________________________________
> The next generation of MSN Hotmail has arrived - Windows Live Hotmail
> http://www.newhotmail.co.uk
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: http://public.kitware.com/pipermail/insight-users/attachments/20071011/5d8cf401/attachment-0001.htm
>
> ------------------------------
>
> Message: 5
> Date: Thu, 11 Oct 2007 16:54:03 +0200
> From: "Nic" <itk at fete.ch>
> Subject: [Insight-users] Volume not perfectly rotated
> To: "Insight Users" <insight-users at itk.org>
> Message-ID: <9D9A734FE85145B9A01172EA7A33E9FD at sv.intranet.epfl.ch>
> Content-Type: text/plain; charset="iso-8859-1"
>
> Hi all,
>    I have a strange behaviour I would like to correct in my initialisation.
> What I do is simply initialize the versorRigid3dTransform with a 180°
> rotation around y-axis and -94.55 rotation around z-axis.
> I used quaternion for rotation initialisation like this, as previously
> adviced :
>
> *******************************************************
> double RotX = angleX * vnl_math::pi / 180.0;
> double RotY = angleY * vnl_math::pi / 180.0;
> double RotZ = angleZ * vnl_math::pi / 180.0;
> vnl_quaternion<double> RR(RotX,RotY,RotZ);
> rotation.Set(RR);
> transform->SetRotation( rotation );
>
> [...]
> // Checking
> VersorType rotationInitiale = transform->GetVersor();
> vnl_vector_fixed<double,3> anglesEuleriensInitiaux = (rotationInitiale.GetVnlQuaternion()).rotation_euler_angles();
> cout << "Angles d'Euler (initiaux): " << (anglesEuleriensInitiaux*180.0/vnl_math::pi) << endl;
>
> ********************************************************
>
> What I doesn't understand actually is why by flipping around X or Y axis by 180°, I get an "half image" at the beginning of the stack
> Is this behavious linked to the Quaternions ? Is there a special case for a pi angle ? Is there a way to avoid this behaviour ?
>
> Images:
> http://itk.fete.ch/perso/Rot_0_0_0.jpg
> http://itk.fete.ch/perso/Rot_0_180_0.jpg
> http://itk.fete.ch/perso/Rot_180_0_0.jpg
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: http://public.kitware.com/pipermail/insight-users/attachments/20071011/272b2720/attachment-0001.html
>
> ------------------------------
>
> Message: 6
> Date: Thu, 11 Oct 2007 16:25:26 +0100
> From: Ali - <saveez at hotmail.com>
> Subject: RE: [Insight-users] How to label the output of binary
>        threshold filter
> To: Ga?tan Lehmann <gaetan.lehmann at jouy.inra.fr>
> Cc: ITK <insight-users at itk.org>
> Message-ID: <BAY136-W195531D2A7486260D87B32D1A70 at phx.gbl>
> Content-Type: text/plain; charset="windows-1252"
>
> Gaëtan,
>
> Are your labeling classes included in ITK cvs version? Any plans to include them in near future?
>
> >
> >
> > Hi Ali,
> >
> > Please look at the contribution I made recently : http://insight-
> > journal.org/InsightJournalManager/view_reviews.php?
> > back=index.php&pubid=176
> > I'm using it extensively currently, with WrapITK.
> >
> > Gaëtan
> >
> >
> > Le 11 oct. 07 à 16:18, Ali - a écrit :
> >
> > > Hi,
> > >
> > > How is it possible to have a watershed-output-like for the output
> > > of a binary threshold filter, that is, how to access the individual
> > > regoins of the output of a binary threshold filter for further
> > > manipulation?
> > >
> > > The next generation of MSN Hotmail has arrived - Windows Live Hotmail
> > > _______________________________________________
> > > Insight-users mailing list
> > > Insight-users at itk.org
> > > http://www.itk.org/mailman/listinfo/insight-users
> >
> > --
> > Gaëtan Lehmann
> > Biologie du Développement et de la Reproduction
> > INRA de Jouy-en-Josas (France)
> > tel: +33 1 34 65 29 66    fax: 01 34 65 29 09
> > http://voxel.jouy.inra.fr
> >
> >
> >
>
> _________________________________________________________________
> Celeb spotting – Play CelebMashup and win cool prizes
> https://www.celebmashup.com
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: http://public.kitware.com/pipermail/insight-users/attachments/20071011/8a04f7b7/attachment.htm
>
> ------------------------------
>
> Message: 7
> Date: Thu, 11 Oct 2007 11:44:24 -0400
> From: Luis Ibanez <luis.ibanez at kitware.com>
> Subject: Re: [Insight-users] Volume not perfectly rotated
> To: Nic <itk at fete.ch>
> Cc: Insight Users <insight-users at itk.org>
> Message-ID: <470E44D8.10806 at kitware.com>
> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>
>
> Hi Nic,
>
>
> It seems that you have not initialized the Center of Rotation of the
> VersorRigid3DTransform.
>
> By default that center is at (0,0,0), so it is likely that your image
> if being flipped around the corner of the image, not around the center
> of the image.
>
> You may want to compute the center of the image in physical coordinates
> and use that as the center of rotation for the VersorRigid3DTransform.
>
> You will find examples on how to compute the center of the image in
> the ITK Software Guide.
>
>       http://www.itk.org/ItkSoftwareGuide.pdf
>
>
> It comes down to
>
>     for( i=0; i<3; i++)
>       {
>       Center[i] = Origin[i] + Size[i] * Spacing[i] / 2.0
>       }
>
> -----
>
>
> Also, Please aware that *you are not using the Quaternion correctly*.
>
>
>   //: Construct quaternion from Euler Angles,
>   // That is a rotation about the X axis, followed by Y, followed by
>   // the Z axis, using a fixed reference frame.
>   vnl_quaternion(T theta_X, T theta_Y, T theta_Z);
>
>
>
> That is not the order of the rotational sequence that you are assuming.
>
>
>
> It is too bad that so many people have grown used to Euler angles.
> They are one of the *worst things* that have made their way in
> computer graphics. They are clumsy and provide a very poor
> representation of the SO(3) rotational space
>
>          http://en.wikipedia.org/wiki/SO%283%29
>
> Euler angles have impoverished the understanding of generations of
> engineers on the nature of rotational space and crippled them to
> think in Cartesian schems instead of embracing the natural properties
> of the rotational space. That results in uncountable pieces of software
> that require "if" conditions when computing rotational components.
>
>
>
> ---------
>
> The correct way of composing rotations in space when using
> Quaternions is to define a quaternion for each one of the
> intermediate rotations and then use the Quaternion composition
> method:
>
>     vnl_quaternion::operator*()   in VNL
>
> or
>
>     itkVersor::operator*()   in ITK
>
>
> In your case:
>
>  > What I do is simply initialize the versorRigid3dTransform with a 180°
>  > rotation around y-axis and -94.55 rotation around z-axis.
>
>
> You should do:
>
> typedef itk::Versor<double>      VersorType;
> typedef VersorType::VectorType   AxisType;
> typedef VersorType::ValueType    ValueType;
>
> AxisType axis1;   // Rotation Axis = Y
> axis1[0] = 0.0;
> axis1[0] = 1.0;
> axis1[0] = 0.0;
>
> ValueType angle1 = 3.141516...
>
> VersorType versor1;
> versor1.Set( axis1, angle1 ); // 180 degrees around Y
>
>
> AxisType axis2;   // Rotation Axis = Z
> axis2[0] = 0.0;
> axis2[0] = 0.0;
> axis2[0] = 1.0;
>
> ValueType angle2 = 3.141516 * ( -94.55 ) / 180.0;
>
> VersorType versor2;
> versor2.Set( axis2, angle2 ); // -94.55 degrees around Z
>
>
>      VersorType versor3 = versor2 * versor1;
>
>
> The last variable "versor3" will contain the correct rotation
> expressed in terms of a unit quaternion.
>
>
> Note that most of the time, when people use Quaternions,
> what they actually want to use are Versors.
>
> Quaternions can represent rotation *and scaling* in space,
> while Versors are limited to rotations. Versors are equivalent
> to Unit-Quaternions.
>
>
> You may want to read more about Quaternions and their properties:
> http://en.wikipedia.org/wiki/Quaternions_and_spatial_rotation
>
> and the ITK Quaternion Tutorials:
>
> http://www.itk.org/CourseWare/Training/QuaternionsI.pdf
> http://www.itk.org/CourseWare/Training/QuaternionsII.pdf
>
>
>    Regards,
>
>
>       Luis
>
>
>
> ----------------
> Nic wrote:
> > Hi all,
> >     I have a strange behaviour I would like to correct in my initialisation.
> > I used quaternion for rotation initialisation like this, as previously
> > adviced :
> >
> > *******************************************************
> > double RotX = angleX * vnl_math::pi / 180.0;
> > double RotY = angleY * vnl_math::pi / 180.0;
> > double RotZ = angleZ * vnl_math::pi / 180.0;
> > vnl_quaternion<double> RR(RotX,RotY,RotZ);
> > rotation.Set(RR);
> > transform->SetRotation( rotation );
> >
> > [...]
> > // Checking
> > VersorType rotationInitiale = transform->GetVersor();
> > vnl_vector_fixed<double,3> anglesEuleriensInitiaux =
> > (rotationInitiale.GetVnlQuaternion()).rotation_euler_angles();
> > cout << "Angles d'Euler (initiaux): " <<
> > (anglesEuleriensInitiaux*180.0/vnl_math::pi) << endl;
> >
> > ********************************************************
> >
> > What I doesn't understand actually is why by flipping around X or Y axis
> > by 180°, I get an "half image" at the beginning of the stack
> > Is this behavious linked to the Quaternions ? Is there a special case
> > for a pi angle ? Is there a way to avoid this behaviour ?
> >
> > Images:
> > http://itk.fete.ch/perso/Rot_0_0_0.jpg
> > http://itk.fete.ch/perso/Rot_0_180_0.jpg
> > http://itk.fete.ch/perso/Rot_180_0_0.jpg
> >
> >
> >
> > ------------------------------------------------------------------------
> >
> > _______________________________________________
> > Insight-users mailing list
> > Insight-users at itk.org
> > http://www.itk.org/mailman/listinfo/insight-users
>
>
> ------------------------------
>
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users
>
>
> End of Insight-users Digest, Vol 42, Issue 24
> *********************************************
>


-- 
--------------------------------------------------------------
Rupert Brooks
McGill Centre for Intelligent Machines (www.cim.mcgill.ca)
Ph.D Student, Electrical and Computer Engineering
http://www.cyberus.ca/~rbrooks


More information about the Insight-users mailing list