Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033 #ifndef __cmtkClassStream_h_included_
00034 #define __cmtkClassStream_h_included_
00035
00036 #include <cmtkconfig.h>
00037
00038 #include <IO/cmtkTypedStream.h>
00039 #include <IO/cmtkStudy.h>
00040
00041 #include <Base/cmtkAffineXform.h>
00042 #include <Base/cmtkWarpXform.h>
00043 #include <Base/cmtkSplineWarpXform.h>
00044 #include <Base/cmtkParametricPlane.h>
00045 #include <Base/cmtkLandmark.h>
00046 #include <Base/cmtkLandmarkList.h>
00047
00048 namespace
00049 cmtk
00050 {
00051
00054
00059 class ClassStream :
00061 public TypedStream
00062 {
00063 public:
00065 typedef enum {
00067 READ = TYPEDSTREAM_READ,
00069 WRITE = TYPEDSTREAM_WRITE,
00071 WRITE_ZLIB = TYPEDSTREAM_WRITE_ZLIB,
00073 APPEND = TYPEDSTREAM_APPEND
00074 } FileMode;
00075
00077 ClassStream() : TypedStream() {}
00078
00083 ClassStream( const char *filename, const FileMode mode )
00084 : TypedStream( filename, (TypedStreamMode) mode ) {}
00085
00091 ClassStream( const char *dir, const char *archive, const FileMode mode )
00092 : TypedStream( dir, archive, (TypedStreamMode) mode ) {}
00093
00096 void Open( const char *filename, const FileMode mode ) {
00097 this->TypedStream::Open( filename, (TypedStreamMode) mode );
00098 }
00099
00102 void Open( const char *dir, const char *archive, const FileMode mode ) {
00103 this->TypedStream::Open( dir, archive, (TypedStreamMode) mode );
00104 }
00105
00111 ClassStream& operator << ( const WarpXform *warpXform );
00112
00117 ClassStream& operator << ( const SplineWarpXform& splineWarpXform )
00118 { return (*this) << &splineWarpXform; }
00119
00121 ClassStream& operator >> ( WarpXform::SmartPtr& warpXform );
00122
00124 ClassStream& operator >> ( WarpXform*& warpXform );
00125
00127 ClassStream& Get ( WarpXform::SmartPtr& warpXform, const AffineXform* affineXform = NULL );
00128
00130 ClassStream& Get ( WarpXform*& warpXform, const AffineXform* affineXform = NULL );
00131
00132 private:
00134 ClassStream& PutWarp( const WarpXform* warpXform );
00135
00136 public:
00139 ClassStream& operator << ( const ParametricPlane *parametricPlane );
00140
00145 ClassStream& operator << ( const ParametricPlane& parametricPlane )
00146 { return (*this) << ¶metricPlane; }
00147
00149 ClassStream& operator >> ( ParametricPlane*& parametricPlane );
00150
00153 ClassStream& operator << ( const LandmarkList *landmarkList );
00154
00159 ClassStream& operator << ( const LandmarkList& landmarkList )
00160 { return (*this) << &landmarkList; }
00161
00163 ClassStream& operator >> ( LandmarkList::SmartPtr& landmarkList );
00164 };
00165
00167
00168 }
00169
00170 #endif // #ifndef __cmtkClassStream_h_included_