[vtkusers] Storing SmartPointers in a vector
Karthik Krishnan
karthik.krishnan at kitware.com
Mon Feb 14 22:58:43 EST 2011
Disconnect the image from the pipeline, or it will be subject to updates
when you call Update() or update any of the downstream filters like the
VTK-ITK connector... This is done with a shallow copy.
ie Instead of :
USImageStitch = sonixGrabber->GetOutput();
USImageStitch->Update();
write
sonixGrabber->Update();
USImageStich->ShallowCopy(sonixGrabber->GetOutput());
On Tue, Feb 15, 2011 at 4:18 AM, Alexis Cheng <acheng_1221 at hotmail.com>wrote:
>
> vtkSmartPointer<vtkImageData> USImageStitch =
> vtkSmartPointer<vtkImageData>::New();
> USImageStitch->SetScalarTypeToUnsignedChar();
> USImageStitch->SetDimensions(640,480,1);
> USImageStitch->SetSpacing(1,1,1);
> USImageStitch = sonixGrabber->GetOutput();
> USImageStitch->Update();
>
> ImagePanorama.push_back(USImageStitch);
> Sleep(100);
> }
>
> for (vector<vtkSmartPointer<vtkImageData>>::iterator
> PanoramaIterator = ImagePanorama.begin();PanoramaIterator <
> ImagePanorama.end()-1;PanoramaIterator++)
> {
> VTKImageToITKImageType::Pointer VTKToITKConnector1 =
> VTKImageToITKImageType::New();
> VTKToITKConnector1->SetInput(*PanoramaIterator);
> VTKToITKConnector1->Update();
>
> VTKImageToITKImageType::Pointer VTKToITKConnector2 =
> VTKImageToITKImageType::New();
> VTKToITKConnector2->SetInput(*(PanoramaIterator+1));
> VTKToITKConnector2->Update();
> }
> //////////////////////////////////////////
>
> The iterators are returning the real time image as opposed to the stored
> image. I'm not quite sure what the problem may be. Has anybody worked with
> smartpointers and vectors? Thank you all in advance.
>
> Regards,
> Alexis Cheng
> Electrical Engineering
> University of British Columbia
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20110215/b2a5b2f4/attachment.htm>
More information about the vtkusers
mailing list