ITK  4.1.0
Insight Segmentation and Registration Toolkit
itkSpatialObjectReader.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 __itkSpatialObjectReader_h
00019 #define __itkSpatialObjectReader_h
00020 
00021 #include "itkMetaSceneConverter.h"
00022 #include "itkMetaConverterBase.h"
00023 #include "itkGroupSpatialObject.h"
00024 #include "itkProcessObject.h"
00025 
00026 namespace itk
00027 {
00033 template< unsigned int NDimensions = 3,
00034           typename PixelType = unsigned char,
00035           typename TMeshTraits = DefaultStaticMeshTraits< PixelType, NDimensions, NDimensions >
00036           >
00037 class SpatialObjectReader:public Object
00038 {
00039 public:
00040 
00042   typedef SpatialObjectReader                 Self;
00043   typedef SmartPointer< Self >                Pointer;
00044   typedef SpatialObject< NDimensions >        SpatialObjectType;
00045   typedef typename SpatialObjectType::Pointer SpatialObjectPointer;
00046 
00047   typedef GroupSpatialObject< NDimensions > GroupType;
00048   typedef typename GroupType::Pointer       GroupPointer;
00049 
00050   typedef SceneSpatialObject< NDimensions > SceneType;
00051   typedef typename SceneType::Pointer       ScenePointer;
00052 
00056   typedef MetaConverterBase< NDimensions >  MetaConverterBaseType;
00057 
00059   itkNewMacro(Self);
00060 
00062   typedef Object Superclass;
00063   itkTypeMacro(SpatialObjectReader, Object);
00065 
00067   void Update(void);
00068 
00070   itkSetStringMacro(FileName);
00071 
00073   itkGetStringMacro(FileName);
00074 
00076   ScenePointer GetScene(void) { return m_Scene; }
00077   GroupPointer GetGroup(void) { return m_Group; }
00079 
00081   const MetaEvent * GetEvent() { return m_MetaToSpatialConverter.GetEvent(); }
00082   void SetEvent(MetaEvent *event) { m_MetaToSpatialConverter.SetEvent(event); }
00084 
00086   void RegisterMetaConverter(const char *metaTypeName,
00087                              const char *spatialObjectTypeName,
00088                              MetaConverterBaseType *converter);
00089 
00090 protected:
00091   SpatialObjectReader(const Self &); //purposely not implemented
00092   void operator=(const Self &);      //purposely not implemented
00093 
00094   std::string m_FileName;
00095 
00096   SpatialObjectReader();
00097   virtual ~SpatialObjectReader();
00098 private:
00099 
00100   ScenePointer m_Scene;
00101   GroupPointer m_Group;
00102 
00103   MetaSceneConverter< NDimensions, PixelType, TMeshTraits > m_MetaToSpatialConverter;
00104 };
00105 } // namespace itk
00106 
00107 #ifndef ITK_MANUAL_INSTANTIATION
00108 #include "itkSpatialObjectReader.hxx"
00109 #endif
00110 
00111 #endif // __itkSpatialObjectReader_h
00112