[vtkusers] RE: build the first VTK application

Steven Chen itkvtk at yahoo.com
Wed Dec 31 15:59:12 EST 2003


Hi, all
 
I want to display a bone image(vtk format) in the screen, so i create a bone.cpp file, the code is as follows:
***********************************************

#include "vtkPolyReader.h"

#include "vtkPolyDataMapper.h"

#include "vtkActor.h"

#include "vtkRenderWindow.h"

#include "vtkRenderer.h"

#include "vtkRenderWindowInteractor.h"

void main ()

{



vtkPolyDataReader *reader = vtkPolyDataReader::New();

reader->setFileName("z:/Cisc499/image.vtk);



// map to graphics library

vtkPolyDataMapper *map = vtkPolyDataMapper::New();

map->SetInput(reader->GetOutput());

// actor coordinates geometry, properties, transformation

vtkActor *aBone = vtkActor::New();

aBone->SetMapper(map);

aBone->GetProperty()->SetColor(0,0,1); // sphere color blue

// a renderer and render window

vtkRenderer *ren1 = vtkRenderer::New();

vtkRenderWindow *renWin = vtkRenderWindow::New();

renWin->AddRenderer(ren1);

// an interactor

vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();

iren->SetRenderWindow(renWin);

// add the actor to the scene

ren1->AddActor(aBone);

ren1->SetBackground(1,1,1); // Background color white

// render an image (lights and cameras are created automatically)

renWin->Render();

// begin mouse interaction

iren->Start();

}


************************** end of code

Then i donot know what to do next. Do i have to write a CMakeLists.txt in the same folder(I reallyd donot know how to write CMakeLists.txt for this bone.cpp) or build this bone.cpp directly? or do i have to specify the .h files locaition? and how?

 

By the way, i have already build VTK_Binary and examples.

Thanks for your help

Happy New Years!!

Steven 


---------------------------------
Do you Yahoo!?
Find out what made the Top Yahoo! Searches of 2003
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20031231/ddd2b6b0/attachment.htm>


More information about the vtkusers mailing list