[Insight-users] Reading multiple images, writing one output

Luis Ibanez luis.ibanez at kitware.com
Thu May 11 08:42:49 EDT 2006


Hi Kathy,


You may want to do this "manually" using the following pseudocode:

1) Create an image that is large enough for storing the composite
    of images A and B. Let's call this image: "C".

2) Set the origin, spacing and number of pixesl of that image in
    such a way that both the image A and the resample image B will
    fit inside.

3) Fill the buffer with a zero (or a neutral value)

4) Create an iterator for visitig alll the pixels of image C, and
    map them into image A. Most of the pixels will fall outside of
    image A, and for those you simply don't do anything.

5) Create an iterator for visiting all the pixels of image C, and
    map them into image B (using the transform that resulted from
    the registration process.). Also here, most of the pixels will
    fall outside of image B.


At this point you will have composed image A and B into image C.

Note that you may have to use an interpolator in order to get
intensity values from A and B.  The body of the loops in (4) and (5)
is almost identical to the loop in the GenerateData() methods of the
itkResampleImageFilter:


      Insight/Code/BasicFilters/
                       itkResampleImageFilter.txx


In lines 256-292.



Examples on how to do (1) and (2) are available in the ITK Software
Guide in the "Data Representation" Chapter.

A full description of the concepts of image resampling is presented
in the ITK Software Guide in section 6.9 "Geometric Transformations"
pdf-pages 254-285.




    Regards,



       Luis



=============
k s wrote:
> Hi Luis,
> 
> I read through all the examples, and I didn't see any that were close to
> what I want to do.  I want to take two inputs (from two readers), and write
> them out to one output, where the second image overlaps the first by some
> specified amount.  For example if image A were dimension [m,n] and B were
> dimension [x,y], I want to make a composite of them of dimension [m+x-c,
> n+y-d] for some c and d.  
> I tried using an ImageIterator to do so, but all I can do is write image A,
> and then write image B out below it, without the overlap.  [I simply wrote
> out Image A while A's iterator was not AtEnd(), then wrote out B.]  To
> overlap the images, I tried to specify the SetPosition of my output
> Iterator, but got an error.  I am wondering if I should continue down the
> Iterator path, or whether there are Copy/PasteRegion functions in itk I am
> not aware of.
> 
> Thanks!
> 
> Kathy
> 
> -----Original Message-----
> From: Luis Ibanez [mailto:luis.ibanez at kitware.com] 
> Sent: Wednesday, May 10, 2006 6:00 AM
> To: smythek at u.washington.edu
> Cc: insight-users at itk.org
> Subject: Re: [Insight-users] Reading multiple images, writing one output
> 
> 
> Hi Kathy,
> 
> Please take a look at the examples in the ITK Software Guide,
> in the chapter "Reading and Writing Images".
> 
> You will find the source code in the directory:
> 
> 
>           Insight/Examples/IO
> 
> 
> 
> Regards,
> 
> 
>      Luis
> 
> 
> 
> -------------------------------------
> smythek at u.washington.edu wrote:
> 
>>Hi,
>>
>>I'm trying to write multiple inputs to one output.  I thought the 
>>itkImageSeriesReader paired with a writer would work, but I get an 
>>obscure error when I try to run the program.  Is there another way to do 
>>this?
>>
>>Kathy
>>
>>
>>
>>
>>_______________________________________________
>>Insight-users mailing list
>>Insight-users at itk.org
>>http://www.itk.org/mailman/listinfo/insight-users
>>
>>
> 
> 
> 
> 
> 
> 




More information about the Insight-users mailing list