I believe you need to include vtkImageData.h in your main.<br><br>- Wes<br><br><div><span class="gmail_quote">On 1/17/07, <b class="gmail_sendername">ºúÕýçõ</b> <<a href="mailto:zhengh.hu@gmail.com">zhengh.hu@gmail.com</a>
> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">To all vtkuser:<br><br> 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: 'void __thiscall vtkImageBlend::SetInput(int,class vtkDataObject *)' : cannot convert parameter 2 from 'class vtkImageData *' to 'class vtkDataObject *'
<br> 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: 'void __thiscall vtkImageBlend::SetInput(int,class vtkDataObject *)' : cannot convert parameter 2 from 'class vtkImageData *' to 'class vtkDataObject *'
<br> 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> How should i do? anyone can give me some advices? thank you in advance.
<br><br>//============================<div style="direction: ltr;">============================================================================<br><br>#include "vtkImageGridSource.h"<br>#include "vtkBMPReader.h
"<br>#include "vtkImageBlend.h"<br>#include "vtkImageViewer.h"<br>#include "vtkImageGaussianSmooth.h"<br>#include "vtkImageMathematics.h"<br><br>int main()<br>{<br><br> vtkImageGridSource *imageGrid = vtkImageGridSource::New();
<br> imageGrid->SetGridSpacing(16, 16, 0);<br> imageGrid->SetGridOrigin(0, 0, 0);<br> imageGrid->SetDataExtent(0, 255, 0, 255, 0, 0);<br> imageGrid->SetLineValue(4095);<br> imageGrid->SetFillValue(0);
<br> imageGrid->SetDataScalarTypeToShort();<br><br> vtkBMPReader *bmpReader = vtkBMPReader::New();<br> bmpReader->SetFileName("aaa10.bmp");<br><br> vtkImageBlend *blend = vtkImageBlend::New();
<br>
blend->SetOpacity(0, 0.5);<br> blend->SetOpacity(1, 0.5);<br> blend->AddInput(0, imageGrid->GetOutput());<br> blend->AddInput(1, bmpReader->GetOutput());<br><br> vtkImageViewer *viewer = vtkImageViewer::New();
<br> viewer->SetInput(blend->GetOutput());<br> viewer->SetColorWindow(1000);<br> viewer->SetColorLevel(500);<br> viewer->Render();<br><br> imageGrid->Delete();<br> bmpReader->Delete();
<br> blend->Delete();<br> viewer->Delete();<br><br><br>return 0;<br><br>}</div><br>
<br>_______________________________________________<br>This is the private VTK discussion list.<br>Please keep messages on-topic. Check the FAQ at: <a onclick="return top.js.OpenExtLink(window,event,this)" href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">
http://www.vtk.org/Wiki/VTK_FAQ</a><br>Follow this link to subscribe/unsubscribe:<br><a onclick="return top.js.OpenExtLink(window,event,this)" href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers
</a><br><br><br></blockquote></div><br><br clear="all"><br>-- <br>Wesley D. Turner, Ph.D.<br>R&D Engineer<br>28 Corporate Drive<br>Clifton Park, NY 12065-8662<br>Phone: 518-371-3971 x120