DICOMDIR classes

Introduction

This chapter describes the classes and methods used to read and write DICOMDIR files.

The following classes are described in this chapter:

C++ class

Objective-C/Swift class

Description

imebra::DicomDir

ImebraDicomDir

Allows to access the DICOMDIR entries stored in a DataSet

imebra::MutableDicomDir

ImebraMutableDicomDir

Allows to create a DICOMDIR dataset

imebra::DicomDirEntry

ImebraDicomDirEntry

Represents a single DICOMDIR entry

imebra::MutableDicomDirEntry

ImebraMutableDicomDirEntry

Creates a single DICOMDIR entry

DICOMDIR related classes

Class diagram of the DICOMDIR related classes

DICOMDIR classes

DicomDir

C++

class DicomDir

Represents an immutable DICOMDIR structure.

In order to work DicomDir needs a DataSet, which embeds the DicomDir’s entries.

Subclassed by imebra::MutableDicomDir

Public Functions

DicomDir(const DataSet &fromDataSet)

Construct a DicomDir from a DataSet object.

Parameters
  • fromDataSet: the DataSet created from reading a DICOMDIR file

DicomDir(const DicomDir &source)

Copy constructor.

Parameters
  • source: source DICOMDIR

virtual ~DicomDir()

Destructor.

bool hasRootEntry() const

Returns true if the DICOMDIR has a root entry.

Return

true if the DICOMDIR has a root entry, false otherwise

DicomDirEntry getFirstRootEntry() const

Retrieve the first DicomDir’s root entry.

If the root entry is missing then return a null pointer.

Return

the root DicomDirEntry or a null pointer if the root DicomDirEntry does noot exist

Objective-C/Swift

class ImebraDicomDir : public NSObject

Represents a DICOMDIR structure.

In order to work ImebraDicomDir needs a ImebraDataSet, which embeds the DICOMDIR’s entries.

If the ImebraDicomDir’s content is modified then the method updateDataSet() has to be called to obtain a dataset that can be stored as a DICOMDIR file.

Subclassed by ImebraMutableDicomDir

Public Functions

id ImebraDicomDir::initWithDataSet:error:(ImebraDataSet * pDataSet, NSError ** pError)

Construct an ImebraDicomDir from an ImebraDataSet object.

Parameters
  • pDataSet: the ImebraDataSet created from reading a DICOMDIR file

  • pError: set to an NSError derived class in case of error

ImebraDicomDirEntry* ImebraDicomDir::getFirstRootEntry:(NSError ** pError)

Retrieve the first ImebraDicomDir’s root entry.

If the root entry is missing then return a null pointer.

Return

the root ImebraDicomDirEntry or a null pointer if the root ImebraDicomDirEntry does noot exist

Parameters
  • pError: set to a NSError derived class in case of error

MutableDicomDir

C++

class MutableDicomDir : public imebra::DicomDir

Represents a mutable DICOMDIR structure.

In order to work DicomDir needs a DataSet, which embeds the DicomDir’s entries.

If the DicomDir’s content is modified then the method updateDataSet() has to be called before the managed DataSet can be stored as a DICOMDIR file.

Public Functions

MutableDicomDir()

Construct an empty DicomDir.

MutableDicomDir(MutableDataSet &fromDataSet)

Construct a DicomDir from a DataSet object.

Parameters
  • fromDataSet: the DataSet created from reading a DICOMDIR file

MutableDicomDir(const MutableDicomDir &source)

Copy constructor.

Parameters

MutableDicomDirEntry getNewEntry(const std::string &recordType)

Return a new DicomDirEntry record and insert it into the DicomDir’s DataSet.

Return

a new DicomDirEntry object that can be inserted into the DicomDir object or one of its children DicomDirEntry entries.

Parameters
  • recordType: the type of the new entry

void setFirstRootEntry(const DicomDirEntry &firstEntryRecord)

Set the specified entry as the first DicomDir’s root record.

After the DicomDir’s content has been modified it is necessary to call updateDataSet() before the DataSet managed by DicomDir can be used.

Parameters
  • firstEntryRecord: the DicomDirEntry object to set as the first root entry

DataSet updateDataSet()

This method has to be called to update the managed DataSet after the DicomDir’s content has been updated.

