[vtkusers] vtkimagereader good working example in C?
sbe
sbe at harfangmicro.com
Wed Jan 22 14:36:30 EST 2003
Hi,
Any help is greatly appreciate. Thank you!
I have so much problem making work a good example for raw data display, I have tried many and this is the last one I have tried and it shows nothing? what's wrong with that? I'm using the data example of the head provides by vtk data examples, I have put all the files in the same directory as the executable!
vtkRenderer *ren = vtkRenderer::New();
vtkRenderWindow *ren_win = vtkRenderWindow::New();
ren_win->AddRenderer(ren);
vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();
iren->SetRenderWindow(ren_win);
// read the volume
vtkImageReader *reader = vtkImageReader::New();
reader->SetDataExtent(0, 63, 0, 63, 1, 93);
reader->SetDataByteOrderToLittleEndian();
reader->SetFilePrefix("quarter");
reader->SetDataSpacing(3.2, 3.2, 1.5);
reader->SetDataScalarTypeToUnsignedShort();
// extract the skin
vtkContourFilter *skin_extractor = vtkContourFilter::New();
skin_extractor->SetInput(reader->GetOutput());
skin_extractor->SetValue(0, 500);
vtkPolyDataMapper *skin_mapper = vtkPolyDataMapper::New();
skin_mapper->SetInput(skin_extractor->GetOutput());
skin_mapper->ScalarVisibilityOff();
vtkActor *skin_actor = vtkActor::New();
skin_actor->SetMapper(skin_mapper);
// create the outline
vtkOutlineFilter *outline = vtkOutlineFilter::New();
outline->SetInput(reader->GetOutput());
vtkPolyDataMapper *outline_mapper = vtkPolyDataMapper::New();
outline_mapper->SetInput(outline->GetOutput());
vtkActor *outline_actor = vtkActor::New();
outline_actor->SetMapper(outline_mapper);
outline_actor->GetProperty()->SetColor(1, 1, 1);
// now, tell the renderer our actors
ren->AddActor(outline_actor);
ren->AddActor(skin_actor);
ren->ResetCamera();
ren_win->SetSize(300, 300);
iren->Start();
Serge Béland
Responsable produit, station d'analyse
tél: (418) 683-6222 poste 202
1-866-HARFANG
fax:(418) 683-7032
http://www.harfangmicro.com
HARFANG Microtechniques inc.
420 Boul. Charest Est Suite 200
Quebec (Que)
G1K 8M4
Canada
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20030122/b9bd94ad/attachment.htm>
More information about the vtkusers
mailing list