DCMTK  Version 3.6.1 20170228
OFFIS DICOM Toolkit
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
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

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 transfersyntax
 
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 recalcing
 
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 ( 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

Member Function Documentation

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
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 occured, else the number of errors
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.
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
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

void MdfConsoleEngine::parseNonJobOptions ( )
protected

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

and sets corresponding internal flags

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
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 splitted
pathreturns part containing the path
valuereturns part containing the value(if theres one)
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 occurreds

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


Generated on Tue Feb 28 2017 for DCMTK Version 3.6.1 20170228 by Doxygen 1.8.8