[vtkusers] Adding actors to vtkImageViewer2

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


Hello,

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:
http://img513.imageshack.us/img513/8989/linuxoa0.jpg

On windows I see only some lines of the box:
http://img524.imageshack.us/img524/9315/windowsws7.jpg

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?


Regards,
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 );
  outline->Delete();
  outlineMapper->Delete();
  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 );

ImageViewer->GetRenderer()->ResetCamera();



More information about the vtkusers mailing list