Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
mitkIOAdapter.h
Go to the documentation of this file.
1 /*===================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center,
6 Division of Medical and Biological Informatics.
7 All rights reserved.
8 
9 This software is distributed WITHOUT ANY WARRANTY; without
10 even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 A PARTICULAR PURPOSE.
12 
13 See LICENSE.txt or http://www.mitk.org for details.
14 
15 ===================================================================*/
16 #ifndef __mitkIOAdapter_h
17 #define __mitkIOAdapter_h
18 
19 #include "mitkBaseProcess.h"
20 
21 #include "itkObject.h"
22 
23 namespace mitk
24 {
31  class IOAdapterBase : public itk::Object
32  {
33  public:
36  typedef itk::Object Superclass;
39 
42  const std::string filePrefix,
43  const std::string filePattern) = 0;
44  virtual bool CanReadFile(const std::string filename,
45  const std::string filePrefix,
46  const std::string filePattern) = 0;
47 
48  protected:
51  private:
52  IOAdapterBase(const Self &); // purposely not implemented
53  void operator=(const Self &); // purposely not implemented
54  };
55 
64  template <class T>
65  class IOAdapter : public IOAdapterBase
66  {
67  public:
69  typedef IOAdapter Self;
71 
73  itkFactorylessNewMacro(Self);
75  const std::string filePrefix,
76  const std::string filePattern) override
77  {
78  typename T::Pointer ioProcessObject = T::New();
79  ioProcessObject->SetFileName(filename.c_str());
80  ioProcessObject->SetFilePrefix(filePrefix.c_str());
81  ioProcessObject->SetFilePattern(filePattern.c_str());
82  return ioProcessObject.GetPointer();
83  }
84 
85  virtual bool CanReadFile(const std::string filename,
86  const std::string filePrefix,
87  const std::string filePattern) override
88  {
89  return T::CanReadFile(filename, filePrefix, filePattern);
90  }
91 
92  protected:
93  IOAdapter() {}
95  private:
96  IOAdapter(const Self &); // purposely not implemented
97  void operator=(const Self &); // purposely not implemented
98  };
99 
100 } // end namespace mitk
101 
102 #endif
itk::Object Superclass
Definition: mitkIOAdapter.h:36
itk::SmartPointer< Self > Pointer
virtual bool CanReadFile(const std::string filename, const std::string filePrefix, const std::string filePattern) override
Definition: mitkIOAdapter.h:85
DataCollection - Class to facilitate loading/accessing structured data.
itk::SmartPointer< Self > Pointer
Definition: mitkIOAdapter.h:37
virtual itk::SmartPointer< BaseDataSource > CreateIOProcessObject(const std::string filename, const std::string filePrefix, const std::string filePattern)=0
Create an object and return a pointer to it as a mitk::BaseProcess.
virtual bool CanReadFile(const std::string filename, const std::string filePrefix, const std::string filePattern)=0
mitk::BaseDataSource::Pointer CreateIOProcessObject(const std::string filename, const std::string filePrefix, const std::string filePattern) override
Create an object and return a pointer to it as a mitk::BaseProcess.
Definition: mitkIOAdapter.h:74
IOAdapterBase class is an abstract adapter class for IO process objects.
Definition: mitkIOAdapter.h:31
IOAdapterBase Self
Definition: mitkIOAdapter.h:35
static const std::string filename
IOAdapter class is an adapter class for instantiation of IO process objects. Additional this interfac...
Definition: mitkIOAdapter.h:65
IOAdapter Self
Definition: mitkIOAdapter.h:69
itk::SmartPointer< Self > Pointer
Definition: mitkIOAdapter.h:70
itk::SmartPointer< const Self > ConstPointer
Definition: mitkIOAdapter.h:38
static itkEventMacro(BoundingShapeInteractionEvent, itk::AnyEvent) class MITKBOUNDINGSHAPE_EXPORT BoundingShapeInteractor Pointer New()
Basic interaction methods for mitk::GeometryData.