Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members

mitkPolygonWidgetModel2D Class Reference

mitkPolygonWidgetModel2D - a 2D widget for displaying an arbitrary polygon in an image scene More...

#include <mitkPolygonWidgetModel2D.h>

Inherits mitkWidgetModel2D.

Inheritance diagram for mitkPolygonWidgetModel2D:

Inheritance graph
[legend]
Collaboration diagram for mitkPolygonWidgetModel2D:

Collaboration graph
[legend]
List of all members.

Public Member Functions

virtual void PrintSelf (ostream &os)
virtual int Render (mitkScene *scene)
virtual void Pick (const WidgetNames &names)
virtual void Release ()
void AddPoint (int sx, int sy)
void AddPoint (float x, float y)
void AddPoint (float point[2])
void MoveCurrentPoint (int sx, int sy)
void MoveCurrentPoint (float x, float y)
void MoveCurrentPoint (float point[2])
void SetUnitName (const string &name)
const string & GetUnitName ()
float GetArea ()
float GetPerimeter ()
bool GetCurrentPoint (float &x, float &y)
bool GetCurrentPoint (int &ix, int &iy)
int GetPointsNumber ()
bool GetPoint (int idx, float &x, float &y)
bool GetPoint (int idx, int &ix, int &iy)
virtual mitkVolumeGetRegionMask ()

Protected Member Functions

virtual void _onMouseDown (int mouseButton, bool ctrlDown, bool shiftDown, int xPos, int yPos)
virtual void _onMouseUp (int mouseButton, bool ctrlDown, bool shiftDown, int xPos, int yPos)
virtual void _onMouseMove (bool ctrlDown, bool shiftDown, int xPos, int yPos, int deltaX, int deltaY)

Detailed Description

mitkPolygonWidgetModel2D - a 2D widget for displaying an arbitrary polygon in an image scene

mitkPolygonWidgetModel2D a 2D widget for displaying an arbitrary polygon in an image scene. It can respond the mouse events and return the current area of this arbitrary polygon. It is supposed to be attached to a 2D data model (e.g. mitkImageModel) and add to a 2D scene (e.g. mitkImageScene), and in other conditions the display could be improper.


Member Function Documentation

virtual void mitkPolygonWidgetModel2D::_onMouseDown int  mouseButton,
bool  ctrlDown,
bool  shiftDown,
int  xPos,
int  yPos
[protected, virtual]
 

Deal with mouse down event.

Parameters:
mouseButton indicates which mouse button is pressed
ctrlDown indicates if the key "Ctrl" is pressed
shiftDown indicates if the key "Shift" is pressed
xPos x-coordinate of the mouse position when mouse down event occurs
yPos y-coordinate of the mouse position when mouse down event occurs

Implements mitkWidgetModel.

virtual void mitkPolygonWidgetModel2D::_onMouseMove bool  ctrlDown,
bool  shiftDown,
int  xPos,
int  yPos,
int  deltaX,
int  deltaY
[protected, virtual]
 

Deal with mouse move event.

Parameters:
ctrlDown indicates if the key "Ctrl" is pressed
shiftDown indicates if the key "Shift" is pressed
xPos x-coordinate of the mouse position when mouse move event occurs
yPos y-coordinate of the mouse position when mouse move event occurs
deltaX movement along x-axis of the mouse when mouse move event occurs
deltaY movement along y-axis of the mouse when mouse move event occurs

Implements mitkWidgetModel.

virtual void mitkPolygonWidgetModel2D::_onMouseUp int  mouseButton,
bool  ctrlDown,
bool  shiftDown,
int  xPos,
int  yPos
[protected, virtual]
 

Deal with mouse up event.

Parameters:
mouseButton indicates which mouse button was pressed and now released
ctrlDown indicates if the key "Ctrl" is pressed
shiftDown indicates if the key "Shift" is pressed
xPos x-coordinate of the mouse position when mouse up event occurs
yPos y-coordinate of the mouse position when mouse up event occurs

Implements mitkWidgetModel.

void mitkPolygonWidgetModel2D::AddPoint float  point[2]  )  [inline]
 

Add point.

Parameters:
point[0] x-coordinate of the point in object space
point[1] y-coordinate of the point in object space

void mitkPolygonWidgetModel2D::AddPoint float  x,
float  y
 

Add point.

Parameters:
x x-coordinate of the point in object space
y y-coordinate of the point in object space

void mitkPolygonWidgetModel2D::AddPoint int  sx,
int  sy
 

Add point.

Parameters:
sx x-coordinate of the point in screen space
sy y-coordinate of the point in screen space
Note:
The coordinates of the point are in the screen coordinate system. This function is useful when you can not get the original coordinates in the object space easily outside. It can do this job for you. But if this widget is attach to a data model, you must ensure the source model and the scene which contains this widget and the source model are properly set to this widget (e.g. call SetSourceModel() of this widget or call AddWidget() of the source model and SetScene() of this widget first) before calling this function, because this function needs the transform matrix of the source model and the scene to calculate the original coordinates.

