ITK  4.1.0
Insight Segmentation and Registration Toolkit
itkSpatialObjectWriter.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 __itkSpatialObjectWriter_h
00019 #define __itkSpatialObjectWriter_h
00020 
00021 #include "itkMetaSceneConverter.h"
00022 #include "itkMetaConverterBase.h"
00023 #include "itkSpatialObject.h"
00024 
00025 namespace itk
00026 {
00032 template< unsigned int NDimensions = 3,
00033           typename PixelType = unsigned char,
00034           typename TMeshTraits = DefaultStaticMeshTraits< PixelType,
00035                                                           NDimensions,
00036                                                           NDimensions >
00037           >
00038 class SpatialObjectWriter:public Object
00039 {
00040 public:
00041 
00043   typedef SpatialObjectWriter  Self;
00044   typedef SmartPointer< Self > Pointer;
00045 
00046   typedef SpatialObject< NDimensions >        SpatialObjectType;
00047   typedef typename SpatialObjectType::Pointer SpatialObjectPointer;
00048   typedef SceneSpatialObject< NDimensions >   SceneType;
00049 
00053   typedef MetaConverterBase< NDimensions >  MetaConverterBaseType;
00054 
00056   itkNewMacro(Self);
00057 
00059   typedef Object Superclass;
00060   itkTypeMacro(SpatialObjectWriter, Object);
00062 
00064   void Update(void);
00065 
00067   itkSetStringMacro(FileName);
00068 
00070   itkGetStringMacro(FileName);
00071 
00073   void SetInput(SpatialObjectType *input){ m_SpatialObject = input; }
00074 
00075   void SetInput(SceneType *input){ m_Scene = input; }
00076 
00077   itkSetMacro(BinaryPoints, bool);
00078   itkGetConstMacro(BinaryPoints, bool);
00079 
00080   void SetTransformPrecision(unsigned int precision);
00081 
00082   unsigned int GetTransformPrecision();
00083 
00085   itkSetMacro(WriteImagesInSeparateFile, bool);
00086   itkGetConstMacro(WriteImagesInSeparateFile, bool);
00088 
00090   void RegisterMetaConverter(const char *metaTypeName,
00091                              const char *spatialObjectTypeName,
00092                              MetaConverterBaseType *converter);
00093 protected:
00094   SpatialObjectWriter(const Self &); //purposely not implemented
00095   void operator=(const Self &);      //purposely not implemented
00097 
00098   std::string m_FileName;
00099   bool        m_BinaryPoints;
00100   bool        m_WriteImagesInSeparateFile;
00101 
00102   SpatialObjectWriter();
00103   virtual ~SpatialObjectWriter();
00104 private:
00105 
00106   SpatialObjectPointer m_SpatialObject;
00107   SceneType *          m_Scene;
00108 
00109   MetaSceneConverter< NDimensions, PixelType, TMeshTraits >
00110   m_MetaToSpatialConverter;
00111 };
00112 } // namespace itk
00113 
00114 #ifndef ITK_MANUAL_INSTANTIATION
00115 #include "itkSpatialObjectWriter.hxx"
00116 #endif
00117 
00118 #endif // __itkSpatialObjectWriter_h
00119