It is not necessary to call updateDataSet() after every DicomDir update, just call it when the updated DataSet object is needed.

Return

the updated managed DataSet object

Objective-C/Swift

class ImebraMutableDicomDir : public ImebraDicomDir

Represents a DICOMDIR structure.

In order to work ImebraDicomDir needs a ImebraDataSet, which embeds the DICOMDIR’s entries.

If the ImebraDicomDir’s content is modified then the method updateDataSet() has to be called to obtain a dataset that can be stored as a DICOMDIR file.

Public Functions

id init()

Construct an empty DicomDir.

ImebraMutableDicomDirEntry* ImebraMutableDicomDir::getNewEntry:error:(NSString * recordType, NSError ** pError)

Return a new ImebraDicomDirEntry record for the DICOMDIR.

Return

a new ImebraDicomDirEntry object that can be inserted into the ImebraDicomDir object or one of its children ImebraDicomDirEntry entries.

Parameters
  • recordType: the type of the new entry

  • pError: set to a NSError derived class in case of error

void ImebraMutableDicomDir::setFirstRootEntry:error:(ImebraDicomDirEntry * firstEntryRecord, (swift_error(nonnull_error)) __attribute__)

Set the specified entry as the first ImebraDicomDir’s root record.

Parameters
  • firstEntryRecord: the DicomDirEntry object to set as the first root entry

ImebraDataSet* ImebraMutableDicomDir::updateDataSet:(NSError ** pError)

This method has to be called to update the managed DataSet after the ImebraDicomDir’s content has been updated.

It is not necessary to call updateDataSet() after every ImebraDicomDir update, just call it when the updated ImebraDataSet object is needed.

Return

the updated managed ImebraDataSet object

DicomDirEntry

C++

class DicomDirEntry

Represents a single immutable DICOMDIR entry.

Each entry can be followed by a sibling entry (on the same depth level) or can point to its first child entry (one level deeper).

Each DicomDirEntry object manages a DataSet which is used to store the entry’s data. The DataSet objects managed by DicomDirEntry objects are inserted as sequence items into the DicomDir’s DataSet.

Subclassed by imebra::MutableDicomDirEntry

Public Functions

DicomDirEntry(const DicomDirEntry &source)

Copy constructor.

Parameters
  • source: source DICOMDIR entry

DataSet getEntryDataSet() const

Return the DataSet managed by the DicomDirEntry object.

Return

the DataSet managed by the DicomDirEntry object

DicomDirEntry getNextEntry() const

Return the next sibling entry (on the same depth level).

If the next DicomDirEntry is missing (this is the last entry) then return a null pointer.

Return

the next sibling DicomDirEntry object, or a null pointer if the next sibling DicomDirEntry does not exist

DicomDirEntry getFirstChildEntry() const

Return the first child entry (one level deeper).

If the first child DicomDirEntry is missing then return a null pointer.

Return

the first child DicomDirEntry object, or a null pointer if there aren’t any children

fileParts_t getFileParts() const

Returns the parts that form the name of the file referenced by the DicomDirEntry object.

Return

a list of strings that form the name of the file referenced by the DicomDirEntry object. The last item in the list is the file name, while the preceding items contain the folders names. For instance, on Linux the parts “folder0”, “folder1”, “fileName” represent the path “folder0/folder1/fileName”

Objective-C/Swift

class ImebraDicomDirEntry : public NSObject

Represents a single DICOMDIR entry.

Each entry can be followed by a sibling entry (on the same depth level) and/or can point to its first child entry (one level deeper).

Each ImebraDicomDirEntry object manages a ImebraDataSet which is used to store the entry’s data. The ImebraDataSet objects managed by ImebraDicomDirEntry objects are inserted as sequence items into the ImebraDicomDir’s dataSet.

Subclassed by ImebraMutableDicomDirEntry

Public Functions

ImebraDataSet *getEntryDataSet()

Return the ImebraDataSet managed by the ImebraDicomDirEntry object.

Return

the ImebraDataSet managed by the ImebraDicomDirEntry object

ImebraDicomDirEntry *getNextEntry()

Return the next sibling entry (on the same depth level).

If the next ImebraDicomDirEntry is missing (this is the last entry) then return a null pointer.

