[Insight-users] Change the dimension of an index

Gaëtan Lehmann gaetan.lehmann at jouy.inra.fr
Sun Jun 29 10:20:52 EDT 2008


Hi Alberto,

Can't you simply copy the index on the dimensions of interest from the  
3D itk::Index to the 2D itk::Index?
Something like:

   itk::Index< 2 > idx2;
   idx2[0] = idx3[0];
   idx3[1] = idx3[1];
   img->SetPixel( idx2, 90 );

Regards,

Gaëtan

Le 29 juin 08 à 16:13, Alberto a écrit :

> 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

-- 
Gaëtan Lehmann
Biologie du Développement et de la Reproduction
INRA de Jouy-en-Josas (France)
tel: +33 1 34 65 29 66    fax: 01 34 65 29 09
http://voxel.jouy.inra.fr  http://www.mandriva.org
http://www.itk.org  http://www.clavier-dvorak.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 186 bytes
Desc: This is a digitally signed message part
URL: <http://www.itk.org/pipermail/insight-users/attachments/20080629/eb18c1dc/attachment.pgp>


More information about the Insight-users mailing list