float mitkPolygonWidgetModel2D::GetArea  ) 
 

Get area of this polygon.

Returns:
Return the area of this polygon.

bool mitkPolygonWidgetModel2D::GetCurrentPoint int &  ix,
int &  iy
 

Get currently picked point in the original image.

Parameters:
ix return x-coordinate of the picked point
iy return y-coordinate of the picked point
Returns:
Return false if no point was picked. Otherwise return true.

bool mitkPolygonWidgetModel2D::GetCurrentPoint float &  x,
float &  y
 

Get currently picked point in object space (affected by pixel spacing).

Parameters:
x return x-coordinate of the picked point
y return y-coordinate of the picked point
Returns:
Return false if no point was picked. Otherwise return true.

float mitkPolygonWidgetModel2D::GetPerimeter  ) 
 

Get perimeter of this polygon.

Returns:
Return the perimeter of this polygon.

bool mitkPolygonWidgetModel2D::GetPoint int  idx,
int &  ix,
int &  iy
 

Get the integral coordinates of the ith point in the original image.

Parameters:
idx the index of the point to get
ix return the x-coordinate
iy return the y-coordinate
Returns:
Return false if no such point was found, otherwise return true.

bool mitkPolygonWidgetModel2D::GetPoint int  idx,
float &  x,
float &  y
 

Get the coordinates of the ith point in object space (affected by pixel spacing).

Parameters:
idx the index of the point to get
x return the x-coordinate
y return the y-coordinate
Returns:
Return false if no such point was found, otherwise return true.

int mitkPolygonWidgetModel2D::GetPointsNumber  ) 
 

Get the number of points.

Returns:
Return the number of points.

virtual mitkVolume* mitkPolygonWidgetModel2D::GetRegionMask  )  [virtual]
 

Get mask image where the value of widget region is 255 and the rest is 0.

Returns:
Return a pointer of mitkVolume object contains the mask image.
Note:
The returned object pointer should be deleted properly by yourself.

Reimplemented from mitkWidgetModel2D.

const string& mitkPolygonWidgetModel2D::GetUnitName  )  [inline]
 

Get name string of unit.

Returns:
Return a constant reference to a string contains the name of the length unit this line uses

void mitkPolygonWidgetModel2D::MoveCurrentPoint float  point[2]  )  [inline]
 

Move current point.

Parameters:
point[0] x-coordinate of the point in object space
point[1] y-coordinate of the point in object space

void mitkPolygonWidgetModel2D::MoveCurrentPoint float  x,
float  y
 

Move current point.

Parameters:
x x-coordinate of the point in object space
y y-coordinate of the point in object space

void mitkPolygonWidgetModel2D::MoveCurrentPoint int  sx,
int  sy
 

Move current point.

Parameters:
sx x-coordinate of the point in screen space
sy y-coordinate of the point in screen space
Note:
The coordinates of the point are in the screen coordinate system. This function is useful when you can not get the original coordinates in the object space easily outside. It can do this job for you. But if this widget is attach to a data model, you must ensure the source model and the scene which contains this widget and the source model are properly set to this widget (e.g. call SetSourceModel() of this widget or call AddWidget() of the source model and SetScene() of this widget first) before calling this function, because this function needs the transform matrix of the source model and the scene to calculate the original coordinates.

virtual void mitkPolygonWidgetModel2D::Pick const WidgetNames &  names  )  [virtual]
 

Maintain the selection status when this widget is picked.

Parameters:
names a constant reference to an WidgerNames which contains the names of selected parts of this widget.

Implements mitkWidgetModel.

virtual void mitkPolygonWidgetModel2D::PrintSelf ostream &  os  )  [virtual]
 

Print the necessary information about this object for the debugging purpose.

Parameters:
os The specified ostream to output information.

Reimplemented from mitkWidgetModel2D.

virtual void mitkPolygonWidgetModel2D::Release  )  [virtual]
 

Maintain the selection status when this widget is released.

Implements mitkWidgetModel.

virtual int mitkPolygonWidgetModel2D::Render mitkScene scene  )  [virtual]
 

Render this model.

Parameters:
scene the pointer of an mitkScene in which this model will be shown
Returns:
Return 1 if this model is rendered successfully. Otherwise return 0.

Reimplemented from mitkModel.

void mitkPolygonWidgetModel2D::SetUnitName const string &  name  )  [inline]
 

Set name string of unit.

Parameters:
name a constant reference to a string contains the name of the length unit (e.g. mm) this line uses


The documentation for this class was generated from the following file:
Generated on Tue Feb 25 15:05:06 2014 for MITK (Medical Imaging ToolKit) by  doxygen 1.4.3