00001 /*========================================================================= 00002 00003 Program: Medical Imaging & Interaction Toolkit 00004 Language: C++ 00005 Date: $Date$ 00006 Version: $Revision$ 00007 00008 Copyright (c) German Cancer Research Center, Division of Medical and 00009 Biological Informatics. All rights reserved. 00010 See MITKCopyright.txt or https://www.mitk.org/copyright.html for details. 00011 00012 This software is distributed WITHOUT ANY WARRANTY; without even 00013 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00014 PURPOSE. See the above copyright notices for more information. 00015 00016 =========================================================================*/ 00017 00018 #ifndef MITK_THRESHOLDCOMPONENT_H 00019 #define MITK_THRESHOLDCOMPONENT_H 00020 00021 #include "QmitkFunctionalityComponentContainer.h" 00022 #include "QmitkExtExports.h" 00023 #include <itkImage.h> 00024 #include "ui_QmitkThresholdComponentControls.h" 00025 class QmitkStdMultiWidget; 00026 00027 #include "qcheckbox.h" 00028 00047 class QmitkExt_EXPORT QmitkThresholdComponent : public QmitkFunctionalityComponentContainer 00048 { 00049 00050 Q_OBJECT 00051 00052 public: 00053 /*************** CONSTRUCTOR ***************/ 00055 QmitkThresholdComponent(QObject *parent=0, const char *parentName=0, bool updateSelector = true, bool showSelector = true, QmitkStdMultiWidget *mitkStdMultiWidget = NULL); 00056 00057 /*************** DESTRUCTOR ***************/ 00059 virtual ~QmitkThresholdComponent(); 00060 00061 /*************** CREATE ***************/ 00062 00064 void CreateQtPartControl(QWidget *parent, mitk::DataStorage::Pointer dataStorage); 00065 00067 virtual void CreateConnections(); 00068 00069 00070 /*************** SET AND GET ***************/ 00071 00073 virtual void SetSelectorVisibility(bool visibility); 00074 00076 virtual QmitkDataStorageComboBox* GetTreeNodeSelector(); 00077 00079 virtual void SetDataStorage(mitk::DataStorage::Pointer dataStorage/*, mitk::DataNode::Pointer dtn = NULL*/); 00080 00082 virtual mitk::DataStorage::Pointer GetDataStorage(); 00083 00085 virtual QGroupBox * GetContentContainer(); 00086 00088 virtual QGroupBox * GetMainCheckBoxContainer(); 00089 00091 virtual QGroupBox* GetImageContent(); 00092 00093 /*************** (DE)ACTIVATED ***************/ 00094 00096 virtual void Activated(); 00097 00099 virtual void Deactivated(); 00100 00101 public slots: 00102 /*************** OHTER METHODS ***************/ 00103 00104 virtual void DataStorageChanged(mitk::DataStorage::Pointer ds); 00105 00107 void ImageSelected(const mitk::DataNode* item); 00108 00110 void ShowThreshold(bool show = true); 00111 00113 void ShowThresholdFinderContent(bool show = true); 00114 00116 void ShowImageContent(bool show = true); 00117 00119 void ThresholdSliderChanged(int moved = 0); 00120 00122 void ThresholdValueChanged( ); 00123 00125 void CreateThresholdSegmentation(); 00126 00127 00128 protected: 00129 00133 mitk::DataNode::Pointer CreateSegmentationNode( mitk::Image* image); 00134 00136 void DataObjectSelected(); 00137 00138 /*************** ATTRIBUTES ***************/ 00139 00141 mitk::DataStorage::Pointer m_DataStorage; 00142 00146 mitk::DataNode::Pointer m_ThresholdImageNode; 00147 00148 00149 private: 00150 00152 void CreateThresholdImageNode(); 00153 00155 void SetSliderRange(); 00156 00158 void DeleteThresholdNode(); 00159 00160 // /*! 00161 // \brief template to create thresholdSegmentation 00162 // */ 00163 //template < typename TPixel, unsigned int VImageDimension > 00164 //void ThresholdSegmentation(itk::Image< TPixel, VImageDimension >* itkImage, mitk::Image* segmentation, QmitkThresholdComponent * /*thresholdComponent*/); 00165 00166 template <typename TPixel, unsigned int VImageDimension> 00167 void ITKThresholding( itk::Image<TPixel, VImageDimension>* originalImage, mitk::Image* segmentation, unsigned int timeStep ); 00168 00169 /*************** ATTRIBUTES ***************/ 00170 00172 Ui::QmitkThresholdComponentControls * m_ThresholdComponentGUI; 00173 00175 bool m_ThresholdNodeExisting; 00176 00180 mitk::Image::Pointer m_ThresholdSegmentationImage; 00181 00182 /*******GUI ELEMENTS******/ 00183 QGroupBox* m_ThresholdFinder; 00184 QGroupBox* m_ThresholdSelectDataGroupBox; 00185 QGroupBox* m_ImageContent; 00186 QGroupBox* m_ContainerContent; 00187 QGroupBox* m_ShowThresholdGroupBox; 00188 QLineEdit* m_ThresholdInputNumber; 00189 QSlider* m_ThresholdInputSlider; 00190 QGroupBox* m_ThresholdValueContent; 00191 QPushButton* m_CreateSegmentationButton; 00192 QCheckBox* m_DeleateImageIfDeactivatedCheckBox; 00193 QmitkDataStorageComboBox* m_TreeNodeSelector; 00194 00195 typedef unsigned char DefaultSegmentationDataType; 00196 00197 }; 00198 00199 #endif 00200