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