00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __MetaSceneConverter__h
00018 #define __MetaSceneConverter__h
00019
00020 #include "itkSpatialObject.h"
00021 #include "metaScene.h"
00022 #include "itkMetaEvent.h"
00023 #include "itkSceneSpatialObject.h"
00024 #include "itkDefaultStaticMeshTraits.h"
00025
00026 namespace itk
00027 {
00028
00029 template <unsigned int NDimensions,
00030 typename PixelType = unsigned char,
00031 typename TMeshTraits = DefaultStaticMeshTraits< PixelType , NDimensions, NDimensions >
00032 >
00033 class MetaSceneConverter
00034 {
00035
00036 public:
00037
00038 MetaSceneConverter();
00039 ~MetaSceneConverter();
00040
00041 itkStaticConstMacro(MaximumDepth, unsigned int, 9999999);
00042
00043 typedef itk::SceneSpatialObject<NDimensions> SceneType;
00044 typedef typename SceneType::Pointer ScenePointer;
00045
00046 ScenePointer ReadMeta(const char* name);
00047
00048 bool WriteMeta(SceneType * scene,const char* fileName,
00049 unsigned int depth=MaximumDepth,
00050 char * spatialObjectTypeName=NULL);
00051
00052
00053 const MetaEvent* GetEvent() const {return m_Event;}
00054 void SetEvent(MetaEvent* event) {m_Event = event;}
00055
00057 void SetBinaryPoints(bool binary) {m_BinaryPoints = binary;}
00058
00059 void SetTransformPrecision(unsigned int precision){m_TransformPrecision = precision;}
00060 unsigned int GetTransformPrecision(){return m_TransformPrecision;}
00061
00063 void SetWriteImagesInSeparateFile(bool separate) {m_WriteImagesInSeparateFile = separate;}
00064
00065
00066 private:
00067
00068 typedef itk::SpatialObject<NDimensions> SpatialObjectType;
00069 typedef typename SpatialObjectType::Pointer SpatialObjectPointer;
00070 typedef typename SpatialObjectType::TransformType TransformType ;
00071
00072 typedef std::list<MetaObject*> MetaObjectListType;
00073
00074 MetaScene * CreateMetaScene(SceneType * scene,
00075 unsigned int depth=MaximumDepth,
00076 char * name=NULL);
00077
00078 ScenePointer CreateSpatialObjectScene( MetaScene * scene );
00079
00080 void SetTransform(MetaObject* obj, TransformType* transform) ;
00081 void SetTransform(SpatialObjectType* so, MetaObject* obj) ;
00082
00083 double m_Orientation[100] ;
00084 double m_Position[10] ;
00085 double m_CenterOfRotation[10] ;
00086
00087 MetaEvent* m_Event;
00088 bool m_BinaryPoints;
00089 bool m_WriteImagesInSeparateFile;
00090 unsigned int m_TransformPrecision;
00091
00092 };
00093
00094 }
00095
00096 #ifndef ITK_MANUAL_INSTANTIATION
00097 #include "itkMetaSceneConverter.txx"
00098 #endif
00099
00100
00101 #endif