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

mitkEllipseWidgetModel2D Class Reference

mitkEllipseWidgetModel2D - an ellipse widget used in 2D scenes More...

#include <mitkEllipseWidgetModel2D.h>

Inherits mitkWidgetModel2D.

Inheritance diagram for mitkEllipseWidgetModel2D:

Inheritance graph
[legend]
Collaboration diagram for mitkEllipseWidgetModel2D:

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 SetCenterPoint (int scx, int scy)
void SetCenterPoint (float cx, float cy)
void SetCenterPoint (float p[2])
void SetRadius (float xr, float yr)
void SetRadius (float r)
void SetStartPoint (float point[2])
void SetStartPoint (float x, float y)
void SetStartPoint (int sx, int sy)
void SetMovePoint (float point[2])
void SetMovePoint (float x, float y)
void SetMovePoint (int sx, int sy)
void SetEndPoint (float point[2])
void SetEndPoint (float x, float y)
void SetEndPoint (int sx, int sy)
void SetUnitName (const string &name)
const string & GetUnitName ()
float GetArea ()
float GetPerimeter ()
void GetCenterPoint (float &tx, float &ty)
void GetCenterPoint (int &ix, int &iy)
void GetSemiMajorMinorAxis (float &ta, float &tb)
void GetSemiMajorMinorAxis (int &a, int &b)
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

mitkEllipseWidgetModel2D - an ellipse widget used in 2D scenes

mitkEllipseWidgetModel2D is an ellipse widget used in 2D scenes which can respond the mouse events to change its statuses and return the information about itself (e.g. center coordinates, area ...). It is supposed to be attached to a 2D data model (e.g. mitkImageModel) and add to a 2D scene (e.g. mitkImageScene), or the display could be improper.


Member Function Documentation

virtual void mitkEllipseWidgetModel2D::_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 mitkEllipseWidgetModel2D::_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 mitkEllipseWidgetModel2D::_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.

float mitkEllipseWidgetModel2D::GetArea  ) 
 

Get area of this ellipse.

Returns:
Return the area of this ellipse.

void mitkEllipseWidgetModel2D::GetCenterPoint int &  ix,
int &  iy
 

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

Parameters:
ix return the x-coordinate of the center point
iy return the y-coordinate of the center point

void mitkEllipseWidgetModel2D::GetCenterPoint float &  tx,
float &  ty
 

Get the physical coordinates in the object space of the center point.

Parameters:
tx return the x-coordinate of the center point
ty return the y-coordinate of the center point

float mitkEllipseWidgetModel2D::GetPerimeter  ) 
 

Get the perimeter of the ellipse.

Returns:
Return the perimeter of the ellipse.
Note:
The return value is an approximation. It is calculated by the following formula:

\[\pi(a+b)\frac{64-3\lambda^4}{64-16\lambda^2}\]


where

\[\lambda=\frac{a-b}{a+b}\]

$a$ is the semimajor axis, $b$ is the semiminor axis.

virtual mitkVolume* mitkEllipseWidgetModel2D::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.

void mitkEllipseWidgetModel2D::GetSemiMajorMinorAxis int &  a,
int &  b
 

Get the integral length of the semimajor and minor axis in the original image.

Parameters:
a return the semimajor axis
b return the semiminor axis
Note:
a is always greater than b.

void mitkEllipseWidgetModel2D::GetSemiMajorMinorAxis float &  ta,
float &  tb
 

Get the physical length of the semimajor and minor axis in the object space.

Parameters:
ta return the semimajor axis
tb return the semiminor axis
Note:
ta is always greater than tb.

const string& mitkEllipseWidgetModel2D::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

virtual void mitkEllipseWidgetModel2D::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 mitkEllipseWidgetModel2D::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 mitkEllipseWidgetModel2D::Release  )  [virtual]
 

Maintain the selection status when this widget is released.

Implements mitkWidgetModel.

virtual int mitkEllipseWidgetModel2D::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 mitkEllipseWidgetModel2D::SetCenterPoint float  p[2]  )  [inline]
 

Set the center point of this ellipse in object space.

Parameters:
p[0] x-coordinate of the center point
p[1] y-coordinate of the center point

void mitkEllipseWidgetModel2D::SetCenterPoint float  cx,
float  cy
[inline]
 

