Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
mitkBaseDataSource.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 
17 #ifndef MITK_BASE_DATA_SOURCE_H
18 #define MITK_BASE_DATA_SOURCE_H
19 
20 #include <MitkCoreExports.h>
21 #include <itkProcessObject.h>
22 #include <mitkCommon.h>
23 
24 #define mitkBaseDataSourceGetOutputDeclarations \
25  OutputType *GetOutput(); \
26  const OutputType *GetOutput() const; \
27  OutputType *GetOutput(DataObjectPointerArraySizeType idx); \
28  const OutputType *GetOutput(DataObjectPointerArraySizeType idx) const;
29 
30 #define mitkBaseDataSourceGetOutputDefinitions(className) \
31  className::OutputType *className::GetOutput(void) \
32  { \
33  return itkDynamicCastInDebugMode<OutputType *>(this->GetPrimaryOutput()); \
34  } \
35  const className::OutputType *className::GetOutput(void) const \
36  { \
37  return itkDynamicCastInDebugMode<const OutputType *>(this->GetPrimaryOutput()); \
38  } \
39  className::OutputType *className::GetOutput(DataObjectPointerArraySizeType idx) \
40  { \
41  OutputType *out = dynamic_cast<OutputType *>(this->ProcessObject::GetOutput(idx)); \
42  if (out == NULL && this->ProcessObject::GetOutput(idx) != NULL) \
43  { \
44  itkWarningMacro(<< "Unable to convert output number " << idx << " to type " << typeid(OutputType).name()); \
45  } \
46  return out; \
47  } \
48  const className::OutputType *className::GetOutput(DataObjectPointerArraySizeType idx) const \
49  { \
50  const OutputType *out = dynamic_cast<const OutputType *>(this->ProcessObject::GetOutput(idx)); \
51  if (out == NULL && this->ProcessObject::GetOutput(idx) != NULL) \
52  { \
53  itkWarningMacro(<< "Unable to convert output number " << idx << " to type " << typeid(OutputType).name()); \
54  } \
55  return out; \
56  }
57 
58 namespace mitk
59 {
60  class BaseData;
61 
75  class MITKCORE_EXPORT BaseDataSource : public itk::ProcessObject
76  {
77  public:
79 
82 
84 
107  virtual void
108  GraftOutput(OutputType *output);
109 
116  virtual void GraftOutput(const DataObjectIdentifierType &key, OutputType *output);
117 
127  virtual void GraftNthOutput(unsigned int idx, OutputType *output);
128 
132  virtual DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx) override = 0;
133 
137  virtual DataObjectPointer MakeOutput(const DataObjectIdentifierType &name) override = 0;
138 
146  bool Updating() const;
147 
148  protected:
149  BaseDataSource();
150  virtual ~BaseDataSource();
151 
152  // purposely not implemented
153  static Pointer New();
154  };
155 
156 } // namespace mitk
157 
158 #endif /* MITK_BASE_DATA_SOURCE_H */
itk::DataObject::DataObjectIdentifierType DataObjectIdentifierType
#define MITKCORE_EXPORT
Base of all data objects.
Definition: mitkBaseData.h:39
Superclass of all classes generating some kind of mitk::BaseData.
DataCollection - Class to facilitate loading/accessing structured data.
#define mitkClassMacroItkParent(className, SuperClassName)
Definition: mitkCommon.h:53
#define mitkBaseDataSourceGetOutputDeclarations
static itkEventMacro(BoundingShapeInteractionEvent, itk::AnyEvent) class MITKBOUNDINGSHAPE_EXPORT BoundingShapeInteractor Pointer New()
Basic interaction methods for mitk::GeometryData.