To all vtkuser:<br><br> &nbsp; &nbsp; &nbsp; &nbsp;i am a VTK novice, i have the following program, but it has the following wrong.<br><br>D:\C PROGRAM\test\test.cpp(53) : error C2664: &#39;void __thiscall vtkImageBlend::SetInput(int,class vtkDataObject *)&#39; : cannot convert parameter 2 from &#39;class vtkImageData *&#39; to &#39;class vtkDataObject *&#39;
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast<br>D:\C PROGRAM\test\test.cpp(54) : error C2664: &#39;void __thiscall vtkImageBlend::SetInput(int,class vtkDataObject *)&#39; : cannot convert parameter 2 from &#39;class vtkImageData *&#39; to &#39;class vtkDataObject *&#39;
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast<br>Error executing cl.exe.<br><br>test.obj - 2 error(s), 0 warning(s)<br><br>&nbsp;How should i do? anyone can give me some advices? thank you in advance.
<br><br>//============================<div style="direction: ltr;">============================================================================<br><br>#include &quot;vtkImageGridSource.h&quot;<br>#include &quot;vtkBMPReader.h
&quot;<br>#include &quot;vtkImageBlend.h&quot;<br>#include &quot;vtkImageViewer.h&quot;<br>#include &quot;vtkImageGaussianSmooth.h&quot;<br>#include &quot;vtkImageMathematics.h&quot;<br><br>int main()<br>{<br><br> &nbsp; &nbsp;vtkImageGridSource *imageGrid = vtkImageGridSource::New();
<br> &nbsp; &nbsp;imageGrid-&gt;SetGridSpacing(16, 16, 0);<br> &nbsp; &nbsp;imageGrid-&gt;SetGridOrigin(0, 0, 0);<br> &nbsp; &nbsp;imageGrid-&gt;SetDataExtent(0, 255, 0, 255, 0, 0);<br> &nbsp; &nbsp;imageGrid-&gt;SetLineValue(4095);<br> &nbsp; &nbsp;imageGrid-&gt;SetFillValue(0);
<br> &nbsp; &nbsp;imageGrid-&gt;SetDataScalarTypeToShort();<br><br> &nbsp; &nbsp;vtkBMPReader *bmpReader = vtkBMPReader::New();<br> &nbsp; &nbsp;bmpReader-&gt;SetFileName(&quot;aaa10.bmp&quot;);<br><br> &nbsp; &nbsp;vtkImageBlend *blend = vtkImageBlend::New();<br>
 &nbsp; &nbsp;blend-&gt;SetOpacity(0, 0.5);<br> &nbsp; &nbsp;blend-&gt;SetOpacity(1, 0.5);<br> &nbsp; &nbsp;blend-&gt;AddInput(0, imageGrid-&gt;GetOutput());<br> &nbsp; &nbsp;blend-&gt;AddInput(1, bmpReader-&gt;GetOutput());<br><br> &nbsp; &nbsp;vtkImageViewer *viewer = vtkImageViewer::New();
<br> &nbsp; &nbsp;viewer-&gt;SetInput(blend-&gt;GetOutput());<br> &nbsp; &nbsp;viewer-&gt;SetColorWindow(1000);<br> &nbsp; &nbsp;viewer-&gt;SetColorLevel(500);<br> &nbsp; &nbsp;viewer-&gt;Render();<br><br> &nbsp; &nbsp;imageGrid-&gt;Delete();<br> &nbsp; &nbsp;bmpReader-&gt;Delete();
<br> &nbsp; &nbsp;blend-&gt;Delete();<br> &nbsp; &nbsp;viewer-&gt;Delete();<br><br><br>return 0;<br><br>}</div><br>