Medical Imaging Interaction Toolkit  2023.12.00
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 (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 #ifndef mitkIOAdapter_h
13 #define mitkIOAdapter_h
14 
15 #include "mitkBaseProcess.h"
16 
17 #include "itkObject.h"
18 
19 namespace mitk
20 {
27  class IOAdapterBase : public itk::Object
28  {
29  public:
32  typedef itk::Object Superclass;
35 
37  virtual itk::SmartPointer<BaseDataSource> CreateIOProcessObject(const std::string filename,
38  const std::string filePrefix,
39  const std::string filePattern) = 0;
40  virtual bool CanReadFile(const std::string filename,
41  const std::string filePrefix,
42  const std::string filePattern) = 0;
43 
44  protected:
46  ~IOAdapterBase() override {}
47  private:
48  IOAdapterBase(const Self &); // purposely not implemented
49  void operator=(const Self &); // purposely not implemented
50  };
51 
60  template <class T>
61  class IOAdapter : public IOAdapterBase
62  {
63  public:
65  typedef IOAdapter Self;
67 
69  itkFactorylessNewMacro(Self);
71  const std::string filePrefix,
72  const std::string filePattern) override
73  {
74  typename T::Pointer ioProcessObject = T::New();
75  ioProcessObject->SetFileName(filename.c_str());
76  ioProcessObject->SetFilePrefix(filePrefix.c_str());
77  ioProcessObject->SetFilePattern(filePattern.c_str());
78  return ioProcessObject.GetPointer();
79  }
80 
81  bool CanReadFile(const std::string filename,
82  const std::string filePrefix,
83  const std::string filePattern) override
84  {
85  return T::CanReadFile(filename, filePrefix, filePattern);
86  }
87 
88  protected:
89  IOAdapter() {}
90  ~IOAdapter() override {}
91  private:
92  IOAdapter(const Self &); // purposely not implemented
93  void operator=(const Self &); // purposely not implemented
94  };
95 
96 } // end namespace mitk
97 
98 #endif
mitk::IOAdapter::~IOAdapter
~IOAdapter() override
Definition: mitkIOAdapter.h:90
mitk::IOAdapter::CreateIOProcessObject
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:70
mitk::IOAdapterBase::Pointer
itk::SmartPointer< Self > Pointer
Definition: mitkIOAdapter.h:33
mitk::IOAdapterBase
IOAdapterBase class is an abstract adapter class for IO process objects.
Definition: mitkIOAdapter.h:27
mitk::IOAdapterBase::CreateIOProcessObject
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.
mitk::IOAdapter::Pointer
itk::SmartPointer< Self > Pointer
Definition: mitkIOAdapter.h:66
itk::SmartPointer< Self >
mitkBaseProcess.h
mitk
Find image slices visible on a given plane.
Definition: RenderingTests.dox:1
mitk::IOAdapter::CanReadFile
bool CanReadFile(const std::string filename, const std::string filePrefix, const std::string filePattern) override
Definition: mitkIOAdapter.h:81
mitk::IOAdapterBase::IOAdapterBase
IOAdapterBase()
Definition: mitkIOAdapter.h:45
mitk::IOAdapterBase::CanReadFile
virtual bool CanReadFile(const std::string filename, const std::string filePrefix, const std::string filePattern)=0
mitk::IOAdapterBase::Superclass
itk::Object Superclass
Definition: mitkIOAdapter.h:32
mitk::IOAdapter::Self
IOAdapter Self
Definition: mitkIOAdapter.h:65
mitk::IOAdapter
IOAdapter class is an adapter class for instantiation of IO process objects. Additional this interfac...
Definition: mitkIOAdapter.h:61
mitk::IOAdapter::IOAdapter
IOAdapter()
Definition: mitkIOAdapter.h:89
mitk::IOAdapterBase::~IOAdapterBase
~IOAdapterBase() override
Definition: mitkIOAdapter.h:46
mitk::IOAdapterBase::ConstPointer
itk::SmartPointer< const Self > ConstPointer
Definition: mitkIOAdapter.h:34
mitk::IOAdapterBase::Self
IOAdapterBase Self
Definition: mitkIOAdapter.h:31