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

mitkScene Class Reference

mitkScene - a scene to display 3D surface rendered or volume rendered image More...

#include <mitkScene.h>

Inherits mitkSceneBase.

Inherited by mitkImageScene.

Inheritance diagram for mitkScene:

Inheritance graph
[legend]
Collaboration diagram for mitkScene:

Collaboration graph
[legend]
List of all members.

Public Member Functions

const int * GetViewPort ()
void GetViewPort (int vp[4])
virtual void InitGL ()
virtual void DestroyGL ()
virtual void ResizeGL (int newX, int newY)
virtual void RenderGL ()
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)
virtual void OnMouseWheel (bool ctrlDown, bool shiftDown, int xPos, int yPos, int delta)
void SetBackColor (unsigned char rColor, unsigned char gColor, unsigned char bColor)
void SetBackColor (float rColor, float gColor, float bColor)
void SetBackColor (int rColor, int gColor, int bColor)
void GetBackColor (float &rColor, float &gColor, float &bColor)
void GetBackColor (unsigned char &rColor, unsigned char &gColor, unsigned char &bColor)
void GetBackColor (int &rColor, int &gColor, int &bColor)
virtual void ResetScene ()
virtual void Translate (float deltX, float deltY, float deltZ)
virtual void Rotate (float deltX, float deltY, float deltZ)
virtual void Rotate (float ax, float ay, float az, float angle)
virtual void Rotate (const mitkQuaternion &q)
virtual void SetRotation (float x, float y, float z)
virtual void SetRotation (float ax, float ay, float az, float angle)
virtual void SetRotation (const mitkQuaternion &q)
virtual void Scale (float delt)
virtual mitkManipulatorCreateManipulator ()
void SetManipulator (mitkManipulator *mani)
void AddModel (mitkModel *model)
void RemoveModel (mitkModel *model)
void RemoveModel (int i)
void RemoveAllModels ()
void RemoveAllModel ()
mitkModelGetModel (int i)
mitkListGetModels ()
int GetModelCount ()
int GetNumberOfPropsRendered ()
void SetCamera (mitkCamera *cam)
mitkCameraGetCamera ()
void SetDefaultLight (mitkLight *lit)
mitkLightGetDefaultLight ()
mitkLightGetLight ()
void AddAdditionalLight (mitkLight *lit)
void RemoveAdditionalLight (int idx)
void RemoveAdditionalLight (mitkLight *lit)
void RemoveAllAdditionalLights ()
int GetAdditionalLightCount ()
mitkLightGetAdditionalLight (int idx)
void AlignScene ()
float * GetZbufferData (int x1, int y1, int x2, int y2)
void GetZbufferData (int x1, int y1, int x2, int y2, float *buffer)
unsigned char * GetPixelData (int xOffset, int yOffset, int width, int height)
void GetPixelData (int xOffset, int yOffset, int width, int height, unsigned char *buffer, int packAlignment=4, bool swapRGB=false)
void GetPixelData24 (int xOffset, int yOffset, int width, int height, unsigned char *buffer, int packAlignment=4, bool swapRGB=false)
void GetPixelData32 (int xOffset, int yOffset, int width, int height, unsigned char *buffer, bool swapRGB=false)
void SetSelected (bool isSelected)
bool GetSelected ()
float GetTranslateSpeed ()
float GetTranslationX ()
float GetTranslationY ()
float GetTranslationZ ()
void GetTranslation (float trans[3])
const mitkQuaternionGetRotation ()
float GetScale ()
void EnableLoD ()
void DisableLoD ()
bool IsLoDEnabled ()
bool IsModelsModified ()
bool IsCameraModified ()
bool IsAdditionalLightModified ()

Detailed Description

mitkScene - a scene to display 3D surface rendered or volume rendered image

mitkScene is a 3d scene to display 3D surface rendered or volume rendered image. To display 3d images, you must create one or several models (either mitkSurfaceModel or mitkVolumeModel) firstly, then add them using the function

 AddModel() 
. mitkScene needs a container subclasses from mitkSceneContainer. You can use mitkGLWindow for the container, or implement your own container. This class is added from Mitk 2.3, in order to allow the users have their own OpenGL context encapsulation. (For example, the using the QGLWidget class provided by QT).


Member Function Documentation

void mitkScene::AddAdditionalLight mitkLight lit  ) 
 

Add an additional light to this scene.

Parameters:
lit the light to add
Note:
At most 5 additional light can be added to the scene.

void mitkScene::AddModel mitkModel model  ) 
 

Add a model to this scene for display. Scene can contain many models, including surface model, volume model and widget model, and display them simultaneity. So scene provides a set of functions to manage the models.

