<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hey Dongqing,<div><br></div><div>I'm not sure if this is the problem, but it sounds quite similar to a recent thread:</div><div><br></div><div><a href="http://www.vtk.org/pipermail/vtkusers/2008-November/098266.html">http://www.vtk.org/pipermail/vtkusers/2008-November/098266.html</a></div><div><br></div><div>In her reply, Amy Squillacote pointed the user to:</div><div><br></div><div><a href="http://www.vtk.org/Wiki/VTK_FAQ#The_C.2B.2B_compiler_cannot_convert_some_pointer_type_to_another_pointer_type_in_my_little_program">http://www.vtk.org/Wiki/VTK_FAQ#The_C.2B.2B_compiler_cannot_convert_some_pointer_type_to_another_pointer_type_in_my_little_program</a></div><div><br></div><div>See if putting in #include "vtkImageData.h" helps.</div><div><br></div><div>-Eric</div><div><br></div><div><br><div><div>On Nov 14, 2008, at 8:41 PM, Dongqing Chen wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0; "><div bgcolor="#ffffff"><div><font face="Arial" size="2">Dear All:</font></div><div><font face="Arial" size="2"></font> </div><div><font face="Arial" size="2"> During the past two days, I got really nice from this group list and finally installed the VTK 5.2 (upgraded from VTK 5.0) and QT 4.4.</font></div><div><font face="Arial" size="2"></font> </div><div><font face="Arial" size="2"> Since it is my first time to use QT to design GUI, I tried two simple examples recommended by Dr. Eric E Monson at Duke University, and both run very well.</font></div><div><font face="Arial" size="2"></font> </div><div><font face="Arial" size="2"> Now, I copy and paste some simple codes from my previous program,, which worked very well under VTK 5.0.</font></div><div> </div><div><font face="Arial" size="2"> But I do not know why those two problems appeared. Any hint or clue should be highly appreciated.</font></div><div><font face="Arial" size="2">----------------------------------------------------------------------------------------------------------------------------------------------------------------</font></div><div><font face="Arial" size="2">SimpleView4.cxx<br></font></div><div><font face="Arial" size="2">E:\QT_Practice\QT_SimpleView\src\SimpleView4.cxx(93) : error C2664: 'void __thiscall vtkPolyDataAlgorithm::SetInput(class vtkDataObject *)' : cannot convert parameter 1 from 'class vtkImageData *' to 'class vtkDataObject *'<br> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast<br>E:\QT_Practice\QT_SimpleView\src\SimpleView4.cxx(136) : error C2664: 'void __thiscall vtkAlgorithm::SetInputConnection(class vtkAlgorithmOutput *)' : cannot convert parameter 1 from 'class vtkPolyData *' to 'class vtkAlgorithmOutput *'<span class="Apple-converted-space"> </span><br> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast<br>Error executing cl.exe.</font></div><div><font face="Arial" size="2"></font> </div><div><font face="Arial" size="2">The first error refers to isoSurface->SetInput(readerSegmented->GetOutput());<br>while the second error refers to mapper->SetInputConnection(normals->GetOutput());<br></font></div><div><font face="Arial" size="2">------------------------------------------Directly modify the SimpleView code-------------------------------------------------------------</font></div><div><font face="Arial" size="2">void SimpleView::fileOpen()<br>{<br> // Geometry<br> //source = vtkCylinderSource::New();</font></div><div><font face="Arial" size="2"></font> </div><div><font face="Arial" size="2"> //starting from here, modified by Dongqing Chen,<span class="Apple-converted-space"> </span><br> //load in pgm firstly, then dicom </font></div><div><font face="Arial" size="2"></font> </div><div><font face="Arial" size="2"> // Load Segmented Volume<br> int N1, N2, m_Slices, m_X, m_Y, m_Z;<br> char SourcePath[256];</font></div><div><font face="Arial" size="2"></font> </div><div><font face="Arial" size="2"> vtkPNMReader *readerSegmented = vtkPNMReader::New();<br> readerSegmented->SetDataExtent(0, N1-1, 0, N2-1, 1, m_Slices);<br> readerSegmented->SetDataSpacing(m_X, m_Y, m_Z);<br> readerSegmented->SetFilePrefix (SourcePath);<br> readerSegmented->SetFilePattern("%s.%03d.pgm"); // %s is prefix, '.', then number taken from DataExtent (1, Slices).</font></div><div><font face="Arial" size="2"></font> </div><div><font face="Arial" size="2"> // Create IsoSurface<br> vtkMarchingCubes *isoSurface = vtkMarchingCubes::New();<br> isoSurface->SetInput(readerSegmented->GetOutput());<br> isoSurface->SetValue(0, 200); //you need to change this value to get the good result</font></div><div><font face="Arial" size="2"></font> </div><div><font face="Arial" size="2"> //Clean the Data<br> vtkCleanPolyData *cleaner = vtkCleanPolyData::New();<br> cleaner->SetInput(isoSurface->GetOutput());<br> <br> //Decimate the volume<br> vtkDecimatePro *deci = vtkDecimatePro::New();<br> deci->SetInput(cleaner->GetOutput());<br> deci->SetTargetReduction(0.25);<br> deci->PreserveTopologyOn();</font></div><div><font face="Arial" size="2"></font> </div><div><font face="Arial" size="2"> //Linear SubdivisionFilter to make the mesh surface more denser<br> vtkLinearSubdivisionFilter *linear = vtkLinearSubdivisionFilter::New();<br> linear->SetInput(cleaner->GetOutput());<br> int times=0; //iteration times,<span class="Apple-converted-space"> </span><br> //Each subdivision iteration create<span class="Apple-converted-space"> </span><br> //4 new triangles for each triangle in the polydata.<br> linear->SetNumberOfSubdivisions(times);</font></div><div><font face="Arial" size="2"></font> </div><div><font face="Arial" size="2"> //Smooth the volume<br> int m_SmoothIterations=20;</font></div><div><font face="Arial" size="2"></font> </div><div><font face="Arial" size="2"> vtkWindowedSincPolyDataFilter *smooth = vtkWindowedSincPolyDataFilter::New();<br> smooth->SetInput(linear->GetOutput());<br> smooth->SetNumberOfIterations(m_SmoothIterations);<br> smooth->BoundarySmoothingOn();<br> smooth->SetFeatureAngle(120);<br> smooth->SetEdgeAngle(90);<br> smooth->SetPassBand(0.01);<br> <br> //Create Normal Vectors to enhance smoothness & illumination <span class="Apple-converted-space"> </span><br> vtkPolyDataNormals *normals = vtkPolyDataNormals::New();<br> normals->SetInput(smooth->GetOutput());<br> normals->SetFeatureAngle(60.0);<br> normals->FlipNormalsOff();<br> normals->ComputePointNormalsOn();</font></div><div><font face="Arial" size="2"></font> </div><div><font face="Arial" size="2"> // Mapper<br> mapper = vtkPolyDataMapper::New();<br> mapper->ImmediateModeRenderingOn();<br> //mapper->SetInputConnection(source->GetOutputPort());<br> mapper->SetInputConnection(normals->GetOutput());<br> mapper->ScalarVisibilityOff();</font></div><div><font face="Arial" size="2"></font> </div><div><font face="Arial" size="2"> // Actor in scene<br> actor = vtkActor::New();<br> actor->SetMapper(mapper);</font></div><div><font face="Arial" size="2"></font> </div><div><font face="Arial" size="2"> // Add Actor to renderer<br> ren->AddActor(actor);</font></div><div><font face="Arial" size="2"></font> </div><div><font face="Arial" size="2"> // Reset camera<br> ren->ResetCamera();</font></div><div><font face="Arial" size="2"></font> </div><div><font face="Arial" size="2"> ren->GetRenderWindow()->Render();<br>}</font></div><div><font face="Arial" size="2"></font> </div><div><font face="Arial" size="2">void SimpleView::fileExit() {<br> qApp->exit();<br>}</font></div><div><font face="Arial" size="2">------------------------------------------------------------------------------------------------------------------------------------</font></div><div> </div><div> </div><div> </div><div> </div><div><font face="Arial" size="2">Best Wishes,<br>-----------------------------------------------------------------------------<br>Dongqing Chen, Ph.D.<br>Computer Vision & Image Processing (CVIP) Lab<br>Department of Electrical & Computer Engineering<br>Speed School of Engineering<br>University of Louisville<br>Louisville, KY, 40292<br>U.S.A<br>email:<span class="Apple-converted-space"> </span><a href="mailto:dqchen@cvip.louisville.edu">dqchen@cvip.louisville.edu</a><br>phone: 1-502-852-2789 (Lab)<br> 1-502-852-6130 (Office)<br>----------------------------------------------------------------------------</font></div>_______________________________________________<br>This is the private VTK discussion list.<br>Please keep messages on-topic. Check the FAQ at:<span class="Apple-converted-space"> </span><a href="http://www.vtk.org/Wiki/VTK_FAQ">http://www.vtk.org/Wiki/VTK_FAQ</a><br>Follow this link to subscribe/unsubscribe:<br><a href="http://www.vtk.org/mailman/listinfo/vtkusers">http://www.vtk.org/mailman/listinfo/vtkusers</a><br></div></span></blockquote></div><br></div></body></html>