<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html><head><meta name="robots" content="noindex"> <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"> <title>ITK: itkChainCodePath2D.h Source File</title> <link href="DoxygenStyle.css" rel="stylesheet" type="text/css"> </head><body bgcolor="#ffffff"> <!-- Section customized for INSIGHT : Tue Jul 17 01:02:45 2001 --> <center> <a href="index.html" class="qindex">Main Page</a> <a href="modules.html" class="qindex">Groups</a> <a href="namespaces.html" class="qindex">Namespace List</a> <a href="hierarchy.html" class="qindex">Class Hierarchy</a> <a href="classes.html" class="qindex">Alphabetical List</a> <a href="annotated.html" class="qindex">Compound List</a> <a href="files.html" class="qindex">File List</a> <a href="namespacemembers.html" class="qindex">Namespace Members</a> <a href="functions.html" class="qindex">Compound Members</a> <a href="globals.html" class="qindex">File Members</a> <a href="pages.html" class="qindex">Concepts</a></center> <!-- Generated by Doxygen 1.5.9 --> <div class="navpath"><a class="el" href="dir_02e23d841c198393a6e961e9a0678fff.html">Code</a> » <a class="el" href="dir_ea7fc529ede9a38b0438cf13831ae873.html">Common</a> </div> <div class="contents"> <h1>itkChainCodePath2D.h</h1><a href="itkChainCodePath2D_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*=========================================================================</span> <a name="l00002"></a>00002 <span class="comment"></span> <a name="l00003"></a>00003 <span class="comment"> Program: Insight Segmentation & Registration Toolkit</span> <a name="l00004"></a>00004 <span class="comment"> Module: $RCSfile: itkChainCodePath2D.h,v $</span> <a name="l00005"></a>00005 <span class="comment"> Language: C++</span> <a name="l00006"></a>00006 <span class="comment"> Date: $Date: 2008-10-07 12:05:28 $</span> <a name="l00007"></a>00007 <span class="comment"> Version: $Revision: 1.10 $</span> <a name="l00008"></a>00008 <span class="comment"></span> <a name="l00009"></a>00009 <span class="comment"> Copyright (c) Insight Software Consortium. All rights reserved.</span> <a name="l00010"></a>00010 <span class="comment"> See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.</span> <a name="l00011"></a>00011 <span class="comment"></span> <a name="l00012"></a>00012 <span class="comment"> This software is distributed WITHOUT ANY WARRANTY; without even </span> <a name="l00013"></a>00013 <span class="comment"> the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR </span> <a name="l00014"></a>00014 <span class="comment"> PURPOSE. See the above copyright notices for more information.</span> <a name="l00015"></a>00015 <span class="comment"></span> <a name="l00016"></a>00016 <span class="comment">=========================================================================*/</span> <a name="l00017"></a>00017 <span class="preprocessor">#ifndef __itkChainCodePath2D_h</span> <a name="l00018"></a>00018 <span class="preprocessor"></span><span class="preprocessor">#define __itkChainCodePath2D_h</span> <a name="l00019"></a>00019 <span class="preprocessor"></span> <a name="l00020"></a>00020 <span class="preprocessor">#include "<a class="code" href="itkChainCodePath_8h.html">itkChainCodePath.h</a>"</span> <a name="l00021"></a>00021 <span class="preprocessor">#include "<a class="code" href="itkObjectFactory_8h.html">itkObjectFactory.h</a>"</span> <a name="l00022"></a>00022 <span class="preprocessor">#include "<a class="code" href="itkIndex_8h.html">itkIndex.h</a>"</span> <a name="l00023"></a>00023 <span class="preprocessor">#include "<a class="code" href="itkOffset_8h.html">itkOffset.h</a>"</span> <a name="l00024"></a>00024 <a name="l00025"></a>00025 <span class="preprocessor">#include <vector></span> <a name="l00026"></a>00026 <span class="preprocessor">#include <string></span> <a name="l00027"></a>00027 <a name="l00028"></a>00028 <a name="l00029"></a>00029 <span class="keyword">namespace </span>itk <a name="l00030"></a>00030 { <a name="l00031"></a>00031 <a name="l00032"></a>00032 <a name="l00053"></a><a class="code" href="classitk_1_1ChainCodePath2D.html">00053</a> <span class="keyword">class </span><a class="code" href="itkWin32Header_8h.html#faefe352c9fb4179f5a770afc70ea90f">ITKCommon_EXPORT</a> <a class="code" href="classitk_1_1ChainCodePath2D.html" title="Represent a 2D path as a sequence of connected image index offsets.">ChainCodePath2D</a> : <span class="keyword">public</span> <a name="l00054"></a>00054 <a class="code" href="classitk_1_1ChainCodePath.html" title="Represent a path as a sequence of connected image index offsets.">ChainCodePath</a><2> <a name="l00055"></a>00055 { <a name="l00056"></a>00056 <span class="keyword">public</span>: <a name="l00058"></a>00058 <a class="code" href="itkMacro_8h.html#1905cf6b2e88235996fa7ff73b2fb0eb">itkStaticConstMacro</a>(Dimension, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span>, 2); <a name="l00059"></a>00059 <a name="l00061"></a><a class="code" href="classitk_1_1ChainCodePath2D.html#726465d6c3bae0fad7d4da48bee7fe34">00061</a> <span class="keyword">typedef</span> <a class="code" href="classitk_1_1ChainCodePath2D.html" title="Represent a 2D path as a sequence of connected image index offsets.">ChainCodePath2D</a> <a class="code" href="classitk_1_1ChainCodePath2D.html" title="Represent a 2D path as a sequence of connected image index offsets.">Self</a>; <a name="l00062"></a><a class="code" href="classitk_1_1ChainCodePath2D.html#cd9b0eb6acd0f046aafb768de092a957">00062</a> <span class="keyword">typedef</span> <a class="code" href="classitk_1_1ChainCodePath.html">ChainCodePath<2></a> <a class="code" href="classitk_1_1ChainCodePath.html">Superclass</a>; <a name="l00063"></a>00063 <a name="l00064"></a><a class="code" href="classitk_1_1ChainCodePath2D.html#4cca324a64b39cbc4a086f0afd44a1bd">00064</a> <span class="keyword">typedef</span> <a class="code" href="classitk_1_1SmartPointer.html">SmartPointer<Self></a> <a class="code" href="classitk_1_1SmartPointer.html">Pointer</a>; <a name="l00065"></a><a class="code" href="classitk_1_1ChainCodePath2D.html#59075e61c4562084cfb6f9d4f6104282">00065</a> <span class="keyword">typedef</span> <a class="code" href="classitk_1_1SmartPointer.html">SmartPointer<const Self></a> <a class="code" href="classitk_1_1SmartPointer.html">ConstPointer</a>; <a name="l00066"></a>00066 <a name="l00068"></a><a class="code" href="classitk_1_1ChainCodePath2D.html#4b1e6ff089d5847edbccae1ede13798c">00068</a> <a class="code" href="itkMacro_8h.html#574c1f86661d409dd32c742307a0e96a">itkTypeMacro</a>(<a class="code" href="classitk_1_1ChainCodePath2D.html" title="Represent a 2D path as a sequence of connected image index offsets.">ChainCodePath2D</a>, <a class="code" href="classitk_1_1ChainCodePath.html" title="Represent a path as a sequence of connected image index offsets.">ChainCodePath</a>); <a name="l00069"></a>00069 <a name="l00071"></a>00071 <span class="keyword">typedef</span> Superclass::OutputType OutputType; <a name="l00072"></a><a class="code" href="classitk_1_1ChainCodePath2D.html#4d30934a6ecfab595c9dc8448f05b159">00072</a> <span class="keyword">typedef</span> Superclass::InputType InputType; <a name="l00073"></a>00073 <a name="l00075"></a><a class="code" href="classitk_1_1ChainCodePath2D.html#ee2219042537a2b0fc9665df7dd7d35b">00075</a> <span class="keyword">typedef</span> OutputType OffsetType; <a name="l00076"></a><a class="code" href="classitk_1_1ChainCodePath2D.html#8a58179fc6efd4b2e221585b76110aad">00076</a> <span class="keyword">typedef</span> <a class="code" href="classitk_1_1Index.html" title="Represent a n-dimensional index in a n-dimensional image.">Index<2></a> <a class="code" href="classitk_1_1Index.html" title="Represent a n-dimensional index in a n-dimensional image.">IndexType</a>; <a name="l00077"></a>00077 <a name="l00079"></a><a class="code" href="classitk_1_1ChainCodePath2D.html#d4d3f13dd7610e156b747377bb8d8c51">00079</a> <span class="keyword">typedef</span> Superclass::ChainCodeType ChainCodeType; <a name="l00080"></a><a class="code" href="classitk_1_1ChainCodePath2D.html#9bcad642c55dd71e1d97d872180995b3">00080</a> <span class="keyword">typedef</span> Superclass::ChainCodeSizeType ChainCodeSizeType; <a name="l00081"></a>00081 <a name="l00083"></a><a class="code" href="classitk_1_1ChainCodePath2D.html#11661e0fe4c00399717c1cd0522d217a">00083</a> <span class="keyword">typedef</span> std::vector<int> ChainCode2DType; <a name="l00084"></a>00084 <a name="l00085"></a>00085 <span class="comment">// Functions inherited from Path</span> <a name="l00086"></a>00086 <a name="l00088"></a>00088 <span class="keyword">virtual</span> OutputType Evaluate( <span class="keyword">const</span> InputType & input ) <span class="keyword">const</span>; <a name="l00089"></a>00089 <a name="l00091"></a>00091 <span class="keyword">virtual</span> <a class="code" href="classitk_1_1Index.html" title="Represent a n-dimensional index in a n-dimensional image.">IndexType</a> EvaluateToIndex( <span class="keyword">const</span> InputType & input ) <span class="keyword">const</span>; <a name="l00092"></a>00092 <a name="l00097"></a>00097 <span class="keyword">virtual</span> OffsetType IncrementInput(InputType & input) <span class="keyword">const</span>; <a name="l00098"></a>00098 <a name="l00099"></a>00099 <span class="comment">// Functions specific to ChainCodePath and its descendents</span> <a name="l00100"></a>00100 <a name="l00102"></a>00102 <a class="code" href="itkMacro_8h.html#0fdc15685afa271857c57e7cd482f30c">itkNewMacro</a>( <a class="code" href="classitk_1_1ChainCodePath2D.html" title="Represent a 2D path as a sequence of connected image index offsets.">Self</a> ); <a name="l00103"></a>00103 <a name="l00105"></a><a class="code" href="classitk_1_1ChainCodePath2D.html#0b2d72713dbd4bf3159a108bddfeb4f2">00105</a> <span class="keyword">inline</span> ChainCodeSizeType <a class="code" href="classitk_1_1ChainCodePath2D.html#0b2d72713dbd4bf3159a108bddfeb4f2">NumberOfSteps</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_Chain2D.size(); } <a name="l00106"></a>00106 <a name="l00107"></a>00107 <a name="l00109"></a><a class="code" href="classitk_1_1ChainCodePath2D.html#8b4e1b4c661151399128c5eed098b7f2">00109</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> InsertStep( InputType position, <span class="keywordtype">int</span> encodedStep ) <a name="l00110"></a>00110 { <a name="l00111"></a>00111 m_Chain2D.insert( m_Chain2D.begin()+position, encodedStep ); <a name="l00112"></a>00112 this->Modified(); <a name="l00113"></a>00113 } <a name="l00114"></a><a class="code" href="classitk_1_1ChainCodePath2D.html#e663bc50fbf4dc53f0a3f7f13059592e">00114</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> InsertStep( InputType position, OffsetType step ) <a name="l00115"></a>00115 { <a name="l00116"></a>00116 m_Chain2D.insert( m_Chain2D.begin()+position, EncodeOffset(step) ); <a name="l00117"></a>00117 this->Modified(); <a name="l00118"></a>00118 } <a name="l00120"></a>00120 <a name="l00122"></a><a class="code" href="classitk_1_1ChainCodePath2D.html#50a3890c7dcf45a9f6b664ad8a43ef0a">00122</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> ChangeStep( InputType position, <span class="keywordtype">int</span> encodedStep ) <a name="l00123"></a>00123 { <a name="l00124"></a>00124 m_Chain2D[position]=encodedStep; <a name="l00125"></a>00125 this->Modified(); <a name="l00126"></a>00126 } <a name="l00127"></a><a class="code" href="classitk_1_1ChainCodePath2D.html#386c4bc1c5786ef247617ff266f64c53">00127</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> ChangeStep( InputType position, OffsetType step ) <a name="l00128"></a>00128 { <a name="l00129"></a>00129 m_Chain2D[position]=EncodeOffset(step); <a name="l00130"></a>00130 this->Modified(); <a name="l00131"></a>00131 } <a name="l00133"></a>00133 <a name="l00135"></a><a class="code" href="classitk_1_1ChainCodePath2D.html#3a0ff1e58fb4a61f2e1be0d2e280baa5">00135</a> <span class="keyword">virtual</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> Clear() <a name="l00136"></a>00136 { <a name="l00137"></a>00137 m_Chain2D.clear(); <a name="l00138"></a>00138 this->Modified(); <a name="l00139"></a>00139 } <a name="l00141"></a>00141 <a name="l00142"></a>00142 std::string GetChainCodeAsString(<span class="keywordtype">void</span>) <span class="keyword">const</span>; <a name="l00143"></a>00143 <a name="l00144"></a>00144 <span class="keyword">protected</span>: <a name="l00145"></a>00145 <a class="code" href="classitk_1_1ChainCodePath2D.html" title="Represent a 2D path as a sequence of connected image index offsets.">ChainCodePath2D</a>(); <a name="l00146"></a>00146 ~<a class="code" href="classitk_1_1ChainCodePath2D.html" title="Represent a 2D path as a sequence of connected image index offsets.">ChainCodePath2D</a>(); <a name="l00147"></a>00147 <span class="keywordtype">void</span> <a class="code" href="namespaceHardConnectedComponentImageFilter.html#920ae03048a5ad715d803ca2e92b52de">PrintSelf</a>(std::ostream& os, <a class="code" href="classitk_1_1Indent.html" title="Control indentation during Print() invocation.">Indent</a> indent) <span class="keyword">const</span>; <a name="l00148"></a>00148 <a name="l00150"></a><a class="code" href="classitk_1_1ChainCodePath2D.html#f785ba29182feea870d552f09482a34d">00150</a> <span class="keyword">inline</span> <span class="keywordtype">int</span> EncodeOffset( OffsetType step )<span class="keyword"> const</span> <a name="l00151"></a>00151 <span class="keyword"> </span>{ <a name="l00152"></a>00152 <span class="keywordflow">return</span> m_FreemanCode[ step[0] + 1 ][ step[1] + 1 ]; <a name="l00153"></a>00153 } <a name="l00154"></a><a class="code" href="classitk_1_1ChainCodePath2D.html#68b4f63a8c1bb74b6d761c819f2539ae">00154</a> <span class="keyword">inline</span> OffsetType DecodeOffset( <span class="keywordtype">int</span> encodedStep )<span class="keyword"> const</span> <a name="l00155"></a>00155 <span class="keyword"> </span>{ <a name="l00156"></a>00156 <span class="keywordflow">return</span> m_ReverseFreemanCode[ encodedStep ]; <a name="l00157"></a>00157 } <a name="l00159"></a>00159 <a name="l00160"></a>00160 <a name="l00161"></a>00161 <span class="keyword">private</span>: <a name="l00162"></a>00162 <a class="code" href="classitk_1_1ChainCodePath2D.html" title="Represent a 2D path as a sequence of connected image index offsets.">ChainCodePath2D</a>(<span class="keyword">const</span> <a class="code" href="namespaceHardConnectedComponentImageFilter.html#ac7d0120fe5292cdcdddb6163b8cb150">Self</a>&); <span class="comment">//purposely not implemented</span> <a name="l00163"></a>00163 <span class="keywordtype">void</span> operator=(<span class="keyword">const</span> <a class="code" href="namespaceHardConnectedComponentImageFilter.html#ac7d0120fe5292cdcdddb6163b8cb150">Self</a>&); <span class="comment">//purposely not implemented</span> <a name="l00164"></a>00164 <a name="l00165"></a>00165 ChainCode2DType m_Chain2D; <span class="comment">// the Freeman-encoded chain code</span> <a name="l00166"></a>00166 <a name="l00167"></a>00167 <span class="comment">// FreemanCode[][] implements a lookup table for converting offsets to a</span> <a name="l00168"></a>00168 <span class="comment">// Freeman code. Within each dimension, the only allowable offset values are</span> <a name="l00169"></a>00169 <span class="comment">// { -1, 0, 1 }. The y-axis is assumed to point up. It is initialized in the</span> <a name="l00170"></a>00170 <span class="comment">// constructor. Use it as follows:</span> <a name="l00171"></a>00171 <span class="comment">//</span> <a name="l00172"></a>00172 <span class="comment">// encodedValue = m_FreemanCode[ x offset + 1 ][ y offset + 1 ]</span> <a name="l00173"></a>00173 <span class="comment">//</span> <a name="l00174"></a>00174 <span class="keywordtype">int</span> m_FreemanCode[3][3]; <a name="l00175"></a>00175 <a name="l00176"></a>00176 <span class="comment">// m_ReverseFreemanCode[ encodedValue ] implements a lookup table for the</span> <a name="l00177"></a>00177 <span class="comment">// inverse of m_FreemanCode[][]. It is initialized in the constructor.</span> <a name="l00178"></a>00178 OffsetType m_ReverseFreemanCode[9]; <a name="l00179"></a>00179 }; <a name="l00180"></a>00180 <a name="l00181"></a>00181 } <span class="comment">// end namespace itk</span> <a name="l00182"></a>00182 <a name="l00183"></a>00183 <span class="preprocessor">#endif</span> <a name="l00184"></a>00184 <span class="preprocessor"></span> </pre></div></div> <hr><address><small> Generated at Thu May 7 22:23:43 2009 for ITK by <a href="http://www.stack.nl/~dimitri/doxygen/index.html"> <img src="http://www.stack.nl/~dimitri/doxygen/doxygen.png" alt="doxygen" align="middle" border=0 width=110 height=53> </a> 1.5.9 written by <a href="mailto:dimitri@stack.nl">Dimitri van Heesch</a>, © 1997-2000</small></address> </body> </html>