See also:
RemoveModel()

RemoveAllModel()

GetModel()

GetModels()

GetModelCount()

Parameters:
model Specify the model that will be added to this scene.

void mitkScene::AlignScene  ) 
 

Warning:
Internal function. Don't call it directly.

virtual mitkManipulator* mitkScene::CreateManipulator  )  [virtual]
 

Create a default manipulator for the mouse events processing. Subclass can override this function to create a proper manipulator.

Reimplemented in mitkImageScene.

virtual void mitkScene::DestroyGL  )  [virtual]
 

Free OpenGL resources

Reimplemented from mitkSceneBase.

void mitkScene::DisableLoD  ) 
 

Disable LoD rendering mode.

Note:
It is only a hint to rendering method and depends on actual implementation. Maybe it will not take any effect.

void mitkScene::EnableLoD  ) 
 

Enable LoD rendering mode.

Note:
It is only a hint to rendering method and depends on actual implementation. Maybe it will not take any effect.

mitkLight* mitkScene::GetAdditionalLight int  idx  ) 
 

Get the idx'th additional light.

Parameters:
idx the index of the light to get

int mitkScene::GetAdditionalLightCount  ) 
 

Get the count of additional lights.

Returns:
Return the count of additional lights.

void mitkScene::GetBackColor int &  rColor,
int &  gColor,
int &  bColor
 

Get the background color of this scene.

Parameters:
rColor Return the red component of the background color. The value range is from 0 to 255.
gColor Return the green component of the background color. The value range is from 0 to 255.
bColor Return the blue component of the background color. The value range is from 0 to 255.

void mitkScene::GetBackColor unsigned char &  rColor,
unsigned char &  gColor,
unsigned char &  bColor
 

Get the background color of this scene.

Parameters:
rColor Return the red component of the background color. The value range is from 0 to 255.
gColor Return the green component of the background color. The value range is from 0 to 255.
bColor Return the blue component of the background color. The value range is from 0 to 255.

void mitkScene::GetBackColor float &  rColor,
float &  gColor,
float &  bColor
 

Get the background color of this scene.

Parameters:
rColor Return the red component of the background color. The value range is from 0.0 to 1.0.
gColor Return the green component of the background color. The value range is from 0.0 to 1.0.
bColor Return the blue component of the background color. The value range is from 0.0 to 1.0.

mitkCamera* mitkScene::GetCamera  ) 
 

Get the camera of this scene.

Returns:
Return the camera of this scene.

mitkLight* mitkScene::GetDefaultLight  ) 
 

Get the default light of this scene.

Returns:
Return the light of this scene.
Note:
The position of the default light is calculated by the scene automatically, so any changes of the position will be discarded.

mitkLight* mitkScene::GetLight  )  [inline]
 

Provided for back compatibility, just the same as SetSliceNum().

mitkModel* mitkScene::GetModel int  i  ) 
 

Get the model in specified position.

Parameters:
i Zero based index to specify the position of the model.
Returns:
Return the ith model in this scene.

int mitkScene::GetModelCount  ) 
 

Get the model count in this scene.

Returns:
Return the model count in this scene.

mitkList* mitkScene::GetModels  ) 
 

Get the list of models in this scene.

Returns:
Return the internal list of models. User can access each model through the interface of mitkList.

int mitkScene::GetNumberOfPropsRendered  )  [inline]
 

Warning:
Internal function. Don't call it directly.

void mitkScene::GetPixelData int  xOffset,
int  yOffset,
int  width,
int  height,
unsigned char *  buffer,
int  packAlignment = 4,
bool  swapRGB = false
[inline]
 

Get frame buffer data (RGB pixel data) in the specified region. This function is provided for convenience. It does the same thing as GetPixelData24().

