Public Member Functions | |
MdfDatasetManager () | |
Constructor, initializes member-variables. | |
~MdfDatasetManager () | |
Destructor. | |
OFCondition | loadFile (const char *file_name, const E_FileReadMode readMode=ERM_autoDetect, const E_TransferSyntax xfer=EXS_Unknown) |
Loads a file into dataset manager. | |
OFCondition | modifyOrInsertPath (OFString tag_path, const OFString &value, const OFBool &only_modify, const OFBool update_metaheader=OFTrue, const OFBool ignore_missing_tags=OFFalse, const OFBool no_reservation_checks=OFFalse) |
Modifies/Inserts a path (with a specific value if desired). | |
OFCondition | modifyOrInsertFromFile (OFString tag_path, const OFString &filename, const OFBool &only_modify, const OFBool update_metaheader=OFTrue, const OFBool ignore_missing_tags=OFFalse, const OFBool no_reservation_checks=OFFalse) |
Modifies/Inserts a path with a specific value read from file. | |
OFCondition | modifyAllTags (OFString tag_path, const OFString &value, const OFBool update_metaheader, int &count, const OFBool ignore_missing_tags=OFFalse) |
Modifies all matching tags in dataset to a new value. | |
OFCondition | deleteTag (OFString tag_path, const OFBool all_tags, const OFBool ignore_missing_tags) |
Deletes tag in dataset. | |
OFCondition | deletePrivateData () |
Deletes all private data from file, ie. | |
OFCondition | generateAndInsertUID (const DcmTagKey &uidKey) |
Inserts new Study, Series or SOP Instance UID. | |
OFCondition | saveFile (const char *file_name, E_TransferSyntax opt_xfer=EXS_Unknown, E_EncodingType opt_enctype=EET_UndefinedLength, E_GrpLenEncoding opt_glenc=EGL_recalcGL, E_PaddingEncoding opt_padenc=EPD_noChange, OFCmdUnsignedInt opt_filepad=0, OFCmdUnsignedInt opt_itempad=0, OFBool opt_dataset=OFFalse) |
Saves current dataset back to a file. | |
OFCondition | saveFile () |
Saves current dataset back to file using original filename and original parameters like transfer syntax, padding etc. | |
DcmDataset * | getDataset () |
Returns the dataset, that this MdfDatasetManager handles. | |
DcmFileFormat * | getFileFormat () |
Returns the DcmFileFormat, that this MdfDatasetManager handles. | |
OFString | getFilename () const |
Returns filename of the file, that's loaded currently. | |
void | setModifyUNValues (OFBool modifyUNValues) |
Sets whether attributes with VR of UN should be modified or left alone. | |
Protected Member Functions | |
OFCondition | startModify (DcmElement *elem, const OFString &value) |
modifies element to a specific value | |
void | deleteRelatedMetaheaderTag (const DcmTagKey &key) |
If key is the tag for SOPInstanceUID or SOPClassUID, then this function removes the related MediaStorage UIDs from the metaheader. | |
OFBool | isTagInDictionary (const DcmTagKey &search_key) |
Returns true, if given tag key can be found in dictionary. | |
Private Member Functions | |
MdfDatasetManager & | operator= (const MdfDatasetManager &) |
private undefined assignment operator | |
MdfDatasetManager (const MdfDatasetManager &) | |
private undefined copy constructor | |
Private Attributes | |
OFString | current_file |
name of file, that is loaded currently | |
DcmFileFormat * | dfile |
will hold file to modify | |
DcmDataset * | dset |
will hold the dataset, that should be modified | |
OFBool | ignore_un_modifies |
if enabled, no value modifications on attributes having VR of UN are not executed |
Therefore it allows the process of load->modify->save to provide this service.
Definition at line 49 of file mdfdsman.h.
OFCondition MdfDatasetManager::loadFile | ( | const char * | file_name, | |
const E_FileReadMode | readMode = ERM_autoDetect , |
|||
const E_TransferSyntax | xfer = EXS_Unknown | |||
) |
Loads a file into dataset manager.
file_name | file to be loaded | |
readMode | read file with or without metaheader. Default=autodetect | |
xfer | try to read with this transfer syntax. Default=autodetect |
OFCondition MdfDatasetManager::modifyOrInsertPath | ( | OFString | tag_path, | |
const OFString & | value, | |||
const OFBool & | only_modify, | |||
const OFBool | update_metaheader = OFTrue , |
|||
const OFBool | ignore_missing_tags = OFFalse , |
|||
const OFBool | no_reservation_checks = OFFalse | |||
) |
Modifies/Inserts a path (with a specific value if desired).
tag_path | path to item/element | |
value | denotes new value of tag | |
only_modify | if true, only existing tags are processed. If false, any not existing tag is inserted | |
update_metaheader | updates metaheader UIDs, if related UIDs in dataset are changed (default=true) | |
ignore_missing_tags | if true, tags that could not be found while modifying (only_modify must be true) are handled as non-errors | |
no_reservation_checks | if true, any missing private reservation tags are ignored when inserting private tags. Only makes sense w/o only_modify |
OFCondition MdfDatasetManager::modifyOrInsertFromFile | ( | OFString | tag_path, | |
const OFString & | filename, | |||
const OFBool & | only_modify, | |||
const OFBool | update_metaheader = OFTrue , |
|||
const OFBool | ignore_missing_tags = OFFalse , |
|||
const OFBool | no_reservation_checks = OFFalse | |||
) |
Modifies/Inserts a path with a specific value read from file.
tag_path | path to item/element | |
filename | name of the file from which the value should be read | |
only_modify | if true, only existing tags are processed. If false, any not existing tag is inserted | |
update_metaheader | updates metaheader UIDs, if related UIDs in dataset are changed (default=true) | |
ignore_missing_tags | if true, tags that could not be found while modifying (only_modify must be true) are handled as non-errors | |
no_reservation_checks | if true, any missing private reservation tags are ignored when inserting private tags. Only makes sense w/o only_modify |
OFCondition MdfDatasetManager::modifyAllTags | ( | OFString | tag_path, | |
const OFString & | value, | |||
const OFBool | update_metaheader, | |||
int & | count, | |||
const OFBool | ignore_missing_tags = OFFalse | |||
) |
Modifies all matching tags in dataset to a new value.
tag_path | denotes, which tag to modify | |
value | denotes new value of tag | |
update_metaheader | if true, metaheader uids are updated, if related dataset uids are changed, (default=true) | |
count | returns holds the number of tags, that were affected | |
ignore_missing_tags | if true, tags that could not be found while modifying (only_modify must be true) are handled as non-errors |
OFCondition MdfDatasetManager::deleteTag | ( | OFString | tag_path, | |
const OFBool | all_tags, | |||
const OFBool | ignore_missing_tags | |||
) |
Deletes tag in dataset.
tag_path | holds complete path to tag | |
all_tags | if true, tag is deleted at all levels of dataset, else only 1st level is accessed | |
ignore_missing_tags | if true, tags that could not be found while modifying (only_modify must be true) are handled as non-errors |
OFCondition MdfDatasetManager::deletePrivateData | ( | ) |
Deletes all private data from file, ie.
all tags having odd group numbers.
OFCondition MdfDatasetManager::generateAndInsertUID | ( | const DcmTagKey & | uidKey | ) |
Inserts new Study, Series or SOP Instance UID.
If SOP Instance UID is generated, the related tag in the metaheader is deleted, too so that the new UID is also applied there when saving to disk later.
uidkey | [in] The Instance UID to insert (study, series or sop instance UID key permitted). |
OFCondition MdfDatasetManager::saveFile | ( | const char * | file_name, | |
E_TransferSyntax | opt_xfer = EXS_Unknown , |
|||
E_EncodingType | opt_enctype = EET_UndefinedLength , |
|||
E_GrpLenEncoding | opt_glenc = EGL_recalcGL , |
|||
E_PaddingEncoding | opt_padenc = EPD_noChange , |
|||
OFCmdUnsignedInt | opt_filepad = 0 , |
|||
OFCmdUnsignedInt | opt_itempad = 0 , |
|||
OFBool | opt_dataset = OFFalse | |||
) |
Saves current dataset back to a file.
Caution: After saving MdfDatasetManager keeps working on old filename.
file_name | filename to save to | |
opt_xfer | transfer syntax to save to (EXS_Unknown: dont change) | |
opt_enctype | write with explicit or implicit length encoding | |
opt_glenc | option to set group lenghth calculation mode | |
opt_padenc | sets padding option | |
opt_filepad | pad file to a multiple of this options value | |
opt_itempad | pad item to a multiple of this options value | |
opt_dataset | if true:ony write only dataset, else write fileformat |
OFCondition MdfDatasetManager::saveFile | ( | ) |
Saves current dataset back to file using original filename and original parameters like transfer syntax, padding etc.
DcmDataset* MdfDatasetManager::getDataset | ( | ) |
Returns the dataset, that this MdfDatasetManager handles.
You should use the returned object with care to avoid sideeffects with other class methods, that modify this object, too.
DcmFileFormat* MdfDatasetManager::getFileFormat | ( | ) |
Returns the DcmFileFormat, that this MdfDatasetManager handles.
You should use the returned object with care to avoid sideeffects with other class methods, that modify this object, too.
OFString MdfDatasetManager::getFilename | ( | ) | const |
Returns filename of the file, that's loaded currently.
void MdfDatasetManager::setModifyUNValues | ( | OFBool | modifyUNValues | ) |
Sets whether attributes with VR of UN should be modified or left alone.
modifyUNValues | [in] If set, UN values will be modified (default) |
OFCondition MdfDatasetManager::startModify | ( | DcmElement * | elem, | |
const OFString & | value | |||
) | [protected] |
modifies element to a specific value
elem | element, that should be changed | |
value | the value, the element should be changed to |
void MdfDatasetManager::deleteRelatedMetaheaderTag | ( | const DcmTagKey & | key | ) | [protected] |
If key is the tag for SOPInstanceUID or SOPClassUID, then this function removes the related MediaStorage UIDs from the metaheader.
The metaheader is then updated automagically when the file is saved back to disk.
key | tag to examine |
OFBool MdfDatasetManager::isTagInDictionary | ( | const DcmTagKey & | search_key | ) | [protected] |
Returns true, if given tag key can be found in dictionary.
search_key | tag to lookup |