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

mitkRectWidgetModel2D Class Reference

mitkRectWidgetModel2D - a 2D widget for displaying a rectangle in an image scene More...

#include <mitkRectWidgetModel2D.h>

Inherits mitkWidgetModel2D.

Inheritance diagram for mitkRectWidgetModel2D:

Inheritance graph
[legend]
Collaboration diagram for mitkRectWidgetModel2D:

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 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 ()
int GetWidth ()
float GetTrueWidth ()
int GetHeight ()
float GetTrueHeight ()
int GetLeft ()
float GetTrueLeft ()
int GetRight ()
float GetTrueRight ()
int GetBottom ()
float GetTrueBottom ()
int GetTop ()
float GetTrueTop ()
void GetStartPoint (int &sx, int &sy)
void GetTrueStartPoint (float &sx, float &sy)
void GetStartPoint (int p[2])
void GetTrueStartPoint (float p[2])
void GetEndPoint (int &ex, int &ey)
void GetTrueEndPoint (float &ex, float &ey)
void GetEndPoint (int p[2])
void GetTrueEndPoint (float p[2])
bool IsValid ()
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

mitkRectWidgetModel2D - a 2D widget for displaying a rectangle in an image scene

mitkRectWidgetModel2D is a 2D widget for displaying a rectangle in an image scene. It can respond the mouse events and return the current width and height of this rectangle. 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 mitkRectWidgetModel2D::_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 mitkRectWidgetModel2D::_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 mitkRectWidgetModel2D::_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.

int mitkRectWidgetModel2D::GetBottom  ) 
 

Get the bottom of the rectangle in screen space.

Returns:
Return the bottom of the rectangle.

void mitkRectWidgetModel2D::GetEndPoint int  p[2]  )  [inline]
 

Get the end point of the rectangle in screen space.

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

void mitkRectWidgetModel2D::GetEndPoint int &  ex,
int &  ey
[inline]
 

Get the end point of the rectangle in screen space.

Parameters:
ex return the x-coordinate of the end point
ey return the y-coordinate of the end point

int mitkRectWidgetModel2D::GetHeight  ) 
 

Get the height of the rectangle in screen space.

Returns:
Return the height of the pseudocolor rectangle.

int mitkRectWidgetModel2D::GetLeft  ) 
 

Get the left of the rectangle in screen space.

Returns:
Return the left of the rectangle.

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

int mitkRectWidgetModel2D::GetRight  ) 
 

Get the right of the rectangle in screen space.

Returns:
Return the right of the rectangle.

void mitkRectWidgetModel2D::GetStartPoint int  p[2]  )  [inline]
 

Get the start point of the rectangle in screen space.

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

void mitkRectWidgetModel2D::GetStartPoint int &  sx,
int &  sy
[inline]
 

Get the start point of the rectangle in screen space.

Parameters:
sx return the x-coordinate of the start point
sy return the y-coordinate of the start point

int mitkRectWidgetModel2D::GetTop  ) 
 

Get the top of the rectangle in screen space.

Returns:
Return the left of the rectangle.

float mitkRectWidgetModel2D::GetTrueBottom  ) 
 

Get the true bottom of the rectangle in source model space.

Returns:
Return the bottom of the rectangle.

void mitkRectWidgetModel2D::GetTrueEndPoint float  p[2]  )  [inline]
 

Get the true end point of the rectangle in source model space.

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

void mitkRectWidgetModel2D::GetTrueEndPoint float &  ex,
float &  ey
[inline]
 

Get the true end point of the rectangle in source model space.

Parameters:
ex return the x-coordinate of the end point
ey return the y-coordinate of the end point

float mitkRectWidgetModel2D::GetTrueHeight  ) 
 

Get the true height of the rectangle in source model space.

Returns:
Return the height of the pseudocolor rectangle.

float mitkRectWidgetModel2D::GetTrueLeft  ) 
 

Get the true left of the rectangle in source model space.

Returns:
Return the left of the rectangle.

float mitkRectWidgetModel2D::GetTrueRight  ) 
 

Get the true right of the rectangle in source model space.

Returns:
Return the right of the rectangle.

void mitkRectWidgetModel2D::GetTrueStartPoint float  p[2]  )  [inline]
 

Get the true start point of the rectangle in source model space.

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

void mitkRectWidgetModel2D::GetTrueStartPoint float &  sx,
float &  sy
[inline]
 

Get the true start point of the rectangle in source model space.

Parameters:
sx return the x-coordinate of the start point
sy return the y-coordinate of the start point

float mitkRectWidgetModel2D::GetTrueTop  ) 
 

Get the true top of the rectangle in source model space.

Returns:
Return the left of the rectangle.

float mitkRectWidgetModel2D::GetTrueWidth  ) 
 

Get the true width of the rectangle in source model space.

Returns:
Return the width of the pseudocolor rectangle.

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

int mitkRectWidgetModel2D::GetWidth  ) 
 

Get the width of the rectangle in screen space.

Returns:
Return the width of the pseudocolor rectangle.

bool mitkRectWidgetModel2D::IsValid  )  [inline]
 

If the widget model is valid.

Returns:
Return if the widget model is valid (i.e. can be shown in the scene).

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

Maintain the selection status when this widget is released.

Implements mitkWidgetModel.

virtual int mitkRectWidgetModel2D::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 mitkRectWidgetModel2D::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 mitkRectWidgetModel2D::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 mitkRectWidgetModel2D::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 mitkRectWidgetModel2D::SetMovePoint int  sx,
int  sy
 

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 mitkRectWidgetModel2D::SetMovePoint float  x,
float  y
 

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 mitkRectWidgetModel2D::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 mitkRectWidgetModel2D::SetStartPoint int  sx,
int  sy
 

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 mitkRectWidgetModel2D::SetStartPoint float  x,
float  y
 

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 mitkRectWidgetModel2D::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 mitkRectWidgetModel2D::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:33 2014 for MITK (Medical Imaging ToolKit) by  doxygen 1.4.3