DCMTK Version 3.6.9
OFFIS DICOM Toolkit
Loading...
Searching...
No Matches
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.
 
 ~MdfConsoleEngine ()
 Destructor.
 
int startProvidingService ()
 This function looks at commandline options and decides what to do.
 

Protected Member Functions

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

Static Protected Member Functions

static OFBool jobOptionExpectsParameters (const OFString &job)
 Checks whether given job expects more values on commandline, e.
 
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.
 

Private Member Functions

MdfConsoleEngineoperator= (const MdfConsoleEngine &)
 private undefined assignment operator
 
 MdfConsoleEngine (const MdfConsoleEngine &)
 private undefined copy constructor
 

Private Attributes

OFConsoleApplicationapp
 helper class for console applications
 
OFCommandLinecmd
 helper class for commandline parsing
 
MdfDatasetManagerds_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
argcNumber of commandline arguments
argvArray holding the commandline arguments
appl_nameName of calling application, that instantiates this class

Referenced by MdfConsoleEngine(), and operator=().

Member Function Documentation

◆ backupFile()

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

Backup given file from file to file.bak.

Parameters
file_namefilename 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
jobjob to be executed
filenamename 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)
staticprotected

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
filenamename 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
filenamerestore "filename".bak to original without .bak
Returns
OFCondition, whether restoring was successful

◆ splitPathAndValue()

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

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
wholestring to be split
pathreturns part containing the path
valuereturns 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:


Generated on Fri Feb 28 2025 for DCMTK Version 3.6.9 by Doxygen 1.13.2