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