ITK  4.1.0
Insight Segmentation and Registration Toolkit
itkHDF5TransformIO.h
Go to the documentation of this file.
00001 /*=========================================================================
00002  *
00003  *  Copyright Insight Software Consortium
00004  *
00005  *  Licensed under the Apache License, Version 2.0 (the "License");
00006  *  you may not use this file except in compliance with the License.
00007  *  You may obtain a copy of the License at
00008  *
00009  *         http://www.apache.org/licenses/LICENSE-2.0.txt
00010  *
00011  *  Unless required by applicable law or agreed to in writing, software
00012  *  distributed under the License is distributed on an "AS IS" BASIS,
00013  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00014  *  See the License for the specific language governing permissions and
00015  *  limitations under the License.
00016  *
00017  *=========================================================================*/
00018 #ifndef __itkHDF5TransformIO_h
00019 #define __itkHDF5TransformIO_h
00020 #include "itkTransformIOBase.h"
00021 
00022 #include <string>
00023 
00024 // Avoids KWStyle error from forward declaration below.
00025 namespace itk
00026 {
00027 }
00028 
00029 // Forward declaration of class H5::H5File
00030 namespace H5
00031 {
00032 class H5File;
00033 }
00034 
00035 namespace itk
00036 {
00046 class HDF5TransformIO:public TransformIOBase
00047 {
00048 public:
00049   typedef HDF5TransformIO               Self;
00050   typedef TransformIOBase               Superclass;
00051   typedef SmartPointer< Self >          Pointer;
00052   typedef TransformBase                 TransformType;
00053   typedef Superclass::TransformPointer  TransformPointer;
00054   typedef Superclass::TransformListType TransformListType;
00055   typedef TransformType::ParametersType ParametersType;
00057   itkTypeMacro(HDF5TransformIO, TransformIOBase);
00058   itkNewMacro(Self);
00060 
00063   virtual bool CanReadFile(const char *);
00064 
00067   virtual bool CanWriteFile(const char *);
00068 
00070   virtual void Read();
00071 
00075   virtual void Write();
00076 
00077 protected:
00078   HDF5TransformIO();
00079   virtual ~HDF5TransformIO();
00080 private:
00082   ParametersType ReadParameters(const std::string &DataSetName);
00083 
00085   void WriteParameters(const std::string &name,
00086                        const ParametersType &parameters);
00087 
00089   void WriteString(const std::string &path, const std::string &value);
00090   void WriteString(const std::string &path, const char *value);
00091   void WriteOneTransform(const int transformIndex,
00092                          const TransformType *transform);
00094 
00095   H5::H5File *m_H5File;
00096 };
00097 }
00098 #endif // __itkHDF5TransformIO_h
00099