Return

the next sibling ImebraDicomDirEntry object, or a null pointer if the next sibling does not exist

ImebraDicomDirEntry *getFirstChildEntry()

Return the first child entry (one level deeper).

If the first child ImebraDicomDirEntry is missing then return a null pointer.

Return

the first child ImebraDicomDirEntry object, or a null pointer if there aren’t any children

NSArray* ImebraDicomDirEntry::getFileParts:(NSError ** pError)

Returns the parts that form the name of the file referenced by the ImebraDicomDirEntry object.

Return

a NSArray of NSString objects that form the name of the file referenced by the ImebraDicomDirEntry object. The last item in the array is the file name, while the preceding items contain the folders names. For instance, the parts “folder0”, “folder1”, “fileName” represent the path “folder0/folder1/fileName”

MutableDicomDirEntry

C++

class MutableDicomDirEntry : public imebra::DicomDirEntry

Represents a single mutable DICOMDIR entry.

Each entry can be followed by a sibling entry (on the same depth level) or can point to its first child entry (one level deeper).

Each DicomDirEntry object manages a DataSet which is used to store the entry’s data. The DataSet objects managed by DicomDirEntry objects are inserted as sequence items into the DicomDir’s DataSet.

Public Functions

MutableDicomDirEntry(const MutableDicomDirEntry &source)

Copy constructor.

Parameters
  • source: source mutable DICOMDIR entry

MutableDataSet getEntryDataSet()

Return the MutableDataSet managed by the MutableDicomDirEntry object.

Return

the MutableDataSet managed by the MutableDicomDirEntry object

void setNextEntry(const DicomDirEntry &nextEntry)

Set the next sibling entry (one the same depth level).

Parameters

void setFirstChildEntry(const DicomDirEntry &firstChildEntry)

Set the first child entry (one level deeper).

Parameters

void setFileParts(const fileParts_t &fileParts)

Set the parts that form the name of the file referenced by the DicomDirEntry object.

Parameters
  • fileParts: a list of strings that form the name of the file referenced by the DicomDirEntry object. The last item in the list is the file name, while the preceding items contain the folders names. For instance, on Linux the parts “folder0”, “folder1”, “fileName” represent the path “folder0/folder1/fileName”

Objective-C/Swift

class ImebraMutableDicomDirEntry : public ImebraDicomDirEntry

Represents a single DICOMDIR entry.

Each entry can be followed by a sibling entry (on the same depth level) and/or can point to its first child entry (one level deeper).

Each ImebraDicomDirEntry object manages a ImebraDataSet which is used to store the entry’s data. The ImebraDataSet objects managed by ImebraDicomDirEntry objects are inserted as sequence items into the ImebraDicomDir’s dataSet.

Public Functions

ImebraMutableDataSet *getEntryDataSet()

Return the ImebraMutableDataSet managed by the ImebraMutableDicomDirEntry object.

Return

the ImebraMutableDataSet managed by the ImebraMutableDicomDirEntry object

void ImebraMutableDicomDirEntry::setNextEntry:error:(ImebraDicomDirEntry * pNextEntry, (swift_error(nonnull_error)) __attribute__)

Set the next sibling entry (one the same depth level).

Parameters
  • nextEntry: the next sibling ImebraDicomDirEntry object

  • pError: set to a NSError derived class in case of error

void ImebraMutableDicomDirEntry::setFirstChildEntry:error:(ImebraDicomDirEntry * pFirstChildEntry, (swift_error(nonnull_error)) __attribute__)

Set the first child entry (one level deeper).

Parameters
  • firstChildEntry: the first child ImebraDicomDirEntry object

  • pError: set to a NSError derived class in case of error

void ImebraMutableDicomDirEntry::setFileParts:error:(NSArray * pFileParts, (swift_error(nonnull_error)) __attribute__)

Set the parts that form the name of the file referenced by the DicomDirEntry object.

Parameters
  • fileParts: a NSArray of NSString objects that form the name of the file referenced by the ImebraDicomDirEntry object. The last item in the list is the file name, while the preceding items contain the folders names. For instance, the parts “folder0”, “folder1”, “fileName” represent the path “folder0/folder1/fileName”