OFFIS DCMTK  Version 3.6.0
mdfconen.h
1 /*
2  *
3  * Copyright (C) 2003-2010, OFFIS e.V.
4  * All rights reserved. See COPYRIGHT file for details.
5  *
6  * This software and supporting documentation were developed by
7  *
8  * OFFIS e.V.
9  * R&D Division Health
10  * Escherweg 2
11  * D-26121 Oldenburg, Germany
12  *
13  *
14  * Module: dcmdata
15  *
16  * Author: Michael Onken
17  *
18  * Purpose: Class for modifying DICOM files from comandline
19  *
20  * Last Update: $Author: joergr $
21  * Update Date: $Date: 2010-10-14 13:17:52 $
22  * CVS/RCS Revision: $Revision: 1.19 $
23  * Status: $State: Exp $
24  *
25  * CVS/RCS Log at end of file
26  *
27  */
28 
29 #ifndef MDFCONEN_H
30 #define MDFCONEN_H
31 
32 #include "dcmtk/config/osconfig.h" // make sure OS specific configuration is included first
33 
34 #include "dcmtk/ofstd/ofcond.h"
35 #include "dcmtk/dcmdata/dcxfer.h"
36 
37 
38 // forward declarations
39 class MdfDatasetManager;
41 class OFCommandLine;
42 
43 
46 class MdfJob {
47 
48 public :
49 
50  OFString option;
51  OFString path;
52  OFString value;
53 
56  OFBool operator==(const MdfJob &j) const;
57 
58 private :
59 
62  MdfJob &operator=(const MdfJob &j);
63 };
64 
65 
70 {
71 public:
72 
79  MdfConsoleEngine(int argc,
80  char *argv[],
81  const char *appl_name);
82 
86 
93 
94 protected:
95 
99  void parseNonJobOptions();
100 
105  void parseCommandLine();
106 
112  static OFBool jobOptionExpectsParameters(const OFString &job);
113 
121  static void splitPathAndValue(const OFString &whole,
122  OFString &path,
123  OFString &value);
124 
130  int executeJob(const MdfJob &job,
131  const char *filename = NULL);
132 
138  OFCondition loadFile(const char *filename);
139 
144  OFCondition backupFile(const char *file_name);
145 
150  OFCondition restoreFile(const char *filename);
151 
152 private:
153 
156 
159 
162 
165 
168 
171 
173  E_FileReadMode read_mode_option;
174 
176  E_TransferSyntax input_xfer_option;
177 
180 
182  E_TransferSyntax output_xfer_option;
183 
185  E_GrpLenEncoding glenc_option;
186 
188  E_EncodingType enctype_option;
189 
191  E_PaddingEncoding padenc_option;
192 
194  OFCmdUnsignedInt filepad_option;
195  OFCmdUnsignedInt itempad_option;
196 
200 
204 
208 
211 
214 
218 
222 };
223 
224 #endif // MDFCONEN_H
225 
226 
227 /*
228 ** CVS/RCS Log:
229 ** $Log: mdfconen.h,v $
230 ** Revision 1.19 2010-10-14 13:17:52 joergr
231 ** Updated copyright header. Added reference to COPYRIGHT file.
232 **
233 ** Revision 1.18 2010-05-20 15:45:21 joergr
234 ** Removed some unnecessary include directives.
235 **
236 ** Revision 1.17 2009-11-04 09:58:06 uli
237 ** Switched to logging mechanism provided by the "new" oflog module
238 **
239 ** Revision 1.16 2009-01-15 16:11:55 onken
240 ** Reworked dcmodify to work with the new DcmPath classes for supporting
241 ** wildcard paths and automatic insertion of missing attributes and items.
242 ** Added options for private tag handling and modification of UN values and
243 ** for ignoring errors resulting from missing tags during modify and erase
244 ** operations. Further cleanups.
245 **
246 ** Revision 1.15 2008-06-23 13:39:16 joergr
247 ** Fixed inconsistencies in Doxygen API documentation.
248 **
249 ** Revision 1.14 2006/12/06 09:31:49 onken
250 ** Added "--no-backup" option to prevent dcmodify from creating backup files
251 **
252 ** Revision 1.13 2006/11/23 15:32:58 onken
253 ** Made member variables private (before: protected)
254 **
255 ** Revision 1.12 2005/12/08 15:46:50 meichel
256 ** Updated Makefiles to correctly install header files
257 **
258 ** Revision 1.11 2005/12/02 09:19:26 joergr
259 ** Added new command line option that checks whether a given file starts with a
260 ** valid DICOM meta header.
261 **
262 ** Revision 1.10 2004/11/05 17:17:24 onken
263 ** Added input and output options for dcmodify. minor code enhancements.
264 **
265 ** Revision 1.9 2004/10/22 16:53:26 onken
266 ** - fixed ignore-errors-option
267 ** - major enhancements for supporting private tags
268 ** - removed '0 Errors' output
269 ** - modifications to groups 0000,0001,0002,0003,0005 and 0007 are blocked,
270 ** removing tags with group 0001,0003,0005 and 0007 is still possible
271 ** - UID options:
272 ** - generate new study, series and instance UIDs
273 ** - When changing UIDs in dataset, related metaheader tags are updated
274 ** automatically
275 ** - minor code improvements
276 **
277 ** Revision 1.8 2004/04/19 14:45:07 onken
278 ** Restructured code to avoid default parameter values for "complex types" like
279 ** OFString. Required for Sun CC 2.0.1.
280 **
281 ** Revision 1.7 2003/12/10 16:19:20 onken
282 ** Changed API of MdfDatasetManager, so that its transparent for user, whether
283 ** he wants to modify itemtags or tags at 1. level.
284 **
285 ** Complete rewrite of MdfConsoleEngine. It doesn't support a batchfile any more,
286 ** but now a user can give different modify-options at the same time on
287 ** commandline. Other purifications and simplifications were made.
288 **
289 ** Revision 1.6 2003/11/11 10:55:51 onken
290 ** - debug-mechanism doesn't use debug(..) any more
291 ** - comments purified
292 ** - headers adjustet to debug-modifications
293 **
294 ** Revision 1.5 2003/10/13 14:51:49 onken
295 ** improved backup-strategy
296 **
297 ** Revision 1.4 2003/10/01 14:04:03 onken
298 ** Corrected doxygen-information in headerfiles
299 **
300 ** Revision 1.3 2003/09/19 12:43:54 onken
301 ** major bug fixes, corrections for "dcmtk-coding-style", better error-handling
302 **
303 ** Revision 1.2 2003/07/09 12:13:13 meichel
304 ** Included dcmodify in MSVC build system, updated headers
305 **
306 ** Revision 1.1 2003/06/26 09:17:18 onken
307 ** Added commandline-application dcmodify.
308 **
309 **
310 */
OFCommandLine * cmd
helper class for commandline parsing
Definition: mdfconen.h:158
int startProvidingService()
This function looks at commandline options and decides what to do.
OFCondition backupFile(const char *file_name)
Backup given file from file to file.bak.
E_TransferSyntax input_xfer_option
denotes the expected transfersyntax
Definition: mdfconen.h:176
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 an...
OFBool update_metaheader_uids_option
if false, metaheader UIDs are not updated when related dataset UIDs change
Definition: mdfconen.h:167
This class encapsulates data structures and operations for modifying Dicom files from the commandline...
Definition: mdfconen.h:69
support class for console applications.
Definition: ofconapp.h:49
void parseNonJobOptions()
Checks for non-job commandline options like –debug etc.
OFBool no_reservation_checks
If true, it is not checked whether there is a corresponding private reservation during insertion of p...
Definition: mdfconen.h:203
class reflecting a modify operation (called Job in this context)
Definition: mdfconen.h:46
MdfDatasetManager * ds_man
dataset manager that is used for modify operations
Definition: mdfconen.h:161
E_EncodingType enctype_option
write explicit or implicit length encoding
Definition: mdfconen.h:188
int executeJob(const MdfJob &job, const char *filename=NULL)
Executes given modify job.
OFCmdUnsignedInt filepad_option
internal padding variables
Definition: mdfconen.h:194
E_GrpLenEncoding glenc_option
option for group length recalcing
Definition: mdfconen.h:185
OFBool no_backup_option
if true, no backup is made before modifying a file
Definition: mdfconen.h:170
OFBool output_dataset_option
decides whether to with/without metaheader
Definition: mdfconen.h:179
MdfJob & operator=(const MdfJob &j)
private undefined copy constructor
~MdfConsoleEngine()
Destructor.
static OFBool jobOptionExpectsParameters(const OFString &job)
Checks whether given job expects more values on commandline, e.
OFBool ignore_errors_option
ignore errors option
Definition: mdfconen.h:164
OFBool ignore_missing_tags_option
if true, 'tag not found' errors are treated as being successful for modify and erase operations ...
Definition: mdfconen.h:199
This class encapsulates data structures and operations for modifying Dicom files. ...
Definition: mdfdsman.h:49
OFBool operator==(const MdfJob &j) const
Comparison operator between Jobs.
MdfConsoleEngine(int argc, char *argv[], const char *appl_name)
Constructor.
OFList< MdfJob > * jobs
list of jobs to be executed
Definition: mdfconen.h:210
OFBool ignore_un_modifies
If enabled, any value modifications of UN leaf elements are not executed.
Definition: mdfconen.h:207
OFCondition loadFile(const char *filename)
Backup and load file into internal MdfDatasetManager.
E_TransferSyntax output_xfer_option
denotes the transfer syntax that should be written
Definition: mdfconen.h:182
E_FileReadMode read_mode_option
read file with or without metaheader
Definition: mdfconen.h:173
a simple string class that implements a subset of std::string.
Definition: ofstring.h:86
OFList< OFString > * files
list of files to be modified
Definition: mdfconen.h:213
OFCondition restoreFile(const char *filename)
Restore given file from file.bak to original (without .bak)
OFConsoleApplication * app
helper class for console applications
Definition: mdfconen.h:155
handles command line arguments.
Definition: ofcmdln.h:129
E_PaddingEncoding padenc_option
padding output
Definition: mdfconen.h:191
MdfConsoleEngine & operator=(const MdfConsoleEngine &)
private undefined assignment operator
General purpose class for condition codes.
Definition: ofcond.h:305
void parseCommandLine()
Parses commandline options into corresponding file- and job lists and enables debug/verbose mode...


Generated on Wed Dec 28 2016 for OFFIS DCMTK Version 3.6.0 by Doxygen 1.8.8