Parameters:
xOffset specify the x coordinate of the left bottom corner
yOffset specify the y coordinate of the left bottom corner
width specify the width of the region
height specify the height of the region
buffer return the the frame buffer data. The data is RGB color data, and is arranged in the order of R1G1B1R2G2B2...
packAlignment pack alignment bytes
swapRGB whether swap RGB channel or not (i.e. true: use GL_BGR format to get pixel data, false: use GL_RGB format to get pixel data
Warning:
The parameter "buffer" must point to a memory block which can contain width*height RGB pixel samples. If packAlignment is 4, the total bytes of one line (contain width samples) must be devided exactly by 4, i.e. one line should be ((width*3+3) & (~3)) bytes. Otherwise, one line should be exactly width*3 bytes. Furthermore, this memory block must be allocated by the user before call this function.

unsigned char* mitkScene::GetPixelData int  xOffset,
int  yOffset,
int  width,
int  height
 

Get frame buffer data in the specified region.

Parameters:
xOffset Specify the x coordinate of the left bottom corner
yOffset Specify the y coordinate of the left bottom corner
width Specify the width of the region
height Specify the height of the region
Returns:
Return the address of the frame buffer data. The data is RGB color data, and is arranged in the order of R1G1B1R2G2B2...
Note:
This function is obsolete, please use another function to get frame buffer data.

void mitkScene::GetPixelData24 int  xOffset,
int  yOffset,
int  width,
int  height,
unsigned char *  buffer,
int  packAlignment = 4,
bool  swapRGB = false
 

Get frame buffer data (RGB pixel data) in the specified region.

Parameters:
xOffset specify the x coordinate of the left bottom corner
yOffset specify the y coordinate of the left bottom corner
width specify the width of the region
height specify the height of the region
buffer return the the frame buffer data. The data is RGB color data, and is arranged in the order of R1G1B1R2G2B2...
packAlignment pack alignment bytes
swapRGB whether swap RGB channel or not (i.e. true: use GL_BGR format to get pixel data, false: use GL_RGB format to get pixel data
Warning:
The parameter "buffer" must point to a memory block which can contain width*height RGB pixel samples. If packAlignment is 4, the total bytes of one line (contain width samples) must be devided exactly by 4, i.e. one line should be ((width*3+3) & (~3)) bytes. Otherwise, one line should be exactly width*3 bytes. Furthermore, this memory block must be allocated by the user before call this function.

void mitkScene::GetPixelData32 int  xOffset,
int  yOffset,
int  width,
int  height,
unsigned char *  buffer,
bool  swapRGB = false
 

Get frame buffer data (RGBA pixel data) in the specified region.

Parameters:
xOffset specify the x coordinate of the left bottom corner
yOffset specify the y coordinate of the left bottom corner
width specify the width of the region
height specify the height of the region
buffer return the the frame buffer data. The data is RGBA color data, and is arranged in the order of R1G1B1A1R2G2B2A2...
swapRGB whether swap RGB channel or not (i.e. true: use GL_BGR format to get pixel data, false: use GL_RGB format to get pixel data
Warning:
The parameter "buffer" must point to a memory block which can contain width*height RGBA pixel samples. This memory block must be allocated by the user before call this function.

const mitkQuaternion& mitkScene::GetRotation void   )  [inline]
 

Get the Rotation of the scene.

Returns:
Return the quaternion of the rotation.

float mitkScene::GetScale void   )  [inline]
 

Get the scale of the scene.

Returns:
Return the scale of the scene.

bool mitkScene::GetSelected  )  [inline]
 

Set the selected status of this scene. If scene is selected, it will be added a red frame.

Parameters:
isSelected isSelected=true, set the scene is selected. isSelected=false, set the scene is unselected.

float mitkScene::GetTranslateSpeed  )  [inline]
 

Warning:
Internal function. Don't call it directly.

void mitkScene::GetTranslation float  trans[3]  )  [inline]
 

Get the translation of the scene.

Parameters:
trans[0] return translation in x-axis
trans[1] return translation in y-axis
trans[2] return translation in z-axis
Warning:
This function is provided for convenience. Don't call it directly.

float mitkScene::GetTranslationX  )  [inline]
 

Get the translation along x-axis of the scene.

Returns:
Return the translation along x-axis of the scene.
Warning:
This function is provided for convenience. Don't call it directly.

float mitkScene::GetTranslationY  )  [inline]
 

Get the translation along y-axis of the scene.

Returns:
Return the translation along y-axis of the scene.
Warning:
This function is provided for convenience. Don't call it directly.

float mitkScene::GetTranslationZ  )  [inline]
 

Get the translation along z-axis of the scene.

Returns:
Return the translation along z-axis of the scene.
Warning:
This function is provided for convenience. Don't call it directly.

void mitkScene::GetViewPort int  vp[4]  )  [inline]
 

Get the viewport of this scene. Not all of the area of a scene is used to display the image. Only the viewport is used to display the image. The position and size of viewport are calculated automatically according to the size of image.

Parameters:
vp[0] return the left position of the viewport
vp[1] return the top position of the viewport
vp[2] return the width of the viewport
vp[3] return the height of the viewport

const int* mitkScene::GetViewPort  )  [inline]
 

Get the viewport of this scene. Not all of the area of a scene is used to display the image. Only the viewport is used to display the image. The position and size of viewport are calculated automatically according to the size of image.

Returns:
Return a pointer to the viewport. The first element is the Left position. The second element is the Top position. The third element is the Width of the viewport. The fourth element is the Height of the viewport.

