[Insight-users] Creating ITK image with data from IDL

jose at apollomit.com jose at apollomit.com
Thu Sep 6 04:27:47 EDT 2012


Hello ITK Users,

We are creating an OrientedImage from an array of integers (received  
from IDL) in the following way:

   //------------------------------------------------------------------
   ImageType::IndexType pixelIndex;
         int i=0;
         for(ImageType::IndexValueType l = 0; l < params[2]; l++){
                          for(ImageType::IndexValueType r = 0; r <  
params[1]; r++)
                                 {
                                   for(ImageType::IndexValueType s =  
0; s < params[0]; s++)
                                         {
                                         pixelIndex[0] = s;
                                         pixelIndex[1] = r;
                                         pixelIndex[2] = l;

                                         image->SetPixel(pixelIndex,input[i]);
                                         i++;
                                         }
                                 }
         }
         //-------------------------------------------------



I was wondering if I could create this image without having to  
traverse the entire array (and avoid the O(n3) complexity).
I have an integer array with the values (input[]), so there should be  
a way to just make the image point to the array right? i. e. something  
like: *image  = *input ? or I don't know just another way to create an  
image that I don't have to set pixel by pixel.
I would greatly appreciate any help.
thanks
-Jose



More information about the Insight-users mailing list