[Insight-users] Convert a set of 2D images to 3D

Bill Lorensen bill.lorensen at gmail.com
Wed Apr 29 16:13:00 EDT 2009


Or you could use itkTileImageFilter. Note the last sentence in the
documentation.

/** \class TileImageFilter
 * \brief Tile multiple input images into a single output image.
 *
 * This filter will tile multiple images using a user-specified
 * layout. The tile sizes will be large enough to accommodate the
 * largest image for each tile. The layout is specified with the
 * SetLayout method. The layout has the same dimension as the output
 * image. If all entries of the layout are positive, the tiled output
 * will contain the exact number of tiles. If the layout contains a 0
 * in the last dimension, the filter will compute a size that will
 * accommodate all of the images. Empty tiles are filled with the
 * value specified with the SetDefault value method. The input images
 * must have a dimension less than or equal to the output image. The
 * output image have a larger dimension than the input images. This
 * filter can be used to create a volume from a series of inputs by
 * specifying a layout of 1,1,0.
 */


On Tue, Apr 28, 2009 at 1:41 PM, Luis Ibanez <luis.ibanez at kitware.com> wrote:
> Hi Luis,
>
> It is a bit more complicated than that.
>
> You will need to put the filter in a for loop,
> where you iterate over all the slices.
>
> Inside the loop you take the output of the
> PasteImageFilter and reconnect it as a new
> input.
>
>
> In Pseudo code it will look something like:
>
>      ImageType::Pointer wholeImage;
>
>      for-loop
>      {
>      pasteFilter->SetInput1( wholeImage );
>      pasteFilter->SetInput2( slice_i );
>      pasteFilter->Update();
>      wholeImage = pasterFilter->GetOutupt();
>      wholeImage->DisconnectPipeline();
>      }
>
>
>
>   Regards,
>
>
>      Luis
>
>
>
> --------------------------
> Luis Roberto P. Paula wrote:
>>
>> After that, all I need to do is to call the SetInput for each slice and,
>> at the end, call the Update method?
>>
>> Thanks,
>> Luis
>>
>> On Tue, Apr 21, 2009 at 10:06 AM, Luis Ibanez <luis.ibanez at kitware.com
>> <mailto:luis.ibanez at kitware.com>> wrote:
>>
>>
>>    Hi Luis,
>>
>>    You should instantiate the Paste filter in 3D.
>>
>>    Since you are going to paste 2D slices into a 3D image,
>>    you need to set up the filter in such a way that a 2D
>>    image is seen as a 3D image of a single slice.
>>
>>
>>
>>      Regards,
>>
>>
>>          Luis
>>
>>
>>    -----------------------------
>>    Luis Roberto P. Paula wrote:
>>
>>        Hi Luis,
>>
>>        I'm a little confused on how to use the itkPasteImageFilter.
>>
>>        At first, I created the typedef:
>>
>>        typedef itk::PasteImageFilter< ImageType2D > PasteFilter2D;
>>
>>
>>        Then:
>>
>>          PasteFilter2D::Pointer paste2D = PasteFilter2D::New();
>>
>>          // I'm lost in this part
>>
>>          for (int i; i < VECTOR_SIZE; i++) {
>>             paste2D->SetInput( IMAGE2D_VECTOR[i] );
>>          }
>>
>>        How do I make the output of the paste2D be a 3D image?
>>
>>        Do I need to set to the destination image a 3D blank image?
>>
>>        The destination index affects the output?
>>
>>        I thought it would work like the add method of the std:vector
>>        class with an output as a 3D image, but it seems that it can
>>        return an image with the same dimension.
>>
>>        Thanks,
>>        Luis
>>
>>        On Fri, Apr 17, 2009 at 3:36 PM, Luis Ibanez
>>        <luis.ibanez at kitware.com <mailto:luis.ibanez at kitware.com>
>>        <mailto:luis.ibanez at kitware.com
>>        <mailto:luis.ibanez at kitware.com>>> wrote:
>>
>>
>>           Hi Luis,
>>
>>           Yes,
>>           the same should work for pasting 3D images into to 4D images.
>>
>>
>>
>>             Regards,
>>
>>
>>                Luis
>>
>>
>>           ---------------------------
>>           Luis Roberto P. Paula wrote:
>>
>>               Thanks Luis!! This is a much better approach
>>        (itkPasteImageFilter).
>>
>>               I guess it works the same way from 3D to 4D, right?
>>
>>               Regards,
>>               Luis
>>
>>               On Thu, Apr 16, 2009 at 1:59 PM, Luis Ibanez
>>               <luis.ibanez at kitware.com <mailto:luis.ibanez at kitware.com>
>>        <mailto:luis.ibanez at kitware.com <mailto:luis.ibanez at kitware.com>>
>>               <mailto:luis.ibanez at kitware.com
>>        <mailto:luis.ibanez at kitware.com>
>>               <mailto:luis.ibanez at kitware.com
>>        <mailto:luis.ibanez at kitware.com>>>> wrote:
>>
>>
>>                  Hi Luis,
>>
>>                  If your images are in individual 2D files, then
>>                  you could simply use the ImageSeriesReader.
>>
>>                  If your images are in an array of 2D images in
>>                  memory, then you may want to use the Paste
>>                  filter:
>>
>>
>> http://itk.org/Doxygen/html/itkPasteImageFilter_8h.html
>>
>>                  You will have to call it multiple times...
>>                  once per input slice.
>>
>>
>>                     Regards,
>>
>>
>>                         Luis
>>
>>
>>                  ---------------------------
>>
>>                  Luis Roberto P. Paula wrote:
>>
>>                      Hi All,
>>
>>                      I have a set of 2D images in axial orientation and
>>        I want to
>>                      create a 3D volume with this images.
>>
>>                      It would be de reverse operation of the class
>>               ExtractImageFilter.
>>
>>                      Does anybody knows how to do it?
>>
>>                      Thanks in advance,
>>                      Luis
>>
>>
>>
>>  ------------------------------------------------------------------------
>>
>>                      _____________________________________
>>                      Powered by www.kitware.com
>>        <http://www.kitware.com> <http://www.kitware.com>
>>               <http://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