<!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: itkNeuralNetworkFileWriter.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_dd352b1cbb04f9ff09fa5f33693fed9f.html">Review</a> </div> <div class="contents"> <h1>itkNeuralNetworkFileWriter.h</h1><a href="itkNeuralNetworkFileWriter_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: itkNeuralNetworkFileWriter.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-02-07 15:58:06 $</span> <a name="l00007"></a>00007 <span class="comment">Version: $Revision: 1.14 $</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 <a name="l00018"></a>00018 <span class="preprocessor">#ifndef __itkNeuralNetworkFileWriter_h</span> <a name="l00019"></a>00019 <span class="preprocessor"></span><span class="preprocessor">#define __itkNeuralNetworkFileWriter_h</span> <a name="l00020"></a>00020 <span class="preprocessor"></span> <a name="l00021"></a>00021 <span class="preprocessor">#include <metaTypes.h></span> <a name="l00022"></a>00022 <span class="preprocessor">#include <metaUtils.h></span> <a name="l00023"></a>00023 <span class="preprocessor">#include <typeinfo></span> <a name="l00024"></a>00024 <a name="l00025"></a>00025 <span class="preprocessor">#include "<a class="code" href="itkMultilayerNeuralNetworkBase_8h.html">itkMultilayerNeuralNetworkBase.h</a>"</span> <a name="l00026"></a>00026 <span class="preprocessor">#include "<a class="code" href="itkOneHiddenLayerBackPropagationNeuralNetwork_8h.html">itkOneHiddenLayerBackPropagationNeuralNetwork.h</a>"</span> <a name="l00027"></a>00027 <span class="preprocessor">#include "<a class="code" href="itkTwoHiddenLayerBackPropagationNeuralNetwork_8h.html">itkTwoHiddenLayerBackPropagationNeuralNetwork.h</a>"</span> <a name="l00028"></a>00028 <a name="l00029"></a>00029 <span class="preprocessor">#include "<a class="code" href="itkBackPropagationLayer_8h.html">itkBackPropagationLayer.h</a>"</span> <a name="l00030"></a>00030 <span class="preprocessor">#include "<a class="code" href="itkCompletelyConnectedWeightSet_8h.html">itkCompletelyConnectedWeightSet.h</a>"</span> <a name="l00031"></a>00031 <a name="l00032"></a>00032 <span class="preprocessor">#include "<a class="code" href="itkSumInputFunction_8h.html">itkSumInputFunction.h</a>"</span> <a name="l00033"></a>00033 <span class="preprocessor">#include "<a class="code" href="itkProductInputFunction_8h.html">itkProductInputFunction.h</a>"</span> <a name="l00034"></a>00034 <a name="l00035"></a>00035 <span class="preprocessor">#include "<a class="code" href="itkIdentityTransferFunction_8h.html">itkIdentityTransferFunction.h</a>"</span> <a name="l00036"></a>00036 <span class="preprocessor">#include "<a class="code" href="itkLogSigmoidTransferFunction_8h.html">itkLogSigmoidTransferFunction.h</a>"</span> <a name="l00037"></a>00037 <span class="preprocessor">#include "<a class="code" href="itkSigmoidTransferFunction_8h.html">itkSigmoidTransferFunction.h</a>"</span> <a name="l00038"></a>00038 <span class="preprocessor">#include "<a class="code" href="itkTanSigmoidTransferFunction_8h.html">itkTanSigmoidTransferFunction.h</a>"</span> <a name="l00039"></a>00039 <span class="preprocessor">#include "<a class="code" href="itkSymmetricSigmoidTransferFunction_8h.html">itkSymmetricSigmoidTransferFunction.h</a>"</span> <a name="l00040"></a>00040 <a name="l00041"></a>00041 <a name="l00042"></a>00042 <span class="keyword">namespace </span>itk <a name="l00043"></a>00043 { <a name="l00065"></a>00065 <span class="keyword">template</span><<span class="keyword">class</span> TNetwork> <a name="l00066"></a><a class="code" href="classitk_1_1NeuralNetworkFileWriter.html">00066</a> <span class="keyword">class </span><a class="code" href="classitk_1_1NeuralNetworkFileWriter.html" title="Writer for Neural Network.">NeuralNetworkFileWriter</a> : <span class="keyword">public</span> <a class="code" href="classitk_1_1Object.html" title="Base class for most itk classes.">Object</a> <a name="l00067"></a>00067 { <a name="l00068"></a>00068 <span class="keyword">public</span>: <a name="l00069"></a>00069 <a name="l00071"></a><a class="code" href="classitk_1_1NeuralNetworkFileWriter.html#caaceb2066a56600efff5ef1af399f10">00071</a> <span class="keyword">typedef</span> <a class="code" href="classitk_1_1NeuralNetworkFileWriter.html" title="Writer for Neural Network.">NeuralNetworkFileWriter</a> <a class="code" href="classitk_1_1LightObject.html" title="Light weight base class for most itk classes.">Self</a>; <a name="l00072"></a><a class="code" href="classitk_1_1NeuralNetworkFileWriter.html#6f018daa01c16bda0b72f8f84e9a11ca">00072</a> <span class="keyword">typedef</span> <a class="code" href="classitk_1_1Object.html" title="Base class for most itk classes.">Object</a> <a class="code" href="classitk_1_1LightObject.html" title="Light weight base class for most itk classes.">Superclass</a>; <a name="l00073"></a><a class="code" href="classitk_1_1NeuralNetworkFileWriter.html#1bdb6c32fc1e9a57570865b104ecbe62">00073</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="l00074"></a><a class="code" href="classitk_1_1NeuralNetworkFileWriter.html#2a88883a21d830b333dadd1b958349dd">00074</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="l00075"></a>00075 <a name="l00077"></a>00077 <a class="code" href="itkMacro_8h.html#574c1f86661d409dd32c742307a0e96a">itkTypeMacro</a>(<a class="code" href="classitk_1_1NeuralNetworkFileWriter.html" title="Writer for Neural Network.">NeuralNetworkFileWriter</a>,<a class="code" href="classitk_1_1Object.html" title="Base class for most itk classes.">Object</a>); <a name="l00078"></a>00078 <a name="l00080"></a><a class="code" href="classitk_1_1NeuralNetworkFileWriter.html#62584d8fdfd6775e8044201bd94b0c09">00080</a> <a class="code" href="itkMacro_8h.html#0fdc15685afa271857c57e7cd482f30c">itkNewMacro</a>(<a class="code" href="classitk_1_1LightObject.html" title="Light weight base class for most itk classes.">Self</a>); <a name="l00081"></a>00081 <a name="l00082"></a>00082 <span class="keyword">typedef</span> <span class="keyword">typename</span> TNetwork::MeasurementVectorType <a class="code" href="classitk_1_1NeuralNetworkFileWriter.html#62584d8fdfd6775e8044201bd94b0c09">MeasurementVectorType</a>; <a name="l00083"></a><a class="code" href="classitk_1_1NeuralNetworkFileWriter.html#ace15bac107734c04dfa9cd591d541a8">00083</a> <span class="keyword">typedef</span> <span class="keyword">typename</span> TNetwork::TargetVectorType <a class="code" href="classitk_1_1NeuralNetworkFileWriter.html#ace15bac107734c04dfa9cd591d541a8">TargetVectorType</a>; <a name="l00084"></a>00084 <a name="l00085"></a>00085 <span class="keyword">typedef</span> <a class="code" href="classitk_1_1Statistics_1_1LayerBase.html">Statistics::LayerBase</a>< <a name="l00086"></a><a class="code" href="classitk_1_1NeuralNetworkFileWriter.html#e08874c207f54726d5832f84bcf8a282">00086</a> <a class="code" href="classitk_1_1NeuralNetworkFileWriter.html#62584d8fdfd6775e8044201bd94b0c09">MeasurementVectorType</a>, <a class="code" href="classitk_1_1NeuralNetworkFileWriter.html#ace15bac107734c04dfa9cd591d541a8">TargetVectorType</a> > <a class="code" href="classitk_1_1Statistics_1_1LayerBase.html">LayerBaseType</a>; <a name="l00087"></a><a class="code" href="classitk_1_1NeuralNetworkFileWriter.html#0e1843867a2cfbd88a65de016b692723">00087</a> <span class="keyword">typedef</span> <span class="keyword">typename</span> <a class="code" href="classitk_1_1SmartPointer.html">LayerBaseType::Pointer</a> <a class="code" href="classitk_1_1SmartPointer.html">LayerBasePointer</a>; <a name="l00088"></a><a class="code" href="classitk_1_1NeuralNetworkFileWriter.html#e4fc9c0e0cd3fbc3d94fa184fea46042">00088</a> <span class="keyword">typedef</span> <span class="keyword">typename</span> <a class="code" href="classitk_1_1SmartPointer.html">LayerBaseType::ConstPointer</a> <a class="code" href="classitk_1_1SmartPointer.html">LayerBaseConstPointer</a>; <a name="l00089"></a>00089 <a name="l00090"></a>00090 <span class="comment">// typedef typename TNetwork::Pointer NetworkPointer;</span> <a name="l00091"></a>00091 <span class="comment">// typedef typename TNetwork::ConstPointer NetworkConstPointer;</span> <a name="l00092"></a>00092 <a name="l00093"></a>00093 <span class="comment">// typedef typename TNetwork::LayerType LayerType;</span> <a name="l00094"></a>00094 <span class="comment">// typedef typename LayerType::Pointer LayerPointer;</span> <a name="l00095"></a>00095 <span class="comment">// typedef typename LayerType::ConstPointer LayerConstPointer;</span> <a name="l00096"></a>00096 <span class="comment">// typedef typename LayerType::TransferFunctionType::Pointer TransferFunctionPointer;</span> <a name="l00097"></a>00097 <span class="comment">// typedef typename LayerType::TransferFunctionType::ConstPointer TransferFunctionConstPointer;</span> <a name="l00098"></a>00098 <a name="l00099"></a>00099 <span class="comment">// typedef typename LayerType::InputFunctionType::Pointer InputFunctionPointer;</span> <a name="l00100"></a>00100 <span class="comment">// typedef typename LayerType::InputFunctionType::ConstPointer InputFunctionConstPointer;</span> <a name="l00101"></a>00101 <a name="l00102"></a>00102 <span class="comment">// typedef typename LayerType::WeightSetType WeightSetType;</span> <a name="l00103"></a>00103 <span class="comment">// typedef typename LayerType::WeightSetPointer WeightSetPointer;</span> <a name="l00104"></a>00104 <span class="comment">// typedef typename LayerType::WeightSetConstPointer WeightSetConstPointer;</span> <a name="l00105"></a>00105 <span class="comment">// typedef typename LayerType::ValueType ValueType;</span> <a name="l00106"></a>00106 <a name="l00108"></a>00108 <a class="code" href="itkMacro_8h.html#3b9c68842cd296d3ef6d1ed0f5a742a4">itkSetStringMacro</a>(FileName); <a name="l00109"></a>00109 <a name="l00111"></a>00111 <a class="code" href="itkMacro_8h.html#bea8d1eeb8af8f01bfec0169f63f6871">itkGetStringMacro</a>(FileName); <a name="l00112"></a>00112 <a name="l00114"></a>00114 <span class="comment">//Avoiding VS6 compiler error void SetInput( const TNetwork* network );</span> <a name="l00115"></a>00115 <span class="keywordtype">void</span> <a class="code" href="classitk_1_1NeuralNetworkFileWriter.html#40f803e15849b7374fea8a00915ede36">SetInput</a>( TNetwork* network ); <a name="l00116"></a>00116 <span class="keyword">const</span> TNetwork * <a class="code" href="classitk_1_1NeuralNetworkFileWriter.html#a876a817ad8d58ba8a9e97584beab6bb">GetInput</a>() <span class="keyword">const</span>; <a name="l00118"></a>00118 <a name="l00120"></a>00120 <span class="keywordtype">void</span> <a class="code" href="classitk_1_1NeuralNetworkFileWriter.html#deb25838edc55448d98a8ef144cb432d">Update</a>(<span class="keywordtype">void</span>); <a name="l00121"></a>00121 <a name="l00122"></a>00122 <span class="preprocessor">#ifdef IGNORE</span> <a name="l00123"></a>00123 <span class="preprocessor"></span><span class="preprocessor">#undef IGNORE</span> <a name="l00124"></a>00124 <span class="preprocessor"></span><span class="preprocessor">#endif</span> <a name="l00125"></a>00125 <span class="preprocessor"></span> <span class="comment">//ASCII only works for very small networks (i.e. less than 256 weights),</span> <a name="l00126"></a>00126 <span class="comment">//and the MetaIO mechanism is not desigend for the way that this is used</span> <a name="l00127"></a>00127 <span class="comment">//to write these files out.</span> <a name="l00128"></a>00128 <span class="comment">// Comment this code out until it can be robustly written.</span> <a name="l00129"></a><a class="code" href="classitk_1_1NeuralNetworkFileWriter.html#72198a5666aafb2960f8d077910fd38d">00129</a> <span class="keyword">typedef</span> <span class="keyword">enum</span> { <a class="code" href="classitk_1_1NeuralNetworkFileWriter.html#72198a5666aafb2960f8d077910fd38d9e6f320ca833d4d32895aae889043af3">IGNORE</a>=0, <a class="code" href="classitk_1_1NeuralNetworkFileWriter.html#72198a5666aafb2960f8d077910fd38d6f044005bb2070c57a980c5c96314235">ASCII</a>=1, <a class="code" href="classitk_1_1NeuralNetworkFileWriter.html#72198a5666aafb2960f8d077910fd38d200ee8629dcb8c03722c366b7d96b0ed">BINARY</a>=2 } <a class="code" href="classitk_1_1NeuralNetworkFileWriter.html#72198a5666aafb2960f8d077910fd38d">NetworkWriteWeightsType</a>; <a name="l00130"></a>00130 <a class="code" href="classitk_1_1NeuralNetworkFileWriter.html#6d2cf2d5ea8fa08ed900ec2f17383965">itkSetEnumMacro</a>(WriteWeightValuesType, <a class="code" href="classitk_1_1NeuralNetworkFileWriter.html#72198a5666aafb2960f8d077910fd38d">NetworkWriteWeightsType</a>); <a name="l00131"></a>00131 <a class="code" href="classitk_1_1NeuralNetworkFileWriter.html#0443d531f778bb89477b04e9089a67fb">itkGetEnumMacro</a>(WriteWeightValuesType, <a class="code" href="classitk_1_1NeuralNetworkFileWriter.html#72198a5666aafb2960f8d077910fd38d">NetworkWriteWeightsType</a>); <a name="l00132"></a>00132 <a name="l00133"></a>00133 <span class="keyword">protected</span>: <a name="l00134"></a>00134 <a class="code" href="classitk_1_1NeuralNetworkFileWriter.html#60975742898af7311f8769006d67e891">NeuralNetworkFileWriter</a>(); <a name="l00135"></a>00135 <a class="code" href="classitk_1_1NeuralNetworkFileWriter.html#893a0e89a0aef81eb99ef363d81fb176">~NeuralNetworkFileWriter</a>(); <a name="l00136"></a>00136 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classitk_1_1NeuralNetworkFileWriter.html#d447e022917d9de7eb0146d80b4d858f">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="l00137"></a>00137 <a name="l00138"></a>00138 <span class="keyword">private</span>: <a name="l00139"></a>00139 <span class="keywordtype">void</span> ClearFields(); <a name="l00140"></a>00140 <span class="keyword">typedef</span> std::vector<MET_FieldRecordType *> FieldsContainerType; <a name="l00141"></a>00141 <a name="l00142"></a>00142 <span class="comment">//Attempting to avoid VS 6 compiler error typename TNetwork::ConstPointer m_Network;</span> <a name="l00143"></a>00143 <span class="keyword">typename</span> <a class="code" href="itkFEMMacro_8h.html#539cce1a3282ba59952dedcbf9cdb23f">TNetwork::Pointer</a> m_Network; <a name="l00144"></a>00144 <a class="code" href="classitk_1_1NeuralNetworkFileWriter.html#72198a5666aafb2960f8d077910fd38d">NetworkWriteWeightsType</a> m_WriteWeightValuesType; <a name="l00145"></a>00145 <a name="l00146"></a>00146 std::string m_FileName; <a name="l00147"></a>00147 FieldsContainerType m_Fields; <a name="l00148"></a>00148 <a name="l00149"></a>00149 std::ofstream m_OutputFile; <a name="l00150"></a>00150 }; <a name="l00151"></a>00151 <a name="l00152"></a>00152 } <span class="comment">// namespace itk</span> <a name="l00153"></a>00153 <a name="l00154"></a>00154 <span class="preprocessor">#ifndef ITK_MANUAL_INSTANTIATION</span> <a name="l00155"></a>00155 <span class="preprocessor"></span><span class="preprocessor">#include "itkNeuralNetworkFileWriter.txx"</span> <a name="l00156"></a>00156 <span class="preprocessor">#endif</span> <a name="l00157"></a>00157 <span class="preprocessor"></span> <a name="l00158"></a>00158 <span class="preprocessor">#endif</span> <a name="l00159"></a>00159 <span class="preprocessor"></span> </pre></div></div> <hr><address><small> Generated at Thu May 7 23:41:20 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>