OpenWalnut  1.5.0dev
WSegmentationAlgoRegionGrowingConfidenceConnected.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 "WSegmentationAlgoRegionGrowingConfidenceConnected.h"
28 
29 #ifdef OW_USE_ITK
30 
31 WSegmentationAlgoRegionGrowingConfidenceConnected::WSegmentationAlgoRegionGrowingConfidenceConnected()
33 {
34 }
35 
36 WSegmentationAlgoRegionGrowingConfidenceConnected::~WSegmentationAlgoRegionGrowingConfidenceConnected()
37 {
38 }
39 
40 void WSegmentationAlgoRegionGrowingConfidenceConnected::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_regionGrowingIterations = m_properties->addProperty( "Iterations", "Number of region growing iterations.", 10, m_propCondition );
46  m_neighborhoodRadius = m_properties->addProperty( "Neighborhood radius", "Initial neighborhood radius.", 2, m_propCondition );
47  m_neighborhoodRadius->setMin( 1 );
48  m_neighborhoodRadius->setMax( 35 );
49  m_multiplier = m_properties->addProperty( "Variance multiplier", "Variance multiplier.", 2.5, m_propCondition );
50  m_multiplier->setMax( 20.0 );
51 }
52 
53 std::string WSegmentationAlgoRegionGrowingConfidenceConnected::getName()
54 {
55  return "Confidence connected region growing";
56 }
57 
58 std::string WSegmentationAlgoRegionGrowingConfidenceConnected::getDescription()
59 {
60  return "Confidence connected region growing";
61 }
62 
63 bool WSegmentationAlgoRegionGrowingConfidenceConnected::propChanged()
64 {
65  return m_smoothingIter->changed() || m_conductance->changed()
66  || m_regionGrowingIterations->changed() || m_neighborhoodRadius->changed()
67  || m_multiplier->changed();
68 }
69 
70 WSegmentationAlgo::DataSetPtr WSegmentationAlgoRegionGrowingConfidenceConnected::applyOperation()
71 {
72  return m_dataSet->getValueSet()->applyFunction( *this );
73 }
74 
75 #endif // OW_USE_ITK
A base class for segmentation alorithms.
std::shared_ptr< WDataSetScalar > DataSetPtr
A conveniant typedef.