| 1 |
|
/*========================================================================= |
| 2 |
|
|
| 3 |
|
Program: Insight Segmentation & Registration Toolkit |
| 4 |
|
Module: $RCSfile: itkKLMSegmentationBorder.cxx.html,v $ |
| 5 |
|
Language: C++ |
| 6 |
|
Date: $Date: 2006/01/17 19:15:40 $ |
| 7 |
|
Version: $Revision: 1.4 $ |
| 8 |
|
|
| 9 |
|
Copyright (c) Insight Software Consortium. All rights reserved. |
| 10 |
|
See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details. |
| 11 |
|
|
| 12 |
|
This software is distributed WITHOUT ANY WARRANTY; without even |
| 13 |
|
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR |
| 14 |
|
PURPOSE. See the above copyright notices for more information. |
| 15 |
|
|
| 16 |
|
=========================================================================*/ |
| 17 |
DEF |
#ifndef _itkKLMSegmentationBorder_cxx |
| 18 |
DEF |
#define _itkKLMSegmentationBorder_cxx |
| 19 |
|
|
| 20 |
|
#include "itkKLMSegmentationBorder.h" |
| 21 |
|
|
| 22 |
|
namespace itk |
| 23 |
|
{ |
| 24 |
|
|
| 25 |
|
|
| 26 |
|
KLMSegmentationBorder |
| 27 |
|
::KLMSegmentationBorder(void) |
| 28 |
|
{ |
| 29 |
|
m_Lambda = 0.0; |
| 30 |
|
m_Region1 = 0; |
| 31 |
|
m_Region2 = 0; |
| 32 |
|
} |
| 33 |
|
|
| 34 |
|
|
| 35 |
|
KLMSegmentationBorder |
| 36 |
|
::~KLMSegmentationBorder() |
| 37 |
|
{ |
| 38 |
|
|
| 39 |
|
} |
| 40 |
|
|
| 41 |
|
/** |
| 42 |
|
* PrintSelf |
| 43 |
|
*/ |
| 44 |
|
void |
| 45 |
|
KLMSegmentationBorder |
| 46 |
|
::PrintSelf(std::ostream& os, Indent indent) const |
| 47 |
|
{ |
| 48 |
|
Superclass::PrintSelf(os,indent); |
| 49 |
|
os << indent << "Lambda = " << m_Lambda << std::endl; |
| 50 |
|
os << indent << "Region1 = " << m_Region1 << std::endl; |
| 51 |
|
os << indent << "Region2 = " << m_Region2 << std::endl; |
| 52 |
|
|
| 53 |
|
} // end PrintSelf |
| 54 |
|
|
| 55 |
|
|
| 56 |
|
void |
| 57 |
|
KLMSegmentationBorder |
| 58 |
|
::SetRegion1(KLMSegmentationRegion *Region1) |
| 59 |
|
{ |
| 60 |
|
|
| 61 |
|
m_Region1 = Region1; |
| 62 |
|
|
| 63 |
|
} // end SetRegion1 |
| 64 |
|
|
| 65 |
|
|
| 66 |
|
KLMSegmentationRegion * |
| 67 |
|
KLMSegmentationBorder |
| 68 |
|
::GetRegion1() |
| 69 |
|
{ |
| 70 |
|
|
| 71 |
|
return m_Region1; |
| 72 |
|
|
| 73 |
|
} // end GetRegion2 |
| 74 |
|
|
| 75 |
|
|
| 76 |
|
void |
| 77 |
|
KLMSegmentationBorder |
| 78 |
|
::SetRegion2(KLMSegmentationRegion *Region2) |
| 79 |
|
{ |
| 80 |
|
|
| 81 |
|
m_Region2 = Region2; |
| 82 |
|
|
| 83 |
|
} // end SetRegion2 |
| 84 |
|
|
| 85 |
|
|
| 86 |
|
KLMSegmentationRegion * |
| 87 |
|
KLMSegmentationBorder |
| 88 |
|
::GetRegion2() |
| 89 |
|
{ |
| 90 |
|
|
| 91 |
|
return m_Region2; |
| 92 |
|
|
| 93 |
|
} // end GetRegion2 |
| 94 |
|
|
| 95 |
|
|
| 96 |
|
void |
| 97 |
|
KLMSegmentationBorder |
| 98 |
|
::EvaluateLambda() |
| 99 |
|
{ |
| 100 |
|
|
| 101 |
|
m_Lambda = m_Region1->EnergyFunctional( m_Region2 ) / this->GetBorderLength(); |
| 102 |
|
|
| 103 |
|
} // end EvaluateLambda() |
| 104 |
|
|
| 105 |
|
|
| 106 |
|
void |
| 107 |
|
KLMSegmentationBorder |
| 108 |
|
::PrintBorderInfo() |
| 109 |
|
{ |
| 110 |
|
itkDebugMacro(<< "------------------------------"); |
| 111 |
|
itkDebugMacro(<< "Location : " << this); |
| 112 |
|
itkDebugMacro(<< "Lambda : " << m_Lambda); |
| 113 |
|
itkDebugMacro(<< "Region1 : " << this->GetRegion1()); |
| 114 |
LEN |
itkDebugMacro(<< "Region 1 Label: " << (this->GetRegion1()->GetRegionLabel())); |
| 115 |
|
itkDebugMacro(<< "Region2 : " << this->GetRegion2()); |
| 116 |
LEN |
itkDebugMacro(<< "Region 2 Label: " << (this->GetRegion2()->GetRegionLabel())); |
| 117 |
|
itkDebugMacro(<< "++++++++++++++++++++++++++++++" ); |
| 118 |
|
itkDebugMacro(<< "------------------------------" ); |
| 119 |
|
itkDebugMacro(<< "------------------------------" ); |
| 120 |
|
|
| 121 |
|
std::cout << "Location : " << this << std::endl; |
| 122 |
|
std::cout << "Lambda : " << m_Lambda << std::endl; |
| 123 |
|
} // end PrintBorderResults |
| 124 |
|
|
| 125 |
|
|
| 126 |
|
} // namespace itk |
| 127 |
|
|
| 128 |
|
|
| 129 |
|
#endif |
| 130 |
|
|