Medical Imaging Interaction Toolkit  2024.06.00
Medical Imaging Interaction Toolkit
mitkSceneIO.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 mitkSceneIO_h
14 #define mitkSceneIO_h
15 
17 
18 #include "mitkDataStorage.h"
19 #include "mitkNodePredicateBase.h"
20 
21 #include <Poco/Zip/ZipLocalFileHeader.h>
22 
23 namespace tinyxml2
24 {
25  class XMLDocument;
26  class XMLElement;
27 }
28 
29 namespace mitk
30 {
31  class BaseData;
32  class PropertyList;
33 
34  class MITKSCENESERIALIZATION_EXPORT SceneIO : public itk::Object
35  {
36  public:
37  mitkClassMacroItkParent(SceneIO, itk::Object);
38  itkFactorylessNewMacro(Self);
39  itkCloneMacro(Self);
40 
42 
56  virtual DataStorage::Pointer LoadScene(const std::string &filename,
57  DataStorage *storage = nullptr,
58  bool clearStorageFirst = false);
59 
74  virtual DataStorage::Pointer LoadSceneUnzipped(const std::string &indexfilename,
75  DataStorage *storage = nullptr,
76  bool clearStorageFirst = false);
77 
78 
93  virtual bool SaveScene(DataStorage::SetOfObjects::ConstPointer sceneNodes,
94  const DataStorage *storage,
95  const std::string &filename);
96 
103  const FailedBaseDataListType *GetFailedNodes();
104 
116  const PropertyList *GetFailedProperties();
117 
118  protected:
119  SceneIO();
120  ~SceneIO() override;
121 
122  std::string CreateEmptyTempDirectory();
123 
124  tinyxml2::XMLElement *SaveBaseData(tinyxml2::XMLDocument &doc, BaseData *data, const std::string &filenamehint, bool &error);
125  tinyxml2::XMLElement *SavePropertyList(tinyxml2::XMLDocument &doc, PropertyList *propertyList, const std::string &filenamehint);
126 
127  void OnUnzipError(const void *pSender, std::pair<const Poco::Zip::ZipLocalFileHeader, const std::string> &info);
128  void OnUnzipOk(const void *pSender, std::pair<const Poco::Zip::ZipLocalFileHeader, const Poco::Path> &info);
129 
130  FailedBaseDataListType::Pointer m_FailedNodes;
132 
133  std::string m_WorkingDirectory;
134  unsigned int m_UnzipErrors;
135  };
136 }
137 
138 #endif
mitk::DataStorage::SetOfObjects
itk::VectorContainer< unsigned int, DataNode::Pointer > SetOfObjects
A Container of objects that is used as a result set of GetSubset() query operations (Set of.
Definition: mitkDataStorage.h:46
mitk::SceneIO::m_UnzipErrors
unsigned int m_UnzipErrors
Definition: mitkSceneIO.h:134
mitkDataStorage.h
mitk::SceneIO::m_FailedNodes
FailedBaseDataListType::Pointer m_FailedNodes
Definition: mitkSceneIO.h:130
itk::SmartPointer< Self >
mitk::SceneIO::FailedBaseDataListType
DataStorage::SetOfObjects FailedBaseDataListType
Definition: mitkSceneIO.h:39
mitkNodePredicateBase.h
mitkClassMacroItkParent
#define mitkClassMacroItkParent(className, SuperClassName)
Definition: mitkCommon.h:45
mitk
Find image slices visible on a given plane.
Definition: RenderingTests.dox:1
mitk::PropertyList
Key-value list holding instances of BaseProperty.
Definition: mitkPropertyList.h:56
mitk::BaseData
Base of all data objects.
Definition: mitkBaseData.h:42
mitk::DataStorage
Data management class that handles 'was created by' relations.
Definition: mitkDataStorage.h:43
MitkSceneSerializationExports.h
tinyxml2
Definition: mitkContourModelReader.h:25
mitk::SceneIO::m_FailedProperties
PropertyList::Pointer m_FailedProperties
Definition: mitkSceneIO.h:131
mitk::SceneIO::m_WorkingDirectory
std::string m_WorkingDirectory
Definition: mitkSceneIO.h:133
mitk::SceneIO
Definition: mitkSceneIO.h:34
MITKSCENESERIALIZATION_EXPORT
#define MITKSCENESERIALIZATION_EXPORT
Definition: MitkSceneSerializationExports.h:15