[Insight-users] Constructing 3D stack from 2D image series (withregistration)

Luis Ibanez luis.ibanez at kitware.com
Tue Oct 20 12:50:19 EDT 2009


Hi Darren,


This is a very interesting problem.

As you already verified, there is no straight forward way of concatenating
(or composing) two BSplineDeformableTransforms in ITK.

However,
you could easily write a "GroupTransform" that derives from the
itkTransform and that holds an array of SmartPointers to Transforms

typedef std::vector< typename TransformType::Pointer >   TransformArrayType;
TransformArrayType   m_TransformArray;


That you could populate with a method:

AddTransform( const TransformType * t )
{
this->m_TransformArray.push_back( t );
}


Then implement the TransformPoint() method as


TransformPoint( const PointType & p )
{
PointType q = p;
TransformArrayType::const_iterator TransformIterator;
TransformIterator titr = this->m_TransformArray.begin();
TransformIterator tend = this->m_TransformArray.end();
while( titr != tend )
  {
  q = titr->TransformPoint( q );
  ++titr;
  }
return q;
}


and finally, use this GroupTransform as the transform
that you connect to the ResampleImage Filter for resampling
all the Microscopy slices to the coordinate system of the first
slice.

....

As you progress with your registration, down the slices stack,
you add the new pair-wise resulting transform to the Group
Transform, and have the "equivalent" to the composed transform.


Drinking the proper brand of Coffee, this probably can be coded
in one afternoon.  We will be happy to assist you if you find any
problem.

And... of course, you are strongly encouraged to submit this
transform to the Insight Journal:


mmmm.
and of course,...
after checking the IJ, it happens that

Stephan Klein and Marius Staring
already contributed a similar class to the Insight Journal:
http://www.insight-journal.org/browse/publication/91
"Combining Transforms in ITK"
http://hdl.handle.net/1926/197

In particular, you may want to look at their class:

            itkBSplineCombinationTransform.


I just added it to the list of classes to move into ITK 3.18.
http://www.itk.org/Wiki/ITK_Release_Schedule#Insight_Journal_papers_to_Move_for_ITK_3.18


----------------------------

Note however, that after hundreds of compositions,...
things may start cumulating errors...


When you say that you have "thousands" of slices....

did you mean that they are really about one thousands slices
stacked one on top of each other ?

or are you counting some level of side-by-side mosaicing
as well ?



     Please let us know,


             Thanks


                   Luis



