[vtkusers] program error

Wes Turner wes.turner at kitware.com
Wed Jan 17 09:50:38 EST 2007


I believe you need to include vtkImageData.h in your main.

- Wes

On 1/17/07, 胡正珲 <zhengh.hu at gmail.com> wrote:
>
> To all vtkuser:
>
>        i am a VTK novice, i have the following program, but it has the
> following wrong.
>
> 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 *'
>         Types pointed to are unrelated; conversion requires
> reinterpret_cast, C-style cast or function-style cast
> 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 *'
>         Types pointed to are unrelated; conversion requires
> reinterpret_cast, C-style cast or function-style cast
> Error executing cl.exe.
>
> test.obj - 2 error(s), 0 warning(s)
>
>  How should i do? anyone can give me some advices? thank you in advance.
>
> //============================
> ============================================================================
>
> #include "vtkImageGridSource.h"
> #include "vtkBMPReader.h "
> #include "vtkImageBlend.h"
> #include "vtkImageViewer.h"
> #include "vtkImageGaussianSmooth.h"
> #include "vtkImageMathematics.h"
>
> int main()
> {
>
>    vtkImageGridSource *imageGrid = vtkImageGridSource::New();
>    imageGrid->SetGridSpacing(16, 16, 0);
>    imageGrid->SetGridOrigin(0, 0, 0);
>    imageGrid->SetDataExtent(0, 255, 0, 255, 0, 0);
>    imageGrid->SetLineValue(4095);
>    imageGrid->SetFillValue(0);
>    imageGrid->SetDataScalarTypeToShort();
>
>    vtkBMPReader *bmpReader = vtkBMPReader::New();
>    bmpReader->SetFileName("aaa10.bmp");
>
>    vtkImageBlend *blend = vtkImageBlend::New();
>    blend->SetOpacity(0, 0.5);
>    blend->SetOpacity(1, 0.5);
>    blend->AddInput(0, imageGrid->GetOutput());
>    blend->AddInput(1, bmpReader->GetOutput());
>
>    vtkImageViewer *viewer = vtkImageViewer::New();
>    viewer->SetInput(blend->GetOutput());
>    viewer->SetColorWindow(1000);
>    viewer->SetColorLevel(500);
>    viewer->Render();
>
>    imageGrid->Delete();
>    bmpReader->Delete();
>    blend->Delete();
>    viewer->Delete();
>
>
> return 0;
>
> }
>
>
> _______________________________________________
> This is the private VTK discussion list.
> Please keep messages on-topic. Check the FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
>
>


-- 
Wesley D. Turner, Ph.D.
R&D Engineer
28 Corporate Drive
Clifton Park, NY 12065-8662
Phone: 518-371-3971 x120
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20070117/8fde2ea9/attachment.htm>


More information about the vtkusers mailing list