Medical Imaging Interaction Toolkit  2023.04.00
Medical Imaging Interaction Toolkit
mitkDataCollection.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 
13 #ifndef mitkDataCollection_h
14 #define mitkDataCollection_h
15 
16 #ifdef _MSC_VER
17 # pragma warning (disable : 4996)
18 #endif
19 
20 //#include <itkLightObject.h>
21 //#include <itkDataObject.h>
22 //#include "itkObjectFactory.h"
23 //#include "mitkCommon.h"
24 #include <mitkImage.h>
25 #include <mitkDataNode.h>
26 
27 #include<mitkBaseData.h>
28 
30 
52 namespace mitk
53 {
55  {
56  public:
57 
59 
60  itkFactorylessNewMacro(Self);
61 
62  itkCloneMacro(Self);
63 
64  // Needed methods from Basedata
65  void UpdateOutputInformation() override;
66  void SetRequestedRegionToLargestPossibleRegion() override;
67  bool RequestedRegionIsOutsideOfTheBufferedRegion() override;
68  bool VerifyRequestedRegion() override;
69  void SetRequestedRegion(const itk::DataObject *) override;
70 
71  void Init(std::string name);
72 
80  size_t AddData(DataObject::Pointer data, std::string name, std::string filePath = "");
81 
86  void SetName(std::string name);
87 
88  std::string GetName() const;
89 
90  std::string GetDataFilePath(size_t index) const;
91 
98  size_t NameToIndex(std::string name);
99 
105  std::string IndexToName(size_t index) const;
106 
112  bool HasElement(std::string name);
113 
120  bool HasElement(size_t index);
121 
126  size_t Size() const;
127 
134  void SetData(itk::DataObject::Pointer data, size_t index);
135 
142  void SetData(itk::DataObject::Pointer data, std::string name);
143 
152  itk::DataObject::Pointer GetData(size_t index);
153 
162  itk::DataObject::Pointer GetData(std::string name);
163 
172  mitk::Image::Pointer GetMitkImage(size_t index);
173 
182  mitk::Image::Pointer GetMitkImage(std::string name);
183 
187  template <class ImageType>
188  ImageType GetItkImage(size_t index, ImageType* itkImage);
189 
193  template <class ImageType>
194  ImageType GetItkImage(std::string name, ImageType* itkImage);
195 
196  itk::DataObject::Pointer& operator[](size_t index);
197 
198  itk::DataObject::Pointer& operator[](std::string &name);
199 
205  void SetNameForIndex(size_t index, std::string &name);
206 
210  void SetXMLFile(std::string absoluteXMlFile);
211 
215  std::string GetXMLFile();
216 
221  void SetParent(mitk::DataCollection* parent);
222 
227  mitk::DataCollection* GetParent();
228 
234  bool RemoveIndex(size_t index);
235 
241  bool RemoveElement(std::string& name);
242 
246  void Clear() override;
247 
253  mitk::DataNode::Pointer GetDataNode(size_t index);
254 
260  mitk::DataNode::Pointer GetDataNode(std::string name);
261 
267  mitk::Image::Pointer GetProbabilityMap(std::vector<std::string> probabilityNamesVector);
268 
269  protected:
270 
271  DataCollection();
272  ~DataCollection() override;
273 
274  private:
275  // DATA
276  std::string m_Name;
277  std::vector<itk::DataObject::Pointer> m_DataVector;
278  std::vector<std::string> m_NameVector;
279  std::vector<std::string> m_FilePathVector;
280  std::map<std::string, size_t> m_DataNames;
281 
282  mitk::DataCollection * m_Parent;
283 
284  std::string m_XMLFile; // is only filled for the hightest layer when loading a data collection
285  };
286 } // end namespace
287 #endif
mitkImage.h
itk::SmartPointer< Self >
mitk
DataCollection - Class to facilitate loading/accessing structured data.
Definition: RenderingTests.dox:1
mitk::DataCollection
Definition: mitkDataCollection.h:54
mitk::BaseData
Base of all data objects.
Definition: mitkBaseData.h:42
mitkDataNode.h
MitkDataCollectionExports.h
mitkBaseData.h
mitkClassMacro
#define mitkClassMacro(className, SuperClassName)
Definition: mitkCommon.h:36
MITKDATACOLLECTION_EXPORT
#define MITKDATACOLLECTION_EXPORT
Definition: MitkDataCollectionExports.h:15