CTL
0.6.1
Computed Tomography Library
|
The VolumeViewer class provides a tool for visualization of volume data. More...
#include <volumeviewer.h>
Public Types | |
enum | WindowPreset { Abdomen, Angio, Bone, Brain, Chest, Lungs } |
Public Slots | |
void | autoResize () |
void | hideCompositeOverview (bool hide=true) |
void | setAutoMouseWindowScaling () |
void | showSlice (int slice) |
void | showSubvolume (int subvolume) |
Public Member Functions | |
VolumeViewer (QWidget *parent=nullptr) | |
VolumeViewer (CompositeVolume volume, QWidget *parent=nullptr) | |
~VolumeViewer () | |
const CompositeVolume & | data () const |
Chunk2DView * | dataView () const |
template<typename T > | |
void | setData (const VoxelVolume< T > &data) |
void | setData (SpectralVolumeData data) |
void | setData (CompositeVolume data) |
void | setWindowPresets (WindowPreset preset1, WindowPreset preset2) |
void | setWindowPresetsInMu (WindowPreset preset1, WindowPreset preset2, float referenceEnergy) |
void | setWindowPresets (QPair< QString, QPair< double, double >> preset1, QPair< QString, QPair< double, double >> preset2) |
Static Public Member Functions | |
template<typename T > | |
static void | plot (const VoxelVolume< T > &data) |
static void | plot (CompositeVolume data) |
static void | plot (SpectralVolumeData data) |
Protected Member Functions | |
void | keyPressEvent (QKeyEvent *event) override |
Private Member Functions | |
const SpectralVolumeData & | selectedVolume () const |
Private Attributes | |
Ui::VolumeViewer * | ui |
CompositeVolume | _compData |
The VolumeViewer class provides a tool for visualization of volume data.
This class can be used to visualize different volume data objects. It fully supports:
Any subclass of AbstractDynamicVolumeData can be visualized as well, but will be limited to displaying the current state of the volume (ie. as set by AbstractDynamicVolumeData::setTime()).
For convenience, the plot() method can be used to achieve a one-line solution, creating a widget that will be destroyed once it is closed by the user.
Use the vertical slider to cylce through the slices of the current volume. When visualizing a CompositeVolume, the table widget on the right shows an overview over its different subvolumes. Click on a row to visualize the corresponding subvolume in the viewport. If desired (e.g. to save screen space), the subvolume overview can be hidden with hideCompositeOverview). Subvolumes can then only be selected using showSubvolume().
The following IO operations are supported by this widget:
Within the viewport of the current slice:
Anywhere in the widget:
Contrast line plots are opened in separate windows (see LineSeriesView for details on the corresponding widget).
Visualization of the slice image itself is done using the Chunk2DView class. The viewport can be accessed with dataView(), in order to adjust its settings. For mouse gesture windowing, a convenience method setAutoMouseWindowScaling() exists to directly set a sensitivity suited for the current data.
Example:
Note that it is absolutely possible to use the static version also to visualize a CompositeVolume. However, he property-based version provides more flexibility as it gives access to the full set of methods to configure the VolumeViewer. In particular, it allows us to configure the viewport showing the individual slices. The following example shows, how we can use this approach to create a visualization that uses a black-red colormap:
|
explicit |
Creates a VolumeViewer object with parent as a parent widget. Note that you need to call show() to display the window.
The static method plot() can be used as a convenience alternative for quick visualization.
CTL::gui::VolumeViewer::VolumeViewer | ( | CompositeVolume | volume, |
QWidget * | parent = nullptr |
||
) |
Creates a VolumeViewer with parent widget parent and sets its data to volume. Note that you need to call show() to display the window.
The static method plot() can be used as a convenience alternative for quick visualization.
CTL::gui::VolumeViewer::~VolumeViewer | ( | ) |
Deletes the object.
|
slot |
Requests an automatic resizing of this widget's window size. The window is tried to fit to the size of the shown data, bounded between a minimum size of 700 x 400 pixels (500 x 400 with hidden composite overview) and a maximum size of 1300 x 900 pixels.
const CompositeVolume & CTL::gui::VolumeViewer::data | ( | ) | const |
Returns a (constant) reference to the data currently managed by this instance.
Chunk2DView * CTL::gui::VolumeViewer::dataView | ( | ) | const |
Returns the viewport for displaying the actual slice data. Use this to configure the specific settings of the viewport.
|
slot |
Hides the composite overview table if hide = true
(or makes it visible again if false
).
|
static |
Convenience overload to plot VoxelVolume data of arbitrary template type. The values in data will be converted to float
for internal storage and displaying.
|
static |
Creates a VolumeViewer to visualize data and shows the window.
Sensitivity of windowing using mouse gestures is adapted automatically to data (see setAutoMouseWindowScaling()).
The widget will be deleted automatically if the window is closed.
|
static |
Creates a VolumeViewer to visualize data and shows the window.
Sensitivity of windowing using mouse gestures is adapted automatically to data (see setAutoMouseWindowScaling()).
The widget will be deleted automatically if the window is closed.
|
slot |
Convenience method to set automatically determined values for the sensitvity of windowing using mouse gestures.
Same as:
void CTL::gui::VolumeViewer::setData | ( | const VoxelVolume< T > & | data | ) |
Convenience overload to set VoxelVolume data of arbitrary template type. The values in data will be converted to float
for internal storage and displaying.
void CTL::gui::VolumeViewer::setData | ( | SpectralVolumeData | data | ) |
Sets the visualized data to data. Data is copied, so consider moving if it is no longer required.
Applies a min/max windowing if no specific windowing has been set (ie. the current window is [0,0]).
void CTL::gui::VolumeViewer::setData | ( | CompositeVolume | data | ) |
Sets the visualized data to data. Data is copied, so consider moving if it is no longer required.
By default, always selects the first subvolume in data for visualization.
Applies a min/max windowing if no specific windowing has been set (ie. the current window is [0,0]).
void CTL::gui::VolumeViewer::setWindowPresets | ( | WindowPreset | preset1, |
WindowPreset | preset2 | ||
) |
Sets the presets of the two preset buttons in the windowing GUI block to preset1 and preset2. Presets can be chosen from a set of pre-defined window ranges, specified in Hounsfield units (HU) [from, to]:
Example:
void CTL::gui::VolumeViewer::setWindowPresetsInMu | ( | WindowPreset | preset1, |
WindowPreset | preset2, | ||
float | referenceEnergy | ||
) |
Sets the presets of the two preset buttons in the windowing GUI block to preset1 and preset2. Presets can be chosen from a set of pre-defined window ranges (see setWindowPresets(WindowPreset, WindowPreset)). Window ranges from the presets (defined in Hounsfield units) will be converted to attenuation coefficients with respect to the reference energy referenceEnergy.
Example:
|
slot |
Shows the slice with index slice in the currently selected slice direction.
|
slot |
Shows the subvolume with index subvolume from the currently managed dataset.