void mitkScene::GetZbufferData int  x1,
int  y1,
int  x2,
int  y2,
float *  buffer
 

Get z buffer data in the specified region.

Parameters:
x1 Specify the x coordinate of the left bottom corner
y1 Specify the y coordinate of the left bottom corner
x2 Specify the x coordinate of the right top corner. x2 >= x1 must be satisfied.
y2 Specify the y coordinate of the right top corner. y2 >= y1 must be satisfied.
buffer Return the z buffer data.
Warning:
The parameter "buffer" must point to a memory block which can contain (x2-x1+1)*(y2-y1+1) floats (i.e. (x2-x1+1)*(y2-y1+1)*4 bytes). This memory block must be allocated by the user before call this function.

float* mitkScene::GetZbufferData int  x1,
int  y1,
int  x2,
int  y2
 

Get z buffer data in the specified region.

Parameters:
x1 Specify the x coordinate of the left bottom corner
y1 Specify the y coordinate of the left bottom corner
x2 Specify the x coordinate of the right top corner. x2 >= x1 must be satisfied.
y2 Specify the y coordinate of the right top corner. y2 >= y1 must be satisfied.
Returns:
Return the address of the z buffer data.

virtual void mitkScene::InitGL  )  [virtual]
 

Initialize OpenGL variables and resources.

Reimplemented from mitkSceneBase.

Reimplemented in mitkImageScene.

bool mitkScene::IsAdditionalLightModified  )  [inline]
 

Check whether there is a modified additional light

Returns:
Return true if there is a modified additional light, otherwise Return false

bool mitkScene::IsCameraModified  )  [inline]
 

Check whether the camera has been modified

Returns:
Return true if the camera has been modified, otherwise Return false

bool mitkScene::IsLoDEnabled  ) 
 

Test if the LoD mode is enabled.

Returns:
Return true if the LoD mode is enabled, otherwise return false.

bool mitkScene::IsModelsModified  )  [inline]
 

Check whether there is a modified model

Returns:
Return true if there is a modified model, otherwise Return false

virtual void mitkScene::OnMouseDown int  mouseButton,
bool  ctrlDown,
bool  shiftDown,
int  xPos,
int  yPos
[virtual]
 

Handle the mouse pressed event pass by the container

Reimplemented from mitkSceneBase.

virtual void mitkScene::OnMouseMove bool  ctrlDown,
bool  shiftDown,
int  xPos,
int  yPos
[virtual]
 

Handle the mouse moved event pass by the container

Reimplemented from mitkSceneBase.

virtual void mitkScene::OnMouseUp int  mouseButton,
bool  ctrlDown,
bool  shiftDown,
int  xPos,
int  yPos
[virtual]
 

Handle the mouse released event pass by the container

Reimplemented from mitkSceneBase.

virtual void mitkScene::OnMouseWheel bool  ctrlDown,
bool  shiftDown,
int  xPos,
int  yPos,
int  delta
[virtual]
 

Handle the mouse wheel event pass by the container

Reimplemented from mitkSceneBase.

void mitkScene::RemoveAdditionalLight mitkLight lit  ) 
 

Remove an additional light in this scene.

Parameters:
lit specify the light that will be removed from this scene
Note:
If lit is found in the list of models, it will be removed from the list. Otherwise nothing happens.

void mitkScene::RemoveAdditionalLight int  idx  ) 
 

Remove the additional light in specified position.

Parameters:
idx zero based index to specify the position of the additional light

void mitkScene::RemoveAllAdditionalLights  ) 
 

Remove all additional lights in this scene.

void mitkScene::RemoveAllModel  )  [inline]
 

Provided for back compatibility, just the same as SetSliceNum().

void mitkScene::RemoveAllModels  ) 
 

Remove all models in this scene.

void mitkScene::RemoveModel int  i  ) 
 

Remove the model in specified position.

Parameters:
i Zero based index to specify the position of the model.

void mitkScene::RemoveModel mitkModel model  ) 
 

Remove a model in this scene.

Parameters:
model Specify the model that will be removed from this scene. If model is found in the list of models, it will be removed from the list. Otherwise nothing happens.

virtual void mitkScene::RenderGL  )  [virtual]
 

Handle the render event pass by the container

Reimplemented from mitkSceneBase.

Reimplemented in mitkImageScene.

virtual void mitkScene::ResetScene  )  [virtual]
 

Reset the geometric position of all of the models in this scene.

Reimplemented in mitkImageScene.

virtual void mitkScene::ResizeGL int  newX,
int  newY
[virtual]
 

Handle the resize event pass by the container

