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::DicomDirEntry ImebraDicomDirEntry Represents a single DICOMDIR entry
DICOMDIR related classes

Class diagram of the DICOMDIR related classes

DICOMDIR classes

DicomDir

C++

class DicomDir

Represents a 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

DicomDir()

Construct an empty DicomDir.

DicomDir(const DataSet &fromDataSet)

Construct a DicomDir from a DataSet object.

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

virtual ~DicomDir()

Destructor.

DicomDirEntry *getNewEntry(directoryRecordType_t 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

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

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

Public Functions

id init()

Construct an empty DicomDir.

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::getNewEntry:error:(ImebraDirectoryRecordType_t 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

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

void ImebraDicomDir::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* ImebraDicomDir::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 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

DataSet *getEntryDataSet()

Return the DataSet managed by the DicomDirEntry object.

Return
the DataSet managed by the DicomDirEntry object

DicomDirEntry *getNextEntry()

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

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

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

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”

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

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

void ImebraDicomDirEntry::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 ImebraDicomDirEntry::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

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”

void ImebraDicomDirEntry::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”