[vtkusers] Fw: What's wrong with the code?
cly
clyao at cugb.edu.cn
Fri Mar 29 09:05:37 EST 2002
Hi, Lorenson,
Thank you very much! it works now.
Best Regards,
Changli, Yao
----- Original Message -----
From: "Lorensen, William E (CRD)" <lorensen at crd.ge.com>
To: "'cly'" <clyao at cugb.edu.cn>; <vtkusers at public.kitware.com>
Sent: Friday, March 29, 2002 8:30 PM
Subject: RE: [vtkusers] Fw: What's wrong with the code?
> I'm guessing you are running on an Intel processor.
>
> Try changing
> v16->SwapBytesOn();
> to
> v16->SetDataByteOrderToLittleEndian();
>
> This will make the reader decide whether or not to swap the bytes.
>
> Bill
>
> -----Original Message-----
> From: cly [mailto:clyao at cugb.edu.cn]
> Sent: Friday, March 29, 2002 4:53 AM
> To: vtkusers at public.kitware.com
> Subject: [vtkusers] Fw: What's wrong with the code?
>
>
>
> ----- Original Message -----
> From: cly <mailto:clyao at cugb.edu.cn>
> To: vtkusers at public.kitware.com <mailto:vtkusers at public.kitware.com>
> Sent: Friday, March 29, 2002 5:50 PM
> Subject: What's wrong with the code?
>
>
> Hi,
>
> 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.)
> I changed with many values of isosurfaces, tried to find a smooth 'real' skin of the head, but failed
> at last.
>
> Someone can help.
> Many thanks in advance,
>
> Changli, Yao
>
>
> /* the program in the book ia as these:*/
>
> file://include <file://include> class definitions
> #include "vtkRenderer.h"
> #include "vtkRenderWindow.h"
> #include "vtkRenderWindowInteractor.h"
> #include "vtkVolume16Reader.h"
> #include "vtkPolyDataMapper.h"
> #include "vtkActor.h"
> #include "vtkOutlineFilter.h"
> #include "vtkCamera.h"
> #include "../patented/vtkMarchingCubes.h"
> void main(void)
> {
> file://create <file://create> the renderer stuff
> vtkRenderer *aRenderer = vtkRenderer::New();
> vtkRenderWindow *renWin = vtkRenderWindow::New();
> renWin->AddRenderer(aRenderer);
> vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();
> iren->SetRenderWindow(renWin);
> file://read <file://read> the volume
> vtkVolume16Reader *v16 = vtkVolume16Reader::New();
> v16->SetDataDimensions(64,64);
> v16->SwapBytesOn();
> v16->SetFilePrefix("headsq/quarter");
> v16->SetImageRange(1, 93);
> v16->SetDataSpacing(3.2,3.2,1.5);
> file://extract <file://extract> the skin
> vtkMarchingCubes *skinExtractor = vtkMarchingCubes::New();
> skinExtractor->SetInput(v16->GetOutput());
> skinExtractor->SetValue(0, 500);//or (0, 5000),(0, 10000),(0, 40000),(0, 50000),(0,60000)
> vtkPolyDataMapper* skinMapper = vtkPolyDataMapper::New();
> skinMapper->SetInput(skinExtractor->GetOutput());
> skinMapper->ScalarVisibilityOff();
> vtkActor *skin = vtkActor::New();
> skin->SetMapper(skinMapper);
> file://get <file://get> an outline
> vtkOutlineFilter *outLineData = vtkOutlineFilter::New();
> outLineData->SetInput(v16->GetOutput());
> vtkPolyDataMapper* mapOutline = vtkPolyDataMapper::New();
> mapOutline->SetInput(outLineData->GetOutput());
> vtkActor *outline = vtkActor::New();
> outline->SetMapper(mapOutline);
> outline->GetProperty()->SetColor(0,0,0);
> file://create <file://create> a camera with the correct view up
> vtkCamera * aCamera = vtkCamera::New();
> aCamera->SetViewUp(0,0,-1);
> aCamera->SetPosition(0,1,0);
> aCamera->SetFocalPoint(0,0,0);
> aCamera->ComputeViewPlaneNormal();
> file://tell <file://tell> the renderer our camera and actors
> aRenderer->AddActor(outline);
> aRenderer->AddActor(skin);
> aRenderer->SetActiveCamera(aCamera);
> aRenderer->ResetCamera();
> aRenderer->SetBackground(1,1,1);
> file://interact <file://interact> with data
> renWin->Render();
> iren->Start();
> }
>
>
> _______________________________________________
> This is the private VTK discussion list.
> Please keep messages on-topic. Check the FAQ at: <http://public.kitware.com/cgi-bin/vtkfaq>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/vtkusers
>
More information about the vtkusers
mailing list