<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content="text/html; charset=gb2312" http-equiv=Content-Type>
<META content="MSHTML 5.00.2920.0" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV>&nbsp;</DIV>
<DIV style="FONT: 9pt ËÎÌå">----- Original Message ----- 
<DIV style="BACKGROUND: #e4e4e4; font-color: black"><B>From:</B> <A 
href="mailto:clyao@cugb.edu.cn" title=clyao@cugb.edu.cn>cly</A> </DIV>
<DIV><B>To:</B> <A href="mailto:vtkusers@public.kitware.com" 
title=vtkusers@public.kitware.com>vtkusers@public.kitware.com</A> </DIV>
<DIV><B>Sent:</B> Friday, March 29, 2002 5:50 PM</DIV>
<DIV><B>Subject:</B> What's wrong with the code?</DIV></DIV>
<DIV><BR></DIV>
<DIV><FONT size=2>
<DIV><FONT size=2>Hi,<BR><BR>The following codes was the exact example in the 
vtk book(1998), but I got different results, which I think it were wrong, and 
have attatched as a series pictures. (I failed twice as a whole picture for its 
size.)<BR>I changed with many values of isosurfaces, tried to find a smooth 
'real' skin of the head, but failed at last.<BR><BR>Someone can help.<BR>Many 
thanks in advance,<BR><BR>Changli, Yao<BR><BR><BR>/* the program in the book ia 
as these:*/<BR><BR><A href="file://include">//include</A> class 
definitions<BR>#include "vtkRenderer.h"<BR>#include 
"vtkRenderWindow.h"<BR>#include "vtkRenderWindowInteractor.h"<BR>#include 
"vtkVolume16Reader.h"<BR>#include "vtkPolyDataMapper.h"<BR>#include 
"vtkActor.h"<BR>#include "vtkOutlineFilter.h"<BR>#include 
"vtkCamera.h"<BR>#include "../patented/vtkMarchingCubes.h"<BR>void 
main(void)<BR>{<BR><A href="file://create">//create</A> the renderer 
stuff<BR>&nbsp;vtkRenderer *aRenderer = 
vtkRenderer::New();<BR>&nbsp;vtkRenderWindow *renWin = 
vtkRenderWindow::New();<BR>&nbsp;renWin-&gt;AddRenderer(aRenderer);<BR>&nbsp;vtkRenderWindowInteractor 
*iren = 
vtkRenderWindowInteractor::New();<BR>&nbsp;iren-&gt;SetRenderWindow(renWin);<BR>&nbsp;<A 
href="file://read">//read</A> the volume<BR>&nbsp;vtkVolume16Reader *v16 = 
vtkVolume16Reader::New();<BR>&nbsp;v16-&gt;SetDataDimensions(64,64);<BR>&nbsp;v16-&gt;SwapBytesOn();<BR>&nbsp;v16-&gt;SetFilePrefix("headsq/quarter");<BR>&nbsp;v16-&gt;SetImageRange(1, 
93);<BR>&nbsp;v16-&gt;SetDataSpacing(3.2,3.2,1.5);<BR>&nbsp;<A 
href="file://extract">//extract</A> the skin<BR>&nbsp;vtkMarchingCubes 
*skinExtractor = 
vtkMarchingCubes::New();<BR>&nbsp;skinExtractor-&gt;SetInput(v16-&gt;GetOutput());<BR>&nbsp;skinExtractor-&gt;SetValue(0, 
500);//or (0, 5000),(0, 10000),(0, 40000),(0, 
50000),(0,60000)<BR>&nbsp;vtkPolyDataMapper* skinMapper = 
vtkPolyDataMapper::New();<BR>&nbsp;skinMapper-&gt;SetInput(skinExtractor-&gt;GetOutput());<BR>&nbsp;skinMapper-&gt;ScalarVisibilityOff();<BR>&nbsp;vtkActor 
*skin = vtkActor::New();<BR>&nbsp;skin-&gt;SetMapper(skinMapper);<BR>&nbsp;<A 
href="file://get">//get</A> an outline<BR>&nbsp;vtkOutlineFilter *outLineData = 
vtkOutlineFilter::New();<BR>&nbsp;outLineData-&gt;SetInput(v16-&gt;GetOutput());<BR>&nbsp;vtkPolyDataMapper* 
mapOutline = 
vtkPolyDataMapper::New();<BR>&nbsp;mapOutline-&gt;SetInput(outLineData-&gt;GetOutput());<BR>&nbsp;vtkActor 
*outline = 
vtkActor::New();<BR>&nbsp;outline-&gt;SetMapper(mapOutline);<BR>&nbsp;outline-&gt;GetProperty()-&gt;SetColor(0,0,0);<BR>&nbsp;<A 
href="file://create">//create</A> a camera with the correct view 
up<BR>&nbsp;vtkCamera * aCamera = 
vtkCamera::New();<BR>&nbsp;aCamera-&gt;SetViewUp(0,0,-1);<BR>&nbsp;aCamera-&gt;SetPosition(0,1,0);<BR>&nbsp;aCamera-&gt;SetFocalPoint(0,0,0);<BR>&nbsp;aCamera-&gt;ComputeViewPlaneNormal();<BR>&nbsp;<A 
href="file://tell">//tell</A> the renderer our camera and 
actors<BR>&nbsp;aRenderer-&gt;AddActor(outline);<BR>&nbsp;aRenderer-&gt;AddActor(skin);<BR>&nbsp;aRenderer-&gt;SetActiveCamera(aCamera);<BR>&nbsp;aRenderer-&gt;ResetCamera();<BR>&nbsp;aRenderer-&gt;SetBackground(1,1,1);<BR>&nbsp;<A 
href="file://interact">//interact</A> with 
data<BR>&nbsp;renWin-&gt;Render();<BR>&nbsp;iren-&gt;Start();<BR>}<BR></FONT></DIV></FONT></DIV></BODY></HTML>