[Insight-users] Change the dimension of an index

Luis Ibanez luis.ibanez at kitware.com
Sun Jun 29 10:21:58 EDT 2008


Hi Alberto,

If you are planning to use 2D filters in the slices of a 3D image, you
will find useful the paper that Gaetan Lehmann contributed to the
Insight Journal

http://www.insight-journal.org/InsightJournalManager/view_reviews.php?back=search.php%3Ftexte%3Dgaetan&journalid=6&pubid=133

http://insight-journal.org/midas/handle.php?handle=1926/368

---

In any case,

here is one option for you to try this manually:

      InputImageType::Pointer img = InputImageType::New();
      img->SetRegions( input->GetLargestPossibleRegion() );
      img->Allocate();
      img->FillBuffer( 0 );

      InputImageType::IndexType index;

      index[0] = positionX;
      index[1] = positionY;
      index[2] = sliceNumber;

      img->SetPixel( index, pixelValue );


by changing the values of index[0] and index[1] you can walk
down the slice = sliceNumber.

Notice that you can do this a lot faster by using the Iterator

                ImageSliceIteratorWithIndex

as described in the ITK Software Guide.


It all depends on what operation you are actually planning to
apply to each slice.



     Regards,


        Luis


----------------
Alberto wrote:
> Dear all,
> I am working with images in 3D, but I need to manipulate these images in 
> 2D. After some processing I get an index SliceImageType::IndexType 
> pixelIndex and I would like to create a 3D image setting this index to 
> 90. I don't know how to do it, because this index has 2D and the image 
> 3D. has anyone any suggestion?
> 
>         InputImageType::Pointer img = InputImageType::New();       
>         img->SetRegions( input->GetLargestPossibleRegion() );
>         img->Allocate();
>         img->FillBuffer( 0 );
>        img->SetPixel( ??, 90 );
> 
> Best regards
> Bert
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> 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