From 649fc25e246b85f708b3e2ae8bb99ebc4941bf62 Mon Sep 17 00:00:00 2001 From: Juan Prieto Date: Tue, 28 Jun 2011 16:34:37 +0000 Subject: [PATCH] addition of surface rendering, qt support --- CMakeLists.txt | 10 +++- appli/QtVTKViewer/CMakeLists.txt | 7 +-- appli/QtVTKViewer/qtvtkviewer.cxx | 6 +++ lib/GUI/Base/CMakeLists.txt | 1 + lib/GUI/Base/VolumeRenderer/CMakeLists.txt | 2 + .../VolumeRenderer/volumerendererdata.cxx | 6 ++- lib/GUI/Qt/CMakeLists.txt | 1 + lib/GUI/Qt/Viewers/CMakeLists.txt | 7 ++- lib/GUI/Qt/Viewers/qtvtkviewerwidget.cxx | 6 +++ lib/GUI/Qt/Viewers/qtvtkviewerwidget.ui | 47 +++++++++++++++++-- lib/GUI/Qt/VolumeRenderer/CMakeLists.txt | 2 + lib/GUI/Wx/CMakeLists.txt | 2 + lib/GUI/Wx/VolumeRenderer/CMakeLists.txt | 2 + lib/Kernel/CMakeLists.txt | 2 +- lib/Kernel/VTKObjects/CMakeLists.txt | 1 + .../VTKObjects/ViewerWidgets/CMakeLists.txt | 2 + .../VTKObjects/VolumeRenderer/CMakeLists.txt | 2 + .../volumerenderermanagerdata.cxx | 8 +++- 18 files changed, 96 insertions(+), 18 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e947cb1..a4ecd1a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -80,18 +80,24 @@ INCLUDE_DIRECTORIES( ${PROJECT_SOURCE_DIR}/lib/maracasVisuLib/src/CutModule/inte INCLUDE_DIRECTORIES( ${PROJECT_SOURCE_DIR}/lib/maracasVisuLib/src/CutModule/kernel ) INCLUDE_DIRECTORIES( ${PROJECT_SOURCE_DIR}/lib/maracasVisuLib/../../../ ) -INCLUDE_DIRECTORIES( ${PROJECT_BINARY_DIR}/lib/GUI/Qt/Viewers +INCLUDE_DIRECTORIES( + ${PROJECT_BINARY_DIR}/lib/GUI/Qt/Viewers ${PROJECT_SOURCE_DIR}/lib/GUI/Qt/Viewers ${PROJECT_SOURCE_DIR}/lib/GUI/Qt/VolumeRenderer + ${PROJECT_SOURCE_DIR}/lib/GUI/Qt/SurfaceRenderer ${PROJECT_SOURCE_DIR}/lib/GUI/Wx/VolumeRenderer + ${PROJECT_SOURCE_DIR}/lib/GUI/Wx/SurfaceRenderer ${PROJECT_SOURCE_DIR}/lib/GUI/Base/VolumeRenderer + ${PROJECT_SOURCE_DIR}/lib/GUI/Base/SurfaceRenderer + ${PROJECT_SOURCE_DIR}/lib/Kernel/VTKObjects/SurfaceRenderer ${PROJECT_SOURCE_DIR}/lib/Kernel/VTKObjects/ViewerWidgets ${PROJECT_SOURCE_DIR}/lib/Kernel/VTKObjects/VolumeRenderer - ${PROJECT_SOURCE_DIR}/lib/Kernel/ITKVTK + + ) diff --git a/appli/QtVTKViewer/CMakeLists.txt b/appli/QtVTKViewer/CMakeLists.txt index 1c18fd5..71c4b0d 100644 --- a/appli/QtVTKViewer/CMakeLists.txt +++ b/appli/QtVTKViewer/CMakeLists.txt @@ -32,12 +32,7 @@ INCLUDE_DIRECTORIES ( #---------------------------------------------------------------------------- # DEPENDENCIES (LIBRARIES TO LINK WITH) SET ( ${EXE_NAME}_LINK_LIBRARIES - GUIQtViewers - GUIQtVolumeRenderer - #${VTK_LIBRARIES} - ${QT_LIBRARIES} - QVTK - creaMaracasVisu + GUIQtViewers # ${WXWIDGETS_LIBRARIES} # ${KWWidgets_LIBRARIES} # ${VTK_LIBRARIES} diff --git a/appli/QtVTKViewer/qtvtkviewer.cxx b/appli/QtVTKViewer/qtvtkviewer.cxx index 1b53181..76778d4 100644 --- a/appli/QtVTKViewer/qtvtkviewer.cxx +++ b/appli/QtVTKViewer/qtvtkviewer.cxx @@ -58,6 +58,12 @@ int main(int argc, char **argv) } }else{ std::string inputFilename = argv[1]; + + vtkMetaImageReader* reader = vtkMetaImageReader::New(); + reader->SetFileName(inputFilename.c_str()); + reader->Update(); + img = reader->GetOutput(); + } diff --git a/lib/GUI/Base/CMakeLists.txt b/lib/GUI/Base/CMakeLists.txt index 8214325..ecd2ced 100644 --- a/lib/GUI/Base/CMakeLists.txt +++ b/lib/GUI/Base/CMakeLists.txt @@ -1 +1,2 @@ +ADD_SUBDIRECTORY(SurfaceRenderer) ADD_SUBDIRECTORY(VolumeRenderer) diff --git a/lib/GUI/Base/VolumeRenderer/CMakeLists.txt b/lib/GUI/Base/VolumeRenderer/CMakeLists.txt index 4c8fa91..91ec24a 100644 --- a/lib/GUI/Base/VolumeRenderer/CMakeLists.txt +++ b/lib/GUI/Base/VolumeRenderer/CMakeLists.txt @@ -73,6 +73,8 @@ IF ( BUILD_${LIBRARY_NAME} ) # if you need to create a static library # comment out the following line : + SET(${LIBRARY_NAME}_INSTALL_TREE_RELATIVE_INCLUDE_PATHS include/creaMaracasVisu) + SET(${LIBRARY_NAME}_INSTALL_FOLDER creaMaracasVisu) CREA_ADD_LIBRARY( ${LIBRARY_NAME} ) #SET_TARGET_PROPERTIES(${LIBRARY_NAME} PROPERTIES LINKER_LANGUAGE C) diff --git a/lib/GUI/Base/VolumeRenderer/volumerendererdata.cxx b/lib/GUI/Base/VolumeRenderer/volumerendererdata.cxx index 6adf475..3e3cf88 100644 --- a/lib/GUI/Base/VolumeRenderer/volumerendererdata.cxx +++ b/lib/GUI/Base/VolumeRenderer/volumerendererdata.cxx @@ -13,7 +13,11 @@ void VolumeRendererData::ShowVolume(bool checked){ if(checked){ invariant(); VolRendData = new VolumeRendererManagerData(ImageData, true); - VolRendData->SetLookupTable(LookUpTable); + if(!LookUpTable){ + + }else{ + VolRendData->SetLookupTable(LookUpTable); + } Renderer->AddActor(VolRendData->getProp3D()); }else{ Renderer->RemoveActor(VolRendData->getProp3D()); diff --git a/lib/GUI/Qt/CMakeLists.txt b/lib/GUI/Qt/CMakeLists.txt index 1011f01..d670448 100644 --- a/lib/GUI/Qt/CMakeLists.txt +++ b/lib/GUI/Qt/CMakeLists.txt @@ -1,2 +1,3 @@ +ADD_SUBDIRECTORY(SurfaceRenderer) ADD_SUBDIRECTORY(Viewers) ADD_SUBDIRECTORY(VolumeRenderer) diff --git a/lib/GUI/Qt/Viewers/CMakeLists.txt b/lib/GUI/Qt/Viewers/CMakeLists.txt index 2b7d5c7..cabd620 100644 --- a/lib/GUI/Qt/Viewers/CMakeLists.txt +++ b/lib/GUI/Qt/Viewers/CMakeLists.txt @@ -88,7 +88,10 @@ IF ( BUILD_${LIBRARY_NAME} ) # ${BOOST_LIBRARIES} ${QT_LIBRARIES} QVTK - GUIQtVolumeRenderer + + GUIQtVolumeRenderer + GUIQtSurfaceRenderer + KernelViewerWidgets # If this library must link against other libraries # USER! : Add here any extra Library you need @@ -104,6 +107,8 @@ IF ( BUILD_${LIBRARY_NAME} ) # if you need to create a static library # comment out the following line : + SET(${LIBRARY_NAME}_INSTALL_TREE_RELATIVE_INCLUDE_PATHS include/creaMaracasVisu) + SET(${LIBRARY_NAME}_INSTALL_FOLDER creaMaracasVisu) CREA_ADD_LIBRARY( ${LIBRARY_NAME} ) # and uncomment the 2 lines hereafter: diff --git a/lib/GUI/Qt/Viewers/qtvtkviewerwidget.cxx b/lib/GUI/Qt/Viewers/qtvtkviewerwidget.cxx index 3d9be6e..081107f 100644 --- a/lib/GUI/Qt/Viewers/qtvtkviewerwidget.cxx +++ b/lib/GUI/Qt/Viewers/qtvtkviewerwidget.cxx @@ -11,6 +11,9 @@ QtVTKViewerWidget::QtVTKViewerWidget(QWidget *parent) : this->m_VolumeRender->SetRenderer(this->getRenderer()); this->m_VolumeRender->SetInteractor(this->_qtvtkviewer->GetRenderWindow()->GetInteractor()); + + this->m_SurfaceRender->setRenderer(this->getRenderer()); + this->m_SurfaceRender->setInteractor(this->_qtvtkviewer->GetRenderWindow()->GetInteractor()); } QtVTKViewerWidget::~QtVTKViewerWidget() @@ -25,11 +28,14 @@ vtkRenderer* QtVTKViewerWidget::getRenderer(){ void QtVTKViewerWidget::setImage(vtkImageData* img){ this->_qtvtkviewer->setImage(img); this->m_VolumeRender->SetImageData(img); + this->m_SurfaceRender->SetImageData(img); + } void QtVTKViewerWidget::SetLookupTable(vtkLookupTable *lookuptable){ this->_qtvtkviewer->SetLookupTable(lookuptable); this->m_VolumeRender->SetLookUpTable(lookuptable); + } void QtVTKViewerWidget::on_checkBoxShowPlanes_clicked(){ diff --git a/lib/GUI/Qt/Viewers/qtvtkviewerwidget.ui b/lib/GUI/Qt/Viewers/qtvtkviewerwidget.ui index c9ba272..553d4b9 100644 --- a/lib/GUI/Qt/Viewers/qtvtkviewerwidget.ui +++ b/lib/GUI/Qt/Viewers/qtvtkviewerwidget.ui @@ -2,6 +2,14 @@ QtVTKViewerWidget + + + 0 + 0 + 801 + 616 + + Form @@ -15,15 +23,15 @@ - 1 + 2 0 0 - 239 - 417 + 98 + 28 @@ -57,8 +65,8 @@ 0 0 - 176 - 417 + 98 + 28 @@ -81,6 +89,29 @@ + + + + 0 + 0 + 155 + 505 + + + + Surface Rendering + + + + + 0 + 0 + 151 + 271 + + + + @@ -108,6 +139,12 @@
qtvolumerendererpanel.h
1 + + QtSurfaceRendererPanel + QWidget +
qtsurfacerendererpanel.h
+ 1 +
diff --git a/lib/GUI/Qt/VolumeRenderer/CMakeLists.txt b/lib/GUI/Qt/VolumeRenderer/CMakeLists.txt index 19f47cd..dde40a2 100644 --- a/lib/GUI/Qt/VolumeRenderer/CMakeLists.txt +++ b/lib/GUI/Qt/VolumeRenderer/CMakeLists.txt @@ -104,6 +104,8 @@ IF ( BUILD_${LIBRARY_NAME} ) # if you need to create a static library # comment out the following line : + SET(${LIBRARY_NAME}_INSTALL_TREE_RELATIVE_INCLUDE_PATHS include/creaMaracasVisu) + SET(${LIBRARY_NAME}_INSTALL_FOLDER creaMaracasVisu) CREA_ADD_LIBRARY( ${LIBRARY_NAME} ) # and uncomment the 2 lines hereafter: diff --git a/lib/GUI/Wx/CMakeLists.txt b/lib/GUI/Wx/CMakeLists.txt index 8214325..b572d1b 100644 --- a/lib/GUI/Wx/CMakeLists.txt +++ b/lib/GUI/Wx/CMakeLists.txt @@ -1 +1,3 @@ +ADD_SUBDIRECTORY(SurfaceRenderer) ADD_SUBDIRECTORY(VolumeRenderer) + diff --git a/lib/GUI/Wx/VolumeRenderer/CMakeLists.txt b/lib/GUI/Wx/VolumeRenderer/CMakeLists.txt index 6419b4c..294c230 100644 --- a/lib/GUI/Wx/VolumeRenderer/CMakeLists.txt +++ b/lib/GUI/Wx/VolumeRenderer/CMakeLists.txt @@ -73,6 +73,8 @@ IF ( BUILD_${LIBRARY_NAME} ) # if you need to create a static library # comment out the following line : + SET(${LIBRARY_NAME}_INSTALL_TREE_RELATIVE_INCLUDE_PATHS include/creaMaracasVisu) + SET(${LIBRARY_NAME}_INSTALL_FOLDER creaMaracasVisu) CREA_ADD_LIBRARY( ${LIBRARY_NAME} ) SET_TARGET_PROPERTIES(${LIBRARY_NAME} PROPERTIES LINKER_LANGUAGE C) diff --git a/lib/Kernel/CMakeLists.txt b/lib/Kernel/CMakeLists.txt index 21bc5bf..e9b0b1d 100644 --- a/lib/Kernel/CMakeLists.txt +++ b/lib/Kernel/CMakeLists.txt @@ -1,4 +1,4 @@ # Add a ADD_SUBDIRECTORY command for each of your libraries #ADD_SUBDIRECTORY(ITKVTK) ADD_SUBDIRECTORY(VTKObjects) - \ No newline at end of file + diff --git a/lib/Kernel/VTKObjects/CMakeLists.txt b/lib/Kernel/VTKObjects/CMakeLists.txt index 02b76be..d664bba 100644 --- a/lib/Kernel/VTKObjects/CMakeLists.txt +++ b/lib/Kernel/VTKObjects/CMakeLists.txt @@ -1,2 +1,3 @@ +ADD_SUBDIRECTORY(SurfaceRenderer) ADD_SUBDIRECTORY(ViewerWidgets) ADD_SUBDIRECTORY(VolumeRenderer) diff --git a/lib/Kernel/VTKObjects/ViewerWidgets/CMakeLists.txt b/lib/Kernel/VTKObjects/ViewerWidgets/CMakeLists.txt index fcacc56..0f6533a 100644 --- a/lib/Kernel/VTKObjects/ViewerWidgets/CMakeLists.txt +++ b/lib/Kernel/VTKObjects/ViewerWidgets/CMakeLists.txt @@ -102,6 +102,8 @@ IF ( BUILD_${LIBRARY_NAME} ) # comment out the following line : + SET(${LIBRARY_NAME}_INSTALL_TREE_RELATIVE_INCLUDE_PATHS include/creaMaracasVisu) + SET(${LIBRARY_NAME}_INSTALL_FOLDER creaMaracasVisu) CREA_ADD_LIBRARY( ${LIBRARY_NAME} ) SET_TARGET_PROPERTIES(${LIBRARY_NAME} PROPERTIES LINKER_LANGUAGE C) diff --git a/lib/Kernel/VTKObjects/VolumeRenderer/CMakeLists.txt b/lib/Kernel/VTKObjects/VolumeRenderer/CMakeLists.txt index 71c94f6..2fcf9ca 100644 --- a/lib/Kernel/VTKObjects/VolumeRenderer/CMakeLists.txt +++ b/lib/Kernel/VTKObjects/VolumeRenderer/CMakeLists.txt @@ -102,6 +102,8 @@ IF ( BUILD_${LIBRARY_NAME} ) # comment out the following line : + SET(${LIBRARY_NAME}_INSTALL_TREE_RELATIVE_INCLUDE_PATHS include/creaMaracasVisu) + SET(${LIBRARY_NAME}_INSTALL_FOLDER creaMaracasVisu) CREA_ADD_LIBRARY( ${LIBRARY_NAME} ) SET_TARGET_PROPERTIES(${LIBRARY_NAME} PROPERTIES LINKER_LANGUAGE C) diff --git a/lib/Kernel/VTKObjects/VolumeRenderer/volumerenderermanagerdata.cxx b/lib/Kernel/VTKObjects/VolumeRenderer/volumerenderermanagerdata.cxx index 74dd505..ba1706c 100644 --- a/lib/Kernel/VTKObjects/VolumeRenderer/volumerenderermanagerdata.cxx +++ b/lib/Kernel/VTKObjects/VolumeRenderer/volumerenderermanagerdata.cxx @@ -141,6 +141,7 @@ VolumeRendererManagerData::~VolumeRendererManagerData() void VolumeRendererManagerData::EnableBoundingBox(vtkRenderWindowInteractor* interactor) { //EED9Juin2011 if(_volumeMappergpu){ + if(!_boxWidgetS1){ _boxWidgetS1 = vtkBoxWidget::New(); _boxWidgetS1->SetInteractor( interactor ); _boxWidgetS1->SetPlaceFactor(1.01); @@ -161,14 +162,17 @@ void VolumeRendererManagerData::EnableBoundingBox(vtkRenderWindowInteractor* int callback->Delete(); _boxWidgetS1->EnabledOn(); _boxWidgetS1->GetSelectedFaceProperty()->SetOpacity(0.0); + }else{ + _boxWidgetS1->EnabledOn(); + } //EED9Juin2011 } } void VolumeRendererManagerData::DisableBoundingBox(){ if(_boxWidgetS1){ _boxWidgetS1->EnabledOff(); - _boxWidgetS1->Delete(); - _boxWidgetS1 = 0; + //_boxWidgetS1->Delete(); + //_boxWidgetS1 = 0; } } -- 2.47.1