Created
May 17, 2011 13:27
-
-
Save ihnorton/976461 to your computer and use it in GitHub Desktop.
tractography display widget patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Index: Libs/MRML/vtkMRMLFiberBundleNode.cxx | |
=================================================================== | |
--- Libs/MRML/vtkMRMLFiberBundleNode.cxx (revision ) | |
+++ Libs/MRML/vtkMRMLFiberBundleNode.cxx (working copy) | |
@@ -52,7 +52,7 @@ vtkMRMLNode* vtkMRMLFiberBundleNode::CreateNodeInstance() | |
//---------------------------------------------------------------------------- | |
void vtkMRMLFiberBundleNode::PrintSelf(ostream& os, vtkIndent indent) | |
{ | |
- | |
+ | |
Superclass::PrintSelf(os,indent); | |
} | |
@@ -65,7 +65,7 @@ vtkMRMLFiberBundleDisplayNode* vtkMRMLFiberBundleNode::GetLineDisplayNode() | |
for (int n=0; n<nnodes; n++) | |
{ | |
node = vtkMRMLFiberBundleLineDisplayNode::SafeDownCast(this->GetNthDisplayNode(n)); | |
- if (node) | |
+ if (node) | |
{ | |
break; | |
} | |
@@ -81,7 +81,7 @@ vtkMRMLFiberBundleDisplayNode* vtkMRMLFiberBundleNode::GetTubeDisplayNode() | |
for (int n=0; n<nnodes; n++) | |
{ | |
node = vtkMRMLFiberBundleTubeDisplayNode::SafeDownCast(this->GetNthDisplayNode(n)); | |
- if (node) | |
+ if (node) | |
{ | |
break; | |
} | |
@@ -97,7 +97,7 @@ vtkMRMLFiberBundleDisplayNode* vtkMRMLFiberBundleNode::GetGlyphDisplayNode() | |
for (int n=0; n<nnodes; n++) | |
{ | |
node = vtkMRMLFiberBundleGlyphDisplayNode::SafeDownCast(this->GetNthDisplayNode(n)); | |
- if (node) | |
+ if (node) | |
{ | |
break; | |
} | |
@@ -148,7 +148,7 @@ vtkMRMLFiberBundleDisplayNode* vtkMRMLFiberBundleNode::AddTubeDisplayNode() | |
node->SetAndObserveDiffusionTensorDisplayPropertiesNodeID(glyphDTDPN->GetID()); | |
glyphDTDPN->Delete(); | |
node->SetAndObserveColorNodeID("vtkMRMLColorTableNodeRainbow"); | |
- | |
+ | |
this->AddAndObserveDisplayNodeID(node->GetID()); | |
node->SetPolyData(this->GetPolyData()); | |
} | |
@@ -179,3 +179,147 @@ vtkMRMLFiberBundleDisplayNode* vtkMRMLFiberBundleNode::AddGlyphDisplayNode() | |
} | |
return node; | |
} | |
+ | |
+ | |
+void vtkMRMLFiberBundleNode::SetLineDisplayState(int state) | |
+{ | |
+ vtkMRMLFiberBundleDisplayNode* node = this->GetLineDisplayNode(); | |
+ | |
+ if (state == 0 && node != NULL) | |
+ { | |
+ node->SetVisibility(0); | |
+ } | |
+ else if ( state > 0) | |
+ { | |
+ node = this->AddLineDisplayNode(); | |
+ node->SetVisibility(1); | |
+ } | |
+} | |
+ | |
+void vtkMRMLFiberBundleNode::SetGlyphDisplayState(int state) | |
+{ | |
+ vtkMRMLFiberBundleDisplayNode* node = this->GetGlyphDisplayNode(); | |
+ | |
+ if (state == 0 && node != NULL) | |
+ { | |
+ node->SetVisibility(0); | |
+ } | |
+ else if ( state > 0 ) | |
+ { | |
+ node = this->AddGlyphDisplayNode(); | |
+ node->SetVisibility(1); | |
+ } | |
+} | |
+ | |
+ | |
+void vtkMRMLFiberBundleNode::SetTubeDisplayState(int state) | |
+{ | |
+ vtkMRMLFiberBundleDisplayNode* node = this->GetTubeDisplayNode(); | |
+ | |
+ if (state == 0 && node != NULL) | |
+ { | |
+ node->SetVisibility(0); | |
+ } | |
+ else if (state > 0) | |
+ { | |
+ node = this->AddTubeDisplayNode(); | |
+ node->SetVisibility(1); | |
+ } | |
+} | |
+ | |
+void vtkMRMLFiberBundleNode::SetColorBySolid() | |
+{ | |
+ int nnodes = this->GetNumberOfDisplayNodes(); | |
+ vtkMRMLFiberBundleDisplayNode *displayNode = NULL; | |
+ for (int n=0; n<nnodes; n++) | |
+ { | |
+ displayNode = vtkMRMLFiberBundleDisplayNode::SafeDownCast(this->GetNthDisplayNode(n)); | |
+ if (displayNode) | |
+ { | |
+ displayNode->SetColorModeToSolid(); | |
+ displayNode->UpdatePolyDataPipeline(); | |
+ } | |
+ } | |
+} | |
+ | |
+void vtkMRMLFiberBundleNode::SetColorBySolidColor(float r, float g, float b) | |
+{ | |
+ int nnodes = this->GetNumberOfDisplayNodes(); | |
+ vtkMRMLFiberBundleDisplayNode *displayNode = NULL; | |
+ for (int n=0; n<nnodes; n++) | |
+ { | |
+ displayNode = vtkMRMLFiberBundleDisplayNode::SafeDownCast(this->GetNthDisplayNode(n)); | |
+ if (displayNode) | |
+ { | |
+ displayNode->SetColor(r, g, b); | |
+ displayNode->UpdatePolyDataPipeline(); | |
+ } | |
+ } | |
+} | |
+ | |
+void vtkMRMLFiberBundleNode::SetColorByScalarInvariant() | |
+{ | |
+ int nnodes = this->GetNumberOfDisplayNodes(); | |
+ vtkMRMLFiberBundleDisplayNode *displayNode = NULL; | |
+ for (int n=0; n<nnodes; n++) | |
+ { | |
+ displayNode = vtkMRMLFiberBundleDisplayNode::SafeDownCast(this->GetNthDisplayNode(n)); | |
+ if (displayNode) | |
+ { | |
+ displayNode->SetColorModeToScalar(); | |
+ displayNode->UpdatePolyDataPipeline(); | |
+ } | |
+ } | |
+} | |
+ | |
+void vtkMRMLFiberBundleNode::SetColorByScalarInvariant(int invariantid) | |
+{ | |
+ int nnodes = this->GetNumberOfDisplayNodes(); | |
+ vtkMRMLFiberBundleDisplayNode *displayNode = NULL; | |
+ vtkMRMLDiffusionTensorDisplayPropertiesNode *displayPropertiesNode = NULL; | |
+ for (int n=0; n<nnodes; n++) | |
+ { | |
+ displayNode = vtkMRMLFiberBundleDisplayNode::SafeDownCast(this->GetNthDisplayNode(n)); | |
+ displayPropertiesNode = vtkMRMLDiffusionTensorDisplayPropertiesNode:: | |
+ SafeDownCast(displayNode->GetDiffusionTensorDisplayPropertiesNode()); | |
+ if (displayNode && displayPropertiesNode) | |
+ { | |
+ displayPropertiesNode->SetColorGlyphBy(invariantid); | |
+ displayNode->UpdatePolyDataPipeline(); | |
+ } | |
+ } | |
+} | |
+ | |
+ | |
+void vtkMRMLFiberBundleNode::SetColorByCellScalars() | |
+{ | |
+ int nnodes = this->GetNumberOfDisplayNodes(); | |
+ vtkMRMLFiberBundleDisplayNode *displayNode = NULL; | |
+ for (int n=0; n<nnodes; n++) | |
+ { | |
+ displayNode = vtkMRMLFiberBundleDisplayNode::SafeDownCast(this->GetNthDisplayNode(n)); | |
+ if (displayNode) | |
+ { | |
+ displayNode->SetColorModeToUseCellScalars(); | |
+ displayNode->UpdatePolyDataPipeline(); | |
+ } | |
+ } | |
+} | |
+ | |
+ | |
+void vtkMRMLFiberBundleNode::SetCellScalarsColorTable(vtkMRMLNode* colortableNode) | |
+{ | |
+ if(!vtkMRMLColorNode::SafeDownCast(colortableNode)) return; | |
+ | |
+ int nnodes = this->GetNumberOfDisplayNodes(); | |
+ vtkMRMLFiberBundleDisplayNode *displayNode = NULL; | |
+ | |
+ for (int n=0; n<nnodes; n++) | |
+ { | |
+ displayNode = vtkMRMLFiberBundleDisplayNode::SafeDownCast(this->GetNthDisplayNode(n)); | |
+ if (displayNode) | |
+ { | |
+ displayNode->SetAndObserveColorNodeID(colortableNode->GetID()); | |
+ } | |
+ } | |
+} | |
Index: Libs/MRML/vtkMRMLFiberBundleNode.h | |
=================================================================== | |
--- Libs/MRML/vtkMRMLFiberBundleNode.h (revision ) | |
+++ Libs/MRML/vtkMRMLFiberBundleNode.h (working copy) | |
@@ -12,17 +12,17 @@ | |
=========================================================================auto=*/ | |
/// vtkMRMLFiberBundleNode - MRML node to represent a fiber bundle from tractography in DTI data. | |
-/// | |
+/// | |
/// FiberBundle nodes contain trajectories ("fibers") from tractography, internally represented as vtkPolyData. | |
-/// A FiberBundle node contains many fibers and forms the smallest logical unit of tractography | |
-/// that MRML will manage/read/write. Each fiber has accompanying tensor data. | |
+/// A FiberBundle node contains many fibers and forms the smallest logical unit of tractography | |
+/// that MRML will manage/read/write. Each fiber has accompanying tensor data. | |
/// Visualization parameters for these nodes are controlled by the vtkMRMLFiberBundleDisplayNode class. | |
// | |
#ifndef __vtkMRMLFiberBundleNode_h | |
#define __vtkMRMLFiberBundleNode_h | |
-#include "vtkPolyData.h" | |
+#include "vtkPolyData.h" | |
#include "vtkMRML.h" | |
#include "vtkMRMLScene.h" | |
@@ -44,48 +44,90 @@ public: | |
vtkTypeMacro(vtkMRMLFiberBundleNode,vtkMRMLModelNode); | |
//vtkTypeMacro(vtkMRMLFiberBundleNode,vtkMRMLTransformableNode); | |
void PrintSelf(ostream& os, vtkIndent indent); | |
- | |
+ | |
//-------------------------------------------------------------------------- | |
/// MRMLNode methods | |
//-------------------------------------------------------------------------- | |
virtual vtkMRMLNode* CreateNodeInstance(); | |
- /// | |
+ /// | |
/// Get node XML tag name (like Volume, Model) | |
virtual const char* GetNodeTagName() {return "FiberBundle";}; | |
- /// | |
+ /// | |
/// get associated line display node or NULL if not set | |
vtkMRMLFiberBundleDisplayNode* GetLineDisplayNode(); | |
- /// | |
+ /// | |
/// get associated tube display node or NULL if not set | |
vtkMRMLFiberBundleDisplayNode* GetTubeDisplayNode(); | |
- /// | |
+ /// | |
/// get associated glyph display node or NULL if not set | |
vtkMRMLFiberBundleDisplayNode* GetGlyphDisplayNode(); | |
- /// | |
+ /// | |
/// add line display node if not already present and return it | |
vtkMRMLFiberBundleDisplayNode* AddLineDisplayNode(); | |
- /// | |
+ /// | |
/// add tube display node if not already present and return it | |
vtkMRMLFiberBundleDisplayNode* AddTubeDisplayNode(); | |
- /// | |
+ /// | |
/// add glyph display node if not already present and return it | |
vtkMRMLFiberBundleDisplayNode* AddGlyphDisplayNode(); | |
- /// | |
+ /// | |
+ /// set visibility of line display node | |
+ void SetLineDisplayState(int state); | |
+ | |
+ /// | |
+ /// set visibility of glyph display node | |
+ void SetGlyphDisplayState(int state); | |
+ | |
+ /// | |
+ /// set visibility of glyph display node | |
+ void SetTubeDisplayState(int state); | |
+ | |
+ /// | |
+ /// set ColorBySolid | |
+ /// TODO: move me out, I belong in FBDisplayNode | |
+ void SetColorBySolid(); | |
+ | |
+ /// | |
+ /// set the ColorBySolid color | |
+ void SetColorBySolidColor(float, float, float); | |
+ | |
+ /// | |
+ /// set ColorByScalar | |
+ /// TODO: move me out of here, I belong in FBDisplayNode | |
+ void SetColorByScalarInvariant(); | |
+ | |
+ /// | |
+ /// set the ScalarInvariant | |
+ /// int based on enum in DiffusionTensorDisplayPropertiesNode | |
+ /// TODO: move me out of here, I belong in FBDisplayNode | |
+ void SetColorByScalarInvariant(int); | |
+ | |
+ /// | |
+ /// set ColorByCellScalars | |
+ /// TODO: move me out, I belong in FBDisplayNode | |
+ void SetColorByCellScalars(); | |
+ | |
+ /// | |
+ /// set ColorByCellScalars color table | |
+ void SetCellScalarsColorTable(vtkMRMLNode*); | |
+ | |
+ | |
+ /// | |
/// Create default storage node or NULL if does not have one | |
virtual vtkMRMLStorageNode* CreateDefaultStorageNode() | |
{ | |
return Superclass::CreateDefaultStorageNode(); | |
}; | |
- | |
+ | |
protected: | |
vtkMRMLFiberBundleNode(){}; | |
~vtkMRMLFiberBundleNode(){}; | |
Index: QTModules/TractographyDisplay/CMakeLists.txt | |
=================================================================== | |
--- QTModules/TractographyDisplay/CMakeLists.txt (revision ) | |
+++ QTModules/TractographyDisplay/CMakeLists.txt (working copy) | |
@@ -7,6 +7,7 @@ SET(qt_module_export_directive "Q_SLICER_QTMODULES_TRACTOGRAPHYDISPLAY_EXPORT") | |
SET(qt_module_include_directories | |
${vtkSlicerTractographyDisplayModuleLogic_SOURCE_DIR} | |
${vtkSlicerTractographyDisplayModuleLogic_BINARY_DIR} | |
+ Widgets | |
) | |
# Source files | |
@@ -30,8 +31,13 @@ SET(qt_module_UI_SRCS | |
# Additional Target libraries | |
SET(qt_module_target_libraries | |
vtkSlicerTractographyDisplayModuleLogic | |
+ qSlicerTractographyDisplayWidgets | |
) | |
+IF(Slicer_USE_PYTHONQT) | |
+ LIST(APPEND qt_module_target_libraries qSlicerTractographyDisplayWidgetsPythonQt) | |
+ENDIF() | |
+ | |
# Resources | |
SET(qt_module_resources | |
) | |
@@ -52,4 +58,5 @@ if(BUILD_TESTING) | |
# add_subdirectory(Testing) | |
endif(BUILD_TESTING) | |
+ADD_SUBDIRECTORY(Widgets) | |
Index: QTModules/TractographyDisplay/Widgets/CMakeLists.txt | |
new file mode 100644 | |
=================================================================== | |
--- /dev/null (revision ) | |
+++ QTModules/TractographyDisplay/Widgets/CMakeLists.txt (working copy) | |
@@ -0,0 +1,179 @@ | |
+PROJECT(qSlicerTractographyDisplayWidgets) | |
+ | |
+ | |
+ | |
+#----------------------------------------------------------------------------- | |
+cmake_minimum_required(VERSION 2.8.2) | |
+#----------------------------------------------------------------------------- | |
+ | |
+#----------------------------------------------------------------------------- | |
+# See http://cmake.org/cmake/help/cmake-2-8-docs.html#section_Policies for details | |
+#----------------------------------------------------------------------------- | |
+if(POLICY CMP0016) | |
+ CMAKE_POLICY(SET CMP0016 NEW) | |
+endif() | |
+if(POLICY CMP0017) | |
+ CMAKE_POLICY(SET CMP0017 OLD) | |
+endif() | |
+ | |
+ | |
+IF(NOT DEFINED BUILD_SHARED_LIBS) | |
+ OPTION(BUILD_SHARED_LIBS "Build with shared libraries." ON) | |
+ENDIF(NOT DEFINED BUILD_SHARED_LIBS) | |
+ | |
+# CMake module | |
+SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${qSlicerTractographyDisplayWidget_SOURCE_DIR}/CMake") | |
+ | |
+#----------------------------------------------------------------------------- | |
+# Sources | |
+# | |
+SET(qSlicerTractographyDisplayWidgets_SRCS | |
+ qSlicerTractographyDisplayWidget.cxx | |
+ qSlicerTractographyDisplayWidget.h | |
+ qSlicerTractographyDisplayModuleWidget.cxx | |
+ qSlicerTractographyDisplayModuleWidget.h | |
+) | |
+ | |
+# Headers that should run through moc | |
+SET(qSlicerTractographyDisplayWidgets_MOC_SRCS | |
+ qSlicerTractographyDisplayWidget.h | |
+ qSlicerTractographyDisplayModuleWidget.h | |
+ ) | |
+ | |
+# UI files | |
+SET(qSlicerTractographyDisplayWidgets_UI_SRCS | |
+ Resources/UI/qSlicerTractographyDisplayWidget.ui | |
+ Resources/UI/qSlicerTractographyDisplayModule.ui | |
+ ) | |
+ | |
+SET(qSlicerTractographyDisplayWidgets_QRC_SRCS | |
+ ) | |
+ | |
+QT4_WRAP_CPP(qSlicerTractographyDisplayWidgets_MOC_CXX ${qSlicerTractographyDisplayWidgets_MOC_SRCS}) | |
+QT4_WRAP_UI(qSlicerTractographyDisplayWidgets_UI_CXX ${qSlicerTractographyDisplayWidgets_UI_SRCS}) | |
+QT4_ADD_RESOURCES(qSlicerTractographyDisplayWidgets_QRC_CXX ${qSlicerTractographyDisplayWidgets_QRC_SRCS}) | |
+ | |
+SOURCE_GROUP("Resources" FILES | |
+ ${qSlicerTractographyDisplayWidgets_UI_SRCS} | |
+ ${qSlicerTractographyDisplayWidgets_QRC_SRCS} | |
+ ) | |
+ | |
+SOURCE_GROUP("Generated" FILES | |
+ ${qSlicerTractographyDisplayWidgets_MOC_CXX} | |
+ ${qSlicerTractographyDisplayWidgets_UI_CXX} | |
+ ${qSlicerTractographyDisplayWidgets_QRC_CXX} | |
+ ) | |
+ | |
+# -------------------------------------------------------------------------- | |
+# Include dirs | |
+# -------------------------------------------------------------------------- | |
+SET(include_dirs | |
+ ${CMAKE_CURRENT_SOURCE_DIR} | |
+ ${CMAKE_CURRENT_BINARY_DIR} | |
+ ${MRML_SOURCE_DIR} | |
+ ${MRML_BINARY_DIR} | |
+ ${MRMLLogic_SOURCE_DIR} | |
+ ${MRMLLogic_BINARY_DIR} | |
+ ${MRMLDisplayableManager_SOURCE_DIR} | |
+ ${MRMLDisplayableManager_BINARY_DIR} | |
+ ${qMRMLWidgets_SOURCE_DIR} | |
+ ${qMRMLWidgets_BINARY_DIR} | |
+ ) | |
+ | |
+SET(QT_INCLUDE_DIRS | |
+ ${QT_INCLUDE_DIR} | |
+ ${QT_QTWEBKIT_INCLUDE_DIR} | |
+ ${QT_QTGUI_INCLUDE_DIR} | |
+ ${QT_QTCORE_INCLUDE_DIR} | |
+ ${QT_QTXML_INCLUDE_DIR} | |
+ ) | |
+SET(include_dirs ${include_dirs} ${QT_INCLUDE_DIRS}) | |
+INCLUDE_DIRECTORIES(${include_dirs}) | |
+ | |
+# -------------------------------------------------------------------------- | |
+# Install headers | |
+# -------------------------------------------------------------------------- | |
+IF(NOT DEFINED ${PROJECT_NAME}_INSTALL_NO_DEVELOPMENT) | |
+ SET(${PROJECT_NAME}_INSTALL_NO_DEVELOPMENT ON) | |
+ENDIF() | |
+IF(NOT ${PROJECT_NAME}_INSTALL_NO_DEVELOPMENT) | |
+ file(GLOB headers "${CMAKE_CURRENT_SOURCE_DIR}/*.h") | |
+ install( | |
+ FILES ${headers} | |
+ DESTINATION include/${PROJECT_NAME} COMPONENT Development) | |
+ENDIF() | |
+ | |
+# -------------------------------------------------------------------------- | |
+# Build library | |
+# -------------------------------------------------------------------------- | |
+SET(lib_name ${PROJECT_NAME}) | |
+ | |
+ADD_LIBRARY(${lib_name} | |
+ ${qSlicerTractographyDisplayWidgets_SRCS} | |
+ ${qSlicerTractographyDisplayWidgets_MOC_CXX} | |
+ ${qSlicerTractographyDisplayWidgets_UI_CXX} | |
+ ${qSlicerTractographyDisplayWidgets_QRC_CXX} | |
+ ) | |
+ | |
+SET(qSlicerTractographyDisplayWidgets_LIBRARIES | |
+ ${QT_LIBRARIES} | |
+ ${CTK_LIBRARIES} | |
+ ${CTK_EXTERNAL_LIBRARIES} | |
+ vtkSlicerTractographyDisplayModuleLogic | |
+ qMRMLWidgets | |
+# Comment these out to avoid recompile every time | |
+# MRML | |
+# MRMLLogic | |
+# MRMLDisplayableManager | |
+ ) | |
+ | |
+TARGET_LINK_LIBRARIES(${lib_name} ${qSlicerTractographyDisplayWidgets_LIBRARIES}) | |
+ | |
+# Apply user-defined properties to the library target. | |
+IF(Slicer_LIBRARY_PROPERTIES) | |
+ SET_TARGET_PROPERTIES(${lib_name} PROPERTIES ${Slicer_LIBRARY_PROPERTIES}) | |
+ENDIF() | |
+ | |
+ | |
+# -------------------------------------------------------------------------- | |
+# PythonQt wrapping | |
+# -------------------------------------------------------------------------- | |
+IF(Slicer_USE_PYTHONQT) | |
+ SET(qSlicerTractographyDisplayWidgets_WRAP_PYTHON ON) | |
+ENDIF() | |
+ | |
+IF(qSlicerTractographyDisplayWidgets_WRAP_PYTHON) | |
+ SET(KIT_PYTHONQT_SRCS) # Clear variable | |
+ ctkMacroWrapPythonQt("org.slicer.libs" ${lib_name} | |
+ KIT_PYTHONQT_SRCS "${qSlicerTractographyDisplayWidgets_SRCS}" FALSE) | |
+ ADD_LIBRARY(${lib_name}PythonQt STATIC ${KIT_PYTHONQT_SRCS}) | |
+ TARGET_LINK_LIBRARIES(${lib_name}PythonQt ${lib_name}) | |
+ IF(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64") | |
+ SET_TARGET_PROPERTIES(${lib_name}PythonQt PROPERTIES COMPILE_FLAGS "-fPIC") | |
+ ENDIF() | |
+ENDIF() | |
+ | |
+# -------------------------------------------------------------------------- | |
+# Export target | |
+# -------------------------------------------------------------------------- | |
+IF(NOT DEFINED ${PROJECT_NAME}_EXPORT_FILE) | |
+ SET(${PROJECT_NAME}_EXPORT_FILE ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Targets.cmake) | |
+ENDIF() | |
+EXPORT(TARGETS ${lib_name} APPEND FILE ${${PROJECT_NAME}_EXPORT_FILE}) | |
+ | |
+# -------------------------------------------------------------------------- | |
+# Install library | |
+# -------------------------------------------------------------------------- | |
+IF(NOT DEFINED ${PROJECT_NAME}_INSTALL_BIN_DIR) | |
+ SET(${PROJECT_NAME}_INSTALL_BIN_DIR bin) | |
+ENDIF() | |
+IF(NOT DEFINED ${PROJECT_NAME}_INSTALL_LIB_DIR) | |
+ SET(${PROJECT_NAME}_INSTALL_LIB_DIR lib/${PROJECT_NAME}) | |
+ENDIF() | |
+ | |
+INSTALL(TARGETS ${lib_name} | |
+ RUNTIME DESTINATION ${${PROJECT_NAME}_INSTALL_BIN_DIR} COMPONENT RuntimeLibraries | |
+ LIBRARY DESTINATION ${${PROJECT_NAME}_INSTALL_LIB_DIR} COMPONENT RuntimeLibraries | |
+ ARCHIVE DESTINATION ${${PROJECT_NAME}_INSTALL_LIB_DIR} COMPONENT Development | |
+ ) | |
+ | |
Index: QTModules/TractographyDisplay/Widgets/Resources/UI/qSlicerTractographyDisplayModule.ui | |
new file mode 100644 | |
=================================================================== | |
--- /dev/null (revision ) | |
+++ QTModules/TractographyDisplay/Widgets/Resources/UI/qSlicerTractographyDisplayModule.ui (working copy) | |
@@ -0,0 +1,151 @@ | |
+<?xml version="1.0" encoding="UTF-8"?> | |
+<ui version="4.0"> | |
+ <class>qSlicerTractographyDisplayModule</class> | |
+ <widget class="qSlicerWidget" name="qSlicerTractographyDisplayModule"> | |
+ <property name="enabled"> | |
+ <bool>true</bool> | |
+ </property> | |
+ <property name="geometry"> | |
+ <rect> | |
+ <x>0</x> | |
+ <y>0</y> | |
+ <width>324</width> | |
+ <height>231</height> | |
+ </rect> | |
+ </property> | |
+ <property name="windowTitle"> | |
+ <string>Form</string> | |
+ </property> | |
+ <layout class="QGridLayout" name="gridLayout"> | |
+ <item row="0" column="0"> | |
+ <widget class="QLabel" name="SelectFiberBundleLabel"> | |
+ <property name="text"> | |
+ <string>FIberBundle:</string> | |
+ </property> | |
+ </widget> | |
+ </item> | |
+ <item row="0" column="1"> | |
+ <widget class="qMRMLNodeComboBox" name="FiberBundleNodeSelector"> | |
+ <property name="enabled"> | |
+ <bool>true</bool> | |
+ </property> | |
+ <property name="nodeTypes"> | |
+ <stringlist> | |
+ <string>vtkMRMLFiberBundleNode</string> | |
+ </stringlist> | |
+ </property> | |
+ </widget> | |
+ </item> | |
+ <item row="1" column="0" colspan="2"> | |
+ <widget class="ctkCollapsibleButton" name="CollapsibleButton"> | |
+ <property name="text"> | |
+ <string>Tract Display</string> | |
+ </property> | |
+ <property name="checked"> | |
+ <bool>true</bool> | |
+ </property> | |
+ <property name="collapsed"> | |
+ <bool>false</bool> | |
+ </property> | |
+ <property name="contentsFrameShape"> | |
+ <enum>QFrame::StyledPanel</enum> | |
+ </property> | |
+ <layout class="QVBoxLayout" name="verticalLayout"> | |
+ <item> | |
+ <widget class="qSlicerTractographyDisplayWidget" name="TractographyDisplayWidget" native="true"/> | |
+ </item> | |
+ </layout> | |
+ </widget> | |
+ </item> | |
+ <item row="2" column="0" colspan="2"> | |
+ <spacer name="verticalSpacer"> | |
+ <property name="orientation"> | |
+ <enum>Qt::Vertical</enum> | |
+ </property> | |
+ <property name="sizeHint" stdset="0"> | |
+ <size> | |
+ <width>208</width> | |
+ <height>15</height> | |
+ </size> | |
+ </property> | |
+ </spacer> | |
+ </item> | |
+ </layout> | |
+ </widget> | |
+ <customwidgets> | |
+ <customwidget> | |
+ <class>ctkCollapsibleButton</class> | |
+ <extends>QWidget</extends> | |
+ <header>ctkCollapsibleButton.h</header> | |
+ <container>1</container> | |
+ </customwidget> | |
+ <customwidget> | |
+ <class>qMRMLNodeComboBox</class> | |
+ <extends>QWidget</extends> | |
+ <header>qMRMLNodeComboBox.h</header> | |
+ </customwidget> | |
+ <customwidget> | |
+ <class>qSlicerWidget</class> | |
+ <extends>QWidget</extends> | |
+ <header>qSlicerWidget.h</header> | |
+ <container>1</container> | |
+ </customwidget> | |
+ <customwidget> | |
+ <class>qSlicerTractographyDisplayWidget</class> | |
+ <extends>QWidget</extends> | |
+ <header>qSlicerTractographyDisplayWidget.h</header> | |
+ <container>1</container> | |
+ </customwidget> | |
+ </customwidgets> | |
+ <resources/> | |
+ <connections> | |
+ <connection> | |
+ <sender>qSlicerTractographyDisplayModule</sender> | |
+ <signal>mrmlSceneChanged(vtkMRMLScene*)</signal> | |
+ <receiver>FiberBundleNodeSelector</receiver> | |
+ <slot>setMRMLScene(vtkMRMLScene*)</slot> | |
+ <hints> | |
+ <hint type="sourcelabel"> | |
+ <x>204</x> | |
+ <y>259</y> | |
+ </hint> | |
+ <hint type="destinationlabel"> | |
+ <x>125</x> | |
+ <y>22</y> | |
+ </hint> | |
+ </hints> | |
+ </connection> | |
+ <connection> | |
+ <sender>qSlicerTractographyDisplayModule</sender> | |
+ <signal>mrmlSceneChanged(vtkMRMLScene*)</signal> | |
+ <receiver>TractographyDisplayWidget</receiver> | |
+ <slot>setMRMLScene(vtkMRMLScene*)</slot> | |
+ <hints> | |
+ <hint type="sourcelabel"> | |
+ <x>125</x> | |
+ <y>43</y> | |
+ </hint> | |
+ <hint type="destinationlabel"> | |
+ <x>204</x> | |
+ <y>187</y> | |
+ </hint> | |
+ </hints> | |
+ </connection> | |
+ <connection> | |
+ <sender>FiberBundleNodeSelector</sender> | |
+ <signal>currentNodeChanged(vtkMRMLNode*)</signal> | |
+ <receiver>TractographyDisplayWidget</receiver> | |
+ <slot>setFiberBundleNode(vtkMRMLNode*)</slot> | |
+ <hints> | |
+ <hint type="sourcelabel"> | |
+ <x>125</x> | |
+ <y>22</y> | |
+ </hint> | |
+ <hint type="destinationlabel"> | |
+ <x>204</x> | |
+ <y>187</y> | |
+ </hint> | |
+ </hints> | |
+ </connection> | |
+ </connections> | |
+</ui> | |
Index: QTModules/TractographyDisplay/Widgets/Resources/UI/qSlicerTractographyDisplayWidget.ui | |
new file mode 100644 | |
=================================================================== | |
--- /dev/null (revision ) | |
+++ QTModules/TractographyDisplay/Widgets/Resources/UI/qSlicerTractographyDisplayWidget.ui (working copy) | |
@@ -0,0 +1,336 @@ | |
+<?xml version="1.0" encoding="UTF-8"?> | |
+<ui version="4.0"> | |
+ <class>qSlicerTractographyDisplayWidget</class> | |
+ <widget class="qSlicerWidget" name="qSlicerTractographyDisplayWidget"> | |
+ <property name="geometry"> | |
+ <rect> | |
+ <x>0</x> | |
+ <y>0</y> | |
+ <width>300</width> | |
+ <height>310</height> | |
+ </rect> | |
+ </property> | |
+ <property name="sizePolicy"> | |
+ <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> | |
+ <horstretch>0</horstretch> | |
+ <verstretch>0</verstretch> | |
+ </sizepolicy> | |
+ </property> | |
+ <property name="windowTitle"> | |
+ <string>Form</string> | |
+ </property> | |
+ <layout class="QGridLayout" name="gridLayout"> | |
+ <item row="0" column="0"> | |
+ <widget class="QLabel" name="label"> | |
+ <property name="sizePolicy"> | |
+ <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> | |
+ <horstretch>0</horstretch> | |
+ <verstretch>0</verstretch> | |
+ </sizepolicy> | |
+ </property> | |
+ <property name="font"> | |
+ <font> | |
+ <weight>75</weight> | |
+ <bold>true</bold> | |
+ </font> | |
+ </property> | |
+ <property name="text"> | |
+ <string>Show as:</string> | |
+ </property> | |
+ </widget> | |
+ </item> | |
+ <item row="0" column="1"> | |
+ <layout class="QHBoxLayout" name="Layout_ShowAs" stretch="0,0,0"> | |
+ <property name="sizeConstraint"> | |
+ <enum>QLayout::SetDefaultConstraint</enum> | |
+ </property> | |
+ <item> | |
+ <widget class="QCheckBox" name="ShowAsLineCheckBox"> | |
+ <property name="text"> | |
+ <string>Line</string> | |
+ </property> | |
+ <property name="autoExclusive"> | |
+ <bool>true</bool> | |
+ </property> | |
+ </widget> | |
+ </item> | |
+ <item> | |
+ <widget class="QCheckBox" name="ShowAsTubeCheckBox"> | |
+ <property name="text"> | |
+ <string>Tube</string> | |
+ </property> | |
+ <property name="autoExclusive"> | |
+ <bool>true</bool> | |
+ </property> | |
+ </widget> | |
+ </item> | |
+ <item> | |
+ <widget class="QCheckBox" name="ShowAsGlyphCheckBox"> | |
+ <property name="text"> | |
+ <string>Glyph</string> | |
+ </property> | |
+ <property name="autoExclusive"> | |
+ <bool>true</bool> | |
+ </property> | |
+ </widget> | |
+ </item> | |
+ </layout> | |
+ </item> | |
+ <item row="1" column="0" colspan="2"> | |
+ <widget class="QGroupBox" name="GroupBox_ColorBy"> | |
+ <property name="sizePolicy"> | |
+ <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> | |
+ <horstretch>0</horstretch> | |
+ <verstretch>0</verstretch> | |
+ </sizepolicy> | |
+ </property> | |
+ <property name="font"> | |
+ <font> | |
+ <weight>50</weight> | |
+ <bold>false</bold> | |
+ </font> | |
+ </property> | |
+ <property name="title"> | |
+ <string>Color By:</string> | |
+ </property> | |
+ <property name="flat"> | |
+ <bool>true</bool> | |
+ </property> | |
+ <layout class="QVBoxLayout" name="verticalLayout_3"> | |
+ <item> | |
+ <widget class="QGroupBox" name="GroupBox_ColorByScalars"> | |
+ <property name="sizePolicy"> | |
+ <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> | |
+ <horstretch>0</horstretch> | |
+ <verstretch>0</verstretch> | |
+ </sizepolicy> | |
+ </property> | |
+ <property name="title"> | |
+ <string>Scalar Colormap</string> | |
+ </property> | |
+ <property name="flat"> | |
+ <bool>false</bool> | |
+ </property> | |
+ <layout class="QVBoxLayout" name="verticalLayout"> | |
+ <item> | |
+ <widget class="qMRMLColorTableComboBox" name="ColorByCellScalarsComboBox"> | |
+ <property name="enabled"> | |
+ <bool>true</bool> | |
+ </property> | |
+ <property name="renameEnabled"> | |
+ <bool>false</bool> | |
+ </property> | |
+ </widget> | |
+ </item> | |
+ <item> | |
+ <layout class="QHBoxLayout" name="horizontalLayout"> | |
+ <item> | |
+ <widget class="QCheckBox" name="ColorByScalarInvariantCheckBox"> | |
+ <property name="text"> | |
+ <string>Tensor property</string> | |
+ </property> | |
+ <property name="autoExclusive"> | |
+ <bool>true</bool> | |
+ </property> | |
+ <property name="tristate"> | |
+ <bool>false</bool> | |
+ </property> | |
+ <attribute name="buttonGroup"> | |
+ <string>ButtonGroup_ColorBySelectors</string> | |
+ </attribute> | |
+ </widget> | |
+ </item> | |
+ <item> | |
+ <widget class="QComboBox" name="ColorByScalarInvariantComboBox"/> | |
+ </item> | |
+ </layout> | |
+ </item> | |
+ <item> | |
+ <widget class="QCheckBox" name="ColorByCellScalarsCheckBox"> | |
+ <property name="text"> | |
+ <string>Fiber Cluster Group ID</string> | |
+ </property> | |
+ <property name="autoExclusive"> | |
+ <bool>true</bool> | |
+ </property> | |
+ <property name="tristate"> | |
+ <bool>false</bool> | |
+ </property> | |
+ <attribute name="buttonGroup"> | |
+ <string>ButtonGroup_ColorBySelectors</string> | |
+ </attribute> | |
+ </widget> | |
+ </item> | |
+ </layout> | |
+ </widget> | |
+ </item> | |
+ <item> | |
+ <layout class="QHBoxLayout" name="horizontalLayout_3"> | |
+ <item> | |
+ <widget class="QCheckBox" name="ColorBySolidCheckBox"> | |
+ <property name="text"> | |
+ <string>Solid color</string> | |
+ </property> | |
+ <property name="autoExclusive"> | |
+ <bool>true</bool> | |
+ </property> | |
+ <property name="tristate"> | |
+ <bool>false</bool> | |
+ </property> | |
+ <attribute name="buttonGroup"> | |
+ <string>ButtonGroup_ColorBySelectors</string> | |
+ </attribute> | |
+ </widget> | |
+ </item> | |
+ <item> | |
+ <widget class="ctkColorPickerButton" name="ColorBySolidSelector"/> | |
+ </item> | |
+ </layout> | |
+ </item> | |
+ </layout> | |
+ </widget> | |
+ </item> | |
+ <item row="2" column="0" colspan="2"> | |
+ <widget class="QCheckBox" name="set_clipping"> | |
+ <property name="enabled"> | |
+ <bool>false</bool> | |
+ </property> | |
+ <property name="font"> | |
+ <font> | |
+ <weight>75</weight> | |
+ <bold>true</bold> | |
+ </font> | |
+ </property> | |
+ <property name="layoutDirection"> | |
+ <enum>Qt::LeftToRight</enum> | |
+ </property> | |
+ <property name="text"> | |
+ <string>Enable Clipping</string> | |
+ </property> | |
+ <property name="tristate"> | |
+ <bool>false</bool> | |
+ </property> | |
+ </widget> | |
+ </item> | |
+ <item row="3" column="0"> | |
+ <widget class="QLabel" name="label_opacity"> | |
+ <property name="enabled"> | |
+ <bool>false</bool> | |
+ </property> | |
+ <property name="font"> | |
+ <font> | |
+ <weight>75</weight> | |
+ <bold>true</bold> | |
+ </font> | |
+ </property> | |
+ <property name="text"> | |
+ <string>Opacity:</string> | |
+ </property> | |
+ </widget> | |
+ </item> | |
+ <item row="3" column="1"> | |
+ <widget class="ctkSliderWidget" name="opacity_slider"> | |
+ <property name="enabled"> | |
+ <bool>false</bool> | |
+ </property> | |
+ <property name="singleStep"> | |
+ <double>0.100000000000000</double> | |
+ </property> | |
+ <property name="maximum"> | |
+ <double>1.000000000000000</double> | |
+ </property> | |
+ </widget> | |
+ </item> | |
+ </layout> | |
+ <zorder>label_opacity</zorder> | |
+ <zorder>GroupBox_ColorBy</zorder> | |
+ <zorder>set_clipping</zorder> | |
+ <zorder>label</zorder> | |
+ <zorder>ShowAsLineCheckBox</zorder> | |
+ <zorder>ShowAsTubeCheckBox</zorder> | |
+ <zorder>ShowAsGlyphCheckBox</zorder> | |
+ <zorder>opacity_slider</zorder> | |
+ </widget> | |
+ <customwidgets> | |
+ <customwidget> | |
+ <class>ctkColorPickerButton</class> | |
+ <extends>QPushButton</extends> | |
+ <header>ctkColorPickerButton.h</header> | |
+ </customwidget> | |
+ <customwidget> | |
+ <class>ctkSliderWidget</class> | |
+ <extends>QWidget</extends> | |
+ <header>ctkSliderWidget.h</header> | |
+ </customwidget> | |
+ <customwidget> | |
+ <class>qMRMLColorTableComboBox</class> | |
+ <extends>qMRMLNodeComboBox</extends> | |
+ <header>qMRMLColorTableComboBox.h</header> | |
+ </customwidget> | |
+ <customwidget> | |
+ <class>qMRMLNodeComboBox</class> | |
+ <extends>QWidget</extends> | |
+ <header>qMRMLNodeComboBox.h</header> | |
+ </customwidget> | |
+ <customwidget> | |
+ <class>qSlicerWidget</class> | |
+ <extends>QWidget</extends> | |
+ <header>qSlicerWidget.h</header> | |
+ <container>1</container> | |
+ </customwidget> | |
+ </customwidgets> | |
+ <resources/> | |
+ <connections> | |
+ <connection> | |
+ <sender>qSlicerTractographyDisplayWidget</sender> | |
+ <signal>mrmlSceneChanged(vtkMRMLScene*)</signal> | |
+ <receiver>ColorByCellScalarsComboBox</receiver> | |
+ <slot>setMRMLScene(vtkMRMLScene*)</slot> | |
+ <hints> | |
+ <hint type="sourcelabel"> | |
+ <x>182</x> | |
+ <y>121</y> | |
+ </hint> | |
+ <hint type="destinationlabel"> | |
+ <x>254</x> | |
+ <y>113</y> | |
+ </hint> | |
+ </hints> | |
+ </connection> | |
+ <connection> | |
+ <sender>ColorByScalarInvariantCheckBox</sender> | |
+ <signal>toggled(bool)</signal> | |
+ <receiver>ColorByScalarInvariantComboBox</receiver> | |
+ <slot>setEnabled(bool)</slot> | |
+ <hints> | |
+ <hint type="sourcelabel"> | |
+ <x>108</x> | |
+ <y>139</y> | |
+ </hint> | |
+ <hint type="destinationlabel"> | |
+ <x>225</x> | |
+ <y>140</y> | |
+ </hint> | |
+ </hints> | |
+ </connection> | |
+ <connection> | |
+ <sender>ColorBySolidCheckBox</sender> | |
+ <signal>toggled(bool)</signal> | |
+ <receiver>ColorBySolidSelector</receiver> | |
+ <slot>setEnabled(bool)</slot> | |
+ <hints> | |
+ <hint type="sourcelabel"> | |
+ <x>88</x> | |
+ <y>213</y> | |
+ </hint> | |
+ <hint type="destinationlabel"> | |
+ <x>218</x> | |
+ <y>214</y> | |
+ </hint> | |
+ </hints> | |
+ </connection> | |
+ </connections> | |
+ <buttongroups> | |
+ <buttongroup name="ButtonGroup_ColorBySelectors"/> | |
+ </buttongroups> | |
+</ui> | |
Index: QTModules/TractographyDisplay/Widgets/qSlicerTractographyDisplayModuleWidget.cxx | |
new file mode 100644 | |
=================================================================== | |
--- /dev/null (revision ) | |
+++ QTModules/TractographyDisplay/Widgets/qSlicerTractographyDisplayModuleWidget.cxx (working copy) | |
@@ -0,0 +1,59 @@ | |
+/*============================================================================== | |
+ | |
+ Program: 3D Slicer | |
+ | |
+ Copyright (c) 2010 Kitware Inc. | |
+ | |
+ See Doc/copyright/copyright.txt | |
+ or http://www.slicer.org/copyright/copyright.txt for details. | |
+ | |
+ Unless required by applicable law or agreed to in writing, software | |
+ distributed under the License is distributed on an "AS IS" BASIS, | |
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
+ See the License for the specific language governing permissions and | |
+ limitations under the License. | |
+ | |
+ This file was originally developed by Jean-Christophe Fillion-Robin, Kitware Inc. | |
+ and was partially funded by NIH grant 3P41RR013218-12S1 | |
+ | |
+==============================================================================*/ | |
+ | |
+// Qt includes | |
+#include <QDebug> | |
+ | |
+// CTK includes | |
+//#include <ctkModelTester.h> | |
+ | |
+#include "qSlicerTractographyDisplayModuleWidget.h" | |
+#include "ui_qSlicerTractographyDisplayModule.h" | |
+ | |
+//----------------------------------------------------------------------------- | |
+/// \ingroup Slicer_QtModules_Volumes | |
+class qSlicerTractographyDisplayModuleWidgetPrivate: public Ui_qSlicerTractographyDisplayModule | |
+{ | |
+public: | |
+}; | |
+ | |
+//----------------------------------------------------------------------------- | |
+qSlicerTractographyDisplayModuleWidget::qSlicerTractographyDisplayModuleWidget(QWidget* _parent) | |
+ : Superclass(_parent) | |
+ , d_ptr(new qSlicerTractographyDisplayModuleWidgetPrivate) | |
+{ | |
+} | |
+ | |
+//----------------------------------------------------------------------------- | |
+qSlicerTractographyDisplayModuleWidget::~qSlicerTractographyDisplayModuleWidget() | |
+{ | |
+} | |
+ | |
+//----------------------------------------------------------------------------- | |
+void qSlicerTractographyDisplayModuleWidget::setup() | |
+{ | |
+ Q_D(qSlicerTractographyDisplayModuleWidget); | |
+ d->setupUi(this); | |
+ | |
+ QObject::connect(d->FiberBundleNodeSelector, SIGNAL(currentNodeChanged(vtkMRMLNode*)), | |
+ d->TractographyDisplayWidget, SLOT(setFiberBundleNode(vtkMRMLNode*))); | |
+ //ctkModelTester* tester = new ctkModelTester(this); | |
+ //tester->setModel(d->ActiveVolumeNodeSelector->model()); | |
+} | |
Index: QTModules/TractographyDisplay/Widgets/qSlicerTractographyDisplayModuleWidget.h | |
new file mode 100644 | |
=================================================================== | |
--- /dev/null (revision ) | |
+++ QTModules/TractographyDisplay/Widgets/qSlicerTractographyDisplayModuleWidget.h (working copy) | |
@@ -0,0 +1,57 @@ | |
+/*============================================================================== | |
+ | |
+ Program: 3D Slicer | |
+ | |
+ Copyright (c) 2010 Kitware Inc. | |
+ | |
+ See Doc/copyright/copyright.txt | |
+ or http://www.slicer.org/copyright/copyright.txt for details. | |
+ | |
+ Unless required by applicable law or agreed to in writing, software | |
+ distributed under the License is distributed on an "AS IS" BASIS, | |
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
+ See the License for the specific language governing permissions and | |
+ limitations under the License. | |
+ | |
+ This file was originally developed by Jean-Christophe Fillion-Robin, Kitware Inc. | |
+ and was partially funded by NIH grant 3P41RR013218-12S1 | |
+ | |
+==============================================================================*/ | |
+ | |
+#ifndef __qSlicerTractographyDisplayModuleWidget_h | |
+#define __qSlicerTractographyDisplayModuleWidget_h | |
+ | |
+// CTK includes | |
+#include <ctkPimpl.h> | |
+ | |
+// SlicerQt includes | |
+#include "qSlicerAbstractModuleWidget.h" | |
+#include "qSlicerTractographyDisplayModuleExport.h" | |
+ | |
+class qSlicerTractographyDisplayModuleWidgetPrivate; | |
+class vtkMRMLNode; | |
+ | |
+/// \ingroup Slicer_QtModules_Volumes | |
+class Q_SLICER_QTMODULES_TRACTOGRAPHYDISPLAY_EXPORT qSlicerTractographyDisplayModuleWidget : | |
+ public qSlicerAbstractModuleWidget | |
+{ | |
+ Q_OBJECT | |
+ | |
+public: | |
+ | |
+ typedef qSlicerAbstractModuleWidget Superclass; | |
+ qSlicerTractographyDisplayModuleWidget(QWidget *parent=0); | |
+ virtual ~qSlicerTractographyDisplayModuleWidget(); | |
+ | |
+protected: | |
+ virtual void setup(); | |
+ | |
+protected: | |
+ QScopedPointer<qSlicerTractographyDisplayModuleWidgetPrivate> d_ptr; | |
+ | |
+private: | |
+ Q_DECLARE_PRIVATE(qSlicerTractographyDisplayModuleWidget); | |
+ Q_DISABLE_COPY(qSlicerTractographyDisplayModuleWidget); | |
+}; | |
+ | |
+#endif | |
Index: QTModules/TractographyDisplay/Widgets/qSlicerTractographyDisplayWidget.cxx | |
new file mode 100644 | |
=================================================================== | |
--- /dev/null (revision ) | |
+++ QTModules/TractographyDisplay/Widgets/qSlicerTractographyDisplayWidget.cxx (working copy) | |
@@ -0,0 +1,219 @@ | |
+// QT includes | |
+#include <QDebug> | |
+ | |
+// qMRML includes | |
+#include "qSlicerTractographyDisplayWidget.h" | |
+#include "ui_qSlicerTractographyDisplayWidget.h" | |
+ | |
+// MRML includes | |
+#include <vtkMRMLLabelMapVolumeDisplayNode.h> | |
+#include <vtkMRMLScalarVolumeDisplayNode.h> | |
+#include <vtkMRMLStorageNode.h> | |
+#include <vtkMRMLFiberBundleNode.h> | |
+#include <vtkMRMLFiberBundleDisplayNode.h> | |
+#include <vtkMRMLDiffusionTensorDisplayPropertiesNode.h> | |
+ | |
+// VTK includes | |
+#include <vtkMatrix4x4.h> | |
+#include <vtkSmartPointer.h> | |
+ | |
+//------------------------------------------------------------------------------ | |
+class qSlicerTractographyDisplayWidgetPrivate: public Ui_qSlicerTractographyDisplayWidget | |
+{ | |
+ Q_DECLARE_PUBLIC(qSlicerTractographyDisplayWidget); | |
+ | |
+protected: | |
+ qSlicerTractographyDisplayWidget* const q_ptr; | |
+ | |
+public: | |
+ qSlicerTractographyDisplayWidgetPrivate(qSlicerTractographyDisplayWidget& object); | |
+ void init(); | |
+ bool centeredOrigin(double* origin)const; | |
+ | |
+ vtkMRMLFiberBundleNode* FiberBundleNode; | |
+}; | |
+ | |
+//------------------------------------------------------------------------------ | |
+qSlicerTractographyDisplayWidgetPrivate::qSlicerTractographyDisplayWidgetPrivate(qSlicerTractographyDisplayWidget& object) | |
+ : q_ptr(&object) | |
+{ | |
+ this->FiberBundleNode = 0; | |
+} | |
+ | |
+//------------------------------------------------------------------------------ | |
+void qSlicerTractographyDisplayWidgetPrivate::init() | |
+{ | |
+ Q_Q(qSlicerTractographyDisplayWidget); | |
+ this->setupUi(q); | |
+ | |
+ std::vector<int> supportedScalarModes; | |
+ vtkMRMLFiberBundleDisplayNode::GetSupportedColorModes(supportedScalarModes); | |
+ for (std::vector<int>::iterator it = supportedScalarModes.begin(); it!=supportedScalarModes.end(); ++it) { | |
+ this->ColorByScalarInvariantComboBox->addItem( | |
+ vtkMRMLDiffusionTensorDisplayPropertiesNode::GetScalarEnumAsString(*it), *it); | |
+ } | |
+ | |
+ QObject::connect(this->ShowAsLineCheckBox, SIGNAL(stateChanged(int)), q, SLOT(setDisplayLine(int)) ); | |
+ QObject::connect(this->ShowAsGlyphCheckBox, SIGNAL(stateChanged(int)), q, SLOT(setDisplayGlyph(int)) ); | |
+ QObject::connect(this->ShowAsTubeCheckBox, SIGNAL(stateChanged(int)), q, SLOT(setDisplayTube(int)) ); | |
+ QObject::connect(this->ColorByScalarInvariantCheckBox, SIGNAL(stateChanged(int)), q, SLOT(setColorByScalarInvariant(int)) ); | |
+ QObject::connect(this->ColorByCellScalarsCheckBox, SIGNAL(stateChanged(int)), q, SLOT(setColorByCellScalars(int)) ); | |
+ QObject::connect(this->ColorBySolidCheckBox, SIGNAL(stateChanged(int)), q, SLOT(setColorBySolid(int)) ); | |
+ QObject::connect(this->ColorByScalarInvariantComboBox, SIGNAL(currentIndexChanged(int)), q, SLOT(onColorByScalarInvariantChanged(int)) ); | |
+ QObject::connect(this->ColorBySolidSelector, SIGNAL(colorChanged(QColor)), q, SLOT(onColorBySolidChanged(const QColor&)) ); | |
+ QObject::connect(this->ColorByCellScalarsComboBox, SIGNAL(currentNodeChanged(vtkMRMLNode*)), q, | |
+ SLOT(setColorByCellScalarsColorTable(vtkMRMLNode*)) ); | |
+} | |
+ | |
+ | |
+ | |
+//------------------------------------------------------------------------------ | |
+qSlicerTractographyDisplayWidget::qSlicerTractographyDisplayWidget(QWidget *_parent) | |
+ : Superclass(_parent) | |
+ , d_ptr(new qSlicerTractographyDisplayWidgetPrivate(*this)) | |
+{ | |
+ Q_D(qSlicerTractographyDisplayWidget); | |
+ d->init(); | |
+} | |
+ | |
+//------------------------------------------------------------------------------ | |
+qSlicerTractographyDisplayWidget::~qSlicerTractographyDisplayWidget() | |
+{ | |
+} | |
+ | |
+ | |
+//------------------------------------------------------------------------------ | |
+vtkMRMLFiberBundleNode* qSlicerTractographyDisplayWidget::FiberBundleNode()const | |
+{ | |
+ Q_D(const qSlicerTractographyDisplayWidget); | |
+ return d->FiberBundleNode; | |
+} | |
+ | |
+//------------------------------------------------------------------------------ | |
+void qSlicerTractographyDisplayWidget::setFiberBundleNode(vtkMRMLNode* node) | |
+{ | |
+ this->setFiberBundleNode(vtkMRMLFiberBundleNode::SafeDownCast(node)); | |
+} | |
+ | |
+//------------------------------------------------------------------------------ | |
+void qSlicerTractographyDisplayWidget::setFiberBundleNode(vtkMRMLFiberBundleNode* FiberBundleNode) | |
+{ | |
+ Q_D(qSlicerTractographyDisplayWidget); | |
+ qvtkReconnect(d->FiberBundleNode, FiberBundleNode, vtkCommand::ModifiedEvent, | |
+ this, SLOT(updateWidgetFromMRML())); | |
+ qvtkReconnect(d->FiberBundleNode, FiberBundleNode, vtkMRMLFiberBundleNode::PolyDataModifiedEvent, | |
+ this, SLOT(updateWidgetFromMRML())); | |
+ d->FiberBundleNode = FiberBundleNode; | |
+ this->updateWidgetFromMRML(); | |
+} | |
+ | |
+void qSlicerTractographyDisplayWidget::setDisplayLine(int state) | |
+{ | |
+ Q_D(qSlicerTractographyDisplayWidget); | |
+ | |
+ if (d->FiberBundleNode == NULL) return; | |
+ d->FiberBundleNode->SetLineDisplayState(state > 0); | |
+} | |
+void qSlicerTractographyDisplayWidget::setDisplayGlyph(int state) | |
+{ | |
+ Q_D(qSlicerTractographyDisplayWidget); | |
+ | |
+ if (d->FiberBundleNode == NULL) return; | |
+ d->FiberBundleNode->SetGlyphDisplayState(state > 0); | |
+} | |
+void qSlicerTractographyDisplayWidget::setDisplayTube(int state) | |
+{ | |
+ Q_D(qSlicerTractographyDisplayWidget); | |
+ | |
+ if (d->FiberBundleNode == NULL) return; | |
+ d->FiberBundleNode->SetTubeDisplayState(state > 0); | |
+} | |
+void qSlicerTractographyDisplayWidget::setColorBySolid(int state) | |
+{ | |
+ Q_D(qSlicerTractographyDisplayWidget); | |
+ | |
+ if (not d->FiberBundleNode) | |
+ { | |
+ return; | |
+ } | |
+ d->FiberBundleNode->SetColorBySolid(); | |
+} | |
+ | |
+void qSlicerTractographyDisplayWidget::onColorBySolidChanged(const QColor &color) | |
+{ | |
+ Q_D(qSlicerTractographyDisplayWidget); | |
+ | |
+ if (not d->FiberBundleNode) | |
+ { | |
+ return; | |
+ } | |
+ d->FiberBundleNode->SetColorBySolidColor(color.redF(), color.greenF(), color.blueF()); | |
+} | |
+ | |
+void qSlicerTractographyDisplayWidget::setColorByScalarInvariant(int state) | |
+{ | |
+ Q_D(qSlicerTractographyDisplayWidget); | |
+ | |
+ if (not d->FiberBundleNode) | |
+ { | |
+ return; | |
+ } | |
+ d->FiberBundleNode->SetColorByScalarInvariant(); | |
+} | |
+ | |
+void qSlicerTractographyDisplayWidget::onColorByScalarInvariantChanged(int index) | |
+{ | |
+ Q_D(qSlicerTractographyDisplayWidget); | |
+ int scalarInvariant = d->ColorByScalarInvariantComboBox->itemData(index).toInt(); | |
+ if (not d->FiberBundleNode) | |
+ { | |
+ return; | |
+ } | |
+ d->FiberBundleNode->SetColorByScalarInvariant(scalarInvariant); | |
+} | |
+ | |
+ | |
+void qSlicerTractographyDisplayWidget::setColorByCellScalars(int state) | |
+{ | |
+ Q_D(qSlicerTractographyDisplayWidget); | |
+ | |
+ if (not d->FiberBundleNode) | |
+ { | |
+ return; | |
+ } | |
+ d->FiberBundleNode->SetColorByCellScalars(); | |
+} | |
+ | |
+ | |
+void qSlicerTractographyDisplayWidget::setColorByCellScalarsColorTable(vtkMRMLNode* colortableNode) | |
+{ | |
+ Q_D(qSlicerTractographyDisplayWidget); | |
+ | |
+ if (!d->FiberBundleNode || !colortableNode) | |
+ { | |
+ return; | |
+ } | |
+ Q_ASSERT(vtkMRMLColorNode::SafeDownCast(colortableNode)); | |
+ d->FiberBundleNode->SetCellScalarsColorTable(colortableNode); | |
+} | |
+ | |
+ | |
+//------------------------------------------------------------------------------ | |
+void qSlicerTractographyDisplayWidget::updateWidgetFromMRML() | |
+{ | |
+ Q_D(qSlicerTractographyDisplayWidget); | |
+} | |
+ | |
+ | |
+ | |
+ | |
+ | |
+ | |
+ | |
+ | |
+ | |
+ | |
+ | |
+ | |
+ | |
+ | |
Index: QTModules/TractographyDisplay/Widgets/qSlicerTractographyDisplayWidget.h | |
new file mode 100644 | |
=================================================================== | |
--- /dev/null (revision ) | |
+++ QTModules/TractographyDisplay/Widgets/qSlicerTractographyDisplayWidget.h (working copy) | |
@@ -0,0 +1,59 @@ | |
+#ifndef __qSlicerTractographyDisplayWidget_h | |
+#define __qSlicerTractographyDisplayWidget_h | |
+ | |
+// Qt includes | |
+#include <QWidget> | |
+ | |
+// CTK includes | |
+#include <ctkVTKObject.h> | |
+ | |
+// SlicerQt includes | |
+#include <qSlicerWidget.h> | |
+ | |
+// qMRML includes | |
+#include "qMRMLWidgetsExport.h" | |
+ | |
+class qSlicerTractographyDisplayWidgetPrivate; | |
+class vtkMRMLNode; | |
+class vtkMRMLFiberBundleNode; | |
+ | |
+class QMRML_WIDGETS_EXPORT qSlicerTractographyDisplayWidget : public qSlicerWidget | |
+{ | |
+ Q_OBJECT | |
+ QVTK_OBJECT | |
+public: | |
+ typedef qSlicerWidget Superclass; | |
+ qSlicerTractographyDisplayWidget(QWidget *parent=0); | |
+ virtual ~qSlicerTractographyDisplayWidget(); | |
+ | |
+ vtkMRMLFiberBundleNode* FiberBundleNode()const; | |
+ | |
+public slots: | |
+ void setFiberBundleNode(vtkMRMLNode *node); | |
+ void setFiberBundleNode(vtkMRMLFiberBundleNode *node); | |
+ | |
+ void setDisplayLine(int); | |
+ void setDisplayGlyph(int); | |
+ void setDisplayTube(int); | |
+ void setColorByScalarInvariant(int); | |
+ void onColorByScalarInvariantChanged(int); | |
+ void setColorByCellScalars(int); | |
+ void setColorBySolid(int); | |
+ void onColorBySolidChanged(const QColor&); | |
+ void setColorByCellScalarsColorTable(vtkMRMLNode*); | |
+ | |
+ | |
+ | |
+ | |
+protected slots: | |
+ void updateWidgetFromMRML(); | |
+ | |
+protected: | |
+ QScopedPointer<qSlicerTractographyDisplayWidgetPrivate> d_ptr; | |
+ | |
+private: | |
+ Q_DECLARE_PRIVATE(qSlicerTractographyDisplayWidget); | |
+ Q_DISABLE_COPY(qSlicerTractographyDisplayWidget); | |
+}; | |
+ | |
+#endif | |
Index: QTModules/TractographyDisplay/qSlicerTractographyDisplayModule.cxx | |
=================================================================== | |
--- QTModules/TractographyDisplay/qSlicerTractographyDisplayModule.cxx (revision ) | |
+++ QTModules/TractographyDisplay/qSlicerTractographyDisplayModule.cxx (working copy) | |
@@ -25,13 +25,21 @@ | |
#include <qSlicerCoreApplication.h> | |
#include <qSlicerCoreIOManager.h> | |
+ | |
// Tractography QTModule includes | |
#include "qSlicerTractographyDisplayModule.h" | |
+#include "qSlicerTractographyDisplayModuleWidget.h" | |
+//#include "qSlicerTractographyDisplayWidget.h" | |
#include "qSlicerFiberBundleIO.h" | |
// Tractography Logic includes | |
#include "vtkSlicerFiberBundleLogic.h" | |
+// Setup PythonQt wrapping if enabled | |
+#ifdef Slicer_USE_PYTHONQT | |
+# include <PythonQt.h> | |
+void PythonQt_init_org_slicer_libs_qSlicerTractographyDisplayWidgets(PyObject*); | |
+#endif | |
//----------------------------------------------------------------------------- | |
Q_EXPORT_PLUGIN2(qSlicerTractographyDisplayModule, qSlicerTractographyDisplayModule); | |
@@ -48,6 +56,11 @@ void qSlicerTractographyDisplayModule::setup() | |
this->Superclass::setup(); | |
qSlicerCoreApplication::application()->coreIOManager()->registerIO( | |
new qSlicerFiberBundleIO(this)); | |
+ | |
+ #ifdef Slicer_USE_PYTHONQT | |
+ PythonQt_init_org_slicer_libs_qSlicerTractographyDisplayWidgets(0); | |
+ #endif | |
+ | |
} | |
//----------------------------------------------------------------------------- | |
@@ -65,7 +78,7 @@ QString qSlicerTractographyDisplayModule::title()const | |
//----------------------------------------------------------------------------- | |
qSlicerAbstractModuleRepresentation* qSlicerTractographyDisplayModule::createWidgetRepresentation() | |
{ | |
- return 0; | |
+ return new qSlicerTractographyDisplayModuleWidget; | |
} | |
//----------------------------------------------------------------------------- | |
@@ -78,20 +91,17 @@ vtkMRMLAbstractLogic* qSlicerTractographyDisplayModule::createLogic() | |
//----------------------------------------------------------------------------- | |
QString qSlicerTractographyDisplayModule::helpText()const | |
{ | |
- QString help = | |
- "<b>************** Not implemented yet **************</b>" | |
+ QString help = | |
"Load, save and adjust display parameters of fiber bundles. \n" | |
- "<a>http://wiki.slicer.org/slicerWiki/index.php/Modules:DTIDisplay-Documentation-3.6</a>"; | |
+ "<a>%1/Modules:DTIDisplay-Documentation-3.6</a>"; | |
return help.arg(this->slicerWikiUrl()); | |
} | |
//----------------------------------------------------------------------------- | |
QString qSlicerTractographyDisplayModule::acknowledgementText()const | |
{ | |
- QString acknowledgement = | |
+ QString acknowledgement = | |
"This work was supported by NA-MIC, NAC, BIRN, NCIGT, and the Slicer Community. " | |
- "See <a href=\"http://www.slicer.org\">http://www.slicer.org</a> for details.\n" | |
- "The Fiber Bundle module was contributed by Alex Yarmarkovich, Isomics Inc. with " | |
- "help from others at SPL, BWH (Ron Kikinis)"; | |
+ "See <a href=\"http://www.slicer.org\">http://www.slicer.org</a> for details.\n"; | |
return acknowledgement; | |
} | |
Index: QTModules/TractographyDisplay/qSlicerTractographyDisplayModule.h | |
=================================================================== | |
--- QTModules/TractographyDisplay/qSlicerTractographyDisplayModule.h (revision ) | |
+++ QTModules/TractographyDisplay/qSlicerTractographyDisplayModule.h (working copy) | |
@@ -21,6 +21,9 @@ | |
#ifndef __qSlicerTractographyDisplayModule_h | |
#define __qSlicerTractographyDisplayModule_h | |
+// CTK includes | |
+#include <ctkPimpl.h> | |
+ | |
/// SlicerQT includes | |
#include "qSlicerLoadableModule.h" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment