Computer Assisted Medical Intervention Tool Kit  version 5.2
camitk::CamiTKFile Class Reference

CamiTKFile provides functions to read and write in the CAMITK file format. More...

#include <CamiTKFile.h>

+ Collaboration diagram for camitk::CamiTKFile:

Public Member Functions

void addContent (QString key, const QVariant)
 Add an element to the CamiTKFile with the provided key. More...
 
 CamiTKFile ()
 Construct an empty CamiTKFile (only header information) More...
 
QVariant getContent (QString key)
 
QDateTime getTimestamp ()
 
QString getVersion ()
 
bool hasContent (QString key)
 
bool isValid ()
 
bool save (QString filepath)
 Save the CamitTKFile to a file. More...
 
bool save (QUrl url)
 Save the CamitTKFile to a url (if the protocol is supported) More...
 
void setCurrentTimestamp ()
 
void setCurrentVersion ()
 

Static Public Member Functions

static CamiTKFile load (QString filepath)
 Read a CamiTKFile from a filepath. More...
 
static CamiTKFile load (QUrl url)
 Read a CamiTKFile from a url (if the protocol is supported) More...
 

Static Public Attributes

static const int maxFileSize = 10000000
 maximum authorized camitk file size in bytes (to prevent memory overflow) More...
 
static const char * version = "camitk-5.2"
 Version of the camitk file format This is the CamiTK version which introduced the latest changes in the camitk format. More...
 

Detailed Description

CamiTKFile provides functions to read and write in the CAMITK file format.

Schematic CamiTKFile format (JSON):

{
"camitk": {
"version": "camitk-5.2",
"timestamp": "2023-11-20T15:45:13",
"filename": "current absoluteFilePath or URL?",
"components": [
{
"uid": "uuid2",
"name": "...",
"filename": "..."
},
{
"uid": "uuid3",
"name": "...",
"filename": "...",
"className": "...",
"uuid3-additional" : { ... }
}
],
"framesOfReference": [
{
"uuid": "xxxx",
"name": ""
}
],
"transformations": [
{
"uuid": "xxxx",
"name": "",
"from": "uuid",
"to": "uuid"
}
],
"settings": {},
"history": {},
"pipeline": {},
"cep": {}
}
}

Constructor & Destructor Documentation

◆ CamiTKFile()

camitk::CamiTKFile::CamiTKFile ( )

Construct an empty CamiTKFile (only header information)

References setCurrentTimestamp(), and setCurrentVersion().

Referenced by load().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Function Documentation

◆ addContent()

void camitk::CamiTKFile::addContent ( QString  key,
const QVariant  value 
)

Add an element to the CamiTKFile with the provided key.

If the key already exists, this will replace the current content for this key

The QVariant may be a value (QString, QUrl, double...), a QList<QVariant> or a QMap<QVariant>

Referenced by camitk::PersistenceManager::saveWorkspace().

+ Here is the caller graph for this function:

◆ getContent()

QVariant camitk::CamiTKFile::getContent ( QString  key)

Referenced by camitk::PersistenceManager::loadWorkspace().

+ Here is the caller graph for this function:

◆ getTimestamp()

QDateTime camitk::CamiTKFile::getTimestamp ( )

◆ getVersion()

QString camitk::CamiTKFile::getVersion ( )

Referenced by camitk::PersistenceManager::loadWorkspace().

+ Here is the caller graph for this function:

◆ hasContent()

bool camitk::CamiTKFile::hasContent ( QString  key)

Referenced by camitk::PersistenceManager::loadWorkspace().

+ Here is the caller graph for this function:

◆ isValid()

bool camitk::CamiTKFile::isValid ( )

Referenced by camitk::PersistenceManager::loadWorkspace().

+ Here is the caller graph for this function:

◆ load() [1/2]

CamiTKFile camitk::CamiTKFile::load ( QString  filepath)
static

Read a CamiTKFile from a filepath.

References CAMITK_ERROR_ALT, CAMITK_WARNING_ALT, and maxFileSize.

Referenced by load(), and camitk::PersistenceManager::loadWorkspace().

+ Here is the caller graph for this function:

◆ load() [2/2]

CamiTKFile camitk::CamiTKFile::load ( QUrl  url)
static

Read a CamiTKFile from a url (if the protocol is supported)

References CamiTKFile(), and load().

+ Here is the call graph for this function:

◆ save() [1/2]

bool camitk::CamiTKFile::save ( QString  filepath)

Save the CamitTKFile to a file.

References setCurrentTimestamp(), and setCurrentVersion().

Referenced by save(), and camitk::PersistenceManager::saveWorkspace().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ save() [2/2]

bool camitk::CamiTKFile::save ( QUrl  url)

Save the CamitTKFile to a url (if the protocol is supported)

References save(), and setCurrentTimestamp().

+ Here is the call graph for this function:

◆ setCurrentTimestamp()

void camitk::CamiTKFile::setCurrentTimestamp ( )

Referenced by CamiTKFile(), and save().

+ Here is the caller graph for this function:

◆ setCurrentVersion()

void camitk::CamiTKFile::setCurrentVersion ( )

References version.

Referenced by CamiTKFile(), and save().

+ Here is the caller graph for this function:

Member Data Documentation

◆ maxFileSize

const int camitk::CamiTKFile::maxFileSize = 10000000
static

maximum authorized camitk file size in bytes (to prevent memory overflow)

Referenced by load().

◆ version

const char * camitk::CamiTKFile::version = "camitk-5.2"
static

Version of the camitk file format This is the CamiTK version which introduced the latest changes in the camitk format.

Please update this to the current version of Core::version when introducing

Referenced by camitk::PersistenceManager::loadWorkspace(), and setCurrentVersion().


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