[vtkusers] NULL check and reinitialize vtkSmartPointer<vtkImageData>

Divya Rathore divyarathore at gmail.com
Mon Oct 31 10:46:44 EDT 2011


Thanks, Jothy.
I will check if this does what I intend to get done.

best regards,
Divya



On Mon, Oct 31, 2011 at 2:36 PM, Jothybasu Selvaraj <jothybasu at gmail.com>wrote:

> May be you should use vtkImageChangeInformation(changer) and then
>
> this->imageData=changer->GetOutput().
>
>
> Jothy
>
> On Mon, Oct 31, 2011 at 2:32 PM, Divya Rathore <divyarathore at gmail.com>wrote:
>
>> 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
>>
>> _______________________________________________
>> 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
>>
>>
>
>
> --
> Jothybasu K Selvaraj
> PhD Student
> University of Liverpool
> Liverpool,UK
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20111031/23bbe147/attachment.htm>


More information about the vtkusers mailing list