diff --git a/Plugins/org.mitk.gui.qt.diffusionimaging/src/internal/QmitkDenoisingView.cpp b/Plugins/org.mitk.gui.qt.diffusionimaging/src/internal/QmitkDenoisingView.cpp index 871e0857ed..0f269a2928 100644 --- a/Plugins/org.mitk.gui.qt.diffusionimaging/src/internal/QmitkDenoisingView.cpp +++ b/Plugins/org.mitk.gui.qt.diffusionimaging/src/internal/QmitkDenoisingView.cpp @@ -1,149 +1,115 @@ /*=================================================================== 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 #include #include // Qmitk #include "QmitkDenoisingView.h" #include #include #include #include #include #include #include #include #include #include #include #include +#include const std::string QmitkDenoisingView::VIEW_ID = "org.mitk.views.denoisingview"; QmitkDenoisingView::QmitkDenoisingView() : QmitkFunctionality() , m_Controls( 0 ) - , m_MultiWidget( NULL ) , m_ImageNode(NULL) { } QmitkDenoisingView::~QmitkDenoisingView() { } void QmitkDenoisingView::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::QmitkDenoisingViewControls; m_Controls->setupUi( parent ); + this->CreateConnections(); } } -void QmitkDenoisingView::StdMultiWidgetAvailable (QmitkStdMultiWidget &stdMultiWidget) +void QmitkDenoisingView::CreateConnections() { - //m_MultiWidget = &stdMultiWidget; - - /*{ - mitk::SliceNavigationController* slicer = m_MultiWidget->mitkWidget1->GetSliceNavigationController(); - itk::ReceptorMemberCommand::Pointer command = itk::ReceptorMemberCommand::New(); - command->SetCallbackFunction( this, &QmitkDenoisingView::OnSliceChanged ); - m_SliceObserverTag1 = slicer->AddObserver( mitk::SliceNavigationController::GeometrySliceEvent(NULL, 0), command ); - } - + if ( m_Controls ) { - mitk::SliceNavigationController* slicer = m_MultiWidget->mitkWidget2->GetSliceNavigationController(); - itk::ReceptorMemberCommand::Pointer command = itk::ReceptorMemberCommand::New(); - command->SetCallbackFunction( this, &QmitkDenoisingView::OnSliceChanged ); - m_SliceObserverTag2 = slicer->AddObserver( mitk::SliceNavigationController::GeometrySliceEvent(NULL, 0), command ); + connect( (QObject*)(m_Controls->m_ApplyButton), SIGNAL(clicked()), this, SLOT(StartDenoising())); } - - { - mitk::SliceNavigationController* slicer = m_MultiWidget->mitkWidget3->GetSliceNavigationController(); - itk::ReceptorMemberCommand::Pointer command = itk::ReceptorMemberCommand::New(); - command->SetCallbackFunction( this, &QmitkDenoisingView::OnSliceChanged ); - m_SliceObserverTag3 = slicer->AddObserver( mitk::SliceNavigationController::GeometrySliceEvent(NULL, 0), command ); - }*/ -} - - -void QmitkDenoisingView::StdMultiWidgetNotAvailable() -{ - /*{ - mitk::SliceNavigationController* slicer = m_MultiWidget->mitkWidget1->GetSliceNavigationController(); - slicer->RemoveObserver( m_SliceObserverTag1 ); - } - - { - mitk::SliceNavigationController* slicer = m_MultiWidget->mitkWidget2->GetSliceNavigationController(); - slicer->RemoveObserver( m_SliceObserverTag2 ); - } - - { - mitk::SliceNavigationController* slicer = m_MultiWidget->mitkWidget3->GetSliceNavigationController(); - slicer->RemoveObserver( m_SliceObserverTag3 ); - }*/ - //m_MultiWidget = NULL; } void QmitkDenoisingView::OnSelectionChanged( std::vector nodes ) { if (m_ImageNode.IsNotNull()) m_ImageNode->RemoveObserver( m_PropertyObserverTag ); m_Controls->m_InputData->setTitle("Please Select Input Data"); m_Controls->m_InputImageLabel->setText("mandatory"); m_ImageNode = NULL; // iterate selection for( std::vector::iterator it = nodes.begin(); it != nodes.end(); ++it ) { mitk::DataNode::Pointer node = *it; if( node.IsNotNull() && dynamic_cast(node->GetData())) { m_Controls->m_InputImageLabel->setText(node->GetName().c_str()); m_ImageNode = node; } } if (m_ImageNode.IsNotNull()) { itk::ReceptorMemberCommand::Pointer command = itk::ReceptorMemberCommand::New(); - command->SetCallbackFunction( this, &QmitkDenoisingView::OnSliceChanged ); m_PropertyObserverTag = m_ImageNode->AddObserver( itk::ModifiedEvent(), command ); m_Controls->m_InputData->setTitle("Input Data"); } } -/** -* -* ist das Interessant für mich? -* -**/ -void QmitkDenoisingView::OnSliceChanged(const itk::EventObject& /*e*/) +void QmitkDenoisingView::StartDenoising() { + if (m_ImageNode.IsNotNull()) + { + MITK_INFO << "JOPP"; + typedef itk::NonLocalMeansDenoisingFilter NonLocalMeansDenoisingFilterType; + NonLocalMeansDenoisingFilterType::Pointer denoisingFilter = NonLocalMeansDenoisingFilterType::New(); + denoisingFilter->SetVRadius((unsigned int)m_Controls->m_Parameter1); + denoisingFilter->SetNRadius((unsigned int)m_Controls->m_Parameter2); + denoisingFilter->Update(); + } } diff --git a/Plugins/org.mitk.gui.qt.diffusionimaging/src/internal/QmitkDenoisingView.h b/Plugins/org.mitk.gui.qt.diffusionimaging/src/internal/QmitkDenoisingView.h index b825dd4669..20c87d7e68 100644 --- a/Plugins/org.mitk.gui.qt.diffusionimaging/src/internal/QmitkDenoisingView.h +++ b/Plugins/org.mitk.gui.qt.diffusionimaging/src/internal/QmitkDenoisingView.h @@ -1,105 +1,95 @@ /*=================================================================== 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 _QMITKQmitkDenoisingView_H_INCLUDED #define _QMITKQmitkDenoisingView_H_INCLUDED #include #include #include #include "ui_QmitkDenoisingViewControls.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include // /*! \brief View displaying details of the orientation distribution function in the voxel at the current crosshair position. \sa QmitkFunctionality \ingroup Functionalities */ -//template -class QmitkDenoisingView : public QmitkFunctionality//, public mitk::DiffusionImageSource< DiffusionPixelType > +class QmitkDenoisingView : public QmitkFunctionality { // 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; QmitkDenoisingView(); virtual ~QmitkDenoisingView(); -/* typedef float TOdfPixelType; - typedef itk::Vector OdfVectorType; - typedef itk::Image OdfVectorImgType; - - typedef itk::DiffusionTensor3D< TOdfPixelType > TensorPixelType; - typedef itk::Image< TensorPixelType, 3 > TensorImageType;*/ typedef short DiffusionPixelType; typedef mitk::DiffusionImage< DiffusionPixelType > DiffusionImageType; virtual void CreateQtPartControl(QWidget *parent); - virtual void StdMultiWidgetAvailable (QmitkStdMultiWidget &stdMultiWidget); - virtual void StdMultiWidgetNotAvailable(); - - void OnSliceChanged(const itk::EventObject& e); + /// \brief Creation of the connections of main and control widget + virtual void CreateConnections(); protected slots: + void StartDenoising(); + protected: /// \brief called by QmitkFunctionality when DataManager's selection has changed virtual void OnSelectionChanged( std::vector nodes ); void UpdateOdf(); ///< called if slice position or datamanager selection has changed Ui::QmitkDenoisingViewControls* m_Controls; QmitkStdMultiWidget* m_MultiWidget; mitk::DataNode::Pointer m_ImageNode; - int m_SliceObserverTag1; - int m_SliceObserverTag2; - int m_SliceObserverTag3; int m_PropertyObserverTag; }; #endif // _QmitkDenoisingView_H_INCLUDED