[vtkusers] Drawing 2D annotation on the opened image in vtk

Tanmoy M tanmoy.besu at gmail.com
Fri Jun 24 03:28:44 EDT 2011


hi everyone,

I need to draw an ellipse, circle, unilateral triangle on the image opened
in vtkRenderWindowPanel with the mouse click on the screen, i.e when I will
click mouse left button and release the button the perimeter of all the
object will be given from this points, and the drawn objects will
be intractable, i.e. size, orientation of the objects can be reduced and
increased with the mouse button. please help me to do those operations.



Drawing Circle:

                TestVTKCanvas imageCanvas=view.getVtkImageCanvas();   //
getting an instance of TestVTKCanvas
imageCanvas.vtkPanel.getIren().Disable();
 imageCanvas.vtkPanel.repaint();
imageCanvas.DrawCircle();





public void DrawCircle()
{
vtkPolyDataMapper mapper1 = new vtkPolyDataMapper();
vtkRegularPolygonSource plane = new vtkRegularPolygonSource();


plane.SetCenter(0,0,0);
plane.GeneratePolygonOff();
//  plane.SetNormal(0,0,1);
plane.SetRadius(5);
plane.SetNumberOfSides(360);
plane.Update();
mapper1.SetInputConnection(plane.GetOutputPort());
vtkActor actor1 = new vtkActor();
actor1.SetMapper(mapper1);
actor1.GetProperty().SetColor(1.0,1.0,0.0);
actor1.GetProperty().SetOpacity(0.9);

vtkPanel.GetRenderer().AddActor(actor1);

vtkPanel.getIren().Enable();
vtkPanel.repaint();
//  plane.Delete();
}



Drawing Rectangle

// getting the rectangle at the left bottom portion of the vtkPanel; can be
moved and re-sized but when I zoom and pan the image the rectangle is not
getting interacted.

public void BoxWidget() {
vtkBorderRepresentation borderRep=new vtkBorderRepresentation();
vtkBorderWidget border=new vtkBorderWidget();
border.SetCurrentRenderer(vtkPanel.GetRenderer());
border.SetDefaultRenderer(vtkPanel.GetRenderer());
border.SelectableOn();
border.SetSelectable(0);
borderRep.GetBorderProperty().SetColor(1,0,0);

border.SetRepresentation(borderRep);

 border.SetInteractor(vtkPanel.getIren());
 border.On();
vtkPanel.getIren().Enable();
vtkPanel.repaint();
 }


Drawing Ellipse

getting no code for it
-- 

                                Thanks & Regards

Tanmoy
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20110624/dde7316f/attachment.htm>


More information about the vtkusers mailing list