Seg3D  2.4
Seg3D is a free volume segmentation and processing tool developed by the NIH Center for Integrative Biomedical Computing at the University of Utah Scientific Computing and Imaging (SCI) Institute.
Public Types | Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions | Friends | List of all members
Seg3D::Viewer Class Reference
Inheritance diagram for Seg3D::Viewer:
Core::AbstractViewer Core::StateHandler Core::Lockable Core::ConnectionHandler

Public Types

typedef boost::function< bool(ViewerHandle, const Core::MouseHistory &, int, int, int) > mouse_event_handler_type
 
typedef boost::function< bool(ViewerHandle, int, int) > enter_event_handler_type
 
typedef boost::function< bool(ViewerHandle) > leave_event_handler_type
 
typedef boost::function< bool(ViewerHandle, int, int, int, int, int) > wheel_event_handler_type
 
typedef boost::function< bool(ViewerHandle, int, int) > key_press_event_handler_type
 
typedef boost::function< bool(ViewerHandle, int, int) > key_release_event_handler_type
 
typedef boost::function< bool(ViewerHandle) > cursor_handler_type
 
typedef boost::signals2::signal< void(Core::PickPointHandle) > redraw_scene_pick_signal_type
 
typedef boost::signals2::signal< void(size_t) > slice_changed_signal_type
 
- Public Types inherited from Core::AbstractViewer
typedef boost::signals2::signal< void() > update_display_signal_type
 Types of signals.
 
typedef boost::signals2::signal< void() > redraw_signal_type
 

Public Member Functions

 Viewer (size_t viewer_id, bool visible=true, const std::string &mode=Viewer::AXIAL_C)
 
virtual void mouse_move_event (const Core::MouseHistory &mouse_history, int button, int buttons, int modifiers)
 
virtual void mouse_press_event (const Core::MouseHistory &mouse_history, int button, int buttons, int modifiers)
 
virtual void mouse_release_event (const Core::MouseHistory &mouse_history, int button, int buttons, int modifiers)
 
virtual void mouse_enter_event (int x, int y)
 
virtual void mouse_leave_event ()
 
virtual bool wheel_event (int delta, int x, int y, int buttons, int modifiers)
 
virtual bool key_press_event (int key, int modifiers, int x, int y)
 
virtual bool key_release_event (int key, int modifiers, int x, int y)
 
void set_mouse_move_handler (mouse_event_handler_type func)
 
void set_mouse_press_handler (mouse_event_handler_type func)
 
void set_mouse_release_handler (mouse_event_handler_type func)
 
void set_mouse_enter_handler (enter_event_handler_type func)
 
void set_mouse_leave_handler (leave_event_handler_type func)
 
void set_wheel_event_handler (wheel_event_handler_type func)
 
void set_key_press_event_handler (key_press_event_handler_type func)
 
void set_key_release_event_handler (key_press_event_handler_type func)
 
void set_cursor_handler (cursor_handler_type func)
 
void reset_mouse_handlers ()
 
bool is_busy ()
 
Core::VolumeSliceHandle get_volume_slice (const std::string &layer_id)
 
Core::VolumeSliceHandle get_active_volume_slice () const
 
virtual void resize (int width, int height)
 
virtual void install_renderer (Core::AbstractRendererHandle renderer)
 
void auto_view ()
 
void snap_to_axis ()
 
bool is_volume_view () const
 
Core::StateViewBaseHandle get_active_view_state () const
 
void window_to_world (int x, int y, double &world_x, double &world_y) const
 
void world_to_window (double world_x, double world_y, double &x, double &y) const
 
void get_projection_matrix (Core::Matrix &proj_mat) const
 
void update_status_bar (int x, int y, const std::string &layer_id="")
 
void redraw_scene ()
 
void redraw_overlay ()
 
void redraw_all ()
 
- Public Member Functions inherited from Core::AbstractViewer
 AbstractViewer (size_t viewer_id)
 
size_t get_viewer_id () const
 
Texture2DHandle get_texture ()
 Returns the texture generated by the renderer.
 
Texture2DHandle get_overlay_texture ()
 Returns the overlay texture generated by the renderer.
 
int get_width () const
 Get the width of the viewer.
 