---------------------------------------------------------------------------------------
On Fri, Oct 16, 2009 at 8:43 PM, Darren Weber
<darren.weber.lists at gmail.com> wrote:
>
> I don't see a Compose method for the bspline transform class, only a
> SetBulkTransform.
>
>
> Some code is able to read a series of transforms and report the content of
> the transforms, i.e.:
>
>
> *****************************************
> section0181_w1
>
>
> section0181_w1 :
> /Volumes/data/plastic_imgproc/n2_04d/w1/tif/section0179_w1.tif
> section0181_w1 :
> /Volumes/data/plastic_imgproc/n2_04d/w1/bw_align/section0179to0178_w1_bspline.xfm
> Number of transforms = 1
> bspline transform parameters:
> [-0.00101862, -0.000136816, 0.0428942, -0.0173411, -0.0012381, 0,
> -0.0152427, -0.0829083, 0.562787, 0.0513636, 0.00563827, 0, -0.0978897,
> 0.17254, -0.187553, 0.132699, 0.118559, 0, -0.0423971, 0.0390156, -0.254502,
> -0.211898, 0.0186821, 0, 0.000965728, 0.0209634, 0.0971252, 0.0268716,
> -0.00159635, 0, 0, 0, 0, 0, 0, 0, -0.000822122, -0.0595562, -0.106872,
> 0.0393177, 0.00243043, 0, 0.0182722, -0.183968, 0.136984, 1.16236, 0.064037,
> 0, 0.0551541, 0.37945, -0.741088, 0.394497, 0.0657694, 0, -0.0302881,
> -0.371698, 0.340337, 0.463057, -0.00263912, 0, -0.00393346, -0.00450752,
> 0.209972, 0.0928676, -0.000414552, 0, 0, 0, 0, 0, 0, 0]
> bspline transform fixed parameters:
> [6, 6, -5.7771, -6.41285, 5.74946, 6.38521, 1, 0, 0, 1]
> bspline bulk transform name:
> IdentityTransform
> bspline bulk transform parameters:
> [-59.7311]
> bspline bulk transform fixed parameters:
> [-2.00001]
>
> section0181_w1 :
> /Volumes/data/plastic_imgproc/n2_04d/w1/tif/section0180_w1.tif
> section0181_w1 :
> /Volumes/data/plastic_imgproc/n2_04d/w1/bw_align/section0180to0179_w1_bspline.xfm
> Number of transforms = 2
> bspline transform parameters:
> [-0.00167702, 0.0400107, 0.163826, 0.0494486, 0.000260499, 0, -0.112263,
> -0.962398, 0.382706, 0.0468105, 0.000545406, 0, -0.013627, 0.032147,
> 0.303242, -0.248178, 0.0577727, 0, 0.0310104, 0.0608204, -0.450371,
> 0.0761785, 0.0396465, 0, -0.00145428, -0.0748339, -0.142132, -0.0117953,
> 0.00109538, 0, 0, 0, 0, 0, 0, 0, -0.000739103, 0.0115463, -0.233451,
> -0.151604, -0.00148716, 0, -0.124814, -0.51848, -0.0427284, -1.13778,
> -0.0332992, 0, -0.22645, -1.40995, 1.29008, -0.406795, -0.0169783, 0,
> -0.014309, 0.492513, -0.433653, -0.484105, 0.0174839, 0, 0.00246247,
> 0.100723, 0.0245804, -0.038708, 0.000375209, 0, 0, 0, 0, 0, 0, 0]
> bspline transform fixed parameters:
> [6, 6, -5.7771, -6.32993, 5.74946, 6.30229, 1, 0, 0, 1]
> bspline bulk transform name:
> IdentityTransform
> bspline bulk transform parameters:
> [-2.00001]
> bspline bulk transform fixed parameters:
> [-59.7206]
>
> section0181_w1 :
> /Volumes/data/plastic_imgproc/n2_04d/w1/tif/section0181_w1.tif
> section0181_w1 :
> /Volumes/data/plastic_imgproc/n2_04d/w1/bw_align/section0181to0180_w1_bspline.xfm
> Number of transforms = 3
> bspline transform parameters:
> [0.00301806, -0.00652163, -0.144203, 0.0245637, 0.00424984, 0, -0.00674302,
> 0.435562, -0.00178908, 0.420808, -0.021262, 0, -0.0294096, -0.355242,
> -0.005834, -0.0189256, -0.160569, 0, 0.0709158, 0.736917, -0.210242,
> -0.212069, -0.0294319, 0, 0.00253275, 0.0315866, -0.071481, -0.0291887,
> 4.053e-05, 0, 0, 0, 0, 0, 0, 0, 0.00207632, -0.0583709, 0.109967, 0.12651,
> -0.00259079, 0, 0.0616846, 0.0246376, 0.113406, 0.439344, -0.066714, 0,
> 0.032752, 0.475236, -0.645249, 0.255606, -0.0351145, 0, -0.0414853,
> -0.154973, 0.331845, 0.634161, 0.0229426, 0, -0.00318072, -0.070252,
> -0.195498, -0.0416054, 0.000584519, 0, 0, 0, 0, 0, 0, 0]
> bspline transform fixed parameters:
> [6, 6, -5.88766, -6.46814, 5.86002, 6.4405, 1, 0, 0, 1]
> bspline bulk transform name:
> IdentityTransform
> bspline bulk transform parameters:
> [-2.00001]
> bspline bulk transform fixed parameters:
> [-59.7214]
>
>
> This is a short report for a series of images from number 178--181 (the
> image files are named "section%04d_w1.tif").  The idea is to now concatenate
> all the bspline transforms so that image 181 is transformed all the way to
> 178, via 180 and 179.  Is the way to do that something like this:
>
>
> // no bulk transform for bsplineTransform179to178
> bsplineTransform180to179.SetBulkTransform( bsplineTransform179to178 );
> bsplineTransform181to180.SetBulkTransform( bsplineTransform180to179 );
>
>
> Will that effectively concatenate the entire series of transforms to get
> image 180 all the way into the space of image 178?
>
> TIA,
> Darren
>
>
>
>
>
>
>
> On Thu, Oct 15, 2009 at 8:47 PM, Richard Beare <richard.beare at gmail.com>
> wrote:
>>
>> I think that most of the transform types have a Compose method so you
>> can compute the transform between your first slice and any other.
>>
>> On Fri, Oct 16, 2009 at 2:30 PM, Xiaofeng Z <xf10036 at hotmail.com> wrote:
>> > There must be a way to combine the transformations together before
>> > applying
>> > the combined transformation to the image.  Otherwise, after hundreds of
>> > interpolation, imageN will probably not have much information left.
>> > From: Darren Weber
>> > Sent: Thursday, October 15, 2009 5:20 PM
>> > To: ITK Users
>> > Subject: [Insight-users] Constructing 3D stack from 2D image series
>> > (withregistration)
>> >
>> > We have a series of several thousand 2D microscope images:
>> >
>> > img0001 ... imgN
>> >
>> > A simple ITK program uses itkImageSeriesReader to stack the sequential
>> > images into a 3D volume for output to a .vtk file.  Without any
>> > coregistration of the image series, the result is a mess (as expected).
>> >
>> > Another ITK program runs registration algorithm(s) on consecutive pairs
>> > of
>> > images in the 2D image series (each pair of images is registered
>> > independently of any other images in the series).  It outputs a
>> > transform
>> > file for each image registration, using file names something like:
>> >
>> > img0002to0001.xfm
>> > img0003to0002.xfm
>> > etc.
>> >
>> > What is an efficient way to combine and apply these transforms using an
>> > ITK
>> > pipeline to 'concatenate' the image series into a 3D stack?
>> >
>> > My conception of how this might work, in outline, is:
>> >
>> > a)  begin with img0001
>> > apply transform: none
>> >
>> > b) add img0002 to the stack
>> > apply transform: img0002to0001.xfm
>> >
>> > c) add img0003 to the stack
>> > apply transform: img0002to0001.xfm
>> > apply transform: img0003to0002.xfm
>> > (How to concatenate transforms without resampling image data?)
>> >
>> > d) add img0004 to the stack
>> > apply transform: img0002to0001.xfm
>> > apply transform: img0003to0002.xfm
>> > apply transform: img0004to0003.xfm
>> > (How to concatenate transforms without resampling image data?)
>> >
>> > etc.
>> >
>> >
>> > In this conception of the problem, the pair-wise registration transforms
>> > are
>> > 'concatenated' to propagate the registration through the entire series.
>> > What is the most efficient way to do that in ITK?
>> >
>> > Is it possible (or reasonable) to associate a transform object (or file)
>> > with each 'element' of an itkImageSeriesReader?  If not, is there
>> > another
>> > convention for creating an ITK filter pipeline or registration pipeline?
>> >
>> > TIA and take care,
>> > Darren
>> >
>> > ________________________________
>> >
>> > _____________________________________
>> > Powered by www.kitware.com
>> >
>> > Visit other Kitware open-source projects at
>> > http://www.kitware.com/opensource/opensource.html
>> >
>> > Please keep messages on-topic and check the ITK FAQ at:
>> > http://www.itk.org/Wiki/ITK_FAQ
>> >
>> > Follow this link to subscribe/unsubscribe:
>> > http://www.itk.org/mailman/listinfo/insight-users
>> >
>> > _____________________________________
>> > Powered by www.kitware.com
>> >
>> > Visit other Kitware open-source projects at
>> > http://www.kitware.com/opensource/opensource.html
>> >
>> > Please keep messages on-topic and check the ITK FAQ at:
>> > http://www.itk.org/Wiki/ITK_FAQ
>> >
>> > Follow this link to subscribe/unsubscribe:
>> > http://www.itk.org/mailman/listinfo/insight-users
>> >
>> >
>
>
> _____________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/listinfo/insight-users
>
>


More information about the Insight-users mailing list