<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&nbsp;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>&nbsp;</div><div><font face="Arial" size="2">&nbsp;&nbsp; During the past two days, I got really nice from this group list and&nbsp;finally installed the VTK 5.2 (upgraded from VTK 5.0) and QT 4.4.</font></div><div><font face="Arial" size="2"></font>&nbsp;</div><div><font face="Arial" size="2">&nbsp; 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>&nbsp;</div><div><font face="Arial" size="2">&nbsp;Now, I copy and paste some simple codes from my previous program,, which&nbsp;worked very well under VTK 5.0.</font></div><div>&nbsp;</div><div><font face="Arial" size="2">&nbsp; But I do not know why&nbsp;those two problems&nbsp;appeared. Any hint or clue should be&nbsp;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>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 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">&nbsp;</span><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.</font></div><div><font face="Arial" size="2"></font>&nbsp;</div><div><font face="Arial" size="2">The first error refers to&nbsp; 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>&nbsp; // Geometry<br>&nbsp; //source = vtkCylinderSource::New();</font></div><div><font face="Arial" size="2"></font>&nbsp;</div><div><font face="Arial" size="2">&nbsp; //starting from here, modified by Dongqing Chen,<span class="Apple-converted-space">&nbsp;</span><br>&nbsp;//load in pgm firstly, then dicom&nbsp;</font></div><div><font face="Arial" size="2"></font>&nbsp;</div><div><font face="Arial" size="2">&nbsp;// Load&nbsp; Segmented Volume<br>&nbsp;&nbsp;&nbsp; int N1, N2, m_Slices, m_X, m_Y, m_Z;<br>&nbsp;char SourcePath[256];</font></div><div><font face="Arial" size="2"></font>&nbsp;</div><div><font face="Arial" size="2">&nbsp;vtkPNMReader *readerSegmented = vtkPNMReader::New();<br>&nbsp;&nbsp;&nbsp; readerSegmented->SetDataExtent(0, N1-1, 0, N2-1, 1, m_Slices);<br>&nbsp;readerSegmented->SetDataSpacing(m_X, m_Y, m_Z);<br>&nbsp;&nbsp;&nbsp; readerSegmented->SetFilePrefix (SourcePath);<br>&nbsp;&nbsp;&nbsp; readerSegmented->SetFilePattern("%s.%03d.pgm");&nbsp; // %s is prefix, '.', then number taken from DataExtent (1, Slices).</font></div><div><font face="Arial" size="2"></font>&nbsp;</div><div><font face="Arial" size="2">&nbsp;&nbsp;&nbsp; // Create IsoSurface<br>&nbsp;&nbsp;&nbsp; vtkMarchingCubes *isoSurface = vtkMarchingCubes::New();<br>&nbsp;isoSurface->SetInput(readerSegmented->GetOutput());<br>&nbsp;isoSurface->SetValue(0, 200); //you need to change this value to get the good result</font></div><div><font face="Arial" size="2"></font>&nbsp;</div><div><font face="Arial" size="2">&nbsp;&nbsp; //Clean the Data<br>&nbsp;&nbsp;&nbsp; vtkCleanPolyData *cleaner = vtkCleanPolyData::New();<br>&nbsp;&nbsp;&nbsp; cleaner->SetInput(isoSurface->GetOutput());<br>&nbsp;<br>&nbsp;&nbsp;&nbsp; //Decimate the volume<br>&nbsp;&nbsp;&nbsp; vtkDecimatePro *deci = vtkDecimatePro::New();<br>&nbsp;&nbsp;&nbsp; deci->SetInput(cleaner->GetOutput());<br>&nbsp;&nbsp;&nbsp; deci->SetTargetReduction(0.25);<br>&nbsp;deci->PreserveTopologyOn();</font></div><div><font face="Arial" size="2"></font>&nbsp;</div><div><font face="Arial" size="2">&nbsp;//Linear SubdivisionFilter to make the mesh surface more denser<br>&nbsp;&nbsp;&nbsp; vtkLinearSubdivisionFilter *linear = vtkLinearSubdivisionFilter::New();<br>&nbsp;&nbsp;&nbsp; linear->SetInput(cleaner->GetOutput());<br>&nbsp;int times=0; //iteration times,<span class="Apple-converted-space">&nbsp;</span><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //Each subdivision iteration create<span class="Apple-converted-space">&nbsp;</span><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //4 new triangles for each triangle in the polydata.<br>&nbsp;&nbsp;&nbsp; linear->SetNumberOfSubdivisions(times);</font></div><div><font face="Arial" size="2"></font>&nbsp;</div><div><font face="Arial" size="2">&nbsp; &nbsp;//Smooth the volume<br>&nbsp;int m_SmoothIterations=20;</font></div><div><font face="Arial" size="2"></font>&nbsp;</div><div><font face="Arial" size="2">&nbsp;vtkWindowedSincPolyDataFilter *smooth = vtkWindowedSincPolyDataFilter::New();<br>&nbsp;&nbsp;&nbsp; smooth->SetInput(linear->GetOutput());<br>&nbsp;&nbsp;&nbsp; smooth->SetNumberOfIterations(m_SmoothIterations);<br>&nbsp;&nbsp;&nbsp; smooth->BoundarySmoothingOn();<br>&nbsp;&nbsp;&nbsp; smooth->SetFeatureAngle(120);<br>&nbsp;&nbsp;&nbsp; smooth->SetEdgeAngle(90);<br>&nbsp;&nbsp;&nbsp; smooth->SetPassBand(0.01);<br>&nbsp;<br>&nbsp;&nbsp;//Create Normal Vectors to enhance smoothness &amp; illumination&nbsp;&nbsp;&nbsp;<span class="Apple-converted-space">&nbsp;</span><br>&nbsp;&nbsp;&nbsp; vtkPolyDataNormals *normals = vtkPolyDataNormals::New();<br>&nbsp;&nbsp;&nbsp; normals->SetInput(smooth->GetOutput());<br>&nbsp;normals->SetFeatureAngle(60.0);<br>&nbsp;&nbsp;&nbsp; normals->FlipNormalsOff();<br>&nbsp;&nbsp;&nbsp; normals->ComputePointNormalsOn();</font></div><div><font face="Arial" size="2"></font>&nbsp;</div><div><font face="Arial" size="2">&nbsp; // Mapper<br>&nbsp; mapper = vtkPolyDataMapper::New();<br>&nbsp; mapper->ImmediateModeRenderingOn();<br>&nbsp; //mapper->SetInputConnection(source->GetOutputPort());<br>&nbsp; mapper->SetInputConnection(normals->GetOutput());<br>&nbsp; mapper->ScalarVisibilityOff();</font></div><div><font face="Arial" size="2"></font>&nbsp;</div><div><font face="Arial" size="2">&nbsp; // Actor in scene<br>&nbsp; actor = vtkActor::New();<br>&nbsp; actor->SetMapper(mapper);</font></div><div><font face="Arial" size="2"></font>&nbsp;</div><div><font face="Arial" size="2">&nbsp; // Add Actor to renderer<br>&nbsp; ren->AddActor(actor);</font></div><div><font face="Arial" size="2"></font>&nbsp;</div><div><font face="Arial" size="2">&nbsp; // Reset camera<br>&nbsp; ren->ResetCamera();</font></div><div><font face="Arial" size="2"></font>&nbsp;</div><div><font face="Arial" size="2">&nbsp; ren->GetRenderWindow()->Render();<br>}</font></div><div><font face="Arial" size="2"></font>&nbsp;</div><div><font face="Arial" size="2">void SimpleView::fileExit() {<br>&nbsp; qApp->exit();<br>}</font></div><div><font face="Arial" size="2">------------------------------------------------------------------------------------------------------------------------------------</font></div><div>&nbsp;</div><div>&nbsp;</div><div>&nbsp;</div><div>&nbsp;</div><div><font face="Arial" size="2">Best Wishes,<br>-----------------------------------------------------------------------------<br>Dongqing Chen, Ph.D.<br>Computer Vision &amp; Image Processing (CVIP) Lab<br>Department of Electrical &amp; 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">&nbsp;</span><a href="mailto:dqchen@cvip.louisville.edu">dqchen@cvip.louisville.edu</a><br>phone: 1-502-852-2789 (Lab)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 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">&nbsp;</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>