[vtkusers] NULL check and reinitialize vtkSmartPointer<vtkImageData>

Jothybasu Selvaraj jothybasu at gmail.com
Mon Oct 31 11:07:58 EDT 2011


I can't see counterparts of SetDimensions(), SetSpacing(), SetOrigin etc
in vtkImageChangeInformation.

-- they are as SetOutputSpacing.....origin...extent....


Jothy



On Mon, Oct 31, 2011 at 3:00 PM, Divya Rathore <divyarathore at gmail.com>wrote:

> Considering a hypothetical scenario:
>
> //Step 1: Load Data: 256*256*256 volume
> // set various parameters
> imageData->SetDimensions(width, height, depth);
> imageData->SetNumberOfScalarComponents(1);
> imageData->SetScalarTypeToUnsignedShort();
> imageData->SetSpacing(spacingX, spacingY, spacingZ);
> imageData->SetOrigin(originX, originY, originZ);
> // Visualize it. Get Happy.
>
> // Now try loading another dataset of different size
> //Step 2: Load Data: 512*512*512 volume
>
> // I can't see counterparts of SetDimensions(), SetSpacing(), SetOrigin etc
> in vtkImageChangeInformation.
> // What next?
>
>
> - Divya
>
> On Mon, Oct 31, 2011 at 2:46 PM, Divya Rathore <divyarathore at gmail.com>wrote:
>
>> 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
>>>
>>>
>>
>


-- 
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/7064b0d2/attachment.htm>


More information about the vtkusers mailing list