Skip to content

Commit 2a6b28a

Browse files
authored
Feature/volume rendering (#110)
* Add initial version of volume rendering * Add toggle for volume rendering * Turn on front face culling when volume rendering * Add initial window/level control for transfer function * Fix issue with initializing window level start position, use wireframe when volume rendering * Use otsu method to set initial volume rendering window level * Use raycast volume mapper * Add surface render mode, using front face culling with no lighting for volume rendering * Adjust maximum opacity * Use extract voi for current region when volume rendering * Mask volume by visible region extents * Show full volume if no current region * Set current region in pop temp history
1 parent 874f7ca commit 2a6b28a

16 files changed

+647
-19
lines changed

CMakeLists.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ set(UI_RESOURCES
6767
# Create executable
6868
qt5_wrap_ui(UISrcs ${UI_FILES} )
6969
# CMAKE_AUTOMOC is ON so the MOC headers will be automatically wrapped.
70-
add_executable(Segmentor MACOSX_BUNDLE WIN32 ${CXX_FILES} ${UISrcs} ${QT_WRAP} ${UI_RESOURCES})
71-
#add_executable(Segmentor MACOSX_BUNDLE ${CXX_FILES} ${UISrcs} ${QT_WRAP} ${UI_RESOURCES})
70+
#add_executable(Segmentor MACOSX_BUNDLE WIN32 ${CXX_FILES} ${UISrcs} ${QT_WRAP} ${UI_RESOURCES})
71+
add_executable(Segmentor MACOSX_BUNDLE ${CXX_FILES} ${UISrcs} ${QT_WRAP} ${UI_RESOURCES})
7272
qt5_use_modules(Segmentor Core Gui)
7373
target_link_libraries(Segmentor ${VTK_LIBRARIES})
7474
install(TARGETS Segmentor

Segmentor.qrc

+1
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,6 @@
2525
<file>icons/icon_show_neighbor_regions.png</file>
2626
<file>icons/icon_filter_regions.png</file>
2727
<file>icons/icon_reset_view.png</file>
28+
<file>icons/icon_volume_render.png</file>
2829
</qresource>
2930
</RCC>

icons/icon_volume_render.png

1.58 KB
Loading

icons/icon_volume_render.svg

+171
Loading

interaction/InteractionCallbacks.cxx

+8
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include "VolumeView.h"
1414
#include "SliceView.h"
1515
#include "vtkInteractorStyleSlice.h"
16+
#include "vtkInteractorStyleVolume.h"
1617

1718
bool InteractionCallbacks::firstCameraCallback = true;
1819

@@ -293,4 +294,11 @@ void InteractionCallbacks::WindowLevel(vtkObject* caller, unsigned long eventId,
293294
VisualizationContainer* vis = static_cast<VisualizationContainer*>(clientData);
294295

295296
vis->SetWindowLevel(style->GetWindow(), style->GetLevel());
297+
}
298+
299+
void InteractionCallbacks::VolumeWindowLevel(vtkObject* caller, unsigned long eventId, void* clientData, void *callData) {
300+
vtkInteractorStyleVolume* style = static_cast<vtkInteractorStyleVolume*>(caller);
301+
VisualizationContainer* vis = static_cast<VisualizationContainer*>(clientData);
302+
303+
vis->SetVolumeWindowLevel(style->GetWindow(), style->GetLevel());
296304
}

interaction/InteractionCallbacks.h

+1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ class InteractionCallbacks {
3434
static void MouseMove(vtkObject* caller, unsigned long eventId, void* clientData, void *callData);
3535

3636
static void WindowLevel(vtkObject* caller, unsigned long eventId, void* clientData, void *callData);
37+
static void VolumeWindowLevel(vtkObject* caller, unsigned long eventId, void* clientData, void *callData);
3738

3839
private:
3940
static bool firstCameraCallback;

0 commit comments

Comments
 (0)