diff --git a/Modules/ToFUI/Qmitk/QmitkToFCompositeFilterWidget.cpp b/Modules/ToFUI/Qmitk/QmitkToFCompositeFilterWidget.cpp index 423e954314..e0ae5f65fb 100644 --- a/Modules/ToFUI/Qmitk/QmitkToFCompositeFilterWidget.cpp +++ b/Modules/ToFUI/Qmitk/QmitkToFCompositeFilterWidget.cpp @@ -1,213 +1,213 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Module: $RCSfile$ Language: C++ Date: $Date: 2009-05-20 13:35:09 +0200 (Mi, 20 Mai 2009) $ Version: $Revision: 17332 $ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #include //QT headers #include const std::string QmitkToFCompositeFilterWidget::VIEW_ID = "org.mitk.views.qmitktofcompositefilterwidget"; QmitkToFCompositeFilterWidget::QmitkToFCompositeFilterWidget(QWidget* parent, Qt::WindowFlags f): QWidget(parent, f) { this->m_ToFCompositeFilter = NULL; m_Controls = NULL; CreateQtPartControl(this); } QmitkToFCompositeFilterWidget::~QmitkToFCompositeFilterWidget() { } void QmitkToFCompositeFilterWidget::CreateQtPartControl(QWidget *parent) { if (!m_Controls) { // create GUI widgets m_Controls = new Ui::QmitkToFCompositeFilterWidgetControls; m_Controls->setupUi(parent); QPlastiqueStyle *sliderStyle = new QPlastiqueStyle(); int min = m_Controls->m_ThresholdFilterMinValueSpinBox->value(); int max = m_Controls->m_ThresholdFilterMaxValueSpinBox->value(); m_Controls->m_ThresholdFilterRangeSlider->setMinimum(min); m_Controls->m_ThresholdFilterRangeSlider->setMaximum(max); m_Controls->m_ThresholdFilterRangeSlider->setLowerValue(min); m_Controls->m_ThresholdFilterRangeSlider->setUpperValue(max); m_Controls->m_ThresholdFilterRangeSlider->setHandleMovementMode(QxtSpanSlider::NoOverlapping); m_Controls->m_ThresholdFilterRangeSlider->setStyle(sliderStyle); this->CreateConnections(); } } void QmitkToFCompositeFilterWidget::CreateConnections() { if ( m_Controls ) { connect(m_Controls->m_TemporalMedianFilterNumOfFramesSpinBox, SIGNAL(valueChanged(int)), this, SLOT(OnTemporalMedianFilterNumOfFramesSpinBoxValueChanged(int))); - connect(m_Controls->m_BilateralFilterDomainSigmaSpinBox, SIGNAL(valueChanged(int)), this, SLOT(OnBilateralFilterDomainSigmaSpinBoxValueChanged(int))); - connect(m_Controls->m_BilateralFilterRangeSigmaSpinBox, SIGNAL(valueChanged(int)), this, SLOT(OnBilateralFilterRangeSigmaSpinBoxValueChanged(int))); + connect(m_Controls->m_BilateralFilterDomainSigmaSpinBox, SIGNAL(valueChanged(double)), this, SLOT(OnBilateralFilterDomainSigmaSpinBoxValueChanged(double))); + connect(m_Controls->m_BilateralFilterRangeSigmaSpinBox, SIGNAL(valueChanged(double)), this, SLOT(OnBilateralFilterRangeSigmaSpinBoxValueChanged(double))); connect(m_Controls->m_BilateralFilterKernelRadiusSpinBox, SIGNAL(valueChanged(int)), this, SLOT(OnBilateralFilterKernelRadiusSpinBoxValueChanged(int))); connect(m_Controls->m_ThresholdFilterMinValueSpinBox, SIGNAL(valueChanged(int)), this, SLOT(OnThresholdFilterMinValueChanged(int))); connect(m_Controls->m_ThresholdFilterMaxValueSpinBox, SIGNAL(valueChanged(int)), this, SLOT(OnThresholdFilterMaxValueChanged(int))); connect( (QObject*)(m_Controls->m_TemporalMedianFilterCheckBox), SIGNAL(toggled(bool)), this, SLOT(OnTemporalMedianFilterCheckBoxChecked(bool)) ); connect( (QObject*)(m_Controls->m_AverageFilterCheckBox), SIGNAL(toggled(bool)), this, SLOT(OnAverageFilterCheckBoxChecked(bool)) ); connect( (QObject*)(m_Controls->m_ThresholdFilterCheckBox), SIGNAL(toggled(bool)), this, SLOT(OnThresholdFilterCheckBoxChecked(bool)) ); connect( (QObject*)(m_Controls->m_BilateralFilterCheckBox), SIGNAL(toggled(bool)), this, SLOT(OnBilateralFilterCheckBoxChecked(bool)) ); connect( (QObject*)(m_Controls->m_MedianFilterCheckBox), SIGNAL(toggled(bool)), this, SLOT(OnMedianFilterCheckBoxChecked(bool)) ); connect(m_Controls->m_ThresholdFilterRangeSlider, SIGNAL(spanChanged(int, int) ),this, SLOT( OnSpanChanged(int , int ) )); //reset button connect(m_Controls->m_ThresholdFilterRangeSliderReset, SIGNAL(pressed()), this, SLOT(OnResetThresholdFilterRangeSlider())); } } void QmitkToFCompositeFilterWidget::SetToFCompositeFilter(mitk::ToFCompositeFilter* toFCompositeFilter) { this->m_ToFCompositeFilter = toFCompositeFilter; } mitk::ToFCompositeFilter* QmitkToFCompositeFilterWidget::GetToFCompositeFilter() { if (this->m_ToFCompositeFilter.IsNull()) { this->m_ToFCompositeFilter = mitk::ToFCompositeFilter::New(); } return this->m_ToFCompositeFilter; } void QmitkToFCompositeFilterWidget::UpdateFilterParameter() { OnTemporalMedianFilterCheckBoxChecked(m_Controls->m_TemporalMedianFilterCheckBox->isChecked()); OnAverageFilterCheckBoxChecked(m_Controls->m_AverageFilterCheckBox->isChecked()); OnMedianFilterCheckBoxChecked(m_Controls->m_MedianFilterCheckBox->isChecked()); OnThresholdFilterCheckBoxChecked(m_Controls->m_ThresholdFilterCheckBox->isChecked()); OnBilateralFilterCheckBoxChecked(m_Controls->m_BilateralFilterCheckBox->isChecked()); } void QmitkToFCompositeFilterWidget::OnTemporalMedianFilterCheckBoxChecked(bool checked) { this->m_ToFCompositeFilter->SetApplyTemporalMedianFilter(checked); // disable average filter if temporal median filter is enabled if (checked) { m_Controls->m_AverageFilterCheckBox->setChecked(false); this->m_ToFCompositeFilter->SetApplyAverageFilter(false); } } void QmitkToFCompositeFilterWidget::OnAverageFilterCheckBoxChecked(bool checked) { this->m_ToFCompositeFilter->SetApplyAverageFilter(checked); // disable temporal median filter if average filter is enabled if (checked) { m_Controls->m_TemporalMedianFilterCheckBox->setChecked(false); this->m_ToFCompositeFilter->SetApplyTemporalMedianFilter(false); } } void QmitkToFCompositeFilterWidget::OnThresholdFilterCheckBoxChecked(bool checked) { this->m_ToFCompositeFilter->SetApplyThresholdFilter(checked); } void QmitkToFCompositeFilterWidget::OnMedianFilterCheckBoxChecked(bool checked) { this->m_ToFCompositeFilter->SetApplyMedianFilter(checked); } void QmitkToFCompositeFilterWidget::OnBilateralFilterCheckBoxChecked(bool checked) { this->m_ToFCompositeFilter->SetApplyBilateralFilter(checked); } void QmitkToFCompositeFilterWidget::OnTemporalMedianFilterNumOfFramesSpinBoxValueChanged(int value) { this->m_ToFCompositeFilter->SetTemporalMedianFilterParameter(value); } -void QmitkToFCompositeFilterWidget::OnBilateralFilterDomainSigmaSpinBoxValueChanged(int value) +void QmitkToFCompositeFilterWidget::OnBilateralFilterDomainSigmaSpinBoxValueChanged(double value) { SetBilateralFilterParameter(); } -void QmitkToFCompositeFilterWidget::OnBilateralFilterRangeSigmaSpinBoxValueChanged(int value) +void QmitkToFCompositeFilterWidget::OnBilateralFilterRangeSigmaSpinBoxValueChanged(double value) { SetBilateralFilterParameter(); } void QmitkToFCompositeFilterWidget::OnBilateralFilterKernelRadiusSpinBoxValueChanged(int value) { SetBilateralFilterParameter(); } void QmitkToFCompositeFilterWidget::OnThresholdFilterMinValueChanged(int value) { m_Controls->m_ThresholdFilterRangeSlider->setLowerValue(value); SetThresholdFilterParameter(); } void QmitkToFCompositeFilterWidget::OnThresholdFilterMaxValueChanged(int value) { m_Controls->m_ThresholdFilterRangeSlider->setUpperValue(value); SetThresholdFilterParameter(); } void QmitkToFCompositeFilterWidget::SetThresholdFilterParameter() { int min = m_Controls->m_ThresholdFilterMinValueSpinBox->value(); int max = m_Controls->m_ThresholdFilterMaxValueSpinBox->value(); this->m_ToFCompositeFilter->SetThresholdFilterParameter(min, max); } void QmitkToFCompositeFilterWidget::SetBilateralFilterParameter() { - int domainSigma = m_Controls->m_BilateralFilterDomainSigmaSpinBox->value(); - int rangeSigma = m_Controls->m_BilateralFilterRangeSigmaSpinBox->value(); + double domainSigma = m_Controls->m_BilateralFilterDomainSigmaSpinBox->value(); + double rangeSigma = m_Controls->m_BilateralFilterRangeSigmaSpinBox->value(); int kernelRadius = m_Controls->m_BilateralFilterKernelRadiusSpinBox->value(); this->m_ToFCompositeFilter->SetBilateralFilterParameter(domainSigma, rangeSigma, kernelRadius); } void QmitkToFCompositeFilterWidget::OnSpanChanged(int lower, int upper) { int lowerVal = m_Controls->m_ThresholdFilterRangeSlider->lowerValue(); int upperVal = m_Controls->m_ThresholdFilterRangeSlider->upperValue(); m_Controls->m_ThresholdFilterMinValueSpinBox->setValue(lowerVal); m_Controls->m_ThresholdFilterMaxValueSpinBox->setValue(upperVal); } void QmitkToFCompositeFilterWidget::OnResetThresholdFilterRangeSlider() { int lower = 1; int upper = 7000; m_Controls->m_ThresholdFilterRangeSlider->setLowerValue(lower); m_Controls->m_ThresholdFilterRangeSlider->setUpperValue(upper); m_Controls->m_ThresholdFilterMinValueSpinBox->setValue(lower); m_Controls->m_ThresholdFilterMaxValueSpinBox->setValue(upper); } diff --git a/Modules/ToFUI/Qmitk/QmitkToFCompositeFilterWidget.h b/Modules/ToFUI/Qmitk/QmitkToFCompositeFilterWidget.h index 9830327ec8..426f92ef60 100644 --- a/Modules/ToFUI/Qmitk/QmitkToFCompositeFilterWidget.h +++ b/Modules/ToFUI/Qmitk/QmitkToFCompositeFilterWidget.h @@ -1,143 +1,143 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Module: $RCSfile$ Language: C++ Date: $Date: 2009-05-20 13:35:09 +0200 (Mi, 20 Mai 2009) $ Version: $Revision: 17332 $ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef _QMITKTOFCOMPOSITEFILTERWIDGET_H_INCLUDED #define _QMITKTOFCOMPOSITEFILTERWIDGET_H_INCLUDED #include "mitkTOFUIExports.h" #include "ui_QmitkToFCompositeFilterWidgetControls.h" //mitk headers #include /** * @brief Widget for controlling the ToFCompositeFilter (located in module ToFProcessing) * * The widget allows to enable/disable the filters internally used in the ToFCompositeFilter * and to set the individual filter parameters using GUI elements * * @ingroup ToFUI */ class mitkTOFUI_EXPORT QmitkToFCompositeFilterWidget :public QWidget { //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; QmitkToFCompositeFilterWidget(QWidget* p = 0, Qt::WindowFlags f1 = 0); virtual ~QmitkToFCompositeFilterWidget(); /* @brief This method is part of the widget an needs not to be called seperately. */ virtual void CreateQtPartControl(QWidget *parent); /* @brief This method is part of the widget an needs not to be called seperately. (Creation of the connections of main and control widget.)*/ virtual void CreateConnections(); /*! \brief Sets the ToFCompositeFilter used by this widget \param tofCompositeFilter pointer to the internally used ToFCompositeFilter */ void SetToFCompositeFilter(mitk::ToFCompositeFilter* toFCompositeFilter); /*! \brief Returns the ToFCompositeFilter used by this widget \return tofCompositeFilter pointer to the internally used ToFCompositeFilter */ mitk::ToFCompositeFilter* GetToFCompositeFilter(); /*! \brief update parameters of ToFCompositeFilter according to current GUI setting */ void UpdateFilterParameter(); signals: protected slots: /*! \brief slot en-/disabling temporal median filter in internal ToFCompositeFilter */ void OnTemporalMedianFilterCheckBoxChecked(bool checked); /*! \brief slot en-/disabling average filter in internal ToFCompositeFilter */ void OnAverageFilterCheckBoxChecked(bool checked); /*! \brief slot en-/disabling threshold filter in internal ToFCompositeFilter */ void OnThresholdFilterCheckBoxChecked(bool checked); /*! \brief slot en-/disabling median filter in internal ToFCompositeFilter */ void OnMedianFilterCheckBoxChecked(bool checked); /*! \brief slot en-/disabling bilateral filter in internal ToFCompositeFilter */ void OnBilateralFilterCheckBoxChecked(bool checked); /*! \brief slot updating threshold spin boxes according to slider position */ void OnSpanChanged(int lower, int upper); /*! \brief slot resetting threshold range slider to default values (min: 1, max: 7000) */ void OnResetThresholdFilterRangeSlider(); /*! \brief slot updating the parameter "number of frames" of the temporal median filter in the ToFCompositeFilter */ void OnTemporalMedianFilterNumOfFramesSpinBoxValueChanged(int value); /*! \brief slot updating the parameter "domain sigma" of the bilateral filter in the ToFCompositeFilter */ - void OnBilateralFilterDomainSigmaSpinBoxValueChanged(int value); + void OnBilateralFilterDomainSigmaSpinBoxValueChanged(double value); /*! \brief slot updating the paramter "range sigma" of the bilateral filter in the ToFCompositeFilter */ - void OnBilateralFilterRangeSigmaSpinBoxValueChanged(int value); + void OnBilateralFilterRangeSigmaSpinBoxValueChanged(double value); /*! \brief slot updating the paramter "kernel radius" of the bilateral filter in the ToFCompositeFilter */ void OnBilateralFilterKernelRadiusSpinBoxValueChanged(int value); /*! \brief slot updating the paramter "minimal threshold" of the threshold filter in the ToFCompositeFilter */ void OnThresholdFilterMinValueChanged(int value); /*! \brief slot updating the paramter "maximal threshold" of the threshold filter in the ToFCompositeFilter */ void OnThresholdFilterMaxValueChanged(int value); protected: Ui::QmitkToFCompositeFilterWidgetControls* m_Controls; ///< member holding the UI elements of this widget mitk::ToFCompositeFilter::Pointer m_ToFCompositeFilter; ///< member holding the internally used ToFCompositeFilter private: /*! \brief method updating the parameters of the bilateral filter in the ToFCompositeFilter */ void SetBilateralFilterParameter(); /*! \brief method updating the parameters of the threshold filter in the ToFCompositeFilter */ void SetThresholdFilterParameter(); }; #endif // _QMITKTOFCOMPOSITEFILTERWIDGET_H_INCLUDED