<div>Hi all~</div>
<div>The program I'm writing requires some self-defined operation on vtkImageData. I hope to operate on the internal data structure of vtkImageData as on an ordinary array in c++. I write the code like this:</div>
<div>&nbsp;</div>
<div>&nbsp; vtkDICOMImageReader *p=vtkDICOMImageReader::New();<br>&nbsp; p-&gt;SetDirectoryName(&quot;f:\\dcm\\organ1&quot;);</div>
<div>&nbsp; <font color="#3366ff">vtkImageData *t=p-&gt;GetOutput(); <br>&nbsp; float *f=(float*)t-&gt;GetScalarPointer();</font></div>
<div>&nbsp;</div>
<div>&nbsp; vtkContourFilter *skinExtractor = vtkContourFilter::New();<br>&nbsp; skinExtractor-&gt;SetInput(t);<br>&nbsp; <font color="#cc33cc">skinExtractor-&gt;SetValue(0, 300);</font><br>&nbsp; vtkPolyDataMapper *skinMapper = vtkPolyDataMapper::New();
<br>&nbsp; skinMapper-&gt;SetInput(skinExtractor-&gt;GetOutput());<br>&nbsp; skinMapper-&gt;ScalarVisibilityOff();<br>&nbsp; //vtkActor *skin = vtkActor::New();<br>&nbsp; vtkLODActor *skin = vtkLODActor::New();<br>&nbsp; skin-&gt;SetMapper(skinMapper);
</div>
<div>&nbsp;</div>
<div>&nbsp; vtkRenderer *ren1=vtkRenderer::New();<br>&nbsp; vtkRenderWindow *renWin=vtkRenderWindow::New();<br>&nbsp; renWin-&gt;AddRenderer(ren1);<br>&nbsp; vtkRenderWindowInteractor *iren=vtkRenderWindowInteractor::New();<br>&nbsp; iren-&gt;SetRenderWindow(renWin);&nbsp;&nbsp;
<br>&nbsp; ren1-&gt;AddActor(skin);</div>
<div>&nbsp;</div>
<div>
<p>for(int k=0;k&lt;360;k++){&nbsp;&nbsp;<br>&nbsp;&nbsp;<font color="#ff0000"> t-&gt;Update();<br>&nbsp;&nbsp; p-&gt;Update();<br></font><br>&nbsp; renWin-&gt;Render();<br>&nbsp; <br>&nbsp; ren1-&gt;GetActiveCamera()-&gt;Azimuth( 1 );<br>&nbsp; &nbsp;&nbsp; for(int j=0;j&lt;dims[0]*dims[1]*dims[2];j++){
<br>&nbsp;&nbsp;&nbsp;&nbsp; f[j]+=10;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>}</p>
<p>The intention of the code above is to modify the intensity value of the vtkImageData and immediately display it in the rendering window. However, the effect of the modification(as illustrated in the for loop block, which uses a float type pointer which is initialized by vtkImageData::GetScalraPointer() previously) is not reflected in the rendering Window. Since I have set an contour filter which allows the display of only voxel which has the intensity of 300, clearly the scene in the rendering window should be changed due to the modification. But it doesn't, why?
</p>
<p>I suppose that may be it is due to the implicti execute mechanism. I modify the content of array pointed by &quot;f&quot;, but there lacks a method to inform &quot;t&quot;(vtkImageData) of the change, thus the time stamp of &quot;t&quot; will not change. Is it right? Is there anyway to solve the problem?
</p>
<p>Taokai</p>
<p>&nbsp;</p></div>
<div>&nbsp;</div>