Medical Imaging Interaction Toolkit  2018.4.99-eed36131
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 #ifdef _MSC_VER
13 # pragma warning (disable : 4996)
14 #endif
15 
16 #ifndef mitkDataCollection_H_
17 #define mitkDataCollection_H_
18 
19 //#include <itkLightObject.h>
20 //#include <itkDataObject.h>
21 //#include "itkObjectFactory.h"
22 //#include "mitkCommon.h"
23 #include <mitkImage.h>
24 #include <mitkDataNode.h>
25 
26 #include<mitkBaseData.h>
27 
29 
51 namespace mitk
52 {
54  {
55  public:
56 
58 
59  itkFactorylessNewMacro(Self);
60 
61  itkCloneMacro(Self);
62 
63  // Needed methods from Basedata
64  void UpdateOutputInformation() override;
65  void SetRequestedRegionToLargestPossibleRegion() override;
66  bool RequestedRegionIsOutsideOfTheBufferedRegion() override;
67  bool VerifyRequestedRegion() override;
68  void SetRequestedRegion(const itk::DataObject *) override;
69 
70  void Init(std::string name);
71 
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
Base of all data objects.
Definition: mitkBaseData.h:42
itk::Image< unsigned char, 3 > ImageType
DataCollection - Class to facilitate loading/accessing structured data.
#define mitkClassMacro(className, SuperClassName)
Definition: mitkCommon.h:40
static std::string GetName(std::string fileName, std::string suffix)
#define MITKDATACOLLECTION_EXPORT