<html>
The header file for vtkImageData needs to be included:<br><br>
#include "vtkImageData.h"<br><br>
- Amy<br><br>
At 06:15 PM 3/17/2003 -0600, Xianjin Yang wrote:<br><br>
<blockquote type=cite class=cite cite><font size=2>Hi vtkusers,</font>
<br><br>
<font size=2>I copy-paste some code for Visualizing a Quadric Function from VTK.ORG website (</font><a href="http://www.vtk.org/example-code.php"><font size=2 color="#0000FF"><u>http://www.vtk.org/example-code.php</a></u></font><font size=2>) and got these errors while testing it under Borland C++ Builder 6 / WinXP / VTK4..2.1. Will someone please tell what is wrong here?<br>
</font><br>
<font size=2>[C++ Error] Form_Test.cpp(90): E2034 Cannot convert 'vtkImageData *' to 'vtkDataSet *'</font> <br>
<font size=2>[C++ Error] Form_Test.cpp(90): E2342 Type mismatch in parameter 'input' (wanted 'vtkDataSet *', got 'vtkImageData *')</font> <br>
<font size=2>[C++ Error] Form_Test.cpp(106): E2034 Cannot convert 'vtkImageData *' to 'vtkDataSet *'</font> <br>
<font size=2>[C++ Error] Form_Test.cpp(106): E2342 Type mismatch in parameter 'input' (wanted 'vtkDataSet *', got 'vtkImageData *')</font> <br>
<font size=2>[C++ Error] Form_Test.cpp(115): E2315 'SetColor' is not a member of 'vtkProperty', because the type is not yet defined</font> <br><br>
<font size=2>=== Here is the C++ code from the vtk.org website === <br>
</font><br>
<font size=2> // -- create the quadric function object --</font> <br>
<font size=2> // create the quadric function definition</font> <br>
<font size=2> vtkQuadric *quadric = vtkQuadric::New();</font> <br>
<font size=2> quadric->SetCoefficients(.5,1,.2,0,.1,0,0,.2,0,0);</font> <br><br>
<font size=2> // sample the quadric function</font> <br>
<font size=2> vtkSampleFunction *sample = vtkSampleFunction::New();</font> <br>
<font size=2> sample->SetSampleDimensions(50,50,50);</font> <br>
<font size=2> sample->SetImplicitFunction(quadric);</font> <br><br>
<font size=2> // Create five surfaces F(x,y,z) = constant between range specified</font> <br>
<font size=2> vtkContourFilter *contours = vtkContourFilter::New();</font> <br>
<font size=2> contours->SetInput(sample->GetOutput()); // ============= Line 90 ========</font> <br>
<font size=2> contours->GenerateValues(5, 0.0, 1.2);</font> <br><br>
<font size=2> // map the contours to graphical primitives</font> <br>
<font size=2> vtkPolyDataMapper *contMapper = vtkPolyDataMapper::New();</font> <br>
<font size=2> contMapper->SetInput(contours->GetOutput());</font> <br>
<font size=2> contMapper->SetScalarRange(0.0, 1.2);</font> <br><br>
<font size=2> // create an actor for the contours</font> <br>
<font size=2> vtkActor *contActor = vtkActor::New();</font> <br>
<font size=2> contActor->SetMapper(contMapper);</font> <br><br>
<font size=2> // -- create a box around the function to indicate the sampling volume --</font> <br><br>
<font size=2> // create outline</font> <br>
<font size=2> vtkOutlineFilter *outline = vtkOutlineFilter::New();</font> <br>
<font size=2> outline->SetInput(sample->GetOutput()); // ============ Line 106 ======</font> <br><br>
<font size=2> // map it to graphics primitives</font> <br>
<font size=2> vtkPolyDataMapper *outlineMapper = vtkPolyDataMapper::New();</font> <br>
<font size=2> outlineMapper->SetInput(outline->GetOutput());</font> <br><br>
<font size=2> // create an actor for it</font> <br>
<font size=2> vtkActor *outlineActor = vtkActor::New();</font> <br>
<font size=2> outlineActor->SetMapper(outlineMapper);</font> <br>
<font size=2> outlineActor->GetProperty()->SetColor(0,0,0); // ======== Line 115 =========</font> <br><br>
<font size=2>Thanks a lot</font> <br><br>
<font size=2>Yang</font> </blockquote><br>
</html>