[vtkusers] NULL check and reinitialize vtkSmartPointer<vtkImageData>
Divya Rathore
divyarathore at gmail.com
Mon Oct 31 10:32:50 EDT 2011
Hi All,
I have a vtkSmartPointer of vtkImageData:
// declaration in header //
vtkSmartPointer<vtkImageData> imageData;
// implementation in .cpp //
// get values from elsewhere and feed into this //
imageData->SetDimensions(width, height, depth);
imageData->SetNumberOfScalarComponents(1);
imageData->SetScalarTypeToUnsignedShort();
imageData->SetSpacing(spacingX, spacingY, spacingZ);
imageData->SetOrigin(originX, originY, originZ);
During the overall lifecycle of the application, I need to NULL check and
feed values into imageData multiple times. It being a smart pointer, I
can't call:
imageData->Delete(); // WRONG! Its a smart pointer.
what's the way to reinitialize the dimensions, spacing, origin etc
(emptying this pointer back to its initial state)?
best regards,
Divya
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20111031/986e8617/attachment.htm>
More information about the vtkusers
mailing list