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

Luis Roberto P. Paula luisrpp at gmail.com
Wed May 6 10:53:54 EDT 2009


Hi Luis,

I'm using a 3D image viewer that I have developed, but it is also happening
with the Bioimagesuite (www.bioimagesuite.org).

I'm comparing the original 3D image with the one rebuilt from 2D slices.

Thanks,
Luis

On Tue, May 5, 2009 at 10:27 PM, Luis Ibanez <luis.ibanez at kitware.com>wrote:

>
> Hi Luis,
>
> What application are you using as 3D image viewer ?
>
> There are (unfortunately) few applications that manage
> image orientation correctly.
>
> You may want to try Slicer
>
>
>               www.slicer.org
>
>
> which is one of the best applications available for
> displaying medical images in the correct orientation
> and position.
>
>
>    Regards,
>
>
>        Luis
>
>
>
>
> ------------------------------
> Luis Roberto P. Paula wrote:
>
>> Hi Brad,
>>
>> Your suggention works but the when I open this image in a 3D viewer the
>> axial view is with a vertical flip.
>>
>> Where did you get the values of Origin and Spacing?
>>
>>  >>  joinSeries->SetOrigin(inputOrigin[2]);
>>  >>  joinSeries->SetSpacing(inputSpacing[2]);
>>
>> I think this is the cause.
>>
>> Thanks,
>> Luis
>>
>> On Wed, Apr 29, 2009 at 5:25 PM, Bradley Lowekamp <blowekamp at mail.nih.gov<mailto:
>> blowekamp at mail.nih.gov>> wrote:
>>
>>    There is also the JoinSeriesImageFilter. Here is how I have used it
>>    before:
>>
>>
>>      typedef itk::JoinSeriesImageFilter<InputImageType,
>>    InputVolumeType> JoinSeriesFilterType;
>>      JoinSeriesFilterType::Pointer joinSeries =
>>    JoinSeriesFilterType::New();
>>      joinSeries->SetOrigin(inputOrigin[2]);
>>      joinSeries->SetSpacing(inputSpacing[2]);
>>            for (unsigned int z = 0; z < sliceTransforms.size(); ++z) {
>>
>>                typedef itk::ExtractImageFilter<InputVolumeType,
>> InputImageType>
>>    SlicerExtractorType;
>>        SlicerExtractorType::Pointer sliceImageExtractor =
>>    SlicerExtractorType::New();
>>        SlicerExtractorType::InputImageRegionType
>>    sliceSubRegion(inputVolume->GetLargestPossibleRegion());
>>        sliceSubRegion.SetSize(2, 0);
>>        sliceSubRegion.SetIndex(2, z);
>>  sliceImageExtractor->SetExtractionRegion(sliceSubRegion);
>>        sliceImageExtractor->SetInput(inputVolume);
>>  sliceImageExtractor->Update();
>>
>>        ... resampling of the slices...
>>                  joinSeries->PushBackInput(resample->GetOutput());
>>      }
>>              joinSeries->Update();
>>
>>
>>    Hopefully one of the suggestions will work well for you.
>>
>>    Brad
>>
>>    On Apr 29, 2009, at 4:13 PM, Bill Lorensen wrote:
>>
>>     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 <mailto: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>
>>>>>
>>>>
>>>     <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
>>>>>
>>>>
>>>            <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
>>>>>
>>>>
>>>            <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>
>>>>>
>>>>
>>>                   <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 <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 <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
>>>
>>
>>
>>    ========================================================
>>
>>    Bradley Lowekamp
>>    Lockheed Martin Contractor for
>>
>>    Office of High Performance Computing and Communications
>>
>>    National Library of Medicine
>>    blowekamp at mail.nih.gov <mailto:blowekamp at mail.nih.gov>
>>
>>
>>
>>
>>    _____________________________________
>>    Powered by 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
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20090506/526b3336/attachment-0001.htm>


More information about the Insight-users mailing list