<!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> </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> vtkRenderer *aRenderer =
vtkRenderer::New();<BR> vtkRenderWindow *renWin =
vtkRenderWindow::New();<BR> renWin->AddRenderer(aRenderer);<BR> vtkRenderWindowInteractor
*iren =
vtkRenderWindowInteractor::New();<BR> iren->SetRenderWindow(renWin);<BR> <A
href="file://read">//read</A> the volume<BR> vtkVolume16Reader *v16 =
vtkVolume16Reader::New();<BR> v16->SetDataDimensions(64,64);<BR> v16->SwapBytesOn();<BR> v16->SetFilePrefix("headsq/quarter");<BR> v16->SetImageRange(1,
93);<BR> v16->SetDataSpacing(3.2,3.2,1.5);<BR> <A
href="file://extract">//extract</A> the skin<BR> vtkMarchingCubes
*skinExtractor =
vtkMarchingCubes::New();<BR> skinExtractor->SetInput(v16->GetOutput());<BR> skinExtractor->SetValue(0,
500);//or (0, 5000),(0, 10000),(0, 40000),(0,
50000),(0,60000)<BR> vtkPolyDataMapper* skinMapper =
vtkPolyDataMapper::New();<BR> skinMapper->SetInput(skinExtractor->GetOutput());<BR> skinMapper->ScalarVisibilityOff();<BR> vtkActor
*skin = vtkActor::New();<BR> skin->SetMapper(skinMapper);<BR> <A
href="file://get">//get</A> an outline<BR> vtkOutlineFilter *outLineData =
vtkOutlineFilter::New();<BR> outLineData->SetInput(v16->GetOutput());<BR> vtkPolyDataMapper*
mapOutline =
vtkPolyDataMapper::New();<BR> mapOutline->SetInput(outLineData->GetOutput());<BR> vtkActor
*outline =
vtkActor::New();<BR> outline->SetMapper(mapOutline);<BR> outline->GetProperty()->SetColor(0,0,0);<BR> <A
href="file://create">//create</A> a camera with the correct view
up<BR> vtkCamera * aCamera =
vtkCamera::New();<BR> aCamera->SetViewUp(0,0,-1);<BR> aCamera->SetPosition(0,1,0);<BR> aCamera->SetFocalPoint(0,0,0);<BR> aCamera->ComputeViewPlaneNormal();<BR> <A
href="file://tell">//tell</A> the renderer our camera and
actors<BR> aRenderer->AddActor(outline);<BR> aRenderer->AddActor(skin);<BR> aRenderer->SetActiveCamera(aCamera);<BR> aRenderer->ResetCamera();<BR> aRenderer->SetBackground(1,1,1);<BR> <A
href="file://interact">//interact</A> with
data<BR> renWin->Render();<BR> iren->Start();<BR>}<BR></FONT></DIV></FONT></DIV></BODY></HTML>