[Insight-users] Storing Filter Outputs in vectors

Alexis Cheng acheng_1221 at hotmail.com
Thu Feb 10 20:07:32 EST 2011


Hi all,

I'm attempting to grab images from a real time source and store them in a vector. The problem that I'm having is that, when I later try to use the images in the vector, it returns the real time image of the source. An excerpt of my code is as follows.

//////////////////////////////////////////////////////////////////
typedef itk::Image< unsigned char, 2 > FixedImageType;
typedef itk::VTKImageToImageFilter<FixedImageType> VTKImageToITKImageType;

vector<FixedImageType::ConstPointer> ImagePanorama;

                for (int i = 0; i < 10; i++)
                {
                    USImage->SetScalarTypeToUnsignedChar();
                    USImage->SetDimensions(960,480,1);
                    USImage->SetSpacing(1,1,1);
                    USImage = sonixGrabber->GetOutput();
                    USImage->Update();

                    VTKToITKConnector->SetInput(USImage);
                    VTKToITKConnector->Update();
                    
                    FixedImageType::ConstPointer ITKImagePointer = VTKToITKConnector->GetOutput();
                        
                    ImagePanorama.push_back(ITKImagePointer);
                    Sleep(100);
                }

                for (vector<FixedImageType::ConstPointer>::iterator PanoramaIterator = ImagePanorama.begin();PanoramaIterator < ImagePanorama.end()-1;PanoramaIterator++)
                {
                    FixedUSImage = *PanoramaIterator;
                }
//////////////////////////////////////////////////////////////////

Specifically, the iterator doesn't seem to be referring to the series of images that I put into the vector earlier. Does anyone know why this is? Thank you all in advance.

Regards,
Alexis Cheng
Electrical Engineering
University of British Columbia
 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20110210/99a0eaf8/attachment-0001.htm>


More information about the Insight-users mailing list