int get_height () const
 Get the height of the viewer.
 
void set_cursor (CursorShape cursor)
 Set the shape of the cursor in the viewer.
 
CursorShape get_cursor () const
 Get the shape of the cursor in the viewer.
 
- Public Member Functions inherited from Core::StateHandler
 StateHandler (const std::string &type_str, bool auto_id)
 
template<class HANDLE , class T >
bool add_state (const std::string &key, HANDLE &state, const T &default_value)
 Add a local state variable with default value.
 
template<class HANDLE , class T >
bool add_state (const std::string &key, HANDLE &state, const T &default_value, const T &min_value, const T &max_value, const T &step)
 Add a local state variable with default value and min and max.
 
template<class HANDLE >
bool add_state (const std::string &key, HANDLE &state)
 Add a local state variable without default value.
 
template<class HANDLE >
bool add_state (const std::string &key, HANDLE &state, const std::string &default_option, const std::string &option_list)
 Add a local state variable with option list.
 
template<class HANDLE >
bool add_state (const std::string &key, HANDLE &state, const std::string &default_option, const std::vector< std::string > option_list)
 Add a local state variable with option list.
 
template<class HANDLE >
bool add_state (const std::string &key, HANDLE &state, const std::string &default_option, const std::vector< OptionLabelPair > option_list)
 Add a local state variable with option list.
 
template<class HANDLE >
bool add_state (const std::string &key, HANDLE &state, const std::vector< std::string > &default_options, const std::vector< OptionLabelPair > option_list)
 Add a local state variable with option list.
 
template<class HANDLE >
bool add_state (const std::string &key, HANDLE &state, const std::vector< std::string > &default_options, const std::string &option_list)
 Add a local state variable with option list.
 
template<class HANDLE , class T >
bool add_state (const std::string &key, HANDLE &state, const std::vector< T > &default_value)
 Add a local state variable without default value.
 
void invalidate ()
 this function is called when you need to delete something from the state engine, but may have More...
 
bool is_valid ()
 returns true if the function hasn't been invalidated
 
void mark_as_project_data ()
 Mask the states that are added to this state handler as project data.
 
void do_not_save_id_number ()
 The id number of the statehandler will not be saved.
 
void set_initializing (bool initializing)
 
bool load_states (const StateIO &state_io)
 Load the states into the StateIO variable.
 
bool save_states (StateIO &state_io)
 Save the states into the StateIO variable.
 
const std::string & get_statehandler_id () const
 The id of the handler that will be the prefix of the state variables.
 
const std::string & get_statehandler_id_base () const
 The id of the handler that will be the prefix of the state variables.
 
size_t get_statehandler_id_number () const
 The id number of the handler that will be at the end of the prefix.
 

Public Attributes

redraw_scene_pick_signal_type redraw_scene_pick_signal_
 
slice_changed_signal_type slice_changed_signal_
 
Core::StateLabeledOptionHandle view_mode_state_
 
Core::StateView2DHandle axial_view_state_
 
Core::StateView2DHandle coronal_view_state_
 
Core::StateView2DHandle sagittal_view_state_
 
Core::StateView3DHandle volume_view_state_
 
Core::StateRangedIntHandle slice_number_state_
 
Core::StateBoolHandle flip_horizontal_state_
 Whether to flip the 2D view horizontally.
 
Core::StateBoolHandle flip_vertical_state_
 Whether to flip the 2D view vertically.
 
Core::StateBoolHandle slice_grid_state_
 2D viewer state
 
Core::StateBoolHandle slice_visible_state_
 
Core::StateBoolHandle slice_picking_visible_state_
 
Core::StateBoolHandle volume_slices_visible_state_
 3D viewer state
 
Core::StateBoolHandle volume_isosurfaces_visible_state_
 
Core::StateBoolHandle volume_volume_rendering_visible_state_
 
Core::StateBoolHandle volume_light_visible_state_
 
Core::StateBoolHandle volume_enable_fog_state_
 
Core::StateBoolHandle volume_enable_clipping_state_
 
Core::StateBoolHandle volume_show_invisible_slices_state_
 
Core::StateBoolHandle volume_show_bounding_box_state_
 
Core::StateBoolHandle lock_state_
 
