<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.6000.16735" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY 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 *' <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, <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,
<BR>
//Each subdivision iteration create
<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
<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: <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></BODY></HTML>