00001 /*========================================================================= 00002 00003 Program: Medical Imaging & Interaction Toolkit 00004 Language: C++ 00005 Date: $Date$ 00006 Version: $Revision$ 00007 00008 Copyright (c) German Cancer Research Center, Division of Medical and 00009 Biological Informatics. All rights reserved. 00010 See MITKCopyright.txt or https://www.mitk.org/copyright.html for details. 00011 00012 This software is distributed WITHOUT ANY WARRANTY; without even 00013 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00014 PURPOSE. See the above copyright notices for more information. 00015 00016 =========================================================================*/ 00017 00018 #include "mitkImageWriterFactory.h" 00019 00020 #include "itkCreateObjectFunction.h" 00021 #include "itkVersion.h" 00022 00023 #include "mitkImageWriter.h" 00024 00025 namespace mitk 00026 { 00027 00028 template <class T> 00029 class CreateImageWriter : public itk::CreateObjectFunctionBase 00030 { 00031 public: 00032 00034 typedef CreateImageWriter Self; 00035 typedef itk::SmartPointer<Self> Pointer; 00036 00038 itkFactorylessNewMacro(Self); 00039 LightObject::Pointer CreateObject() { typename T::Pointer p = T::New(); 00040 p->Register(); 00041 return p.GetPointer(); 00042 } 00043 00044 protected: 00045 CreateImageWriter() {} 00046 ~CreateImageWriter() {} 00047 00048 private: 00049 CreateImageWriter(const Self&); //purposely not implemented 00050 void operator=(const Self&); //purposely not implemented 00051 }; 00052 00053 ImageWriterFactory::ImageWriterFactory() 00054 { 00055 this->RegisterOverride("IOWriter", 00056 "ImageWriter", 00057 "Image Writer", 00058 1, 00059 mitk::CreateImageWriter<mitk::ImageWriter>::New()); 00060 } 00061 00062 ImageWriterFactory::~ImageWriterFactory() 00063 { 00064 } 00065 00066 const char* ImageWriterFactory::GetITKSourceVersion() const 00067 { 00068 return ITK_SOURCE_VERSION; 00069 } 00070 00071 const char* ImageWriterFactory::GetDescription() const 00072 { 00073 return "ImageWriterFactory"; 00074 } 00075 00076 } // end namespace mitk 00077