Core::StateBoolHandle overlay_visible_state_
 
Core::StateBoolHandle is_picking_target_state_
 
- Public Attributes inherited from Core::AbstractViewer
update_display_signal_type update_display_signal_
 Triggered when new texture is received, or a different cursor shape is set.
 
redraw_signal_type redraw_scene_signal_
 Signals that the scene needs to be redrawn.
 
redraw_signal_type redraw_overlay_signal_
 Signals that the overlay needs to be redrawn.
 
redraw_signal_type redraw_all_signal_
 Signals that the scene needs to be redrawn.
 
StateBoolHandle viewer_visible_state_
 

Static Public Attributes

static const std::string AXIAL_C
 
static const std::string SAGITTAL_C
 
static const std::string CORONAL_C
 
static const std::string VOLUME_C
 

Protected Member Functions

virtual bool pre_load_states (const Core::StateIO &state_io)
 
virtual bool post_load_states (const Core::StateIO &state_io)
 
- Protected Member Functions inherited from Core::StateHandler
virtual void clean_up ()
 This function is called by invalidate to clean up stuff in the statehandler subclasses.
 
void enable_signals (bool enabled)
 This function enables/disables signals in the state variables.
 
virtual bool pre_save_states (StateIO &state_io)
 
virtual bool post_save_states (StateIO &state_io)
 
virtual void state_changed ()
 
virtual int get_session_priority ()
 
virtual int get_version ()
 Get the version number of this class, this one is used for versioning of session files.
 
int get_loaded_version ()
 Get the version number of the data that was loaded.
 
void set_loaded_version (int loaded_version)
 Set the version number of the data that was loaded.
 
- Protected Member Functions inherited from Core::ConnectionHandler
void add_connection (const boost::signals2::connection &connection)
 
void add_connection (const ConnectionHandlerConnectionHandle &connection)
 
void disconnect_all ()
 

Friends

class ViewManipulator
 
class ViewerPrivate
 
class ViewerManager
 
class ViewerManagerPrivate
 
class ActionOffsetSlice
 

Member Function Documentation

void Seg3D::Viewer::auto_view ( )

AUTO_VIEW: Auto adjust the view for the active layer

Core::StateViewBaseHandle Seg3D::Viewer::get_active_view_state ( ) const

GET_ACTIVE_VIEW_STATE: Returns the view state variable associated with the current view mode.

Core::VolumeSliceHandle Seg3D::Viewer::get_active_volume_slice ( ) const

GET_ACTIVE_LAYER_SLICE: Returns the volume slice that corresponds to the active layer.

void Seg3D::Viewer::get_projection_matrix ( Core::Matrix proj_mat) const

GET_PROJECTION_MATRIX: Get the projection matrix of current view mode. NOTE: Only works in 2D modes.

Core::VolumeSliceHandle Seg3D::Viewer::get_volume_slice ( const std::string &  layer_id)

GET_VOLUME_SLICE: Returns the volume slice of the specified layer.

void Seg3D::Viewer::install_renderer ( Core::AbstractRendererHandle  renderer)
virtual

INSTALL_RENDERER: Install a renderer to the viewer.

Reimplemented from Core::AbstractViewer.

bool Seg3D::Viewer::is_busy ( )

IS_BUSY: Returns true if the mouse is pressed, otherwise false.

bool Seg3D::Viewer::is_volume_view ( ) const

IS_VOLUME_VIEW: Returns true if the current view mode is volume, otherwise false.

bool Seg3D::Viewer::key_press_event ( int  key,
int  modifiers,
int  x,
int  y 
)
virtual

KEY_PRESS_EVENT: This function is called when a key is pressed while hovering over the render widget

Reimplemented from Core::AbstractViewer.

bool Seg3D::Viewer::key_release_event ( int  key,
int  modifiers,
int  x,
int  y 
)
virtual

KEY_RELEASE_EVENT: This function is called when a key is released while hovering over the render widget

Reimplemented from Core::AbstractViewer.

void Seg3D::Viewer::mouse_enter_event ( int  x,
int  y 
)
virtual

MOUSE_ENTER_EVENT: This function is called by the render widget when a mouse enter event has occurred.

