OpenWalnut  1.5.0dev
WSegmentationAlgoThreshold.cpp
1 //---------------------------------------------------------------------------
2 //
3 // Project: OpenWalnut ( http://www.openwalnut.org )
4 //
5 // Copyright 2009 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS
6 // For more information see http://www.openwalnut.org/copying
7 //
8 // This file is part of OpenWalnut.
9 //
10 // OpenWalnut is free software: you can redistribute it and/or modify
11 // it under the terms of the GNU Lesser General Public License as published by
12 // the Free Software Foundation, either version 3 of the License, or
13 // (at your option) any later version.
14 //
15 // OpenWalnut is distributed in the hope that it will be useful,
16 // but WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 // GNU Lesser General Public License for more details.
19 //
20 // You should have received a copy of the GNU Lesser General Public License
21 // along with OpenWalnut. If not, see <http://www.gnu.org/licenses/>.
22 //
23 //---------------------------------------------------------------------------
24 
25 #include <string>
26 
27 #include "WSegmentationAlgoThreshold.h"
28 
31 {
32 }
33 
35 {
36 }
37 
39 {
40  m_low_threshold = m_properties->addProperty( "Lower Threshold", "Threshold in %.", 0.0, m_propCondition );
41  m_upp_threshold = m_properties->addProperty( "Upper Threshold", "Threshold in %.", 1.0, m_propCondition );
42 
43  m_low_threshold->setMin( 0.0 );
44  m_low_threshold->setMax( 1.0 );
45  m_upp_threshold->setMin( 0.0 );
46  m_upp_threshold->setMax( 1.0 );
47 
48  m_binarize = m_properties->addProperty( "Binarize", "Replace values with 0 and 1. 0 Means outside, 1 inside.", true, m_propCondition );
49 }
50 
52 {
53  return "Threshold segmentation";
54 }
55 
57 {
58  return "Use thresholding for segmentation.";
59 }
60 
62 {
63  return m_low_threshold->changed() || m_upp_threshold->changed() || m_binarize->changed();
64 }
65 
67 {
68  return m_dataSet->getValueSet()->applyFunction( *this );
69 }
WPropDouble m_upp_threshold
The upper threshold in %.
WSegmentationAlgoThreshold()
Standard constructor.
virtual bool propChanged()
Checks if any properties were changed.
virtual void properties()
Initializes the algorithm's properties.
virtual std::string getDescription()
Return a description of this algorithm.
virtual std::string getName()
Return the name of this algorithm.
WPropBool m_binarize
Whether the values inside range of thresholds should be keept, or resulting images should contain onl...
virtual ~WSegmentationAlgoThreshold()
Destructor.
WPropDouble m_low_threshold
The lower threshold in %.
virtual DataSetPtr applyOperation()
A virtual function that calls the correct segmentation operation.
A base class for segmentation alorithms.
std::shared_ptr< WDataSetScalar > DataSetPtr
A conveniant typedef.
std::shared_ptr< WCondition > m_propCondition
The condition indicating changed to the properties.
DataSetPtr m_dataSet
A pointer to the currently processed dataset.
WPropGroup m_properties
The property group of this segmentation algorithm.