[vtkusers] Re: Mesa / VTK problems
Dave Reed
dreed at capital.edu
Wed Nov 21 16:39:37 EST 2001
I don't know tcl, but here's a simple C++ example (for VTK4.0) that
shows the problem if anyone wants to convert it.
#include <string>
#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 "vtkContourFilter.h"
#include <vtkStripper.h>
#include "SaveImage.h"
int main( int argc, char *argv[] )
{
char *c = getenv("VTK_DATA");
string vtk_data;
if (c != NULL) {
vtk_data = string(c);
}
else {
vtk_data = "";
}
string filename = vtk_data + string("/headsq/quarter");
// create the renderer stuff
vtkRenderer *aRenderer = vtkRenderer::New();
vtkRenderWindow *renWin = vtkRenderWindow::New();
renWin->AddRenderer(aRenderer);
vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();
iren->SetRenderWindow(renWin);
// read the volume
vtkVolume16Reader *v16 = vtkVolume16Reader::New();
v16->SetDataDimensions(64,64);
v16->SetDataByteOrderToLittleEndian();
v16->SetFilePrefix (filename.c_str());
v16->SetImageRange(1, 93);
v16->SetDataSpacing (3.2, 3.2, 1.5);
// extract the skin
vtkContourFilter *skinExtractor = vtkContourFilter::New();
skinExtractor->SetInput(v16->GetOutput());
skinExtractor->SetValue(0, 500);
vtkStripper *stripper = vtkStripper::New();
stripper->SetInput(skinExtractor->GetOutput());
vtkPolyDataMapper *skinMapper = vtkPolyDataMapper::New();
skinMapper->SetInput(stripper->GetOutput());
skinMapper->ScalarVisibilityOff();
skinMapper->ImmediateModeRenderingOn();
vtkActor *skin = vtkActor::New();
skin->SetMapper(skinMapper);
// get an outline
vtkOutlineFilter *outlineData = vtkOutlineFilter::New();
outlineData->SetInput(v16->GetOutput());
vtkPolyDataMapper *mapOutline = vtkPolyDataMapper::New();
mapOutline->ImmediateModeRenderingOn();
mapOutline->SetInput(outlineData->GetOutput());
vtkActor *outline = vtkActor::New();
outline->SetMapper(mapOutline);
outline->GetProperty()->SetColor(0,0,0);
// 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();
// now, tell the renderer our actors
aRenderer->AddActor(outline);
aRenderer->AddActor(skin);
aRenderer->SetActiveCamera(aCamera);
aRenderer->ResetCamera ();
aCamera->Dolly(1.5);
aRenderer->SetBackground(1,1,1);
aRenderer->ResetCameraClippingRange();
// interact with data
renWin->SetSize( 300, 300);
renWin->Render();
iren->Start();
}
Dave
> X-Sender: billlist at pop.nycap.rr.com
> From: "William A. Hoffman" <billlist at nycap.rr.com>
>
> Can someone check in a tcl script that shows this problem as a VTK test?
> We run a nightly build of both VTK and Mesa from cvs. Right now all the
> tests are
> passing.
>
> -Bill
>
>
> At 12:42 PM 11/21/2001 -0700, Brian Paul wrote:
> >Prabhu Ramachandran wrote:
> > >
> > > >>>>> "BP" == Brian Paul <brian_e_paul at yahoo.com> writes:
> >
> > > This will show you missing polygons above the lip and below the nose.
> > >
> > > I also see random disappearance of actors
> >
> >What is an "actor"?
> >
> >
> > > at times with some of my
> > > Python scripts but am unable to replicate it. Will let you know when
> > > I am able to get a repeatable error.
> > >
> > > BP> I'm building from the vtk32-src-unix.tgz source archive but I
> > > BP> have no idea where to get the (non-RPM) "data files" from.
> > >
> > > Go to http://public.kitware.com/VTK/get-software.php and grab the data
> > > files there the files are of the form: vtk20data.part*
> >
> >Is there a mirror ftp from which I can get these files? The kitware
> >ftp site has been _really_ slow (1KB/s).
> >
> >-Brian
> >
> >Do You Yahoo!?
> >Get your free @yahoo.com address at http://mail.yahoo.com
> >
> >Please keep messages on-topic. Check the FAQ at:
> ><http://public.kitware.com/cgi-bin/vtkfaq>
>
>
>
More information about the vtkusers
mailing list