[vtkusers] Adding actors to vtkImageViewer2

Daniele Domenichelli daniele.domenichelli at gmail.com
Tue Feb 5 12:34:14 EST 2008


I'm porting my application (that I developed on linux) on windows.

I have a vtkImageViewer2* with an image and i add a vtkActor* with
colored a bounding box of the image (see below for a snippet taken
from code).

On linux it works:

On windows I see only some lines of the box:

If I change the zoom of the image, sometimes i see all the lines,
sometimes only vertical or horizzontal lines (always both lines) and
sometimes I can't see any.

Is this a bug or am I doing something wrong?

Daniele Domenichelli


vtkActor* MainWidget::boxActor ( vtkImageData* input )
  vtkOutlineFilter *outline = vtkOutlineFilter::New();
  outline->SetInput ( input );
  vtkPolyDataMapper *outlineMapper = vtkPolyDataMapper::New();
  outlineMapper->SetInput ( outline->GetOutput() );
  vtkActor *outlineActor = vtkActor::New();
  outlineActor->SetMapper ( outlineMapper );
  return outlineActor;

vtkImageReslice* ImageReslice;
vtkImageViewer* ImageViewer;
QVTKRenderingWidget* RenderingWidget;
vtkActor* OutlineActor;


ImageViewer->SetInputConnection( ImageReslice->GetOutputPort() );
RenderingWidget->SetRenderWindow ( ImageViewer->GetRenderWindow() );
ImageViewer->SetupInteractor (
RenderingWidget->GetRenderWindow()->GetInteractor() );

OutlineActor = boxActor ( ImageViewer->GetImageActor()->GetInput() );
OutlineActor->GetProperty()->SetColor ( 1.0, 0.0, 0.0 );
ImageViewer->GetRenderer()->AddActor ( OutlineActor );


More information about the vtkusers mailing list