[vtkusers] vtkImageData::SetOrigin didn't take effect
David Doria
daviddoria+vtk at gmail.com
Tue Mar 2 11:53:58 EST 2010
On Tue, Mar 2, 2010 at 7:11 AM, michiel mentink <
michael.mentink at st-hughs.ox.ac.uk> wrote:
>
> try using imgdata->GetOrigin()
>
> cheers, Michael
>
> On Tue, Mar 2, 2010 at 10:03 AM, 王君臣 <wangjunchen at gmail.com> wrote:
>
>>
>> hi, all
>>
>> I just encountered a strange thing that when I set the origin of
>> vtkImageData, and read it out after the assignment, it turned out that the
>> value hasn't changed (hold the value before the assignment).
>>
>> =====code seg =======
>>
>> vtkImageData * imgdata = vNode->GetImageData();
>> double o[3];
>> imgdata->GetOrigin(o); // o is [100, 100, 100]
>> imgdata->SetOrigin(0, 0, 0); // assign origin to [0 0 0]
>> imgdata->GetOrigin(o);// still [100 100 100]
>> ====================
>>
>> something I have to say is that the mehtod SetOrigin will trigger the
>> vtkcommand::modifiedevent of the imgdata and in the handler I re-rendered
>> the widget which contains the actor of the imgdata. imgdata is not connected
>> to the filter, thus there is no possibility that the filter updated the
>> imgdata.
>>
>> I need for your help, thanks.
>> --
>> Best Regards,
>> WANG Junchen
>>
>
This seems to behave as expected:
vtkSmartPointer<vtkImageData> imgdata =
vtkSmartPointer<vtkImageData>::New();
double o[3];
imgdata->GetOrigin(o);
cout << o[0] << " " << o[1] << " " << o[2] << endl;
double newO[3] = {100, 100, 100};
imgdata->SetOrigin(newO);
double modifiedO[3];
imgdata->GetOrigin(modifiedO);
cout << modifiedO[0] << " " << modifiedO[1] << " " << modifiedO[2] <<
endl;
Thanks,
David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100302/ce4dc499/attachment.htm>
More information about the vtkusers
mailing list