<div>On Tue, Mar 2, 2010 at 7:11 AM, michiel mentink <span dir="ltr"><<a href="mailto:michael.mentink@st-hughs.ox.ac.uk">michael.mentink@st-hughs.ox.ac.uk</a>></span> wrote:</div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<br>try using imgdata->GetOrigin()<br><br>cheers, Michael<br><br><div class="gmail_quote"><div><div></div><div class="h5">On Tue, Mar 2, 2010 at 10:03 AM, 王君臣 <span dir="ltr"><<a href="mailto:wangjunchen@gmail.com" target="_blank">wangjunchen@gmail.com</a>></span> wrote:<br>
</div></div><blockquote class="gmail_quote" style="border-left:1px solid rgb(204, 204, 204);margin:0pt 0pt 0pt 0.8ex;padding-left:1ex"><div><div></div><div class="h5"><div><br clear="all">hi, all</div>
<div> </div>
<div>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).</div>
<div> </div>
<div>=====code seg =======</div>
<div> </div>
<div> vtkImageData * imgdata = vNode->GetImageData();<br> double o[3];<br> imgdata->GetOrigin(o); // o is [100, 100, 100]<br> imgdata->SetOrigin(0, 0, 0); // assign origin to [0 0 0]<br> imgdata->GetOrigin(o);// still [100 100 100]</div>
<div>====================</div>
<div> </div>
<div>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. </div>
<div> </div>
<div>I need for your help, thanks.<br>-- <br>Best Regards,</div>
<div>WANG Junchen</div>
<div></div></div></div></blockquote></div></blockquote></div><div><br></div>This seems to behave as expected:<br><div><br></div><div><div> vtkSmartPointer<vtkImageData> imgdata = </div><div> vtkSmartPointer<vtkImageData>::New();</div>
<div> double o[3];</div><div> imgdata->GetOrigin(o);</div><div> cout << o[0] << " " << o[1] << " " << o[2] << endl;</div><div> </div><div> double newO[3] = {100, 100, 100};</div>
<div> imgdata->SetOrigin(newO);</div><div> </div><div> double modifiedO[3];</div><div> imgdata->GetOrigin(modifiedO);</div><div> cout << modifiedO[0] << " " << modifiedO[1] << " " << modifiedO[2] << endl;</div>
<div> </div>Thanks,<br><br>David<br></div>