![]() |
CTK
0.1.0
The Common Toolkit is a community effort to provide support code for medical image analysis, surgical navigation, and related projects.
|
#include <Libs/DICOM/Core/ctkDICOMItem.h>
Public Types | |
typedef QObject | Superclass |
Public Member Functions | |
bool | CopyElement (DcmDataset *dataset, const DcmTagKey &tag, int type) |
Find element in dataset and copy it into internal DcmDataset. More... | |
ctkDICOMItem (bool strictErrorHandling=false) | |
Create an empty object. This has to be initialized by one of the InitializeFrom... methods before it can be used. More... | |
QString | Decode (const DcmTag &tag, const OFString &raw) const |
creates a QString from the OFString, respecting the "specific character set" of the Dataset. More... | |
void | Deserialize () |
Restore the object from a string representation in a database field. More... | |
OFString | Encode (const DcmTag &tag, const QString &qstring) const |
creates an OFString from the QtString More... | |
void | EnsureDcmDataSetIsInitialized () const |
Called by all Get/Set methods to initialize DcmDataSet if needed. More... | |
OFCondition | findAndGetElement (const DcmTag &tag, DcmElement *&element, const OFBool searchIntoSub=OFFalse) const |
A const-correct version of DcmDataset::findAndGetElement. More... | |
OFCondition | findAndGetOFString (const DcmTag &tag, OFString &value, const unsigned long pos=0, const OFBool searchIntoSub=OFFalse) const |
A const-correct version of DcmDataset::findAndGetOFString. More... | |
QString | GetAllElementValuesAsString (const DcmTag &tag) const |
Get-methods for for all subtypes of DcmByteString. More... | |
QDate | GetElementAsDate (const DcmTag &tag, unsigned long pos=0) const |
QDateTime | GetElementAsDateTime (const DcmTag &tag, unsigned long pos=0) const |
double | GetElementAsDouble (const DcmTag &tag, unsigned long pos=0) const |
long | GetElementAsInteger (const DcmTag &tag, unsigned long pos=0) const |
ctkDICOMPersonName | GetElementAsPersonName (const DcmTag &tag, unsigned long pos=0) const |
ctkDICOMPersonNameList | GetElementAsPersonNameList (const DcmTag &tag) const |
int | GetElementAsSignedShort (const DcmTag &tag, unsigned long pos=0) const |
QString | GetElementAsString (const DcmTag &tag, unsigned long pos=0) const |
QStringList | GetElementAsStringList (const DcmTag &tag) const |
QTime | GetElementAsTime (const DcmTag &tag, unsigned long pos=0) const |
int | GetElementAsUnsignedShort (const DcmTag &tag, unsigned long pos=0) const |
QString | GetSeriesInstanceUID () const |
QString | GetSOPInstanceUID () const |
QString | GetStudyInstanceUID () const |
Some convenience getter. More... | |
virtual void | InitializeFromFile (const QString &filename, const E_TransferSyntax readXfer=EXS_Unknown, const E_GrpLenEncoding groupLength=EGL_noChange, const Uint32 maxReadLength=DCM_MaxReadLength, const E_FileReadMode readMode=ERM_autoDetect) |
For initialization from file in a constructor / assignment. More... | |
virtual void | InitializeFromItem (DcmItem *dataset, bool takeOwnership=false) |
For initialization from a DcmDataset in a constructor / assignment. More... | |
bool | IsInitialized () const |
Is this dataset initialized ? More... | |
void | MarkForInitialization () |
To be called from InitializeData, flags status as dirty. More... | |
bool | SaveToFile (const QString &filePath) const |
Save dataset to file. More... | |
void | Serialize () |
Store a string representation of the object to a database field. More... | |
bool | SetElementAsDate (const DcmTag &tag, QDate date) |
bool | SetElementAsDateTime (const DcmTag &tag, QDateTime dateTime) |
bool | SetElementAsInteger (const DcmTag &tag, long value, unsigned long pos=0) |
bool | SetElementAsPersonName (const DcmTag &tag, ctkDICOMPersonName personName) |
bool | SetElementAsPersonNameList (const DcmTag &tag, ctkDICOMPersonNameList personNameList) |
bool | SetElementAsSignedShort (const DcmTag &tag, int value, unsigned long pos=0) |
bool | SetElementAsString (const DcmTag &tag, QString string) |
Set-methods for for all subtypes of DcmByteString. More... | |
bool | SetElementAsStringList (const DcmTag &tag, QStringList stringList) |
bool | SetElementAsTime (const DcmTag &tag, QTime time) |
bool | SetElementAsUnsignedShort (const DcmTag &tag, int value, unsigned long pos=0) |
virtual | ~ctkDICOMItem () |
Static Public Member Functions | |
static bool | CheckCondition (const OFCondition &) |
static QString | TagDescription (const DcmTag &tag) |
Description (name) of the tag. More... | |
static QString | TagKey (const DcmTag &tag) |
Nicely formatted (group,element) version of a tag. More... | |
static QString | TagVR (const DcmTag &tag) |
Value Representation. More... | |
static QString | TranslateDefinedTermModality (const QString &dt) |
Get a human-readable version of modality enumerations used e.g. in DICOM series. More... | |
static QString | TranslateDefinedTermPatientPosition (const QString &dt) |
Get a human-readable version of patient position enumerations used e.g. in DICOM series. More... | |
Protected Member Functions | |
DcmItem & | GetDcmItem () const |
virtual QString | GetStoredSerialization () |
Callback for retrieving a serialized version of this class. More... | |
virtual void | SetStoredSerialization (QString serializedDataset) |
Callback for storing a serialized version of this class. More... | |
Protected Attributes | |
QScopedPointer< ctkDICOMItemPrivate > | d_ptr |
Definition at line 66 of file ctkDICOMItem.h.
typedef QObject ctkDICOMItem::Superclass |
Definition at line 69 of file ctkDICOMItem.h.
ctkDICOMItem::ctkDICOMItem | ( | bool | strictErrorHandling = false | ) |
Create an empty object. This has to be initialized by one of the InitializeFrom... methods before it can be used.
strictErrorHandling | If set to false (the default) only critical errors throw exceptions. |
|
virtual |
|
static |
bool ctkDICOMItem::CopyElement | ( | DcmDataset * | dataset, |
const DcmTagKey & | tag, | ||
int | type | ||
) |
Find element in dataset and copy it into internal DcmDataset.
Attribute types 1, 1C, 2, 2C, 3 as defined in DICOM can be encoded as hex values 0x1, 0x1C, 0x2, 0x2C, 0x3.
Conditional attributes are considered MUST attributes. The calling function shall test the conditions before calling CopyElement (since conditions might be complex).
QString ctkDICOMItem::Decode | ( | const DcmTag & | tag, |
const OFString & | raw | ||
) | const |
creates a QString from the OFString, respecting the "specific character set" of the Dataset.
This method checks if the dataset has an attribute "specific character set". If so, all attributes of types Long String (LO), Long Text (LT), Person Name (PN), Short String (SH), Short Text (ST), Unlimited Text (UT) should be interpreted as encoded with a special set.
See implementation for details.
void ctkDICOMItem::Deserialize | ( | ) |
Restore the object from a string representation in a database field.
The database stored string is base64 decoded into a memory buffer. Then the internal DcmDataset is created using DcmDataset::read(..).
OFString ctkDICOMItem::Encode | ( | const DcmTag & | tag, |
const QString & | qstring | ||
) | const |
creates an OFString from the QtString
void ctkDICOMItem::EnsureDcmDataSetIsInitialized | ( | ) | const |
Called by all Get/Set methods to initialize DcmDataSet if needed.
OFCondition ctkDICOMItem::findAndGetElement | ( | const DcmTag & | tag, |
DcmElement *& | element, | ||
const OFBool | searchIntoSub = OFFalse |
||
) | const |
A const-correct version of DcmDataset::findAndGetElement.
OFCondition ctkDICOMItem::findAndGetOFString | ( | const DcmTag & | tag, |
OFString & | value, | ||
const unsigned long | pos = 0 , |
||
const OFBool | searchIntoSub = OFFalse |
||
) | const |
A const-correct version of DcmDataset::findAndGetOFString.
QString ctkDICOMItem::GetAllElementValuesAsString | ( | const DcmTag & | tag | ) | const |
Get-methods for for all subtypes of DcmByteString.
|
protected |
QDate ctkDICOMItem::GetElementAsDate | ( | const DcmTag & | tag, |
unsigned long | pos = 0 |
||
) | const |
QDateTime ctkDICOMItem::GetElementAsDateTime | ( | const DcmTag & | tag, |
unsigned long | pos = 0 |
||
) | const |
double ctkDICOMItem::GetElementAsDouble | ( | const DcmTag & | tag, |
unsigned long | pos = 0 |
||
) | const |
long ctkDICOMItem::GetElementAsInteger | ( | const DcmTag & | tag, |
unsigned long | pos = 0 |
||
) | const |
ctkDICOMPersonName ctkDICOMItem::GetElementAsPersonName | ( | const DcmTag & | tag, |
unsigned long | pos = 0 |
||
) | const |
ctkDICOMPersonNameList ctkDICOMItem::GetElementAsPersonNameList | ( | const DcmTag & | tag | ) | const |
int ctkDICOMItem::GetElementAsSignedShort | ( | const DcmTag & | tag, |
unsigned long | pos = 0 |
||
) | const |
QString ctkDICOMItem::GetElementAsString | ( | const DcmTag & | tag, |
unsigned long | pos = 0 |
||
) | const |
QStringList ctkDICOMItem::GetElementAsStringList | ( | const DcmTag & | tag | ) | const |
QTime ctkDICOMItem::GetElementAsTime | ( | const DcmTag & | tag, |
unsigned long | pos = 0 |
||
) | const |
int ctkDICOMItem::GetElementAsUnsignedShort | ( | const DcmTag & | tag, |
unsigned long | pos = 0 |
||
) | const |
QString ctkDICOMItem::GetSeriesInstanceUID | ( | ) | const |
QString ctkDICOMItem::GetSOPInstanceUID | ( | ) | const |
|
protectedvirtual |
Callback for retrieving a serialized version of this class.
You can override this method in a subclass to retrieve a serialized version of the object from some storage mechanism, eg a database
QString ctkDICOMItem::GetStudyInstanceUID | ( | ) | const |
Some convenience getter.
|
virtual |
For initialization from file in a constructor / assignment.
|
virtual |
For initialization from a DcmDataset in a constructor / assignment.
This method should be overwritten by all derived classes. It should be called from the constructor or assignment operators when the class should copy information from a DcmDataset object.
bool ctkDICOMItem::IsInitialized | ( | ) | const |
Is this dataset initialized ?
void ctkDICOMItem::MarkForInitialization | ( | ) |
To be called from InitializeData, flags status as dirty.
This is to allow data to be read as late as possible. All the Get/SetElement... methods ensure initialization, which checks this flag.
bool ctkDICOMItem::SaveToFile | ( | const QString & | filePath | ) | const |
Save dataset to file.
void ctkDICOMItem::Serialize | ( | ) |
Store a string representation of the object to a database field.
The internal DcmDataset is serialized into a memory buffer using DcmDataset::write(..). To store the memory buffer in a simple string database field, we convert it to a base64 encoded string. Doing so prevents errors from encoding conversions that could be made by QString or the database etc.
bool ctkDICOMItem::SetElementAsDate | ( | const DcmTag & | tag, |
QDate | date | ||
) |
bool ctkDICOMItem::SetElementAsDateTime | ( | const DcmTag & | tag, |
QDateTime | dateTime | ||
) |
bool ctkDICOMItem::SetElementAsInteger | ( | const DcmTag & | tag, |
long | value, | ||
unsigned long | pos = 0 |
||
) |
bool ctkDICOMItem::SetElementAsPersonName | ( | const DcmTag & | tag, |
ctkDICOMPersonName | personName | ||
) |
bool ctkDICOMItem::SetElementAsPersonNameList | ( | const DcmTag & | tag, |
ctkDICOMPersonNameList | personNameList | ||
) |
bool ctkDICOMItem::SetElementAsSignedShort | ( | const DcmTag & | tag, |
int | value, | ||
unsigned long | pos = 0 |
||
) |
bool ctkDICOMItem::SetElementAsString | ( | const DcmTag & | tag, |
QString | string | ||
) |
Set-methods for for all subtypes of DcmByteString.
bool ctkDICOMItem::SetElementAsStringList | ( | const DcmTag & | tag, |
QStringList | stringList | ||
) |
bool ctkDICOMItem::SetElementAsTime | ( | const DcmTag & | tag, |
QTime | time | ||
) |
bool ctkDICOMItem::SetElementAsUnsignedShort | ( | const DcmTag & | tag, |
int | value, | ||
unsigned long | pos = 0 |
||
) |
|
protectedvirtual |
Callback for storing a serialized version of this class.
You can override this method in a subclass to store a serialized version of the object to some storage mechanism, eg a database
|
static |
Description (name) of the tag.
|
static |
Nicely formatted (group,element) version of a tag.
|
static |
Value Representation.
|
static |
Get a human-readable version of modality enumerations used e.g. in DICOM series.
|
static |
Get a human-readable version of patient position enumerations used e.g. in DICOM series.
|
protected |
Definition at line 255 of file ctkDICOMItem.h.