Reimplemented from mitkSceneBase.

Reimplemented in mitkImageScene.

virtual void mitkScene::Rotate const mitkQuaternion q  )  [virtual]
 

Rotate all of the models in this scene.

Parameters:
q the quaternion of the rotation
Note:
The rotation is incremental.

Reimplemented in mitkImageScene.

virtual void mitkScene::Rotate float  ax,
float  ay,
float  az,
float  angle
[virtual]
 

Rotate all of the models in this scene around axis (ax,ay,az) for angle degrees.

Parameters:
ax the x-coordinate of rotation axis
ay the y-coordinate of rotation axis
az the z-coordinate of rotation axis
angle the angle of rotation in degrees
Note:
The rotation is incremental.

Reimplemented in mitkImageScene.

virtual void mitkScene::Rotate float  deltX,
float  deltY,
float  deltZ
[virtual]
 

Rotate all of the models in this scene around x, y, z axis.

Parameters:
deltX Specify the rotation around x-axis in degrees.
deltY Specify the rotation around y-axis in degrees.
deltZ Specify the rotation around z-axis in degrees.
Note:
The rotation is incremental.

Reimplemented in mitkImageScene.

virtual void mitkScene::Scale float  delt  )  [virtual]
 

Scale all of the models in this scene in x, y, z directions.

Parameters:
delt Specify the scale in x, y, z directions. This function scales the models equally in each direction.

Reimplemented in mitkImageScene.

void mitkScene::SetBackColor int  rColor,
int  gColor,
int  bColor
 

Set the background color of this scene.

Parameters:
rColor Specify the red component of the background color. The valid range is from 0 to 255.
gColor Specify the green component of the background color. The valid range is from 0 to 255.
bColor Specify the blue component of the background color. The valid range is from 0 to 255.

void mitkScene::SetBackColor float  rColor,
float  gColor,
float  bColor
 

Set the background color of this scene.

Parameters:
rColor Specify the red component of the background color. The valid range is from 0.0 to 1.0.
gColor Specify the green component of the background color. The valid range is from 0.0 to 1.0.
bColor Specify the blue component of the background color. The valid range is from 0.0 to 1.0.

void mitkScene::SetBackColor unsigned char  rColor,
unsigned char  gColor,
unsigned char  bColor
 

Set the background color of this scene.

Parameters:
rColor Specify the red component of the background color. The valid range is from 0 to 255.
gColor Specify the green component of the background color. The valid range is from 0 to 255.
bColor Specify the blue component of the background color. The valid range is from 0 to 255.

void mitkScene::SetCamera mitkCamera cam  ) 
 

Set the camera of this scene.

Parameters:
cam the new camera of this scene

void mitkScene::SetDefaultLight mitkLight lit  ) 
 

Set the default light of this scene.

Parameters:
lit the new light of this scene
Note:
The position of the default light is calculated by the scene automatically. It is unchangeable.

void mitkScene::SetManipulator mitkManipulator mani  ) 
 

Set another manipulator to replace the current manipulator. This function provides a chance for the user to override the behavior of mouse events processing.

Parameters:
mani Specify the new manipulator for process the mouse events

virtual void mitkScene::SetRotation const mitkQuaternion q  )  [virtual]
 

Set rotations of all models in this scene to the quaternion "q".

Parameters:
q the quaternion of the rotation

Reimplemented in mitkImageScene.

virtual void mitkScene::SetRotation float  ax,
float  ay,
float  az,
float  angle
[virtual]
 

Set rotations of all models in this scene.

Parameters:
ax the x-coordinate of rotation axis
ay the y-coordinate of rotation axis
az the z-coordinate of rotation axis
angle the angle of rotation in degrees

Reimplemented in mitkImageScene.

virtual void mitkScene::SetRotation float  x,
float  y,
float  z
[virtual]
 

Set rotations of all models in this scene.

Parameters:
x Specify the rotation around x-axis in degrees.
y Specify the rotation around y-axis in degrees.
z Specify the rotation around z-axis in degrees.

Reimplemented in mitkImageScene.

void mitkScene::SetSelected bool  isSelected  )  [inline]
 

Set the selected status of this scene. If scene is selected, it will be added a red frame.

Parameters:
isSelected isSelected=true, set the scene is selected. isSelected=false, set the scene is unselected.

virtual void mitkScene::Translate float  deltX,
float  deltY,
float  deltZ
[virtual]
 

Translate all of the models in this scene in x, y, z directions.

Parameters:
deltX Specify the translation in x direction
deltY Specify the translation in y direction
deltZ Specify the translation in z direction

Reimplemented in mitkImageScene.


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