Set the center point of this ellipse in object space.

Parameters:
cx x-coordinate of the center point
cy y-coordinate of the center point

void mitkEllipseWidgetModel2D::SetCenterPoint int  scx,
int  scy
[inline]
 

Set the center point of this ellipse.

Parameters:
scx x-coordinate of this point on screen
scy y-coordinate of this point on screen
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.

void mitkEllipseWidgetModel2D::SetEndPoint int  sx,
int  sy
[inline]
 

Set position of the end point.

Parameters:
sx x-coordinate of the end point of mouse dragging on screen
sy y-coordinate of the end point of mouse dragging on screen
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.

void mitkEllipseWidgetModel2D::SetEndPoint float  x,
float  y
[inline]
 

Set position of the end point in the object space.

Parameters:
x x-coordinate of the end point of mouse dragging
y y-coordinate of the end point of mouse dragging
Note:
The coordinates of the point must be the original coordinates in the object space before all geometrical transforms. (Because this widget is for 2D image, the z-coordinate will always be zero.)

void mitkEllipseWidgetModel2D::SetEndPoint float  point[2]  )  [inline]
 

Set position of the end point in the object space.

Parameters:
point[0] x-coordinate of the end point of mouse dragging
point[1] y-coordinate of the end point of mouse dragging
Note:
The coordinates of the point must be the original coordinates in the object space before all geometrical transforms. (Because this widget is for 2D image, the z-coordinate will always be zero.)

void mitkEllipseWidgetModel2D::SetMovePoint int  sx,
int  sy
[inline]
 

Set position of the moving end point.

Parameters:
sx x-coordinate of the moving end point of mouse dragging on screen
sy y-coordinate of the moving end point of mouse dragging on screen
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.

void mitkEllipseWidgetModel2D::SetMovePoint float  x,
float  y
[inline]
 

Set position of the moving end point in the object space.

Parameters:
x x-coordinate of the moving end point of mouse dragging
y y-coordinate of the moving end point of mouse dragging
Note:
The coordinates of the point must be the original coordinates in the object space before all geometrical transforms. (Because this widget is for 2D image, the z-coordinate will always be zero.)

void mitkEllipseWidgetModel2D::SetMovePoint float  point[2]  )  [inline]
 

Set position of the moving end point in the object space.

Parameters:
point[0] x-coordinate of the moving end point of mouse dragging
point[1] y-coordinate of the moving end point of mouse dragging
Note:
The coordinates of the point must be the original coordinates in the object space before all geometrical transforms. (Because this widget is for 2D image, the z-coordinate will always be zero.)

void mitkEllipseWidgetModel2D::SetRadius float  r  )  [inline]
 

Set the radiuses of the ellipse to the same value (i.e the ellipse is a circle).

Parameters:
r radius of the circle

void mitkEllipseWidgetModel2D::SetRadius float  xr,
float  yr
[inline]
 

Set the radiuses of the ellipse.

Parameters:
xr radius along x-axis
yr radius along y-axis

void mitkEllipseWidgetModel2D::SetStartPoint int  sx,
int  sy
[inline]
 

Set position of the start point.

Parameters:
sx x-coordinate of the start point of mouse dragging on screen
sy y-coordinate of the start point of mouse dragging on screen
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.

void mitkEllipseWidgetModel2D::SetStartPoint float  x,
float  y
[inline]
 

Set position of the start point in the object space.

Parameters:
x x-coordinate of the start point of mouse dragging
y y-coordinate of the start point of mouse dragging
Note:
The coordinates of the point must be the original coordinates in the object space before all geometrical transforms. (Because this widget is for 2D image, the z-coordinate will always be zero.)

void mitkEllipseWidgetModel2D::SetStartPoint float  point[2]  )  [inline]
 

Set position of the start point in the object space.

Parameters:
point[0] x-coordinate of the start point of mouse dragging
point[1] y-coordinate of the start point of mouse dragging
Note:
The coordinates of the point must be the original coordinates in the object space before all geometrical transforms. (Because this widget is for 2D image, the z-coordinate will always be zero.)

void mitkEllipseWidgetModel2D::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:02:11 2014 for MITK (Medical Imaging ToolKit) by  doxygen 1.4.3