Computer Assisted Medical Intervention Tool Kit  version 5.2
 
Loading...
Searching...
No Matches
camitk::CamiTKFile Class Reference

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

#include <CamiTKFile.h>

Public Member Functions

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

Static Public Member Functions

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

Static Public Attributes

static const int maxFileSize = 10000000
 maximum authorized camitk file size in bytes (to prevent memory overflow)
 
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.
 

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().

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().

◆ getContent()

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

◆ getTimestamp()

QDateTime camitk::CamiTKFile::getTimestamp ( )

◆ getVersion()

QString camitk::CamiTKFile::getVersion ( )

◆ hasContent()

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

◆ isValid()

bool camitk::CamiTKFile::isValid ( )

◆ load() [1/2]

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

◆ 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().

◆ 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().

◆ save() [2/2]

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

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

References save(), and setCurrentTimestamp().

◆ setCurrentTimestamp()

void camitk::CamiTKFile::setCurrentTimestamp ( )

Referenced by CamiTKFile(), save(), and save().

◆ setCurrentVersion()

void camitk::CamiTKFile::setCurrentVersion ( )

References version.

Referenced by CamiTKFile(), and save().

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: