[Insight-users] Passing itk images to functions

habibbaluwala2010 habibbaluwala at gmail.com
Tue Sep 28 13:00:54 EDT 2010


Hello Everyone , 
                       I have been suffering with a minor problem where any
changes that I make in the image in a supplementary function is not
reflected in the main function. I.e. if I change the size of the image in
the function that change is not reflected in the Main function . The example
below will provide a brief review: 



template<typename RType>
void image_resize_filter (RType *test_image)
{ 
   RType:: IndexType start; start[0]=0;start[1]=0;start[2]=0;
   RType::RType imageSize; 
   imageSize[0]=200; 
   imageSize[1]=200; 
   imageSize[2]=200;
   RType::RegionType region; 
   region.SetSize(imageSize); region.SetIndex(start); 
   test_image->SetRegions(region);
   test_image->Update();

}

  
void main ()
{
   typedef float PixelType;
   const unsigned int Dimension = 3;  
   typedef itk::Image< PixelType, Dimension > ImageType;
   ImageType:: IndexType start; start[0]=0;start[1]=0;start[2]=0;
   
   ImageType::SizeType imageSize; 
   imageSize[0]=100; 
   imageSize[1]=100; 
   imageSize[2]=100;
   ImageType::Pointer test1=ImageType::New();
   ImageType::RegionType region; 
   region.SetSize(imageSize); region.SetIndex(start); 
   test1->SetRegions(region); test1->Allocate(); 
   test1->FillBuffer(100.0); test1->SetSpacing(space);

// Change Image resolution in the function

image_resize_filter<ImageType>(test1);
}
  
Now after running this program it does not increase the size of the image .
It would be very helpful if someone could point out the mistake in that....



-- 
View this message in context: http://old.nabble.com/Passing-itk-images-to-functions-tp29830622p29830622.html
Sent from the ITK - Users mailing list archive at Nabble.com.



More information about the Insight-users mailing list