00001 /*========================================================================= 00002 00003 Program: Medical Imaging & Interaction Toolkit 00004 Language: C++ 00005 Date: $Date$ 00006 Version: $Revision: 1.0 $ 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 mitkBinaryThresholdTool_h_Included 00019 #define mitkBinaryThresholdTool_h_Included 00020 00021 #include "mitkCommon.h" 00022 #include "MitkExtExports.h" 00023 #include "mitkAutoSegmentationTool.h" 00024 #include "mitkDataNode.h" 00025 00026 #include <itkImage.h> 00027 00028 namespace mitk 00029 { 00030 00040 class MitkExt_EXPORT BinaryThresholdTool : public AutoSegmentationTool 00041 { 00042 public: 00043 00044 Message2<int,int> IntervalBordersChanged; 00045 Message1<int> ThresholdingValueChanged; 00046 00047 mitkClassMacro(BinaryThresholdTool, AutoSegmentationTool); 00048 itkNewMacro(BinaryThresholdTool); 00049 00050 virtual const char** GetXPM() const; 00051 virtual const char* GetName() const; 00052 00053 virtual void Activated(); 00054 virtual void Deactivated(); 00055 00056 virtual void SetThresholdValue(int value); 00057 virtual void AcceptCurrentThresholdValue(const std::string& organName, const Color& color); 00058 virtual void CancelThresholding(); 00059 00060 00061 protected: 00062 00063 BinaryThresholdTool(); // purposely hidden 00064 virtual ~BinaryThresholdTool(); 00065 00066 void SetupPreviewNodeFor( DataNode* nodeForThresholding ); 00067 00068 void CreateNewSegmentationFromThreshold(DataNode* node, const std::string& organType, const Color& color); 00069 00070 void OnRoiDataChanged(); 00071 00072 template <typename TPixel, unsigned int VImageDimension> 00073 void ITKThresholding( itk::Image<TPixel, VImageDimension>* originalImage, mitk::Image* segmentation, unsigned int timeStep ); 00074 00075 DataNode::Pointer m_ThresholdFeedbackNode; 00076 DataNode::Pointer m_OriginalImageNode; 00077 DataNode::Pointer m_NodeForThresholding; 00078 00079 int m_SensibleMinimumThresholdValue; 00080 int m_SensibleMaximumThresholdValue; 00081 int m_CurrentThresholdValue; 00082 00083 }; 00084 00085 } // namespace 00086 00087 #endif 00088