Medical Imaging Interaction Toolkit  2024.06.00
Medical Imaging Interaction Toolkit
mitk::SceneIO Class Reference

#include <mitkSceneIO.h>

Inheritance diagram for mitk::SceneIO:
Collaboration diagram for mitk::SceneIO:

Public Types

typedef DataStorage::SetOfObjects FailedBaseDataListType
 

Public Member Functions

 mitkClassMacroItkParent (SceneIO, itk::Object)
 
Pointer Clone () const
 
virtual DataStorage::Pointer LoadScene (const std::string &filename, DataStorage *storage=nullptr, bool clearStorageFirst=false)
 Load a scene of objects from file. More...
 
virtual DataStorage::Pointer LoadSceneUnzipped (const std::string &indexfilename, DataStorage *storage=nullptr, bool clearStorageFirst=false)
 Load a scene of objects from directory. More...
 
virtual bool SaveScene (DataStorage::SetOfObjects::ConstPointer sceneNodes, const DataStorage *storage, const std::string &filename)
 Save a scene of objects to file. More...
 
const FailedBaseDataListTypeGetFailedNodes ()
 Get a list of nodes (BaseData containers) that failed to be read/written. More...
 
const PropertyListGetFailedProperties ()
 Get a list of properties that failed to be read/written. More...
 

Static Public Member Functions

static Pointer New ()
 

Protected Member Functions

 SceneIO ()
 
 ~SceneIO () override
 
std::string CreateEmptyTempDirectory ()
 
tinyxml2::XMLElement * SaveBaseData (tinyxml2::XMLDocument &doc, BaseData *data, const std::string &filenamehint, bool &error)
 
tinyxml2::XMLElement * SavePropertyList (tinyxml2::XMLDocument &doc, PropertyList *propertyList, const std::string &filenamehint)
 
void OnUnzipError (const void *pSender, std::pair< const Poco::Zip::ZipLocalFileHeader, const std::string > &info)
 
void OnUnzipOk (const void *pSender, std::pair< const Poco::Zip::ZipLocalFileHeader, const Poco::Path > &info)
 

Protected Attributes

FailedBaseDataListType::Pointer m_FailedNodes
 
PropertyList::Pointer m_FailedProperties
 
std::string m_WorkingDirectory
 
unsigned int m_UnzipErrors
 

Detailed Description

Definition at line 34 of file mitkSceneIO.h.

Member Typedef Documentation

◆ FailedBaseDataListType

Constructor & Destructor Documentation

◆ SceneIO()

mitk::SceneIO::SceneIO ( )
protected

◆ ~SceneIO()

mitk::SceneIO::~SceneIO ( )
overrideprotected

Member Function Documentation

◆ Clone()

Pointer mitk::SceneIO::Clone ( ) const

◆ CreateEmptyTempDirectory()

std::string mitk::SceneIO::CreateEmptyTempDirectory ( )
protected

◆ GetFailedNodes()

const FailedBaseDataListType* mitk::SceneIO::GetFailedNodes ( )

Get a list of nodes (BaseData containers) that failed to be read/written.

FailedBaseDataListType hold all those nodes that contain BaseData objects which could not be read or written during the last call to LoadScene or SaveScene.

◆ GetFailedProperties()

const PropertyList* mitk::SceneIO::GetFailedProperties ( )

Get a list of properties that failed to be read/written.

Each entry corresponds to a property which could not be (de)serialized. The properties may come from either of

◆ LoadScene()

virtual DataStorage::Pointer mitk::SceneIO::LoadScene ( const std::string &  filename,
DataStorage storage = nullptr,
bool  clearStorageFirst = false 
)
virtual

Load a scene of objects from file.

Returns
DataStorage with all scene objects and their relations. If loading failed, query GetFailedNodes() and GetFailedProperties() for more detail.

Attempts to read the provided file and create objects with parent/child relations into a DataStorage.

Parameters
filenamefull filename of the scene file
storageIf given, this DataStorage is used instead of a newly created one
clearStorageFirstIf set, the provided DataStorage will be cleared before populating it with the loaded objects

◆ LoadSceneUnzipped()

virtual DataStorage::Pointer mitk::SceneIO::LoadSceneUnzipped ( const std::string &  indexfilename,
DataStorage storage = nullptr,
bool  clearStorageFirst = false 
)
virtual

Load a scene of objects from directory.

Returns
DataStorage with all scene objects and their relations. If loading failed, query GetFailedNodes() and GetFailedProperties() for more detail.

Does the same like LoadScene, but assumes that the given filename is the index.xml of the scene and the working directory is the directory of the given filename. This function can be used to load an already unpacked scene and create objects with parent/child relations into a DataStorage.

Parameters
indexfilenamefull filename of the scene index file
storageIf given, this DataStorage is used instead of a newly created one
clearStorageFirstIf set, the provided DataStorage will be cleared before populating it with the loaded objects

◆ mitkClassMacroItkParent()

mitk::SceneIO::mitkClassMacroItkParent ( SceneIO  ,
itk::Object   
)

◆ New()

static Pointer mitk::SceneIO::New ( )
static

◆ OnUnzipError()

void mitk::SceneIO::OnUnzipError ( const void *  pSender,
std::pair< const Poco::Zip::ZipLocalFileHeader, const std::string > &  info 
)
protected

◆ OnUnzipOk()

void mitk::SceneIO::OnUnzipOk ( const void *  pSender,
std::pair< const Poco::Zip::ZipLocalFileHeader, const Poco::Path > &  info 
)
protected

◆ SaveBaseData()

tinyxml2::XMLElement* mitk::SceneIO::SaveBaseData ( tinyxml2::XMLDocument &  doc,
BaseData data,
const std::string &  filenamehint,
bool &  error 
)
protected

◆ SavePropertyList()

tinyxml2::XMLElement* mitk::SceneIO::SavePropertyList ( tinyxml2::XMLDocument &  doc,
PropertyList propertyList,
const std::string &  filenamehint 
)
protected

◆ SaveScene()

virtual bool mitk::SceneIO::SaveScene ( DataStorage::SetOfObjects::ConstPointer  sceneNodes,
const DataStorage storage,
const std::string &  filename 
)
virtual

Save a scene of objects to file.

Returns
True if complete success, false if any problem occurred. Note that a scene file might still be written if false is returned, it just will not contain every node/property. If writing failed, query GetFailedNodes() and GetFailedProperties() for more detail.

Attempts to write a scene file, which contains the nodes of the provided DataStorage, their parent/child relations, and properties.

Parameters
sceneNodes
storagea DataStorage containing all nodes that should be saved
filename

Member Data Documentation

◆ m_FailedNodes

FailedBaseDataListType::Pointer mitk::SceneIO::m_FailedNodes
protected

Definition at line 130 of file mitkSceneIO.h.

◆ m_FailedProperties

PropertyList::Pointer mitk::SceneIO::m_FailedProperties
protected

Definition at line 131 of file mitkSceneIO.h.

◆ m_UnzipErrors

unsigned int mitk::SceneIO::m_UnzipErrors
protected

Definition at line 134 of file mitkSceneIO.h.

◆ m_WorkingDirectory

std::string mitk::SceneIO::m_WorkingDirectory
protected

Definition at line 133 of file mitkSceneIO.h.


The documentation for this class was generated from the following file: