diff --git a/Applications/Diffusion/CMakeLists.txt b/Applications/Diffusion/CMakeLists.txt
index 2198111025..f6af42f8ae 100644
--- a/Applications/Diffusion/CMakeLists.txt
+++ b/Applications/Diffusion/CMakeLists.txt
@@ -1,102 +1,103 @@
#if(MITK_USE_Python)
project(MitkDiffusion)
set(DIFFUSIONAPP_NAME MitkDiffusion)
set(_app_options)
if(MITK_SHOW_CONSOLE_WINDOW)
list(APPEND _app_options SHOW_CONSOLE)
endif()
# Create a cache entry for the provisioning file which is used to export
# the file name in the MITKConfig.cmake file. This will keep external projects
# which rely on this file happy.
set(DIFFUSIONIMAGINGAPP_PROVISIONING_FILE "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${DIFFUSIONAPP_NAME}.provisioning" CACHE INTERNAL "${DIFFUSIONAPP_NAME} provisioning file" FORCE)
# should be identical to the list in /CMake/mitkBuildConfigurationmitkDiffusion.cmake
# remember to set plugins which should be automatically toggled in target_libraries.cmake
set(_plugins
org.commontk.configadmin
org.commontk.eventadmin
org.blueberry.core.runtime
org.blueberry.core.expressions
org.blueberry.core.commands
org.blueberry.ui.qt
org.blueberry.ui.qt.log
org.blueberry.ui.qt.help
org.mitk.core.services
org.mitk.gui.common
org.mitk.planarfigure
org.mitk.core.ext
org.mitk.gui.qt.application
org.mitk.gui.qt.ext
org.mitk.gui.qt.diffusionimagingapp
org.mitk.gui.qt.common
org.mitk.gui.qt.stdmultiwidgeteditor
org.mitk.gui.qt.datamanager
org.mitk.gui.qt.measurementtoolbox
org.mitk.gui.qt.segmentation
+ org.mitk.gui_qt.multilabelsegmentation
org.mitk.gui.qt.volumevisualization
org.mitk.gui.qt.diffusionimaging
org.mitk.gui.qt.diffusionimaging.connectomics
org.mitk.gui.qt.diffusionimaging.fiberfox
org.mitk.gui.qt.diffusionimaging.fiberprocessing
org.mitk.gui.qt.diffusionimaging.ivim
org.mitk.gui.qt.diffusionimaging.odfpeaks
org.mitk.gui.qt.diffusionimaging.preprocessing
org.mitk.gui.qt.diffusionimaging.reconstruction
org.mitk.gui.qt.diffusionimaging.tractography
org.mitk.gui.qt.diffusionimaging.registration
# org.mitk.gui.qt.diffusionimaging.python
org.mitk.gui.qt.diffusionimaging.denoising
# org.mitk.gui.qt.matchpoint.algorithm.browser
# org.mitk.gui.qt.matchpoint.algorithm.control
# org.mitk.gui.qt.matchpoint.mapper
org.mitk.gui.qt.imagenavigator
org.mitk.gui.qt.moviemaker
org.mitk.gui.qt.basicimageprocessing
org.mitk.gui.qt.properties
org.mitk.gui.qt.viewnavigator
)
# Plug-ins listed below will not be
# - added as a build-time dependency to the executable
# - listed in the provisioning file for the executable
# - installed if they are external plug-ins
set(_exclude_plugins
org.blueberry.test
org.blueberry.uitest
org.mitk.gui.qt.coreapplication
org.mitk.gui.qt.extapplication
)
set(_src_files
MitkDiffusion.cpp
)
qt5_add_resources(_src_files splashscreen.qrc)
mitkFunctionCreateBlueBerryApplication(
NAME ${DIFFUSIONAPP_NAME}
DESCRIPTION "MITK Diffusion"
PLUGINS ${_plugins}
EXCLUDE_PLUGINS ${_exclude_plugins}
SOURCES ${_src_files}
${_app_options}
)
mitk_use_modules(TARGET ${DIFFUSIONAPP_NAME} MODULES MitkAppUtil)
# Add meta dependencies (e.g. on auto-load modules from depending modules)
if(TARGET ${CMAKE_PROJECT_NAME}-autoload)
add_dependencies(${DIFFUSIONAPP_NAME} ${CMAKE_PROJECT_NAME}-autoload)
endif()
# Add a build time dependency to legacy BlueBerry bundles.
if(MITK_MODULES_ENABLED_PLUGINS)
add_dependencies(${DIFFUSIONAPP_NAME} ${MITK_MODULES_ENABLED_PLUGINS})
endif()
# endif() # MITK_USE_PYTHON
diff --git a/Applications/Diffusion/target_libraries.cmake b/Applications/Diffusion/target_libraries.cmake
index 8600df31e5..f208e9035d 100644
--- a/Applications/Diffusion/target_libraries.cmake
+++ b/Applications/Diffusion/target_libraries.cmake
@@ -1,34 +1,35 @@
# A list of plug-in targets which should be automatically enabled
# (or be available in external projects) for this application
set(target_libraries
org_blueberry_ui_qt
org_blueberry_ui_qt_help
org_mitk_planarfigure
org_mitk_gui_qt_diffusionimagingapp
org_mitk_gui_qt_ext
org_mitk_gui_qt_datamanager
org_mitk_gui_qt_segmentation
+ org_mitk_gui_qt_multilabelsegmentation
org_mitk_gui_qt_volumevisualization
org_mitk_gui_qt_diffusionimaging
org_mitk_gui_qt_diffusionimaging_connectomics
org_mitk_gui_qt_diffusionimaging_fiberfox
org_mitk_gui_qt_diffusionimaging_fiberprocessing
org_mitk_gui_qt_diffusionimaging_ivim
org_mitk_gui_qt_diffusionimaging_odfpeaks
org_mitk_gui_qt_diffusionimaging_preprocessing
org_mitk_gui_qt_diffusionimaging_reconstruction
org_mitk_gui_qt_diffusionimaging_tractography
org_mitk_gui_qt_diffusionimaging_registration
# org_mitk_gui_qt_diffusionimaging_python
org_mitk_gui_qt_diffusionimaging_denoising
# org_mitk_gui_qt_matchpoint_algorithm_browser
# org_mitk_gui_qt_matchpoint_algorithm_control
# org_mitk_gui_qt_matchpoint_mapper
org_mitk_gui_qt_imagenavigator
org_mitk_gui_qt_moviemaker
org_mitk_gui_qt_measurementtoolbox
org_mitk_gui_qt_basicimageprocessing
org_mitk_gui_qt_viewnavigator
)
diff --git a/Plugins/org.mitk.gui.qt.diffusionimaging.connectomics/src/internal/QmitkConnectomicsDataViewControls.ui b/Plugins/org.mitk.gui.qt.diffusionimaging.connectomics/src/internal/QmitkConnectomicsDataViewControls.ui
index 5a68d94544..382ace7e5f 100644
--- a/Plugins/org.mitk.gui.qt.diffusionimaging.connectomics/src/internal/QmitkConnectomicsDataViewControls.ui
+++ b/Plugins/org.mitk.gui.qt.diffusionimaging.connectomics/src/internal/QmitkConnectomicsDataViewControls.ui
@@ -1,269 +1,269 @@
QmitkConnectomicsDataViewControls
0
0
- 231
+ 286
639
0
0
QmitkTemplate
25
-
- Data
+ Input Data
0
0
0
0
-
QLabel { color: rgb(255, 0, 0) }
Select a parcellation and a tractogram!
-
-
Image 1:
-
-
-
-
Image 2:
-
-
-
Network Creation Options
0
0
0
0
-
Create a network from a parcellation and a fiber image
Networkify
-
Create Correlation Matrix
-
- -
-
-
- Create Synthetic Networks
-
-
-
-
true
Synthetic Network Options
0
0
0
0
-
-
+
-
- -
-
+
-
+
-
-
+
- Parameter 1
+ Parameter 2
-
-
+
false
+
+ 3
+
- 9999
+ 999.899999999999977
-
-
+
-
-
+
- Parameter 2
+ Parameter 1
-
-
+
false
-
- 3
-
- 999.899999999999977
+ 9999
+ -
+
+
+ Create Synthetic Networks
+
+
+
-
0
0
Anatomical labeling
0
0
0
0
-
-
Qt::Vertical
20
40
QmitkFreeSurferParcellationWidget
QWidget
QmitkFreeSurferParcellationWidget.h
1
diff --git a/Plugins/org.mitk.gui.qt.diffusionimaging.connectomics/src/internal/QmitkConnectomicsStatisticsView.cpp b/Plugins/org.mitk.gui.qt.diffusionimaging.connectomics/src/internal/QmitkConnectomicsStatisticsView.cpp
index c9a5fcf462..8d6b270242 100644
--- a/Plugins/org.mitk.gui.qt.diffusionimaging.connectomics/src/internal/QmitkConnectomicsStatisticsView.cpp
+++ b/Plugins/org.mitk.gui.qt.diffusionimaging.connectomics/src/internal/QmitkConnectomicsStatisticsView.cpp
@@ -1,256 +1,212 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
-// ####### Blueberry includes #######
#include
#include
-
-// ####### Qmitk includes #######
#include "QmitkConnectomicsStatisticsView.h"
-
-// ####### Qt includes #######
#include
#include
-
-// ####### ITK includes #######
#include
-
-// ####### MITK includes #######
#include
#include
#include
#include
-
-// Includes for image casting between ITK and MITK
#include "mitkImageCast.h"
#include "mitkITKImageImport.h"
#include "mitkImageAccessByItk.h"
-
+#include
#include
const std::string QmitkConnectomicsStatisticsView::VIEW_ID = "org.mitk.views.connectomicsstatistics";
QmitkConnectomicsStatisticsView::QmitkConnectomicsStatisticsView()
-: QmitkAbstractView()
-, m_Controls( nullptr )
+ : QmitkAbstractView()
+ , m_Controls( nullptr )
{
}
QmitkConnectomicsStatisticsView::~QmitkConnectomicsStatisticsView()
{
}
void QmitkConnectomicsStatisticsView::CreateQtPartControl( QWidget *parent )
{
// build up qt view, unless already done
if ( !m_Controls )
{// create GUI widgets from the Qt Designer's .ui file
m_Controls = new Ui::QmitkConnectomicsStatisticsViewControls;
m_Controls-> setupUi( parent );
connect( m_Controls-> networkBalloonsNodeLabelsComboBox, SIGNAL( currentIndexChanged( int ) ),
this, SLOT( OnNetworkBalloonsNodeLabelsComboBoxCurrentIndexChanged( ) ) );
+
+
+ m_Controls->m_NetworkBox->SetDataStorage(this->GetDataStorage());
+ mitk::TNodePredicateDataType::Pointer isNetwork = mitk::TNodePredicateDataType::New();
+ m_Controls->m_NetworkBox->SetPredicate( isNetwork );
+ connect( (QObject*)(m_Controls->m_NetworkBox), SIGNAL(currentIndexChanged(int)), this, SLOT(UpdateGui()));
}
this-> WipeDisplay();
}
void QmitkConnectomicsStatisticsView::SetFocus()
{
m_Controls->networkStatisticsPlainTextEdit->setFocus();
}
void QmitkConnectomicsStatisticsView::WipeDisplay()
{
- m_Controls->lblWarning->setVisible( true );
- m_Controls->inputImageOneNameLabel->setText( mitk::ConnectomicsConstantsManager::CONNECTOMICS_GUI_DASH );
- m_Controls->inputImageOneNameLabel->setVisible( false );
m_Controls->inputImageOneLabel->setVisible( false );
m_Controls->networkStatisticsPlainTextEdit->clear();
m_Controls->betweennessNetworkHistogramCanvas->SetHistogram( nullptr );
m_Controls->degreeNetworkHistogramCanvas->SetHistogram( nullptr );
m_Controls->shortestPathNetworkHistogramCanvas->SetHistogram( nullptr );
m_Controls->betweennessNetworkHistogramCanvas->update();
m_Controls->degreeNetworkHistogramCanvas->update();
m_Controls->shortestPathNetworkHistogramCanvas->update();
m_Controls->betweennessNetworkHistogramCanvas->Clear();
m_Controls->degreeNetworkHistogramCanvas->Clear();
m_Controls->shortestPathNetworkHistogramCanvas->Clear();
m_Controls->betweennessNetworkHistogramCanvas->Replot();
m_Controls->degreeNetworkHistogramCanvas->Replot();
m_Controls->shortestPathNetworkHistogramCanvas->Replot();
m_Controls-> networkBalloonsNodeLabelsComboBox-> QComboBox::clear();
m_Controls-> networkBalloonsPlainTextEdit-> clear();
}
void QmitkConnectomicsStatisticsView::OnNetworkBalloonsNodeLabelsComboBoxCurrentIndexChanged( )
{
QList nodes = this->GetDataManagerSelection();
if( nodes.size() != 1 ) { return; }
mitk::DataNode::Pointer node = *nodes.begin();
if( node.IsNotNull() )
- {
+ {
mitk::ConnectomicsNetwork* network =
- dynamic_cast< mitk::ConnectomicsNetwork* >( node-> GetData() );
+ dynamic_cast< mitk::ConnectomicsNetwork* >( node-> GetData() );
if( network )
- {
+ {
std::string tempCurrentText = m_Controls-> networkBalloonsNodeLabelsComboBox->
- QComboBox::currentText().toStdString(); // get text of currently selected item.
+ QComboBox::currentText().toStdString(); // get text of currently selected item.
if( tempCurrentText.size() > 3 && tempCurrentText.rfind( ":" ) != tempCurrentText.npos )
{ // update chosenNode property.
tempCurrentText = tempCurrentText.substr( tempCurrentText.rfind( ":" ) + 2 );
node-> SetProperty( mitk::connectomicsRenderingNodeChosenNodeName.c_str(),
mitk::StringProperty::New( tempCurrentText.c_str() ) );
auto renderWindowPart = this->GetRenderWindowPart();
if (renderWindowPart)
{
renderWindowPart->ForceImmediateUpdate(); //RequestUpdate() is too slow.
}
}
std::stringstream balloonTextStream;
node-> Update();
if( node-> GetProperty( mitk::connectomicsRenderingBalloonTextName.c_str() ) != nullptr &&
node-> GetProperty( mitk::connectomicsRenderingBalloonNodeStatsName.c_str() ) != nullptr &&
tempCurrentText != "-1" )
{
balloonTextStream << node-> GetProperty( mitk::connectomicsRenderingBalloonTextName.c_str() )
-> GetValueAsString()
<< node-> GetProperty( mitk::connectomicsRenderingBalloonNodeStatsName.c_str() )
-> GetValueAsString() << std::endl;
QString balloonQString ( balloonTextStream.str().c_str() );
// setPlainText() overwrites, insertPlainText() appends.
m_Controls-> networkBalloonsPlainTextEdit-> setPlainText( balloonQString );
}
if( tempCurrentText == "-1" )
{
m_Controls-> networkBalloonsPlainTextEdit-> setPlainText( "" );
}
}
}
return;
}
-void QmitkConnectomicsStatisticsView::OnSelectionChanged(berry::IWorkbenchPart::Pointer /*part*/, const QList& nodes)
+void QmitkConnectomicsStatisticsView::UpdateGui()
{
this->WipeDisplay();
- // Valid options are either
- // 1 image (parcellation)
- //
- // 1 image (parcellation)
- // 1 fiber bundle
- //
- // 1 network
- if( nodes.size() > 2 )
- {
- return;
- }
-
- bool currentFormatUnknown(true);
-
// iterate all selected objects, adjust warning visibility
- for (mitk::DataNode::Pointer node: nodes)
+ if (m_Controls->m_NetworkBox->GetSelectedNode().IsNotNull())
{
- currentFormatUnknown = true;
-
- if( node.IsNotNull() )
- { // network section
- mitk::ConnectomicsNetwork* network = dynamic_cast( node->GetData() );
- if( network )
- {
- currentFormatUnknown = false;
- if( nodes.size() != 1 )
- {
- // only valid option is a single network
- this->WipeDisplay();
- return;
- }
-
- m_Controls->lblWarning->setVisible( false );
- m_Controls->inputImageOneNameLabel->setText(node->GetName().c_str());
- m_Controls->inputImageOneNameLabel->setVisible( true );
- m_Controls->inputImageOneLabel->setVisible( true );
-
- {
- std::stringstream statisticsStream;
-
- mitk::ConnectomicsStatisticsCalculator::Pointer calculator = mitk::ConnectomicsStatisticsCalculator::New();
-
- calculator->SetNetwork( network );
- calculator->Update();
-
- statisticsStream << "# Vertices: " << calculator->GetNumberOfVertices() << "\n";
- statisticsStream << "# Edges: " << calculator->GetNumberOfEdges() << "\n";
- statisticsStream << "Average Degree: " << calculator->GetAverageDegree() << "\n";
- statisticsStream << "Density: " << calculator->GetConnectionDensity() << "\n";
- statisticsStream << "Small Worldness: " << calculator->GetSmallWorldness() << "\n";
- statisticsStream << "Average Path Length: " << calculator->GetAveragePathLength() << "\n";
- statisticsStream << "Efficiency: " << (1 / calculator->GetAveragePathLength() ) << "\n";
- statisticsStream << "# Connected Components: " << calculator->GetNumberOfConnectedComponents() << "\n";
- statisticsStream << "Average Component Size: " << calculator->GetAverageComponentSize() << "\n";
- statisticsStream << "Largest Component Size: " << calculator->GetLargestComponentSize() << "\n";
- statisticsStream << "Average Clustering Coefficient: " << calculator->GetAverageClusteringCoefficientsC() << "\n";
- statisticsStream << "Average Vertex Betweenness Centrality: " << calculator->GetAverageVertexBetweennessCentrality() << "\n";
- statisticsStream << "Average Edge Betweenness Centrality: " << calculator->GetAverageEdgeBetweennessCentrality() << "\n";
- statisticsStream << "# Isolated Points: " << calculator->GetNumberOfIsolatedPoints() << "\n";
- statisticsStream << "# End Points: " << calculator->GetNumberOfEndPoints() << "\n";
- statisticsStream << "Diameter: " << calculator->GetDiameter() << "\n";
- statisticsStream << "Radius: " << calculator->GetRadius() << "\n";
- statisticsStream << "Average Eccentricity: " << calculator->GetAverageEccentricity() << "\n";
- statisticsStream << "# Central Points: " << calculator->GetNumberOfCentralPoints() << "\n";
-
- QString statisticsString( statisticsStream.str().c_str() );
- m_Controls-> networkStatisticsPlainTextEdit-> setPlainText( statisticsString );
- }
-
- mitk::ConnectomicsNetwork::Pointer connectomicsNetwork( network );
- mitk::ConnectomicsHistogramsContainer *histogramContainer = histogramCache[ connectomicsNetwork ];
- if(histogramContainer)
- {
- m_Controls->betweennessNetworkHistogramCanvas->SetHistogram( histogramContainer->GetBetweennessHistogram() );
- m_Controls->degreeNetworkHistogramCanvas->SetHistogram( histogramContainer->GetDegreeHistogram() );
- m_Controls->shortestPathNetworkHistogramCanvas->SetHistogram( histogramContainer->GetShortestPathHistogram() );
- m_Controls->betweennessNetworkHistogramCanvas->DrawProfiles();
- m_Controls->degreeNetworkHistogramCanvas->DrawProfiles();
- m_Controls->shortestPathNetworkHistogramCanvas->DrawProfiles();
- }
-
- // For the balloon overlay:
- if( node-> GetProperty( mitk::connectomicsRenderingBalloonAllNodeLabelsName.c_str() ) != nullptr )
- { // QComboBox with node label names and numbers.
- QString allNodesLabel = node->
- GetProperty( mitk::connectomicsRenderingBalloonAllNodeLabelsName.c_str() )->
- GetValueAsString().c_str();
- QStringList allNodesLabelList = allNodesLabel.simplified().split( "," );
- allNodesLabelList.sort( Qt::CaseInsensitive );
- m_Controls-> networkBalloonsNodeLabelsComboBox-> QComboBox::addItem( "no node chosen: -1" );
- m_Controls-> networkBalloonsNodeLabelsComboBox-> QComboBox::addItems( allNodesLabelList );
- }
- }
- } // end network section
-
- if ( currentFormatUnknown )
+ mitk::ConnectomicsNetwork* network = dynamic_cast( m_Controls->m_NetworkBox->GetSelectedNode()->GetData() );
+
+ m_Controls->inputImageOneLabel->setVisible( true );
+
+ std::stringstream statisticsStream;
+
+ mitk::ConnectomicsStatisticsCalculator::Pointer calculator = mitk::ConnectomicsStatisticsCalculator::New();
+
+ calculator->SetNetwork( network );
+ calculator->Update();
+
+ statisticsStream << "# Vertices: " << calculator->GetNumberOfVertices() << "\n";
+ statisticsStream << "# Edges: " << calculator->GetNumberOfEdges() << "\n";
+ statisticsStream << "Average Degree: " << calculator->GetAverageDegree() << "\n";
+ statisticsStream << "Density: " << calculator->GetConnectionDensity() << "\n";
+ statisticsStream << "Small Worldness: " << calculator->GetSmallWorldness() << "\n";
+ statisticsStream << "Average Path Length: " << calculator->GetAveragePathLength() << "\n";
+ statisticsStream << "Efficiency: " << (1 / calculator->GetAveragePathLength() ) << "\n";
+ statisticsStream << "# Connected Components: " << calculator->GetNumberOfConnectedComponents() << "\n";
+ statisticsStream << "Average Component Size: " << calculator->GetAverageComponentSize() << "\n";
+ statisticsStream << "Largest Component Size: " << calculator->GetLargestComponentSize() << "\n";
+ statisticsStream << "Average Clustering Coefficient: " << calculator->GetAverageClusteringCoefficientsC() << "\n";
+ statisticsStream << "Average Vertex Betweenness Centrality: " << calculator->GetAverageVertexBetweennessCentrality() << "\n";
+ statisticsStream << "Average Edge Betweenness Centrality: " << calculator->GetAverageEdgeBetweennessCentrality() << "\n";
+ statisticsStream << "# Isolated Points: " << calculator->GetNumberOfIsolatedPoints() << "\n";
+ statisticsStream << "# End Points: " << calculator->GetNumberOfEndPoints() << "\n";
+ statisticsStream << "Diameter: " << calculator->GetDiameter() << "\n";
+ statisticsStream << "Radius: " << calculator->GetRadius() << "\n";
+ statisticsStream << "Average Eccentricity: " << calculator->GetAverageEccentricity() << "\n";
+ statisticsStream << "# Central Points: " << calculator->GetNumberOfCentralPoints() << "\n";
+
+ QString statisticsString( statisticsStream.str().c_str() );
+ m_Controls-> networkStatisticsPlainTextEdit-> setPlainText( statisticsString );
+
+ mitk::ConnectomicsNetwork::Pointer connectomicsNetwork( network );
+ mitk::ConnectomicsHistogramsContainer *histogramContainer = histogramCache[ connectomicsNetwork ];
+ if(histogramContainer)
{
- this->WipeDisplay();
- return;
+ m_Controls->betweennessNetworkHistogramCanvas->SetHistogram( histogramContainer->GetBetweennessHistogram() );
+ m_Controls->degreeNetworkHistogramCanvas->SetHistogram( histogramContainer->GetDegreeHistogram() );
+ m_Controls->shortestPathNetworkHistogramCanvas->SetHistogram( histogramContainer->GetShortestPathHistogram() );
+ m_Controls->betweennessNetworkHistogramCanvas->DrawProfiles();
+ m_Controls->degreeNetworkHistogramCanvas->DrawProfiles();
+ m_Controls->shortestPathNetworkHistogramCanvas->DrawProfiles();
+ }
+
+ // For the balloon overlay:
+ if( m_Controls->m_NetworkBox->GetSelectedNode()->GetProperty( mitk::connectomicsRenderingBalloonAllNodeLabelsName.c_str() ) != nullptr )
+ { // QComboBox with node label names and numbers.
+ QString allNodesLabel = m_Controls->m_NetworkBox->GetSelectedNode()->
+ GetProperty( mitk::connectomicsRenderingBalloonAllNodeLabelsName.c_str() )->
+ GetValueAsString().c_str();
+ QStringList allNodesLabelList = allNodesLabel.simplified().split( "," );
+ allNodesLabelList.sort( Qt::CaseInsensitive );
+ m_Controls-> networkBalloonsNodeLabelsComboBox-> QComboBox::addItem( "no node chosen: -1" );
+ m_Controls-> networkBalloonsNodeLabelsComboBox-> QComboBox::addItems( allNodesLabelList );
}
- } // end for loop
+ }
+}
+
+void QmitkConnectomicsStatisticsView::OnSelectionChanged(berry::IWorkbenchPart::Pointer /*part*/, const QList& )
+{
}
diff --git a/Plugins/org.mitk.gui.qt.diffusionimaging.connectomics/src/internal/QmitkConnectomicsStatisticsView.h b/Plugins/org.mitk.gui.qt.diffusionimaging.connectomics/src/internal/QmitkConnectomicsStatisticsView.h
index c216290956..b1f0aea112 100644
--- a/Plugins/org.mitk.gui.qt.diffusionimaging.connectomics/src/internal/QmitkConnectomicsStatisticsView.h
+++ b/Plugins/org.mitk.gui.qt.diffusionimaging.connectomics/src/internal/QmitkConnectomicsStatisticsView.h
@@ -1,80 +1,81 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef QmitkConnectomicsStatisticsView_h
#define QmitkConnectomicsStatisticsView_h
#include
#include
#include "ui_QmitkConnectomicsStatisticsViewControls.h"
#include "mitkConnectomicsHistogramCache.h"
// ####### ITK includes #######
#include
/*!
\brief QmitkConnectomicsStatisticsView
This view provides the statistics GUI.
*/
class QmitkConnectomicsStatisticsView : public QmitkAbstractView
{
// this is needed for all Qt objects that should have a Qt meta-object
// (everything that derives from QObject and wants to have signal/slots)
Q_OBJECT
public:
static const std::string VIEW_ID;
QmitkConnectomicsStatisticsView();
virtual ~QmitkConnectomicsStatisticsView();
virtual void CreateQtPartControl(QWidget *parent) override;
///
/// Sets the focus to an internal widget.
///
virtual void SetFocus() override;
protected slots:
void OnNetworkBalloonsNodeLabelsComboBoxCurrentIndexChanged( );
+ void UpdateGui();
protected:
// ####### Functions #######
/// \brief called by QmitkAbstractView when DataManager's selection has changed
virtual void OnSelectionChanged(berry::IWorkbenchPart::Pointer part, const QList& nodes) override;
/// \brief Wipe display and empty statistics
void WipeDisplay();
// ####### Variables #######
Ui::QmitkConnectomicsStatisticsViewControls* m_Controls;
/// Cache for histograms
mitk::ConnectomicsHistogramCache histogramCache;
};
#endif // _QMITKBRAINNETWORKANALYSISVIEW_H_INCLUDED
diff --git a/Plugins/org.mitk.gui.qt.diffusionimaging.connectomics/src/internal/QmitkConnectomicsStatisticsViewControls.ui b/Plugins/org.mitk.gui.qt.diffusionimaging.connectomics/src/internal/QmitkConnectomicsStatisticsViewControls.ui
index b3d941a458..15bae3b3f2 100644
--- a/Plugins/org.mitk.gui.qt.diffusionimaging.connectomics/src/internal/QmitkConnectomicsStatisticsViewControls.ui
+++ b/Plugins/org.mitk.gui.qt.diffusionimaging.connectomics/src/internal/QmitkConnectomicsStatisticsViewControls.ui
@@ -1,296 +1,287 @@
QmitkConnectomicsStatisticsViewControls
0
0
557
1218
0
0
QmitkTemplate
25
-
- Data
+ Input Data
0
0
0
0
-
-
-
- QLabel { color: rgb(255, 0, 0) }
-
-
- Select a network!
-
-
-
- -
-
Network:
-
-
-
- -
-
-
+
-
Network Statistics
0
0
0
0
-
true
0
0
true
-
Informational Balloons.
0
0
0
0
-
false
PointingHandCursor
Qt::RightToLeft
true
false
-
false
-1
12
QComboBox::InsertAlphabetically
-
0
0
MS Shell Dlg 2
8
IBeamCursor
false
true
-
Histograms
0
0
0
0
-
0
0
50
150
-
50
150
-
50
150
-
Qt::Vertical
20
40
+
+ QmitkDataStorageComboBox
+ QComboBox
+ QmitkDataStorageComboBox.h
+
QmitkNetworkHistogramCanvas
QWidget
internal/QmitkNetworkHistogramCanvas.h
1
networkBalloonsNodeLabelsComboBox
currentIndexChanged(int)
networkBalloonsNodeLabelsComboBox
setCurrentIndex(int)
360
409
360
409
diff --git a/Plugins/org.mitk.gui.qt.diffusionimaging/src/internal/QmitkControlVisualizationPropertiesView.cpp b/Plugins/org.mitk.gui.qt.diffusionimaging/src/internal/QmitkControlVisualizationPropertiesView.cpp
index 3eb07f66bd..3af7534c2d 100644
--- a/Plugins/org.mitk.gui.qt.diffusionimaging/src/internal/QmitkControlVisualizationPropertiesView.cpp
+++ b/Plugins/org.mitk.gui.qt.diffusionimaging/src/internal/QmitkControlVisualizationPropertiesView.cpp
@@ -1,1274 +1,1291 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#include "QmitkControlVisualizationPropertiesView.h"
#include "mitkNodePredicateDataType.h"
#include "mitkDataNodeObject.h"
#include "mitkOdfNormalizationMethodProperty.h"
#include "mitkOdfScaleByProperty.h"
#include "mitkResliceMethodProperty.h"
#include "mitkRenderingManager.h"
#include "mitkTbssImage.h"
#include "mitkPlanarFigure.h"
#include "mitkFiberBundle.h"
#include "QmitkDataStorageComboBox.h"
#include "mitkPlanarFigureInteractor.h"
#include
#include
#include
#include
#include
#include "usModuleRegistry.h"
#include
#include
#include "mitkPlaneGeometry.h"
#include
#include
#include
#include "berryIWorkbenchWindow.h"
#include "berryIWorkbenchPage.h"
#include "berryISelectionService.h"
#include "berryConstants.h"
#include "berryPlatformUI.h"
#include "itkRGBAPixel.h"
#include
#include "qwidgetaction.h"
#include "qcolordialog.h"
#include
#include
#include
#define ROUND(a) ((a)>0 ? (int)((a)+0.5) : -(int)(0.5-(a)))
const std::string QmitkControlVisualizationPropertiesView::VIEW_ID = "org.mitk.views.controlvisualizationpropertiesview";
using namespace berry;
QmitkControlVisualizationPropertiesView::QmitkControlVisualizationPropertiesView()
: QmitkAbstractView(),
m_Controls(nullptr),
m_CurrentSelection(0),
m_IconTexOFF(new QIcon(":/QmitkDiffusionImaging/texIntOFFIcon.png")),
m_IconTexON(new QIcon(":/QmitkDiffusionImaging/texIntONIcon.png")),
m_IconGlyOFF_T(new QIcon(":/QmitkDiffusionImaging/glyphsoff_T.png")),
m_IconGlyON_T(new QIcon(":/QmitkDiffusionImaging/glyphson_T.png")),
m_IconGlyOFF_C(new QIcon(":/QmitkDiffusionImaging/glyphsoff_C.png")),
m_IconGlyON_C(new QIcon(":/QmitkDiffusionImaging/glyphson_C.png")),
m_IconGlyOFF_S(new QIcon(":/QmitkDiffusionImaging/glyphsoff_S.png")),
m_IconGlyON_S(new QIcon(":/QmitkDiffusionImaging/glyphson_S.png")),
m_GlyIsOn_T(false),
m_GlyIsOn_C(false),
m_GlyIsOn_S(false),
m_CurrentPickingNode(0),
m_ColorPropertyObserverTag(0),
m_OpacityPropertyObserverTag(0)
{
currentThickSlicesMode = 1;
m_MyMenu = nullptr;
int numThread = itk::MultiThreader::GetGlobalMaximumNumberOfThreads();
if (numThread > 12)
numThread = 12;
itk::MultiThreader::SetGlobalDefaultNumberOfThreads(numThread);
}
QmitkControlVisualizationPropertiesView::~QmitkControlVisualizationPropertiesView()
{
}
void QmitkControlVisualizationPropertiesView::OnThickSlicesModeSelected( QAction* action )
{
currentThickSlicesMode = action->data().toInt();
switch( currentThickSlicesMode )
{
case 0: // toInt() returns 0 'otherwise'.
return; // dummy code/todo: implement stuff.
case 1:
this->m_Controls->m_TSMenu->setText("MIP");
break;
case 2:
this->m_Controls->m_TSMenu->setText("SUM");
break;
case 3:
this->m_Controls->m_TSMenu->setText("WEIGH");
break;
default:
return; // dummy code/todo: implement stuff.
}
if (auto renderWindowPart = this->GetRenderWindowPart(OPEN))
{
/// TODO There is no way to access the individual crosshair planes through the render window part API.
/// There could be a new 'mitk::DataNode* mitk::ILinkedRenderWindowPart::GetSlicingPlane(const std::string& name) const'
/// function for this purpose. For the time being, I comment out the lines below, but they are valid
/// and they have to be re-enabled after the crosshair planes can be accessed again.
// mitk::DataNode* n;
// n = renderWindowPart->GetSlicingPlane("axial");
// if (n) { n->SetProperty( "reslice.thickslices", mitk::ResliceMethodProperty::New( currentThickSlicesMode ) ); }
// n = renderWindowPart->GetSlicingPlane("sagittal");
// if (n) { n->SetProperty( "reslice.thickslices", mitk::ResliceMethodProperty::New( currentThickSlicesMode ) ); }
// n = renderWindowPart->GetSlicingPlane("coronal");
// if (n) { n->SetProperty( "reslice.thickslices", mitk::ResliceMethodProperty::New( currentThickSlicesMode ) ); }
mitk::BaseRenderer::Pointer renderer;
renderer = renderWindowPart->GetQmitkRenderWindow("axial")->GetRenderer();
if (renderer.IsNotNull()) { renderer->SendUpdateSlice(); }
renderer = renderWindowPart->GetQmitkRenderWindow("sagittal")->GetRenderer();
if (renderer.IsNotNull()) { renderer->SendUpdateSlice(); }
renderer = renderWindowPart->GetQmitkRenderWindow("coronal")->GetRenderer();
if (renderer.IsNotNull()) { renderer->SendUpdateSlice(); }
renderer->GetRenderingManager()->RequestUpdateAll();
}
}
void QmitkControlVisualizationPropertiesView::OnTSNumChanged( int num )
{
if (auto renderWindowPart = this->GetRenderWindowPart(OPEN))
{
/// TODO There is no way to access the individual crosshair planes through the render window part API.
/// There could be a new 'mitk::DataNode* mitk::ILinkedRenderWindowPart::GetSlicingPlane(const std::string& name) const'
/// function for this purpose. For the time being, I comment out the lines below, but they are valid
/// and they have to be re-enabled after the crosshair planes can be accessed again.
// if(num==0)
// {
// mitk::DataNode* n;
// n = renderWindowPart->GetSlicingPlane("axial");
// if(n) n->SetProperty( "reslice.thickslices", mitk::ResliceMethodProperty::New( 0 ) );
// if(n) n->SetProperty( "reslice.thickslices.num", mitk::IntProperty::New( num ) );
// if(n) n->SetProperty( "reslice.thickslices.showarea", mitk::BoolProperty::New( false ) );
//
// n = renderWindowPart->GetSlicingPlane("sagittal");
// if(n) n->SetProperty( "reslice.thickslices", mitk::ResliceMethodProperty::New( 0 ) );
// if(n) n->SetProperty( "reslice.thickslices.num", mitk::IntProperty::New( num ) );
// if(n) n->SetProperty( "reslice.thickslices.showarea", mitk::BoolProperty::New( false ) );
//
// n = renderWindowPart->GetSlicingPlane("coronal");
// if(n) n->SetProperty( "reslice.thickslices", mitk::ResliceMethodProperty::New( 0 ) );
// if(n) n->SetProperty( "reslice.thickslices.num", mitk::IntProperty::New( num ) );
// if(n) n->SetProperty( "reslice.thickslices.showarea", mitk::BoolProperty::New( false ) );
// }
// else
// {
// mitk::DataNode* n;
// n = renderWindowPart->GetSlicingPlane("axial");
// if(n) n->SetProperty( "reslice.thickslices", mitk::ResliceMethodProperty::New( currentThickSlicesMode ) );
// if(n) n->SetProperty( "reslice.thickslices.num", mitk::IntProperty::New( num ) );
// if(n) n->SetProperty( "reslice.thickslices.showarea", mitk::BoolProperty::New( (num>0) ) );
//
// n = renderWindowPart->GetSlicingPlane("sagittal");
// if(n) n->SetProperty( "reslice.thickslices", mitk::ResliceMethodProperty::New( currentThickSlicesMode ) );
// if(n) n->SetProperty( "reslice.thickslices.num", mitk::IntProperty::New( num ) );
// if(n) n->SetProperty( "reslice.thickslices.showarea", mitk::BoolProperty::New( (num>0) ) );
//
// n = renderWindowPart->GetSlicingPlane("coronal");
// if(n) n->SetProperty( "reslice.thickslices", mitk::ResliceMethodProperty::New( currentThickSlicesMode ) );
// if(n) n->SetProperty( "reslice.thickslices.num", mitk::IntProperty::New( num ) );
// if(n) n->SetProperty( "reslice.thickslices.showarea", mitk::BoolProperty::New( (num>0) ) );
// }
m_TSLabel->setText(QString::number( num*2 + 1 ));
mitk::BaseRenderer::Pointer renderer;
renderer = renderWindowPart->GetQmitkRenderWindow("axial")->GetRenderer();
if(renderer.IsNotNull()) { renderer->SendUpdateSlice(); }
renderer = nullptr;
renderer = renderWindowPart->GetQmitkRenderWindow("sagittal")->GetRenderer();
if(renderer.IsNotNull()) { renderer->SendUpdateSlice(); }
renderer = nullptr;
renderer = renderWindowPart->GetQmitkRenderWindow("coronal")->GetRenderer();
if(renderer.IsNotNull()) { renderer->SendUpdateSlice(); }
renderer->GetRenderingManager()->RequestUpdateAll(mitk::RenderingManager::REQUEST_UPDATE_2DWINDOWS);
}
}
void QmitkControlVisualizationPropertiesView::CreateQtPartControl(QWidget *parent)
{
if (!m_Controls)
{
// create GUI widgets
m_Controls = new Ui::QmitkControlVisualizationPropertiesViewControls;
m_Controls->setupUi(parent);
this->CreateConnections();
// hide warning (ODFs in rotated planes)
m_Controls->m_lblRotatedPlanesWarning->hide();
m_MyMenu = new QMenu(parent);
m_Controls->m_TSMenu->setMenu( m_MyMenu );
QIcon iconFiberFade(":/QmitkDiffusionImaging/MapperEfx2D.png");
m_Controls->m_FiberFading2D->setIcon(iconFiberFade);
#ifndef DIFFUSION_IMAGING_EXTENDED
int size = m_Controls->m_AdditionalScaling->count();
for(int t=0; tm_AdditionalScaling->itemText(t).toStdString() == "Scale by ASR")
{
m_Controls->m_AdditionalScaling->removeItem(t);
}
}
#endif
m_Controls->m_NormalizationFrame->setVisible(false);
m_Controls->m_Crosshair->setVisible(false);
mitk::IRenderWindowPart* renderWindow = this->GetRenderWindowPart();
if (renderWindow)
{
m_SliceChangeListener.RenderWindowPartActivated(renderWindow);
connect(&m_SliceChangeListener, SIGNAL(SliceChanged()), this, SLOT(OnSliceChanged()));
}
+
+ connect(m_Controls->m_SetColor1, SIGNAL(clicked()), this, SLOT(SetColor()));
+ connect(m_Controls->m_SetColor2, SIGNAL(clicked()), this, SLOT(SetColor()));
+ }
+}
+
+void QmitkControlVisualizationPropertiesView::SetColor()
+{
+ if(m_SelectedNode)
+ {
+ QColor c = QColorDialog::getColor();
+ float rgb[3];
+ rgb[0] = c.redF();
+ rgb[1] = c.greenF();
+ rgb[2] = c.blueF();
+ m_SelectedNode->SetColor(rgb);
+ mitk::RenderingManager::GetInstance()->RequestUpdateAll();
}
}
void QmitkControlVisualizationPropertiesView::SetFocus()
{
m_Controls->m_TSMenu->setFocus();
}
void QmitkControlVisualizationPropertiesView::SliceRotation(const itk::EventObject&)
{
// test if plane rotated
if( m_GlyIsOn_T || m_GlyIsOn_C || m_GlyIsOn_S )
{
if( this->IsPlaneRotated() )
{
// show label
m_Controls->m_lblRotatedPlanesWarning->show();
}
else
{
//hide label
m_Controls->m_lblRotatedPlanesWarning->hide();
}
}
}
void QmitkControlVisualizationPropertiesView::NodeRemoved(const mitk::DataNode* /*node*/)
{
}
#include
void QmitkControlVisualizationPropertiesView::CreateConnections()
{
if ( m_Controls )
{
connect( (QObject*)(m_Controls->m_VisibleOdfsON_T), SIGNAL(clicked()), this, SLOT(VisibleOdfsON_T()) );
connect( (QObject*)(m_Controls->m_VisibleOdfsON_S), SIGNAL(clicked()), this, SLOT(VisibleOdfsON_S()) );
connect( (QObject*)(m_Controls->m_VisibleOdfsON_C), SIGNAL(clicked()), this, SLOT(VisibleOdfsON_C()) );
connect( (QObject*)(m_Controls->m_ShowMaxNumber), SIGNAL(editingFinished()), this, SLOT(ShowMaxNumberChanged()) );
connect( (QObject*)(m_Controls->m_NormalizationDropdown), SIGNAL(currentIndexChanged(int)), this, SLOT(NormalizationDropdownChanged(int)) );
connect( (QObject*)(m_Controls->m_ScalingFactor), SIGNAL(valueChanged(double)), this, SLOT(ScalingFactorChanged(double)) );
connect( (QObject*)(m_Controls->m_AdditionalScaling), SIGNAL(currentIndexChanged(int)), this, SLOT(AdditionalScaling(int)) );
connect((QObject*) m_Controls->m_ResetColoring, SIGNAL(clicked()), (QObject*) this, SLOT(ResetColoring()));
connect((QObject*) m_Controls->m_ResetColoring2, SIGNAL(clicked()), (QObject*) this, SLOT(ResetColoring()));
connect((QObject*) m_Controls->m_FiberFading2D, SIGNAL(clicked()), (QObject*) this, SLOT( Fiber2DfadingEFX() ) );
connect((QObject*) m_Controls->m_FiberThicknessSlider, SIGNAL(sliderReleased()), (QObject*) this, SLOT( FiberSlicingThickness2D() ) );
connect((QObject*) m_Controls->m_FiberThicknessSlider, SIGNAL(valueChanged(int)), (QObject*) this, SLOT( FiberSlicingUpdateLabel(int) ));
connect((QObject*) m_Controls->m_Crosshair, SIGNAL(clicked()), (QObject*) this, SLOT(SetInteractor()));
connect((QObject*) m_Controls->m_LineWidth, SIGNAL(editingFinished()), (QObject*) this, SLOT(LineWidthChanged()));
connect((QObject*) m_Controls->m_TubeWidth, SIGNAL(editingFinished()), (QObject*) this, SLOT(TubeRadiusChanged()));
connect( (QObject*) m_Controls->m_OdfColorBox, SIGNAL(currentIndexChanged(int)), (QObject*) this, SLOT(OnColourisationModeChanged() ) );
connect((QObject*) m_Controls->m_Clip0, SIGNAL(toggled(bool)), (QObject*) this, SLOT(Toggle3DClipping(bool)));
connect((QObject*) m_Controls->m_Clip1, SIGNAL(toggled(bool)), (QObject*) this, SLOT(Toggle3DClipping(bool)));
connect((QObject*) m_Controls->m_Clip2, SIGNAL(toggled(bool)), (QObject*) this, SLOT(Toggle3DClipping(bool)));
connect((QObject*) m_Controls->m_Clip3, SIGNAL(toggled(bool)), (QObject*) this, SLOT(Toggle3DClipping(bool)));
connect((QObject*) m_Controls->m_FlipClipBox, SIGNAL(stateChanged(int)), (QObject*) this, SLOT(Toggle3DClipping()));
connect((QObject*) m_Controls->m_FlipPeaksButton, SIGNAL(clicked()), (QObject*) this, SLOT(FlipPeaks()));
}
}
// set diffusion image channel to b0 volume
void QmitkControlVisualizationPropertiesView::NodeAdded(const mitk::DataNode *node)
{
mitk::DataNode* notConst = const_cast(node);
bool isDiffusionImage( mitk::DiffusionPropertyHelper::IsDiffusionWeightedImage( dynamic_cast(node->GetData())) );
if (isDiffusionImage)
{
mitk::Image::Pointer dimg = dynamic_cast(notConst->GetData());
// if there is no b0 image in the dataset, the GetB0Indices() returns a vector of size 0
// and hence we cannot set the Property directly to .front()
int displayChannelPropertyValue = 0;
mitk::BValueMapProperty* bmapproperty
= static_cast
(dimg->GetProperty(mitk::DiffusionPropertyHelper::BVALUEMAPPROPERTYNAME.c_str()).GetPointer() );
mitk::DiffusionPropertyHelper::BValueMapType map = bmapproperty->GetBValueMap();
if( map[0].size() > 0) { displayChannelPropertyValue = map[0].front(); }
notConst->SetIntProperty("DisplayChannel", displayChannelPropertyValue );
}
}
/* OnSelectionChanged is registered to SelectionService, therefore no need to
implement SelectionService Listener explicitly */
void QmitkControlVisualizationPropertiesView::OnSelectionChanged(berry::IWorkbenchPart::Pointer /*part*/, const QList& nodes)
{
m_Controls->m_BundleControlsFrame->setVisible(false);
m_Controls->m_ImageControlsFrame->setVisible(false);
m_Controls->m_PeakImageFrame->setVisible(false);
if (nodes.size()>1) // only do stuff if one node is selected
return;
m_Controls->m_NumberGlyphsFrame->setVisible(false);
m_Controls->m_GlyphFrame->setVisible(false);
m_Controls->m_TSMenu->setVisible(false);
m_SelectedNode = nullptr;
int numOdfImages = 0;
for (mitk::DataNode::Pointer node: nodes)
{
if(node.IsNull())
continue;
mitk::BaseData* nodeData = node->GetData();
if(nodeData == nullptr)
continue;
m_SelectedNode = node;
if (dynamic_cast(nodeData))
{
m_Controls->m_PeakImageFrame->setVisible(true);
if (m_Color.IsNotNull())
m_Color->RemoveObserver(m_ColorPropertyObserverTag);
itk::ReceptorMemberCommand::Pointer command = itk::ReceptorMemberCommand::New();
command->SetCallbackFunction( this, &QmitkControlVisualizationPropertiesView::SetCustomColor );
m_Color = dynamic_cast(node->GetProperty("color", nullptr));
if (m_Color.IsNotNull())
m_ColorPropertyObserverTag = m_Color->AddObserver( itk::ModifiedEvent(), command );
}
else if (dynamic_cast(nodeData))
{
int Fiber3DClippingPlaneId = -1;
m_SelectedNode->GetPropertyValue("Fiber3DClippingPlaneId",Fiber3DClippingPlaneId);
switch(Fiber3DClippingPlaneId)
{
case 0:
m_Controls->m_Clip0->setChecked(1);
break;
case 1:
m_Controls->m_Clip1->setChecked(1);
break;
case 2:
m_Controls->m_Clip2->setChecked(1);
break;
case 3:
m_Controls->m_Clip3->setChecked(1);
break;
default :
m_Controls->m_Clip0->setChecked(1);
}
// handle fiber property observers
if (m_Color.IsNotNull())
m_Color->RemoveObserver(m_ColorPropertyObserverTag);
itk::ReceptorMemberCommand::Pointer command = itk::ReceptorMemberCommand::New();
command->SetCallbackFunction( this, &QmitkControlVisualizationPropertiesView::SetCustomColor );
m_Color = dynamic_cast(node->GetProperty("color", nullptr));
if (m_Color.IsNotNull())
m_ColorPropertyObserverTag = m_Color->AddObserver( itk::ModifiedEvent(), command );
m_Controls->m_BundleControlsFrame->setVisible(true);
if(m_CurrentPickingNode != 0 && node.GetPointer() != m_CurrentPickingNode)
{ m_Controls->m_Crosshair->setEnabled(false); }
else
{ m_Controls->m_Crosshair->setEnabled(true); }
int width;
node->GetIntProperty("shape.linewidth", width);
m_Controls->m_LineWidth->setValue(width);
float radius;
node->GetFloatProperty("shape.tuberadius", radius);
m_Controls->m_TubeWidth->setValue(radius);
float range;
node->GetFloatProperty("Fiber2DSliceThickness",range);
mitk::FiberBundle::Pointer fib = dynamic_cast(node->GetData());
mitk::BaseGeometry::Pointer geo = fib->GetGeometry();
mitk::ScalarType max = geo->GetExtentInMM(0);
max = std::max(max, geo->GetExtentInMM(1));
max = std::max(max, geo->GetExtentInMM(2));
m_Controls->m_FiberThicknessSlider->setMaximum(max * 10);
m_Controls->m_FiberThicknessSlider->setValue(range * 10);
}
else if(dynamic_cast(nodeData) || dynamic_cast(nodeData))
{
m_Controls->m_ImageControlsFrame->setVisible(true);
m_Controls->m_NumberGlyphsFrame->setVisible(true);
m_Controls->m_GlyphFrame->setVisible(true);
m_Controls->m_NormalizationFrame->setVisible(true);
if(m_NodeUsedForOdfVisualization.IsNotNull())
{
m_NodeUsedForOdfVisualization->SetBoolProperty("VisibleOdfs_S", false);
m_NodeUsedForOdfVisualization->SetBoolProperty("VisibleOdfs_C", false);
m_NodeUsedForOdfVisualization->SetBoolProperty("VisibleOdfs_T", false);
}
m_NodeUsedForOdfVisualization = node;
m_NodeUsedForOdfVisualization->SetBoolProperty("VisibleOdfs_S", m_GlyIsOn_S);
m_NodeUsedForOdfVisualization->SetBoolProperty("VisibleOdfs_C", m_GlyIsOn_C);
m_NodeUsedForOdfVisualization->SetBoolProperty("VisibleOdfs_T", m_GlyIsOn_T);
if (dynamic_cast(nodeData))
{
m_Controls->m_NormalizationDropdown->setVisible(false);
m_Controls->m_NormalizationLabel->setVisible(false);
}
else
{
m_Controls->m_NormalizationDropdown->setVisible(true);
m_Controls->m_NormalizationLabel->setVisible(true);
}
int val;
node->GetIntProperty("ShowMaxNumber", val);
m_Controls->m_ShowMaxNumber->setValue(val);
m_Controls->m_NormalizationDropdown
->setCurrentIndex(dynamic_cast(node->GetProperty("Normalization"))
->GetValueAsId());
float fval;
node->GetFloatProperty("Scaling",fval);
m_Controls->m_ScalingFactor->setValue(fval);
m_Controls->m_AdditionalScaling
->setCurrentIndex(dynamic_cast(node->GetProperty("ScaleBy"))->GetValueAsId());
bool switchTensorViewValue = false;
node->GetBoolProperty( "DiffusionCore.Rendering.OdfVtkMapper.SwitchTensorView", switchTensorViewValue );
bool colourisationModeBit = false;
node->GetBoolProperty("DiffusionCore.Rendering.OdfVtkMapper.ColourisationModeBit", colourisationModeBit );
m_Controls->m_OdfColorBox->setCurrentIndex(colourisationModeBit);
numOdfImages++;
}
else if(dynamic_cast(nodeData))
{
PlanarFigureFocus();
}
else if( dynamic_cast(nodeData) )
{
m_Controls->m_ImageControlsFrame->setVisible(true);
m_Controls->m_TSMenu->setVisible(true);
}
}
if( nodes.empty() ) { return; }
mitk::DataNode::Pointer node = nodes.at(0);
if( node.IsNull() ) { return; }
QMenu *myMenu = m_MyMenu;
myMenu->clear();
QActionGroup* thickSlicesActionGroup = new QActionGroup(myMenu);
thickSlicesActionGroup->setExclusive(true);
int currentTSMode = 0;
{
mitk::ResliceMethodProperty::Pointer m = dynamic_cast(node->GetProperty( "reslice.thickslices" ));
if( m.IsNotNull() )
currentTSMode = m->GetValueAsId();
}
int maxTS = 30;
for (auto node: nodes)
{
mitk::Image* image = dynamic_cast(node->GetData());
if (image)
{
int size = std::max(image->GetDimension(0), std::max(image->GetDimension(1), image->GetDimension(2)));
if (size>maxTS) { maxTS=size; }
}
}
maxTS /= 2;
int currentNum = 0;
{
mitk::IntProperty::Pointer m = dynamic_cast(node->GetProperty( "reslice.thickslices.num" ));
if( m.IsNotNull() )
{
currentNum = m->GetValue();
if(currentNum < 0) { currentNum = 0; }
if(currentNum > maxTS) { currentNum = maxTS; }
}
}
if(currentTSMode==0) { currentNum=0; }
QSlider *m_TSSlider = new QSlider(myMenu);
m_TSSlider->setMinimum(0);
m_TSSlider->setMaximum(maxTS-1);
m_TSSlider->setValue(currentNum);
m_TSSlider->setOrientation(Qt::Horizontal);
connect( m_TSSlider, SIGNAL( valueChanged(int) ), this, SLOT( OnTSNumChanged(int) ) );
QHBoxLayout* _TSLayout = new QHBoxLayout;
_TSLayout->setContentsMargins(4,4,4,4);
_TSLayout->addWidget(m_TSSlider);
_TSLayout->addWidget(m_TSLabel=new QLabel(QString::number(currentNum*2+1),myMenu));
QWidget* _TSWidget = new QWidget;
_TSWidget->setLayout(_TSLayout);
QActionGroup* thickSliceModeActionGroup = new QActionGroup(myMenu);
thickSliceModeActionGroup->setExclusive(true);
QWidgetAction *m_TSSliderAction = new QWidgetAction(myMenu);
m_TSSliderAction->setDefaultWidget(_TSWidget);
myMenu->addAction(m_TSSliderAction);
QAction* mipThickSlicesAction = new QAction(myMenu);
mipThickSlicesAction->setActionGroup(thickSliceModeActionGroup);
mipThickSlicesAction->setText("MIP (max. intensity proj.)");
mipThickSlicesAction->setCheckable(true);
mipThickSlicesAction->setChecked(currentThickSlicesMode==1);
mipThickSlicesAction->setData(1);
myMenu->addAction( mipThickSlicesAction );
QAction* sumThickSlicesAction = new QAction(myMenu);
sumThickSlicesAction->setActionGroup(thickSliceModeActionGroup);
sumThickSlicesAction->setText("SUM (sum intensity proj.)");
sumThickSlicesAction->setCheckable(true);
sumThickSlicesAction->setChecked(currentThickSlicesMode==2);
sumThickSlicesAction->setData(2);
myMenu->addAction( sumThickSlicesAction );
QAction* weightedThickSlicesAction = new QAction(myMenu);
weightedThickSlicesAction->setActionGroup(thickSliceModeActionGroup);
weightedThickSlicesAction->setText("WEIGHTED (gaussian proj.)");
weightedThickSlicesAction->setCheckable(true);
weightedThickSlicesAction->setChecked(currentThickSlicesMode==3);
weightedThickSlicesAction->setData(3);
myMenu->addAction( weightedThickSlicesAction );
mitk::RenderingManager::GetInstance()->RequestUpdateAll();
connect( thickSliceModeActionGroup, SIGNAL(triggered(QAction*)), this, SLOT(OnThickSlicesModeSelected(QAction*)) );
}
void QmitkControlVisualizationPropertiesView::VisibleOdfsON_S()
{
m_GlyIsOn_S = m_Controls->m_VisibleOdfsON_S->isChecked();
if (m_NodeUsedForOdfVisualization.IsNull())
{
MITK_WARN << "ODF visualization activated but m_NodeUsedForOdfVisualization is nullptr";
return;
}
m_NodeUsedForOdfVisualization->SetBoolProperty("VisibleOdfs_S", m_GlyIsOn_S);
mitk::RenderingManager::GetInstance()->RequestUpdateAll();
}
void QmitkControlVisualizationPropertiesView::Visible()
{
mitk::IRenderWindowPart* renderWindow = this->GetRenderWindowPart();
if (renderWindow)
{
m_SliceChangeListener.RenderWindowPartActivated(renderWindow);
connect(&m_SliceChangeListener, SIGNAL(SliceChanged()), this, SLOT(OnSliceChanged()));
}
}
void QmitkControlVisualizationPropertiesView::Hidden()
{
}
void QmitkControlVisualizationPropertiesView::Activated()
{
mitk::IRenderWindowPart* renderWindow = this->GetRenderWindowPart();
if (renderWindow)
{
m_SliceChangeListener.RenderWindowPartActivated(renderWindow);
connect(&m_SliceChangeListener, SIGNAL(SliceChanged()), this, SLOT(OnSliceChanged()));
}
}
void QmitkControlVisualizationPropertiesView::Deactivated()
{
}
void QmitkControlVisualizationPropertiesView::FlipPeaks()
{
if (m_SelectedNode.IsNull() || dynamic_cast(m_SelectedNode->GetData())==nullptr)
return;
std::string name = m_SelectedNode->GetName();
mitk::Image::Pointer image = dynamic_cast(m_SelectedNode->GetData());
typedef mitk::ImageToItk< mitk::PeakImage::ItkPeakImageType > CasterType;
CasterType::Pointer caster = CasterType::New();
caster->SetInput(image);
caster->Update();
mitk::PeakImage::ItkPeakImageType::Pointer itkImg = caster->GetOutput();
itk::FlipPeaksFilter< float >::Pointer flipper = itk::FlipPeaksFilter< float >::New();
flipper->SetInput(itkImg);
flipper->SetFlipX(m_Controls->m_FlipPeaksX->isChecked());
flipper->SetFlipY(m_Controls->m_FlipPeaksY->isChecked());
flipper->SetFlipZ(m_Controls->m_FlipPeaksZ->isChecked());
flipper->Update();
mitk::Image::Pointer resultImage = dynamic_cast(mitk::PeakImage::New().GetPointer());
mitk::CastToMitkImage(flipper->GetOutput(), resultImage);
resultImage->SetVolume(flipper->GetOutput()->GetBufferPointer());
m_SelectedNode->SetData(resultImage);
m_SelectedNode->SetName(name);
mitk::RenderingManager::GetInstance()->RequestUpdateAll();
}
void QmitkControlVisualizationPropertiesView::Toggle3DClipping(bool enabled)
{
if (!enabled || m_SelectedNode.IsNull() || dynamic_cast(m_SelectedNode->GetData())==nullptr)
return;
m_SelectedNode->SetBoolProperty( "Fiber3DClippingPlaneFlip", m_Controls->m_FlipClipBox->isChecked() );
if (m_Controls->m_Clip0->isChecked())
{
m_SelectedNode->SetIntProperty( "Fiber3DClippingPlaneId", 0 );
Set3DClippingPlane(true, m_SelectedNode, "");
}
else if (m_Controls->m_Clip1->isChecked())
{
m_SelectedNode->SetIntProperty( "Fiber3DClippingPlaneId", 1 );
Set3DClippingPlane(false, m_SelectedNode, "axial");
}
else if (m_Controls->m_Clip2->isChecked())
{
m_SelectedNode->SetIntProperty( "Fiber3DClippingPlaneId", 2 );
Set3DClippingPlane(false, m_SelectedNode, "sagittal");
}
else if (m_Controls->m_Clip3->isChecked())
{
m_SelectedNode->SetIntProperty( "Fiber3DClippingPlaneId", 3 );
Set3DClippingPlane(false, m_SelectedNode, "coronal");
}
mitk::RenderingManager::GetInstance()->RequestUpdateAll();
}
void QmitkControlVisualizationPropertiesView::OnSliceChanged()
{
mitk::DataStorage::SetOfObjects::ConstPointer nodes = this->GetDataStorage()->GetAll();
for (unsigned int i=0; iSize(); ++i)
{
mitk::DataNode::Pointer node = nodes->GetElement(i);
int plane_id = -1;
node->GetIntProperty("Fiber3DClippingPlaneId", plane_id);
if (plane_id==1)
Set3DClippingPlane(false, node, "axial");
else if (plane_id==2)
Set3DClippingPlane(false, node, "sagittal");
else if (plane_id==3)
Set3DClippingPlane(false, node, "coronal");
}
mitk::RenderingManager::GetInstance()->RequestUpdateAll();
}
void QmitkControlVisualizationPropertiesView::Set3DClippingPlane(bool disable, mitk::DataNode* node, std::string plane)
{
mitk::IRenderWindowPart* renderWindow = this->GetRenderWindowPart();
if (renderWindow && node && dynamic_cast(node->GetData()))
{
mitk::Vector3D planeNormal; planeNormal.Fill(0.0);
if (!disable)
{
mitk::SliceNavigationController* slicer = renderWindow->GetQmitkRenderWindow(QString(plane.c_str()))->GetSliceNavigationController();
mitk::PlaneGeometry::ConstPointer planeGeo = slicer->GetCurrentPlaneGeometry();
//generate according cutting planes based on the view position
planeNormal = planeGeo->GetNormal();
float tmp1 = planeGeo->GetOrigin()[0] * planeNormal[0];
float tmp2 = planeGeo->GetOrigin()[1] * planeNormal[1];
float tmp3 = planeGeo->GetOrigin()[2] * planeNormal[2];
float distance = tmp1 + tmp2 + tmp3; //attention, correct normalvector
planeNormal *= distance;
if (distance<0)
node->SetBoolProperty( "Fiber3DClippingPlaneSecondFlip", true );
else
node->SetBoolProperty( "Fiber3DClippingPlaneSecondFlip", false );
}
node->SetProperty( "Fiber3DClippingPlane", mitk::Vector3DProperty::New( planeNormal ) );
dynamic_cast(node->GetData())->RequestUpdate();
}
}
void QmitkControlVisualizationPropertiesView::VisibleOdfsON_T()
{
m_GlyIsOn_T = m_Controls->m_VisibleOdfsON_T->isChecked();
if (m_NodeUsedForOdfVisualization.IsNull())
{
MITK_WARN << "ODF visualization activated but m_NodeUsedForOdfVisualization is nullptr";
return;
}
m_NodeUsedForOdfVisualization->SetBoolProperty("VisibleOdfs_T", m_GlyIsOn_T);
mitk::RenderingManager::GetInstance()->RequestUpdateAll();
}
void QmitkControlVisualizationPropertiesView::VisibleOdfsON_C()
{
m_GlyIsOn_C = m_Controls->m_VisibleOdfsON_C->isChecked();
if (m_NodeUsedForOdfVisualization.IsNull())
{
MITK_WARN << "ODF visualization activated but m_NodeUsedForOdfVisualization is nullptr";
return;
}
m_NodeUsedForOdfVisualization->SetBoolProperty("VisibleOdfs_C", m_GlyIsOn_C);
mitk::RenderingManager::GetInstance()->RequestUpdateAll();
}
bool QmitkControlVisualizationPropertiesView::IsPlaneRotated()
{
mitk::Image* currentImage = dynamic_cast( m_NodeUsedForOdfVisualization->GetData() );
if( currentImage == nullptr )
{
MITK_ERROR << " Casting problems. Returning false";
return false;
}
mitk::Vector3D imageNormal0 = currentImage->GetSlicedGeometry()->GetAxisVector(0);
mitk::Vector3D imageNormal1 = currentImage->GetSlicedGeometry()->GetAxisVector(1);
mitk::Vector3D imageNormal2 = currentImage->GetSlicedGeometry()->GetAxisVector(2);
imageNormal0.Normalize();
imageNormal1.Normalize();
imageNormal2.Normalize();
auto renderWindowPart = this->GetRenderWindowPart();
double eps = 0.000001;
// for all 2D renderwindows of the render window part check alignment
{
mitk::PlaneGeometry::ConstPointer displayPlane
= dynamic_cast
( renderWindowPart->GetQmitkRenderWindow("axial")->GetRenderer()->GetCurrentWorldPlaneGeometry() );
if (displayPlane.IsNull()) { return false; }
mitk::Vector3D normal = displayPlane->GetNormal();
normal.Normalize();
int test = 0;
if( fabs(fabs(dot_product(normal.GetVnlVector(),imageNormal0.GetVnlVector()))-1) > eps ) { test++; }
if( fabs(fabs(dot_product(normal.GetVnlVector(),imageNormal1.GetVnlVector()))-1) > eps ) { test++; }
if( fabs(fabs(dot_product(normal.GetVnlVector(),imageNormal2.GetVnlVector()))-1) > eps ) { test++; }
if (test==3) { return true; }
}
{
mitk::PlaneGeometry::ConstPointer displayPlane
= dynamic_cast
( renderWindowPart->GetQmitkRenderWindow("sagittal")->GetRenderer()->GetCurrentWorldPlaneGeometry() );
if (displayPlane.IsNull()) { return false; }
mitk::Vector3D normal = displayPlane->GetNormal();
normal.Normalize();
int test = 0;
if( fabs(fabs(dot_product(normal.GetVnlVector(),imageNormal0.GetVnlVector()))-1) > eps ) { test++; }
if( fabs(fabs(dot_product(normal.GetVnlVector(),imageNormal1.GetVnlVector()))-1) > eps ) { test++; }
if( fabs(fabs(dot_product(normal.GetVnlVector(),imageNormal2.GetVnlVector()))-1) > eps ) { test++; }
if (test==3) { return true; }
}
{
mitk::PlaneGeometry::ConstPointer displayPlane
= dynamic_cast
( renderWindowPart->GetQmitkRenderWindow("coronal")->GetRenderer()->GetCurrentWorldPlaneGeometry() );
if (displayPlane.IsNull()) { return false; }
mitk::Vector3D normal = displayPlane->GetNormal();
normal.Normalize();
int test = 0;
if( fabs(fabs(dot_product(normal.GetVnlVector(),imageNormal0.GetVnlVector()))-1) > eps ) { test++; }
if( fabs(fabs(dot_product(normal.GetVnlVector(),imageNormal1.GetVnlVector()))-1) > eps ) { test++; }
if( fabs(fabs(dot_product(normal.GetVnlVector(),imageNormal2.GetVnlVector()))-1) > eps ) { test++; }
if (test==3) { return true; }
}
return false;
}
void QmitkControlVisualizationPropertiesView::ShowMaxNumberChanged()
{
int maxNr = m_Controls->m_ShowMaxNumber->value();
if ( maxNr < 1 )
{
m_Controls->m_ShowMaxNumber->setValue( 1 );
maxNr = 1;
}
if ( dynamic_cast(m_SelectedNode->GetData())
|| dynamic_cast(m_SelectedNode->GetData()) )
{
m_SelectedNode->SetIntProperty("ShowMaxNumber", maxNr);
}
mitk::RenderingManager::GetInstance()->RequestUpdateAll();
}
void QmitkControlVisualizationPropertiesView::NormalizationDropdownChanged(int normDropdown)
{
typedef mitk::OdfNormalizationMethodProperty PropType;
PropType::Pointer normMeth = PropType::New();
switch(normDropdown)
{
case 0:
normMeth->SetNormalizationToMinMax();
break;
case 1:
normMeth->SetNormalizationToMax();
break;
case 2:
normMeth->SetNormalizationToNone();
break;
case 3:
normMeth->SetNormalizationToGlobalMax();
break;
default:
normMeth->SetNormalizationToMinMax();
}
if ( dynamic_cast(m_SelectedNode->GetData())
|| dynamic_cast(m_SelectedNode->GetData()) )
{
m_SelectedNode->SetProperty("Normalization", normMeth.GetPointer());
}
mitk::RenderingManager::GetInstance()->RequestUpdateAll();
}
void QmitkControlVisualizationPropertiesView::ScalingFactorChanged(double scalingFactor)
{
if ( dynamic_cast(m_SelectedNode->GetData())
|| dynamic_cast(m_SelectedNode->GetData()) )
{
m_SelectedNode->SetFloatProperty("Scaling", scalingFactor);
}
if (auto renderWindowPart = this->GetRenderWindowPart())
{
renderWindowPart->RequestUpdate();
}
}
void QmitkControlVisualizationPropertiesView::AdditionalScaling(int additionalScaling)
{
typedef mitk::OdfScaleByProperty PropType;
PropType::Pointer scaleBy = PropType::New();
switch(additionalScaling)
{
case 0:
scaleBy->SetScaleByNothing();
break;
case 1:
scaleBy->SetScaleByGFA();
//m_Controls->params_frame->setVisible(true);
break;
#ifdef DIFFUSION_IMAGING_EXTENDED
case 2:
scaleBy->SetScaleByPrincipalCurvature();
// commented in for SPIE paper, Principle curvature scaling
//m_Controls->params_frame->setVisible(true);
break;
#endif
default:
scaleBy->SetScaleByNothing();
}
if ( dynamic_cast(m_SelectedNode->GetData())
|| dynamic_cast(m_SelectedNode->GetData()) )
{
m_SelectedNode->SetProperty("ScaleBy", scaleBy.GetPointer());
}
mitk::RenderingManager::GetInstance()->RequestUpdateAll();
}
void QmitkControlVisualizationPropertiesView::Fiber2DfadingEFX()
{
if (m_SelectedNode && dynamic_cast(m_SelectedNode->GetData()) )
{
bool currentMode;
m_SelectedNode->GetBoolProperty("Fiber2DfadeEFX", currentMode);
m_SelectedNode->SetProperty("Fiber2DfadeEFX", mitk::BoolProperty::New(!currentMode));
dynamic_cast(m_SelectedNode->GetData())->RequestUpdate2D();
mitk::RenderingManager::GetInstance()->RequestUpdateAll();
}
}
void QmitkControlVisualizationPropertiesView::FiberSlicingThickness2D()
{
if (m_SelectedNode && dynamic_cast(m_SelectedNode->GetData()))
{
float fibThickness = m_Controls->m_FiberThicknessSlider->value() * 0.1;
float currentThickness = 0;
m_SelectedNode->GetFloatProperty("Fiber2DSliceThickness", currentThickness);
if ( fabs(fibThickness-currentThickness) < 0.001 )
{
return;
}
m_SelectedNode->SetProperty("Fiber2DSliceThickness", mitk::FloatProperty::New(fibThickness));
dynamic_cast(m_SelectedNode->GetData())->RequestUpdate2D();
mitk::RenderingManager::GetInstance()->RequestUpdateAll();
}
}
void QmitkControlVisualizationPropertiesView::FiberSlicingUpdateLabel(int value)
{
QString label = "Range %1 mm";
label = label.arg(value * 0.1);
m_Controls->label_range->setText(label);
FiberSlicingThickness2D();
}
void QmitkControlVisualizationPropertiesView::SetCustomColor(const itk::EventObject& /*e*/)
{
if(m_SelectedNode && dynamic_cast(m_SelectedNode->GetData()))
{
float color[3];
m_SelectedNode->GetColor(color);
mitk::FiberBundle::Pointer fib = dynamic_cast(m_SelectedNode->GetData());
fib->SetFiberColors(color[0]*255, color[1]*255, color[2]*255);
mitk::RenderingManager::GetInstance()->RequestUpdateAll();
}
else if (m_SelectedNode && dynamic_cast(m_SelectedNode->GetData()))
{
float color[3];
m_SelectedNode->GetColor(color);
mitk::PeakImage::Pointer img = dynamic_cast(m_SelectedNode->GetData());
img->SetCustomColor(color[0]*255, color[1]*255, color[2]*255);
mitk::RenderingManager::GetInstance()->RequestUpdateAll();
}
}
void QmitkControlVisualizationPropertiesView::ResetColoring()
{
if(m_SelectedNode && dynamic_cast(m_SelectedNode->GetData()))
{
mitk::FiberBundle::Pointer fib = dynamic_cast(m_SelectedNode->GetData());
fib->ColorFibersByOrientation();
mitk::RenderingManager::GetInstance()->RequestUpdateAll();
}
else if(m_SelectedNode && dynamic_cast(m_SelectedNode->GetData()))
{
mitk::PeakImage::Pointer fib = dynamic_cast(m_SelectedNode->GetData());
fib->ColorByOrientation();
mitk::RenderingManager::GetInstance()->RequestUpdateAll();
}
}
void QmitkControlVisualizationPropertiesView::PlanarFigureFocus()
{
if(m_SelectedNode)
{
mitk::PlanarFigure* _PlanarFigure = 0;
_PlanarFigure = dynamic_cast (m_SelectedNode->GetData());
if (_PlanarFigure && _PlanarFigure->GetPlaneGeometry())
{
QmitkRenderWindow* selectedRenderWindow = 0;
bool PlanarFigureInitializedWindow = false;
auto renderWindowPart = this->GetRenderWindowPart(OPEN);
QmitkRenderWindow* axialRenderWindow =
renderWindowPart->GetQmitkRenderWindow("axial");
if (m_SelectedNode->GetBoolProperty("PlanarFigureInitializedWindow",
PlanarFigureInitializedWindow, axialRenderWindow->GetRenderer()))
{
selectedRenderWindow = axialRenderWindow;
}
QmitkRenderWindow* sagittalRenderWindow =
renderWindowPart->GetQmitkRenderWindow("sagittal");
if (!selectedRenderWindow && m_SelectedNode->GetBoolProperty(
"PlanarFigureInitializedWindow", PlanarFigureInitializedWindow,
sagittalRenderWindow->GetRenderer()))
{
selectedRenderWindow = sagittalRenderWindow;
}
QmitkRenderWindow* coronalRenderWindow =
renderWindowPart->GetQmitkRenderWindow("coronal");
if (!selectedRenderWindow && m_SelectedNode->GetBoolProperty(
"PlanarFigureInitializedWindow", PlanarFigureInitializedWindow,
coronalRenderWindow->GetRenderer()))
{
selectedRenderWindow = coronalRenderWindow;
}
QmitkRenderWindow* _3DRenderWindow =
renderWindowPart->GetQmitkRenderWindow("3d");
if (!selectedRenderWindow && m_SelectedNode->GetBoolProperty(
"PlanarFigureInitializedWindow", PlanarFigureInitializedWindow,
_3DRenderWindow->GetRenderer()))
{
selectedRenderWindow = _3DRenderWindow;
}
const mitk::PlaneGeometry* _PlaneGeometry = _PlanarFigure->GetPlaneGeometry();
mitk::VnlVector normal = _PlaneGeometry->GetNormalVnl();
mitk::PlaneGeometry::ConstPointer worldGeometry1 =
axialRenderWindow->GetRenderer()->GetCurrentWorldPlaneGeometry();
mitk::PlaneGeometry::ConstPointer _Plane1 =
dynamic_cast( worldGeometry1.GetPointer() );
mitk::VnlVector normal1 = _Plane1->GetNormalVnl();
mitk::PlaneGeometry::ConstPointer worldGeometry2 =
sagittalRenderWindow->GetRenderer()->GetCurrentWorldPlaneGeometry();
mitk::PlaneGeometry::ConstPointer _Plane2 =
dynamic_cast( worldGeometry2.GetPointer() );
mitk::VnlVector normal2 = _Plane2->GetNormalVnl();
mitk::PlaneGeometry::ConstPointer worldGeometry3 =
coronalRenderWindow->GetRenderer()->GetCurrentWorldPlaneGeometry();
mitk::PlaneGeometry::ConstPointer _Plane3 =
dynamic_cast( worldGeometry3.GetPointer() );
mitk::VnlVector normal3 = _Plane3->GetNormalVnl();
normal[0] = fabs(normal[0]); normal[1] = fabs(normal[1]); normal[2] = fabs(normal[2]);
normal1[0] = fabs(normal1[0]); normal1[1] = fabs(normal1[1]); normal1[2] = fabs(normal1[2]);
normal2[0] = fabs(normal2[0]); normal2[1] = fabs(normal2[1]); normal2[2] = fabs(normal2[2]);
normal3[0] = fabs(normal3[0]); normal3[1] = fabs(normal3[1]); normal3[2] = fabs(normal3[2]);
double ang1 = angle(normal, normal1);
double ang2 = angle(normal, normal2);
double ang3 = angle(normal, normal3);
if(ang1 < ang2 && ang1 < ang3)
{
selectedRenderWindow = axialRenderWindow;
}
else
{
if(ang2 < ang3)
{
selectedRenderWindow = sagittalRenderWindow;
}
else
{
selectedRenderWindow = coronalRenderWindow;
}
}
// make node visible
if (selectedRenderWindow)
{
const mitk::Point3D& centerP = _PlaneGeometry->GetOrigin();
selectedRenderWindow->GetSliceNavigationController()->ReorientSlices(
centerP, _PlaneGeometry->GetNormal());
}
}
// set interactor for new node (if not already set)
mitk::PlanarFigureInteractor::Pointer figureInteractor
= dynamic_cast(m_SelectedNode->GetDataInteractor().GetPointer());
if(figureInteractor.IsNull())
{
figureInteractor = mitk::PlanarFigureInteractor::New();
us::Module* planarFigureModule = us::ModuleRegistry::GetModule( "MitkPlanarFigure" );
figureInteractor->LoadStateMachine("PlanarFigureInteraction.xml", planarFigureModule );
figureInteractor->SetEventConfig( "PlanarFigureConfig.xml", planarFigureModule );
figureInteractor->SetDataNode( m_SelectedNode );
}
m_SelectedNode->SetProperty("planarfigure.iseditable",mitk::BoolProperty::New(true));
}
}
void QmitkControlVisualizationPropertiesView::SetInteractor()
{
// BUG 19179
// typedef std::vector Container;
// Container _NodeSet = this->GetDataManagerSelection();
// mitk::DataNode* node = 0;
// mitk::FiberBundle* bundle = 0;
// mitk::FiberBundleInteractor::Pointer bundleInteractor = 0;
// // finally add all nodes to the model
// for(Container::const_iterator it=_NodeSet.begin(); it!=_NodeSet.end()
// ; it++)
// {
// node = const_cast(*it);
// bundle = dynamic_cast(node->GetData());
// if(bundle)
// {
// bundleInteractor = dynamic_cast(node->GetInteractor());
// if(bundleInteractor.IsNotNull())
// mitk::GlobalInteraction::GetInstance()->RemoveInteractor(bundleInteractor);
// if(!m_Controls->m_Crosshair->isChecked())
// {
// m_Controls->m_Crosshair->setChecked(false);
// this->GetActiveStdMultiWidget()->GetRenderWindow4()->setCursor(Qt::ArrowCursor);
// m_CurrentPickingNode = 0;
// }
// else
// {
// m_Controls->m_Crosshair->setChecked(true);
// bundleInteractor = mitk::FiberBundleInteractor::New("FiberBundleInteractor", node);
// mitk::GlobalInteraction::GetInstance()->AddInteractor(bundleInteractor);
// this->GetActiveStdMultiWidget()->GetRenderWindow4()->setCursor(Qt::CrossCursor);
// m_CurrentPickingNode = node;
// }
// }
// }
}
void QmitkControlVisualizationPropertiesView::TubeRadiusChanged()
{
if(m_SelectedNode && dynamic_cast(m_SelectedNode->GetData()))
{
float newRadius = m_Controls->m_TubeWidth->value();
if (newRadius>0)
m_SelectedNode->SetBoolProperty( "light.enable_light", true);
else
m_SelectedNode->SetBoolProperty( "light.enable_light", false);
m_SelectedNode->SetFloatProperty("shape.tuberadius", newRadius);
mitk::RenderingManager::GetInstance()->RequestUpdateAll();
}
}
void QmitkControlVisualizationPropertiesView::LineWidthChanged()
{
if(m_SelectedNode && dynamic_cast(m_SelectedNode->GetData()))
{
int newWidth = m_Controls->m_LineWidth->value();
int currentWidth = 0;
m_SelectedNode->GetIntProperty("shape.linewidth", currentWidth);
if (currentWidth==newWidth)
return;
m_SelectedNode->SetIntProperty("shape.linewidth", newWidth);
dynamic_cast(m_SelectedNode->GetData())->RequestUpdate();
mitk::RenderingManager::GetInstance()->RequestUpdateAll();
}
}
void QmitkControlVisualizationPropertiesView::Welcome()
{
berry::PlatformUI::GetWorkbench()->GetIntroManager()
->ShowIntro(GetSite()->GetWorkbenchWindow(), false);
}
void QmitkControlVisualizationPropertiesView::OnColourisationModeChanged()
{
if( m_SelectedNode && m_NodeUsedForOdfVisualization.IsNotNull() )
{
m_SelectedNode->SetProperty( "DiffusionCore.Rendering.OdfVtkMapper.ColourisationModeBit", mitk::BoolProperty::New( m_Controls->m_OdfColorBox->currentIndex() ) );
mitk::RenderingManager::GetInstance()->RequestUpdateAll();
}
else
{
MITK_DEBUG << "QmitkControlVisualizationPropertiesView::OnColourisationModeChanged() was called but m_NodeUsedForOdfVisualization was Null.";
}
}
diff --git a/Plugins/org.mitk.gui.qt.diffusionimaging/src/internal/QmitkControlVisualizationPropertiesView.h b/Plugins/org.mitk.gui.qt.diffusionimaging/src/internal/QmitkControlVisualizationPropertiesView.h
index 3d2e8d6f4f..be31412d47 100644
--- a/Plugins/org.mitk.gui.qt.diffusionimaging/src/internal/QmitkControlVisualizationPropertiesView.h
+++ b/Plugins/org.mitk.gui.qt.diffusionimaging/src/internal/QmitkControlVisualizationPropertiesView.h
@@ -1,150 +1,151 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef _QMITKControlVisualizationPropertiesView_H_INCLUDED
#define _QMITKControlVisualizationPropertiesView_H_INCLUDED
#include
#include
#include "berryISelectionListener.h"
#include "berryIStructuredSelection.h"
#include "berryISizeProvider.h"
#include "ui_QmitkControlVisualizationPropertiesViewControls.h"
#include "mitkEnumerationProperty.h"
#include
#include
/*!
* \ingroup org_mitk_gui_qt_diffusionquantification_internal
*
* \brief QmitkControlVisualizationPropertiesView
*
* Document your class here.
*/
class QmitkControlVisualizationPropertiesView : public QmitkAbstractView, public mitk::ILifecycleAwarePart
{
friend struct CvpSelListener;
// this is needed for all Qt objects that should have a MOC object (everything that derives from QObject)
Q_OBJECT
public:
static const std::string VIEW_ID;
QmitkControlVisualizationPropertiesView();
virtual ~QmitkControlVisualizationPropertiesView();
virtual void CreateQtPartControl(QWidget *parent) override;
/// \brief Creation of the connections of main and control widget
virtual void CreateConnections();
protected slots:
void VisibleOdfsON_S();
void VisibleOdfsON_T();
void VisibleOdfsON_C();
void ShowMaxNumberChanged();
void NormalizationDropdownChanged(int);
void ScalingFactorChanged(double);
void AdditionalScaling(int);
void OnThickSlicesModeSelected( QAction* action );
void OnTSNumChanged(int num);
void ResetColoring();
void PlanarFigureFocus();
void Fiber2DfadingEFX();
void FiberSlicingThickness2D();
void FiberSlicingUpdateLabel(int);
void LineWidthChanged();
void TubeRadiusChanged();
void SetInteractor();
void Toggle3DClipping(bool enabled=true);
void FlipPeaks();
void Welcome();
void OnSliceChanged();
+ void SetColor();
/// \brief Slot function for switching colourisation mode of glyphs.
void OnColourisationModeChanged();
protected:
virtual void SetFocus() override;
virtual void Activated() override;
virtual void Deactivated() override;
virtual void Visible() override;
virtual void Hidden() override;
virtual void NodeRemoved(const mitk::DataNode* node) override;
/// \brief called by QmitkAbstractView when DataManager's selection has changed
virtual void OnSelectionChanged(berry::IWorkbenchPart::Pointer part, const QList& nodes) override;
virtual void NodeAdded(const mitk::DataNode *node) override;
void SetCustomColor(const itk::EventObject& /*e*/);
bool IsPlaneRotated();
void SliceRotation(const itk::EventObject&);
void Set3DClippingPlane(bool disable, mitk::DataNode *node, std::string plane);
Ui::QmitkControlVisualizationPropertiesViewControls* m_Controls;
QScopedPointer m_SelListener;
berry::IStructuredSelection::ConstPointer m_CurrentSelection;
mitk::DataNode::Pointer m_NodeUsedForOdfVisualization;
QIcon* m_IconTexOFF;
QIcon* m_IconTexON;
QIcon* m_IconGlyOFF_T;
QIcon* m_IconGlyON_T;
QIcon* m_IconGlyOFF_C;
QIcon* m_IconGlyON_C;
QIcon* m_IconGlyOFF_S;
QIcon* m_IconGlyON_S;
bool m_TexIsOn;
bool m_GlyIsOn_T;
bool m_GlyIsOn_C;
bool m_GlyIsOn_S;
int currentThickSlicesMode;
QLabel* m_TSLabel;
QMenu* m_MyMenu;
// for planarfigure and bundle handling:
mitk::DataNode::Pointer m_SelectedNode;
mitk::DataNode* m_CurrentPickingNode;
unsigned long m_ColorPropertyObserverTag;
unsigned long m_OpacityPropertyObserverTag;
mitk::ColorProperty::Pointer m_Color;
mitk::FloatProperty::Pointer m_Opacity;
QmitkSliceNavigationListener m_SliceChangeListener;
};
#endif // _QMITKControlVisualizationPropertiesView_H_INCLUDED
diff --git a/Plugins/org.mitk.gui.qt.diffusionimaging/src/internal/QmitkControlVisualizationPropertiesViewControls.ui b/Plugins/org.mitk.gui.qt.diffusionimaging/src/internal/QmitkControlVisualizationPropertiesViewControls.ui
index eff9c055bb..84d90de329 100644
--- a/Plugins/org.mitk.gui.qt.diffusionimaging/src/internal/QmitkControlVisualizationPropertiesViewControls.ui
+++ b/Plugins/org.mitk.gui.qt.diffusionimaging/src/internal/QmitkControlVisualizationPropertiesViewControls.ui
@@ -1,890 +1,938 @@
QmitkControlVisualizationPropertiesViewControls
0
0
567
619
0
100
0
0
QmitkTemplate
0
0
0
0
-
QFrame::NoFrame
QFrame::Raised
0
0
0
0
-
0
0
QFrame::NoFrame
QFrame::Raised
0
0
0
0
-
Multislice Projection
MIP
QToolButton::MenuButtonPopup
Qt::NoArrow
-
QFrame::NoFrame
QFrame::Plain
0
0
0
0
-
Toggle visibility of ODF glyphs (axial)
:/QmitkDiffusionImaging/glyphsoff_T.png
:/QmitkDiffusionImaging/glyphson_T.png:/QmitkDiffusionImaging/glyphsoff_T.png
true
false
-
Toggle visibility of ODF glyphs (sagittal)
:/QmitkDiffusionImaging/glyphsoff_S.png
:/QmitkDiffusionImaging/glyphson_S.png:/QmitkDiffusionImaging/glyphsoff_S.png
true
false
-
Toggle visibility of ODF glyphs (coronal)
:/QmitkDiffusionImaging/glyphsoff_C.png
:/QmitkDiffusionImaging/glyphson_C.png:/QmitkDiffusionImaging/glyphsoff_C.png
true
false
-
#Glyphs
-
9999
-
Qt::Horizontal
20
20
-
QFrame::NoFrame
QFrame::Raised
0
0
0
0
0
-
QFrame::NoFrame
QFrame::Raised
0
0
0
0
-
QFrame::NoFrame
QFrame::Plain
0
0
0
0
-
ODF normalization
false
-
Min-Max
-
Max
-
None
-
ODF Normalization:
-
ODF normalization
false
-
ODF Value
-
Principal Direction
-
Color ODFs/Tensors by:
-
QFrame::NoFrame
QFrame::Plain
0
0
0
0
-
ODF Scale:
-
false
-
None
-
FA/GFA
-
*
-
Additional scaling factor
3
999999999.000000000000000
0.100000000000000
1.000000000000000
-
QFrame::NoFrame
QFrame::Raised
0
0
0
0
-
QFrame::NoFrame
QFrame::Raised
0
0
0
0
+
-
+
+
+ Reset to Default Coloring
+
+
+
+
+
+
+ :/QmitkDiffusionImaging/color64.gif:/QmitkDiffusionImaging/color64.gif
+
+
+
-
Reset to Default Coloring
:/QmitkDiffusionImaging/reset.png:/QmitkDiffusionImaging/reset.png
-
Position Crosshair by 3D-Click
:/QmitkDiffusionImaging/crosshair.png:/QmitkDiffusionImaging/crosshair.png
true
false
-
2D Fiberfading on/off
-
Qt::Horizontal
40
20
-
QFrame::NoFrame
QFrame::Raised
0
0
0
0
-
2D Clipping
-
100
10
10
10
Qt::Horizontal
-
90
0
10000
16777215
Range
-
QFrame::NoFrame
QFrame::Raised
0
0
0
0
-
1
10
-
Tube Radius
-
Line Width
-
4
0.100000000000000
-
3D Fiber Clipping
0
0
0
0
0
-
Sagittal
-
No clipping
true
-
Coronal
-
Axial
-
Flipp Clipping Direction
-
50
false
false
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
p, li { white-space: pre-wrap; }
</style></head><body style=" font-family:'Ubuntu'; font-size:11pt; font-weight:400; font-style:normal;">
<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#ff0000;">One or more slices are rotated. ODF Visualisation is not possible in rotated planes. Use 'Reinit' on the image node to reset. </span></p></body></html>
Qt::AutoText
true
-
QFrame::NoFrame
QFrame::Raised
0
0
0
0
-
-
-
-
- z
-
-
-
- -
-
-
- x
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- Flip Peaks
-
-
-
- -
+
-
Qt::Horizontal
40
20
- -
-
-
- y
+
-
+
+
+ QFrame::NoFrame
+
+
+ QFrame::Raised
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
-
+
+
+
+ 0
+ 0
+
+
+
+ Flip Peaks
+
+
+
+ -
+
+
+ x
+
+
+
+ -
+
+
+ y
+
+
+
+ -
+
+
+ z
+
+
+
+
-
Reset to Default Coloring
:/QmitkDiffusionImaging/reset.png:/QmitkDiffusionImaging/reset.png
+ -
+
+
+ Reset to Default Coloring
+
+
+
+
+
+
+ :/QmitkDiffusionImaging/color64.gif:/QmitkDiffusionImaging/color64.gif
+
+
+
-
Qt::Vertical
20
40
QmitkDataStorageComboBox.h
-
-
-
-