#include <volume_canvas.h>
Public Member Functions | |
VolumeCanvas (wxWindow *parent, wxWindowID id=wxID_ANY) | |
~VolumeCanvas () | |
void | OpenFile (const char *filename) |
Opens a volume data file. | |
Viewmode | GetViewmode () const |
Returns the current viewmode. | |
void | SetViewmode (Viewmode viewmode) |
Set the new viewmode. | |
int | GetSizeX () const |
Returns the size of the dataset in the X dimension. | |
int | GetSizeY () const |
Returns the size of the dataset in the Y dimension. | |
int | GetSizeZ () const |
Returns the size of the dataset in the Z dimension. | |
void | SetSlice (int value) |
Set the slice that should be displayed. | |
int | GetSlice () const |
Return the currently displayed slice. | |
void | Set3dOrientation (float rx, float ry, float rz) |
Set the 3d orientation angles (in degrees). | |
void | Get3dOrientation (float *rx, float *ry, float *rz) |
Retrieve the currently set 3d orientation. | |
const HistogramData * | GetHistogramData () const |
Get the histogram data. | |
void | UpdateTransferFunction (TransferFunctionSampler *sampler) |
void | RenderToFile (const wxString &file_name, int width, int height) |
Protected Member Functions | |
Event handling | |
void | OnPaint (wxPaintEvent &) |
Called when a repaint is needed. | |
void | OnSize (wxSizeEvent &) |
Called when the client area is resized. | |
void | OnEraseBackground (wxEraseEvent &) |
Called when the background should be redrawn. Does nothing to prevent flickering. | |
Private Types | |
enum | GLStatus { GLS_INIT_PENDING, GLS_INIT_FAILED, GLS_OK } |
Enum used to determine the OpenGL initialisation status. More... | |
Private Member Functions | |
void | Render () const |
Does the rendering. | |
void | Render3dView () const |
Renders the 3d view. | |
void | RenderSliceView () const |
Renders the slice view. | |
bool | InitGL () |
Initialises OpenGL. Returns false on failure. | |
bool | CheckGL () |
Initialises OpenGL if not yet done and returns true on success. | |
Private Attributes | |
GLStatus | m_glstatus |
Initialisation status. | |
GLuint | m_volume_texture |
The loaded OpenGL volume texture. | |
GLuint | m_transfer_texture |
Texture representing the transfer funtion. | |
VolProgram * | m_volprog |
Shader program used for rendering. | |
GLint | m_viewport_width |
Determines the Width to witch the data is rendered. | |
GLint | m_viewport_height |
Determines the Height to witch the data is rendered. | |
Viewmode | m_viewmode |
std::auto_ptr< HistogramData > | m_histogramdata |
Slice data | |
int | m_sizex |
int | m_sizey |
int | m_sizez |
int | m_slice |
Rotation | |
float | m_rotx |
float | m_roty |
float | m_rotz |
Definition at line 34 of file volume_canvas.h.
enum VolumeCanvas::GLStatus [private] |
Enum used to determine the OpenGL initialisation status.
Definition at line 135 of file volume_canvas.h.
VolumeCanvas::VolumeCanvas | ( | wxWindow * | parent, | |
wxWindowID | id = wxID_ANY | |||
) |
Definition at line 30 of file volume_canvas.cpp.
VolumeCanvas::~VolumeCanvas | ( | ) | [inline] |
bool VolumeCanvas::CheckGL | ( | ) | [private] |
Initialises OpenGL if not yet done and returns true on success.
Definition at line 340 of file volume_canvas.cpp.
References GLS_INIT_FAILED, GLS_INIT_PENDING, GLS_OK, InitGL(), and m_glstatus.
Referenced by OnPaint(), OpenFile(), and RenderToFile().
void VolumeCanvas::Get3dOrientation | ( | float * | rx, | |
float * | ry, | |||
float * | rz | |||
) | [inline] |
const HistogramData* VolumeCanvas::GetHistogramData | ( | ) | const [inline] |
Get the histogram data.
Definition at line 107 of file volume_canvas.h.
References m_histogramdata.
Referenced by VisLUFrame::OnOpenTraFu().
int VolumeCanvas::GetSizeX | ( | ) | const [inline] |
Returns the size of the dataset in the X dimension.
Definition at line 61 of file volume_canvas.h.
References m_sizex.
Referenced by Render3dView(), RenderSliceView(), and VisLUFrame::SyncUIState().
int VolumeCanvas::GetSizeY | ( | ) | const [inline] |
Returns the size of the dataset in the Y dimension.
Definition at line 67 of file volume_canvas.h.
References m_sizey.
Referenced by Render3dView(), RenderSliceView(), and VisLUFrame::SyncUIState().
int VolumeCanvas::GetSizeZ | ( | ) | const [inline] |
Returns the size of the dataset in the Z dimension.
Definition at line 73 of file volume_canvas.h.
References m_sizez.
Referenced by Render3dView(), RenderSliceView(), and VisLUFrame::SyncUIState().
int VolumeCanvas::GetSlice | ( | ) | const [inline] |
Return the currently displayed slice.
Definition at line 85 of file volume_canvas.h.
References m_slice.
Referenced by RenderSliceView().
Viewmode VolumeCanvas::GetViewmode | ( | ) | const [inline] |
Returns the current viewmode.
Definition at line 49 of file volume_canvas.h.
References m_viewmode.
Referenced by Render(), RenderSliceView(), and VisLUFrame::VisLUFrame().
bool VolumeCanvas::InitGL | ( | ) | [private] |
Initialises OpenGL. Returns false on failure.
Definition at line 320 of file volume_canvas.cpp.
References m_transfer_texture, and m_volprog.
Referenced by CheckGL().
void VolumeCanvas::OnEraseBackground | ( | wxEraseEvent & | event | ) | [protected] |
Called when the background should be redrawn. Does nothing to prevent flickering.
Definition at line 369 of file volume_canvas.cpp.
void VolumeCanvas::OnPaint | ( | wxPaintEvent & | event | ) | [protected] |
Called when a repaint is needed.
Definition at line 352 of file volume_canvas.cpp.
References CheckGL(), m_viewport_height, m_viewport_width, and Render().
void VolumeCanvas::OnSize | ( | wxSizeEvent & | event | ) | [protected] |
void VolumeCanvas::OpenFile | ( | const char * | filename | ) |
Opens a volume data file.
std::exception | if an error occurs. |
Definition at line 384 of file volume_canvas.cpp.
References CheckGL(), m_histogramdata, m_sizex, m_sizey, m_sizez, m_volume_texture, and value.
Referenced by VisLUFrame::OnOpen().
void VolumeCanvas::Render | ( | ) | const [private] |
Does the rendering.
Definition at line 305 of file volume_canvas.cpp.
References GetViewmode(), m_viewport_height, m_viewport_width, m_volume_texture, Render3dView(), RenderSliceView(), and VM_3D.
Referenced by OnPaint(), and RenderToFile().
void VolumeCanvas::Render3dView | ( | ) | const [private] |
Renders the 3d view.
Definition at line 71 of file volume_canvas.cpp.
References GetSizeX(), GetSizeY(), GetSizeZ(), VolProgram::M_3D_COLOR_CUBE, VolProgram::M_3D_RAYCAST, m_rotx, m_roty, m_rotz, m_transfer_texture, m_viewport_height, m_viewport_width, m_volprog, m_volume_texture, VolProgram::SetBackAndFrontTextures(), VolProgram::SetMode(), VolProgram::SetTransferFunctionTexture(), VolProgram::SetVolumeTexture(), and VolProgram::Use().
Referenced by Render().
void VolumeCanvas::RenderSliceView | ( | ) | const [private] |
Renders the slice view.
Definition at line 181 of file volume_canvas.cpp.
References GetSizeX(), GetSizeY(), GetSizeZ(), GetSlice(), GetViewmode(), VolProgram::M_SLICE, m_transfer_texture, m_viewport_height, m_viewport_width, m_volprog, m_volume_texture, VolProgram::SetMode(), VolProgram::SetTransferFunctionTexture(), VolProgram::SetVolumeTexture(), VolProgram::Use(), VM_SLICE_X, VM_SLICE_Y, and VM_SLICE_Z.
Referenced by Render().
void VolumeCanvas::RenderToFile | ( | const wxString & | file_name, | |
int | width, | |||
int | height | |||
) |
Definition at line 246 of file volume_canvas.cpp.
References CheckGL(), m_viewport_height, m_viewport_width, and Render().
Referenced by VisLUFrame::OnSave().
void VolumeCanvas::Set3dOrientation | ( | float | rx, | |
float | ry, | |||
float | rz | |||
) | [inline] |
Set the 3d orientation angles (in degrees).
Definition at line 91 of file volume_canvas.h.
References m_rotx, m_roty, and m_rotz.
Referenced by VisLUFrame::SyncUIState().
void VolumeCanvas::SetSlice | ( | int | value | ) | [inline] |
Set the slice that should be displayed.
Definition at line 79 of file volume_canvas.h.
References m_slice.
Referenced by VisLUFrame::SyncUIState().
void VolumeCanvas::SetViewmode | ( | Viewmode | viewmode | ) | [inline] |
Set the new viewmode.
Definition at line 55 of file volume_canvas.h.
References m_viewmode.
Referenced by VisLUFrame::SyncUIState().
void VolumeCanvas::UpdateTransferFunction | ( | TransferFunctionSampler * | sampler | ) |
Definition at line 47 of file volume_canvas.cpp.
References TransferFunctionSampler::Color::a, TransferFunctionSampler::Color::b, TransferFunctionSampler::Color::g, m_transfer_texture, TransferFunctionSampler::MapDensity(), and TransferFunctionSampler::Color::r.
Referenced by VisLUFrame::OnOpen(), VisLUFrame::OnOpenTraFu(), and VisLUFrame::OnTraFuChanged().
GLStatus VolumeCanvas::m_glstatus [private] |
std::auto_ptr<HistogramData> VolumeCanvas::m_histogramdata [private] |
float VolumeCanvas::m_rotx [private] |
Definition at line 161 of file volume_canvas.h.
Referenced by Get3dOrientation(), Render3dView(), and Set3dOrientation().
float VolumeCanvas::m_roty [private] |
Definition at line 161 of file volume_canvas.h.
Referenced by Get3dOrientation(), Render3dView(), and Set3dOrientation().
float VolumeCanvas::m_rotz [private] |
Definition at line 161 of file volume_canvas.h.
Referenced by Get3dOrientation(), Render3dView(), and Set3dOrientation().
int VolumeCanvas::m_sizex [private] |
int VolumeCanvas::m_sizey [private] |
int VolumeCanvas::m_sizez [private] |
int VolumeCanvas::m_slice [private] |
GLuint VolumeCanvas::m_transfer_texture [private] |
Texture representing the transfer funtion.
Definition at line 143 of file volume_canvas.h.
Referenced by InitGL(), Render3dView(), RenderSliceView(), and UpdateTransferFunction().
Viewmode VolumeCanvas::m_viewmode [private] |
GLint VolumeCanvas::m_viewport_height [private] |
Determines the Height to witch the data is rendered.
Definition at line 147 of file volume_canvas.h.
Referenced by OnPaint(), Render(), Render3dView(), RenderSliceView(), and RenderToFile().
GLint VolumeCanvas::m_viewport_width [private] |
Determines the Width to witch the data is rendered.
Definition at line 146 of file volume_canvas.h.
Referenced by OnPaint(), Render(), Render3dView(), RenderSliceView(), and RenderToFile().
VolProgram* VolumeCanvas::m_volprog [private] |
Shader program used for rendering.
Definition at line 144 of file volume_canvas.h.
Referenced by InitGL(), Render3dView(), RenderSliceView(), and ~VolumeCanvas().
GLuint VolumeCanvas::m_volume_texture [private] |
The loaded OpenGL volume texture.
Definition at line 142 of file volume_canvas.h.
Referenced by OpenFile(), Render(), Render3dView(), and RenderSliceView().