Medical Imaging Interaction Toolkit  2018.4.99-12ad79a3
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  itkCloneMacro(Self)
61 
62  // Needed methods from Basedata
63  void UpdateOutputInformation() override;
64  void SetRequestedRegionToLargestPossibleRegion() override;
65  bool RequestedRegionIsOutsideOfTheBufferedRegion() override;
66  bool VerifyRequestedRegion() override;
67  void SetRequestedRegion(const itk::DataObject *) override;
68 
69  void Init(std::string name);
70 
79  size_t AddData(DataObject::Pointer data, std::string name, std::string filePath = "");
80 
85  void SetName(std::string name);
86 
87  std::string GetName() const;
88 
89  std::string GetDataFilePath(size_t index) const;
90 
97  size_t NameToIndex(std::string name);
98 
104  std::string IndexToName(size_t index) const;
105 
111  bool HasElement(std::string name);
112 
119  bool HasElement(size_t index);
120 
125  size_t Size() const;
126 
133  void SetData(itk::DataObject::Pointer data, size_t index);
134 
141  void SetData(itk::DataObject::Pointer data, std::string name);
142 
151  itk::DataObject::Pointer GetData(size_t index);
152 
161  itk::DataObject::Pointer GetData(std::string name);
162 
171  mitk::Image::Pointer GetMitkImage(size_t index);
172 
181  mitk::Image::Pointer GetMitkImage(std::string name);
182 
186  template <class ImageType>
187  ImageType GetItkImage(size_t index, ImageType* itkImage);
188 
192  template <class ImageType>
193  ImageType GetItkImage(std::string name, ImageType* itkImage);
194 
195  itk::DataObject::Pointer& operator[](size_t index);
196 
197  itk::DataObject::Pointer& operator[](std::string &name);
198 
204  void SetNameForIndex(size_t index, std::string &name);
205 
209  void SetXMLFile(std::string absoluteXMlFile);
210 
214  std::string GetXMLFile();
215 
220  void SetParent(mitk::DataCollection* parent);
221 
226  mitk::DataCollection* GetParent();
227 
233  bool RemoveIndex(size_t index);
234 
240  bool RemoveElement(std::string& name);
241 
245  void Clear() override;
246 
252  mitk::DataNode::Pointer GetDataNode(size_t index);
253 
259  mitk::DataNode::Pointer GetDataNode(std::string name);
260 
266  mitk::Image::Pointer GetProbabilityMap(std::vector<std::string> probabilityNamesVector);
267 
268  protected:
269 
270  DataCollection();
271  ~DataCollection() override;
272 
273  private:
274  // DATA
275  std::string m_Name;
276  std::vector<itk::DataObject::Pointer> m_DataVector;
277  std::vector<std::string> m_NameVector;
278  std::vector<std::string> m_FilePathVector;
279  std::map<std::string, size_t> m_DataNames;
280 
281  mitk::DataCollection * m_Parent;
282 
283  std::string m_XMLFile; // is only filled for the hightest layer when loading a data collection
284  };
285 } // end namespace
286 #endif
Base of all data objects.
Definition: mitkBaseData.h:37
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