DCMTK Version 3.7.0 OFFIS DICOM Toolkit

Public Member Functions | Protected Member Functions | Static Protected Member Functions | Private Member Functions | Private Attributes | List of all members
MdfConsoleEngine Class Reference

This class encapsulates data structures and operations for modifying DICOM files from the commandline. More...

## Public Member Functions
| MdfConsoleEngine (int argc, char *argv[], const char *appl_name)
| Constructor. More...
| ~MdfConsoleEngine ()
| Destructor.
int | startProvidingService ()
| This function looks at commandline options and decides what to do. More...

## Protected Member Functions
void | parseNonJobOptions ()
| Checks for non-job commandline options like –debug etc. More...
void | parseCommandLine ()
| Parses commandline options into corresponding file- and job lists and enables debug/verbose mode. More...
int | executeJob (const MdfJob &job, const char *filename=NULL)
| Executes given modify job. More...
OFCondition | loadFile (const char *filename)
| Backup and load file into internal MdfDatasetManager. More...
OFCondition | backupFile (const char *file_name)
| Backup given file from file to file.bak. More...
OFCondition | restoreFile (const char *filename)
| Restore given file from file.bak to original (without .bak) More...

## Static Protected Member Functions
static OFBool | jobOptionExpectsParameters (const OFString &job)
| Checks whether given job expects more values on commandline, e. More...
static void | splitPathAndValue (const OFString &whole, OFString &path, OFString &value)
| This function splits a modify option (inclusive value) as found on commandline into to parts (path and value) e.g. More...

## Private Member Functions
MdfConsoleEngine & | operator= (const MdfConsoleEngine &)
| private undefined assignment operator
| MdfConsoleEngine (const MdfConsoleEngine &)
| private undefined copy constructor

## Private Attributes
OFConsoleApplication * | app
| helper class for console applications
OFCommandLine * | cmd
| helper class for commandline parsing
MdfDatasetManager * | ds_man
| dataset manager that is used for modify operations
OFBool | ignore_errors_option
| ignore errors option
OFBool | update_metaheader_uids_option
| if false, metaheader UIDs are not updated when related dataset UIDs change
OFBool | no_backup_option
| if true, no backup is made before modifying a file
E_FileReadMode | read_mode_option
| read file with or without metaheader
E_TransferSyntax | input_xfer_option
| denotes the expected transfer syntax
OFBool | output_dataset_option
| decides whether to with/without metaheader
E_TransferSyntax | output_xfer_option
| denotes the transfer syntax that should be written
E_GrpLenEncoding | glenc_option
| option for group length recalculation
E_EncodingType | enctype_option
| write explicit or implicit length encoding
E_PaddingEncoding | padenc_option
| padding output
OFCmdUnsignedInt | filepad_option
| internal padding variables
OFBool | ignore_missing_tags_option
| if true, 'tag not found' errors are treated as being successful for modify and erase operations
OFBool | no_reservation_checks
| If true, it is not checked whether there is a corresponding private reservation during insertion of private tags.
OFBool | ignore_un_modifies
| If enabled, any value modifications of UN leaf elements are not executed.
OFBool | create_if_necessary
| If enabled, a new dataset is created in memory if a file is not existing.
OFBool | was_created
| Used to remember, whether a file was newly created.
OFList< MdfJob > * | jobs
| list of jobs to be executed
OFList< OFString > * | files
| list of files to be modified

## Detailed Description

This class encapsulates data structures and operations for modifying DICOM files from the commandline.

## Constructor & Destructor Documentation

## ◆ MdfConsoleEngine()

MdfConsoleEngine::MdfConsoleEngine | ( | int | argc,
|  | char * | argv[],
|  | const char * | appl_name
| ) |  |

Constructor.

Parameters

  argc | Number of commandline arguments
  argv | Array holding the commandline arguments
  appl_name | Name of calling application, that instantiates this class

## Member Function Documentation

## ◆ backupFile()

OFCondition MdfConsoleEngine::backupFile | ( | const char * | file_name | ) |
| protected

Backup given file from file to file.bak.

Parameters

  file_name | filename of file, that should be backuped

Returns
  OFCondition, whether backup was successful or not

## ◆ executeJob()

int MdfConsoleEngine::executeJob | ( | const MdfJob & | job,
|  | const char * | filename = `NULL`
| ) |  |
| protected

Executes given modify job.

Parameters

  job | job to be executed
  filename | name of the file to be processed (optional)

Returns
  returns 0 if no error occurred, else the number of errors

## ◆ jobOptionExpectsParameters()

static OFBool MdfConsoleEngine::jobOptionExpectsParameters | ( | const OFString & | job | ) |
| static protected

Checks whether given job expects more values on commandline, e.

g. a a tag path or any kind of value.

Parameters

  job | [in] The job option to check (e. g. "i", "m", "ma"...)

Returns
  OFTrue, if a value is expected.

## ◆ loadFile()

OFCondition MdfConsoleEngine::loadFile | ( | const char * | filename | ) |
| protected

Backup and load file into internal MdfDatasetManager.

Parameters

  filename | name of file to load

Returns
  OFCondition, whether loading/backuping was successful including error description

## ◆ parseCommandLine()

void MdfConsoleEngine::parseCommandLine | ( |  | ) |
| protected

Parses commandline options into corresponding file- and job lists and enables debug/verbose mode.

The joblist is built in order of modify options on commandline

## ◆ parseNonJobOptions()

void MdfConsoleEngine::parseNonJobOptions | ( |  | ) |
| protected

Checks for non-job commandline options like –debug etc.

and sets corresponding internal flags

## ◆ restoreFile()

OFCondition MdfConsoleEngine::restoreFile | ( | const char * | filename | ) |
| protected

Restore given file from file.bak to original (without .bak)

Parameters

  filename | restore "filename".bak to original without .bak

Returns
  OFCondition, whether restoring was successful

## ◆ splitPathAndValue()

static void MdfConsoleEngine::splitPathAndValue | ( | const OFString & | whole,
|  | OFString & | path,
|  | OFString & | value
| ) |  |
| static protected

This function splits a modify option (inclusive value) as found on commandline into to parts (path and value) e.g.

"(0010,0010)=value" into path "(0010,0010)" and "value"

Parameters

  whole | string to be split
  path | returns part containing the path
  value | returns part containing the value (if there is one)

## ◆ startProvidingService()

int MdfConsoleEngine::startProvidingService | ( |  | ) |

This function looks at commandline options and decides what to do.

It evaluates option values from commandline and prepares them for starting the corresponding private functions.

Returns
  Returns 0 if successful, another value if errors occurred

The documentation for this class was generated from the following file:

- dcmdata/apps/mdfconen.h

Generated on Mon Dec 15 2025 for DCMTK Version 3.7.0 by Doxygen 1.9.1