Display of an SLC file

Rik Rose firebird at bits.bris.ac.uk
Wed May 10 05:53:02 EDT 2000


Hi all,

I'm very new to the VTK, and to computer imaging, and I am having some
trouble with displaying an SLC file. I have been provided with an SLC
file, and told that I need to use the "Marching Cubes" technique to
display it. I have so far managed to pop up 3 run-time errors, but, since
I am new to imaging, I don't know what they mean.

Here's my code so far:

--- cut ---
#include <vtk.h>
#include <vtkMarchingCubes.h>
#include <iostream>

int main(int argc, char **argv){
        vtkRenderer *aRenderer = vtkRenderer::New();
        vtkRenderWindow *renWin = vtkRenderWindow::New();
        vtkRenderWindowInteractor *iren = \
vtkRenderWindowInteractor::New();
        vtkSLCReader *inFile = vtkSLCReader::New();
        vtkMarchingCubes *skinExtractor = vtkMarchingCubes::New();
        vtkPolyDataMapper *skinMapper = vtkPolyDataMapper::New();
        vtkActor *skin = vtkActor::New();

        renWin->AddRenderer(aRenderer);
        iren->SetRenderWindow(renWin);
        inFile->SetFileName("brainbig.vis");

        skinExtractor->SetInput(inFile->GetOutput());
        cout << skinExtractor->GetNumberOfContours() << endl;

        skinMapper->SetInput(skinExtractor->GetOutput());
        skinMapper->ScalarVisibilityOff();

        skin->SetMapper(skinMapper);

        vtkOutlineFilter *outlineData = vtkOutlineFilter::New();
        outlineData->SetInput(inFile->GetOutput());
        vtkPolyDataMapper *mapOutline = vtkPolyDataMapper::New();
        mapOutline->SetInput(outlineData->GetOutput());
        vtkActor *outline = vtkActor::New();
        outline->SetMapper(mapOutline);
        outline->GetProperty()->SetColor(0,0,0);

        vtkCamera *aCamera = vtkCamera::New();
        aCamera->SetViewUp(0,0,-1);
        aCamera->SetPosition(0,1,0);
        aCamera->SetFocalPoint(0,0,0);
        aCamera->ComputeViewPlaneNormal();

        aRenderer->AddActor(outline);
        aRenderer->AddActor(skin);
        aRenderer->SetActiveCamera(aCamera);
        aRenderer->ResetCamera();
        aCamera->Dolly(1.5);
        aRenderer->SetBackground(0,0,0);
        aRenderer->ResetCameraClippingRange();
        renWin->SetSize(300,300);
        renWin->Render();

        iren->Start();
}

--- end ---

and the Makefile I am using

--- cut ---
FLAGS = -g -O2 -fPIC -DVTK_USE_PTHREADS -D_HP_NO_FAST_MACROS \  
        -DHAVE_LIMITS_H -DHAVE_UNISTD_H -DVTK_USE_MESA
        -I/usr/local/include -I/usr/X11R6/include -I/usr/src/vtk/common \
        -I/usr/src/vtk/graphics -I/usr/src/vtk/patented \
        -I/usr/src/vtk/imaging

LINKFLAGS = /usr/src/vtk/imaging/libVTKImaging.so \
        /usr/src/vtk/graphics/libVTKGraphics.so \
        /usr/src/vtk/common/libVTKCommon.so \
        /usr/src/vtk/patented/libVTKPatented.so \
        /usr/local/lib/libMesaGL.so \
        -L /usr/X11R6/lib -ldl -lpthread -lXext -lXt -lSM -lICE -lX11 -lm

all:
        g++ ${FLAGS} -c viewer.cxx -o viewer.o

        g++ ${FLAGS} ${LINKFLAGS} viewer.o -o viewer

clean:
        rm -f viewer

--- end ---

If anyone could help me with this, I'd be grateful, as it is rather urgent
(hence I haven't got the time to go read all^H^H^Hany of the imagin books
out there.)

Thanks in advance,

Rik Rose



--------------------------------------------------------------------
This is the private VTK discussion list. Please keep messages on-topic.
Check the FAQ at: <http://public.kitware.com/cgi-bin/vtkfaq>
To UNSUBSCRIBE, send message body containing "unsubscribe vtkusers" to
<majordomo at public.kitware.com>. For help, send message body containing
"info vtkusers" to the same address.
--------------------------------------------------------------------



More information about the vtkusers mailing list