Reimplemented from Core::AbstractViewer.

void Seg3D::Viewer::mouse_leave_event ( )
virtual

MOUSE_LEAVE_EVENT: This function is called by the render widget when a mouse leave event has occurred.

Reimplemented from Core::AbstractViewer.

void Seg3D::Viewer::mouse_move_event ( const Core::MouseHistory mouse_history,
int  button,
int  buttons,
int  modifiers 
)
virtual

MOUSE_MOVE_EVENT: This function is called by the render widget when a mouse move event has occurred. This function needs to be overloaded to record mouse movements.

Reimplemented from Core::AbstractViewer.

void Seg3D::Viewer::mouse_press_event ( const Core::MouseHistory mouse_history,
int  button,
int  buttons,
int  modifiers 
)
virtual

MOUSE_PRESS_EVENT: This function is called by the render widget when a mouse button press event has occurred. This function needs to be overloaded to record mouse buttons being pressed.

Reimplemented from Core::AbstractViewer.

void Seg3D::Viewer::mouse_release_event ( const Core::MouseHistory mouse_history,
int  button,
int  buttons,
int  modifiers 
)
virtual

MOUSE_RELEASE_EVENT: This function is called by the render widget when a mouse button release event has occurred. This function needs to be overloaded to record mouse buttons being released.

Reimplemented from Core::AbstractViewer.

bool Seg3D::Viewer::post_load_states ( const Core::StateIO state_io)
protectedvirtual

POST_LOAD_STATES: This function is called by StateHandler::load_states once the initial state loading has finished.

Reimplemented from Core::StateHandler.

bool Seg3D::Viewer::pre_load_states ( const Core::StateIO state_io)
protectedvirtual

PRE_LOAD_STATES: This virtual function is called by StateHandler::load_states before loading any states.

Reimplemented from Core::StateHandler.

void Seg3D::Viewer::redraw_all ( )

REDRAW_ALL: Emits both redraw_scene_signal_ and redraw_overlay_signal_

void Seg3D::Viewer::redraw_overlay ( )

REDRAW_OVERLAY: Emits redraw_overlay_signal_.

void Seg3D::Viewer::redraw_scene ( )

REDRAW_SCENE: Emits redraw_scene_signal_.

void Seg3D::Viewer::resize ( int  width,
int  height 
)
virtual

RESIZE: Set the new size of the viewer.

Reimplemented from Core::AbstractViewer.

void Seg3D::Viewer::snap_to_axis ( )

SNAP_TO_AXIS: Snap the eye position of the volume view to the closest axis.

void Seg3D::Viewer::update_status_bar ( int  x,
int  y,
const std::string &  layer_id = "" 
)

UPDATE_STATUS_BAR: Update the status bar to show the data information of the specified layer under the mouse cursor. If no layer is specified, the active layer will be used.

bool Seg3D::Viewer::wheel_event ( int  delta,
int  x,
int  y,
int  buttons,
int  modifiers 
)
virtual

WHEEL_EVENT: This function is called by the render widget when a mouse wheel event has occurred. This function needs to be overloaded to track mouse wheel events.

Reimplemented from Core::AbstractViewer.

void Seg3D::Viewer::window_to_world ( int  x,
int  y,
double &  world_x,
double &  world_y 
) const

WINDOW_TO_WORLD: Maps from window coordinates to world coordinates. NOTE: Only call this function when the viewer is in one of the 2D modes. Locks: StateEngine

void Seg3D::Viewer::world_to_window ( double  world_x,
double  world_y,
double &  x,
double &  y 
) const

WORLD_TO_WINDOW: Maps from world coordinates to window coordinates. NOTE: Only call this function when the viewer is in one of the 2D modes. Locks: StateEngine

Member Data Documentation

redraw_scene_pick_signal_type Seg3D::Viewer::redraw_scene_pick_signal_

REDRAW_SCENE_PICK_SIGNAL: Signals that 3D pick point needs to be obtained from renderer.

slice_changed_signal_type Seg3D::Viewer::slice_changed_signal_

SLICE_CHANGED_SIGNAL_: Triggered when slice number or viewer visibility is changed. Renderer of other viewers connect to this signal to update the overlay.


The documentation for this class was generated from the following files: