Main Page   Groups   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Concepts

itkNeuralNetworkFileReader.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003 Program:   Insight Segmentation & Registration Toolkit
00004 Module:    $RCSfile: itkNeuralNetworkFileReader.h,v $
00005 Language:  C++
00006 Date:      $Date: 2008-02-07 15:58:06 $
00007 Version:   $Revision: 1.16 $
00008 
00009 Copyright (c) Insight Software Consortium. All rights reserved.
00010 See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
00011 
00012 This software is distributed WITHOUT ANY WARRANTY; without even
00013 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00014 PURPOSE.  See the above copyright notices for more information.
00015 
00016 =========================================================================*/
00017 
00018 #ifndef __itkNeuralNetworkFileReader_h
00019 #define __itkNeuralNetworkFileReader_h
00020 
00021 #include "metaTypes.h"
00022 #include "metaUtils.h"
00023 
00024 #include "itkMultilayerNeuralNetworkBase.h"
00025 
00026 #include "itkBackPropagationLayer.h"
00027 
00028 #include "itkCompletelyConnectedWeightSet.h"
00029 
00030 #include "itkSumInputFunction.h"
00031 #include "itkProductInputFunction.h"
00032 
00033 #include "itkIdentityTransferFunction.h"
00034 #include "itkLogSigmoidTransferFunction.h"
00035 #include "itkSigmoidTransferFunction.h"
00036 #include "itkTanSigmoidTransferFunction.h"
00037 #include "itkSymmetricSigmoidTransferFunction.h"
00038 
00039 
00040 namespace itk
00041 {
00042 
00062 template<class TNetwork>
00063 class NeuralNetworkFileReader : public Object
00064 {
00065 public:
00066 
00068   typedef NeuralNetworkFileReader                       Self;
00069   typedef Object                                        Superclass;
00070   typedef SmartPointer<Self>                            Pointer;
00071   typedef SmartPointer<const Self>                      ConstPointer;
00072 
00074   itkTypeMacro(NeuralNetworkFileReader,Object);
00075 
00077   itkNewMacro(Self);
00078 
00079   typedef typename TNetwork::MeasurementVectorType     MeasurementVectorType;
00080   typedef typename TNetwork::TargetVectorType          TargetVectorType;
00081   typedef Statistics::BackPropagationLayer<
00082     MeasurementVectorType, TargetVectorType>           BackPropagationLayerType;
00083   typedef typename BackPropagationLayerType::Pointer   BackPropagationLayerPointer;
00084   typedef typename MeasurementVectorType::ValueType    MeasurementVectorValueType;
00085 
00086   typedef typename TNetwork::LayerInterfaceType        LayerInterfaceType;
00087   typedef typename LayerInterfaceType::WeightSetType   WeightSetType;
00088   typedef typename WeightSetType::Pointer              WeightSetPointer;
00089 
00090 // typedef typename TNetwork::Pointer                       NetworkPointer;
00091 // typedef typename TNetwork::ConstPointer                  NetworkConstPointer;
00092 
00093 
00094 //  typedef typename LayerInterfaceType::TransferFunctionType::Pointer      TransferFunctionPointer;
00095 //  typedef typename LayerInterfaceType::TransferFunctionType::ConstPointer TransferFunctionConstPointer;
00096 
00097 //  typedef typename LayerInterfaceType::InputFunctionType::Pointer         InputFunctionPointer;
00098 //  typedef typename LayerInterfaceType::InputFunctionType::ConstPointer    InputFunctionConstPointer;
00099 
00100 //  typedef typename LayerInterfaceType::ValueType                    ValueType;
00101 
00103   itkSetStringMacro( FileName );
00104 
00106   itkGetStringMacro( FileName );
00107 
00109   void Update(void);
00110 
00111   TNetwork * GetOutput() const;
00112 
00113 #ifdef IGNORE
00114 #undef IGNORE
00115 #endif
00116   typedef enum { IGNORE=0, ASCII=1, BINARY=2 } NetworkWriteWeightsType;
00117   itkSetEnumMacro(ReadWeightValuesType, NetworkWriteWeightsType);
00118   itkGetEnumMacro(ReadWeightValuesType, NetworkWriteWeightsType);
00119 
00120 
00121 protected:
00122   NeuralNetworkFileReader();
00123   ~NeuralNetworkFileReader();
00124   virtual void PrintSelf( std::ostream& os, Indent indent ) const;
00125 
00126 private:
00127 
00128   void ClearFields();
00129   typedef std::vector<MET_FieldRecordType *>      FieldsContainerType;
00130   typedef std::vector<typename TNetwork::LayerInterfaceType::Pointer >             LayersContainer;
00131   typedef std::vector<typename TNetwork::LayerInterfaceType::WeightSetInterfaceType::Pointer>  WeightsContainer;
00132 
00133   typedef struct
00134     {
00135     std::string name;
00136     std::string value;
00137     }                                 LineType;
00138 
00139   typedef std::list< LineType >       LinesContainer;
00140 
00141 
00142   typename TNetwork::Pointer          m_Network;
00143   NetworkWriteWeightsType             m_ReadWeightValuesType;
00144   LayersContainer                     m_Layers;
00145   WeightsContainer                    m_Weights;
00146   LinesContainer                      m_NameValue;
00147   std::string                         m_FileName;
00148   FieldsContainerType                 m_Fields;
00149   std::ifstream                       m_InputFile;
00150   bool                                m_BinaryDataByteOrderMSB;
00151 };
00152 
00153 } // namespace itk
00154 
00155 #ifndef ITK_MANUAL_INSTANTIATION
00156 #include "itkNeuralNetworkFileReader.txx"
00157 #endif
00158 
00159 #endif
00160 

Generated at Mon Jul 12 2010 19:18:47 for ITK by doxygen 1.7.1 written by Dimitri van Heesch, © 1997-2000