OpenWalnut  1.5.0dev
WSegmentationAlgoWatershed.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 "WSegmentationAlgoWatershed.h"
28 
29 #ifdef OW_USE_ITK
30 
31 WSegmentationAlgoWatershed::WSegmentationAlgoWatershed()
33 {
34 }
35 
36 WSegmentationAlgoWatershed::~WSegmentationAlgoWatershed()
37 {
38 }
39 
40 void WSegmentationAlgoWatershed::properties()
41 {
42  m_threshold = m_properties->addProperty( "Threshold", "Threshold in %.", 0.0, m_propCondition );
43  m_level = m_properties->addProperty( "Level", "Water level in %.", 0.0, m_propCondition );
44  m_iter = m_properties->addProperty( "Iterations", "Number of smoothing passes:", 10, m_propCondition );
45  m_conductance = m_properties->addProperty( "Conductance", "Conductance parameter for smoothing.", 1.0, m_propCondition );
46  m_conductance->setMax( 10.0 );
47 }
48 
49 std::string WSegmentationAlgoWatershed::getName()
50 {
51  return "Watershed segmentation";
52 }
53 
54 std::string WSegmentationAlgoWatershed::getDescription()
55 {
56  return "Use watersheds for segmentation.";
57 }
58 
59 bool WSegmentationAlgoWatershed::propChanged()
60 {
61  return m_threshold->changed() || m_level->changed() || m_iter->changed() || m_conductance->changed();
62 }
63 
64 WSegmentationAlgo::DataSetPtr WSegmentationAlgoWatershed::applyOperation()
65 {
66  return m_dataSet->getValueSet()->applyFunction( *this );
67 }
68 
69 #endif // OW_USE_ITK
A base class for segmentation alorithms.
std::shared_ptr< WDataSetScalar > DataSetPtr
A conveniant typedef.