Skip to content

Commit

Permalink
Feature/volume rendering (#110)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
davidborland authored Jun 4, 2021
1 parent 874f7ca commit 2a6b28a
Show file tree
Hide file tree
Showing 16 changed files with 647 additions and 19 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ set(UI_RESOURCES
# Create executable
qt5_wrap_ui(UISrcs ${UI_FILES} )
# CMAKE_AUTOMOC is ON so the MOC headers will be automatically wrapped.
add_executable(Segmentor MACOSX_BUNDLE WIN32 ${CXX_FILES} ${UISrcs} ${QT_WRAP} ${UI_RESOURCES})
#add_executable(Segmentor MACOSX_BUNDLE ${CXX_FILES} ${UISrcs} ${QT_WRAP} ${UI_RESOURCES})
#add_executable(Segmentor MACOSX_BUNDLE WIN32 ${CXX_FILES} ${UISrcs} ${QT_WRAP} ${UI_RESOURCES})
add_executable(Segmentor MACOSX_BUNDLE ${CXX_FILES} ${UISrcs} ${QT_WRAP} ${UI_RESOURCES})
qt5_use_modules(Segmentor Core Gui)
target_link_libraries(Segmentor ${VTK_LIBRARIES})
install(TARGETS Segmentor
Expand Down
1 change: 1 addition & 0 deletions Segmentor.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,6 @@
<file>icons/icon_show_neighbor_regions.png</file>
<file>icons/icon_filter_regions.png</file>
<file>icons/icon_reset_view.png</file>
<file>icons/icon_volume_render.png</file>
</qresource>
</RCC>
Binary file added icons/icon_volume_render.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
171 changes: 171 additions & 0 deletions icons/icon_volume_render.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions interaction/InteractionCallbacks.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include "VolumeView.h"
#include "SliceView.h"
#include "vtkInteractorStyleSlice.h"
#include "vtkInteractorStyleVolume.h"

bool InteractionCallbacks::firstCameraCallback = true;

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

vis->SetWindowLevel(style->GetWindow(), style->GetLevel());
}

void InteractionCallbacks::VolumeWindowLevel(vtkObject* caller, unsigned long eventId, void* clientData, void *callData) {
vtkInteractorStyleVolume* style = static_cast<vtkInteractorStyleVolume*>(caller);
VisualizationContainer* vis = static_cast<VisualizationContainer*>(clientData);

vis->SetVolumeWindowLevel(style->GetWindow(), style->GetLevel());
}
1 change: 1 addition & 0 deletions interaction/InteractionCallbacks.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ class InteractionCallbacks {
static void MouseMove(vtkObject* caller, unsigned long eventId, void* clientData, void *callData);

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

private:
static bool firstCameraCallback;
Expand Down
Loading

0 comments on commit 2a6b28a

Please sign in to comment.