dcmdata/apps/mdfconen.h

00001 /*
00002  *
00003  *  Copyright (C) 2003-2010, OFFIS e.V.
00004  *  All rights reserved.  See COPYRIGHT file for details.
00005  *
00006  *  This software and supporting documentation were developed by
00007  *
00008  *    OFFIS e.V.
00009  *    R&D Division Health
00010  *    Escherweg 2
00011  *    D-26121 Oldenburg, Germany
00012  *
00013  *
00014  *  Module:  dcmdata
00015  *
00016  *  Author:  Michael Onken
00017  *
00018  *  Purpose: Class for modifying DICOM files from comandline
00019  *
00020  *  Last Update:      $Author: joergr $
00021  *  Update Date:      $Date: 2010-10-14 13:17:52 $
00022  *  CVS/RCS Revision: $Revision: 1.19 $
00023  *  Status:           $State: Exp $
00024  *
00025  *  CVS/RCS Log at end of file
00026  *
00027  */
00028 
00029 #ifndef MDFCONEN_H
00030 #define MDFCONEN_H
00031 
00032 #include "dcmtk/config/osconfig.h"   // make sure OS specific configuration is included first
00033 
00034 #include "dcmtk/ofstd/ofcond.h"
00035 #include "dcmtk/dcmdata/dcxfer.h"
00036 
00037 
00038 // forward declarations
00039 class MdfDatasetManager;
00040 class OFConsoleApplication;
00041 class OFCommandLine;
00042 
00043 
00046 class MdfJob {
00047 
00048 public :
00049 
00050     OFString option;
00051     OFString path;
00052     OFString value;
00053 
00056     OFBool operator==(const MdfJob &j) const;
00057 
00058 private :
00059 
00062     MdfJob &operator=(const MdfJob &j);
00063 };
00064 
00065 
00069 class MdfConsoleEngine
00070 {
00071 public:
00072 
00079     MdfConsoleEngine(int argc,
00080                      char *argv[],
00081                      const char *appl_name);
00082 
00085     ~MdfConsoleEngine();
00086 
00092     int startProvidingService();
00093 
00094 protected:
00095 
00099     void parseNonJobOptions();
00100 
00105     void parseCommandLine();
00106 
00112     static OFBool jobOptionExpectsParameters(const OFString &job);
00113 
00121     static void splitPathAndValue(const OFString &whole,
00122                                   OFString &path,
00123                                   OFString &value);
00124 
00130     int executeJob(const MdfJob &job,
00131                    const char *filename = NULL);
00132 
00138     OFCondition loadFile(const char *filename);
00139 
00144     OFCondition backupFile(const char *file_name);
00145 
00150     OFCondition restoreFile(const char *filename);
00151 
00152 private:
00153 
00155     OFConsoleApplication *app;
00156 
00158     OFCommandLine *cmd;
00159 
00161     MdfDatasetManager *ds_man;
00162 
00164     OFBool ignore_errors_option;
00165 
00167     OFBool update_metaheader_uids_option;
00168 
00170     OFBool no_backup_option;
00171 
00173     E_FileReadMode read_mode_option;
00174 
00176     E_TransferSyntax input_xfer_option;
00177 
00179     OFBool output_dataset_option;
00180 
00182     E_TransferSyntax output_xfer_option;
00183 
00185     E_GrpLenEncoding glenc_option;
00186 
00188     E_EncodingType enctype_option;
00189 
00191     E_PaddingEncoding padenc_option;
00192 
00194     OFCmdUnsignedInt filepad_option;
00195     OFCmdUnsignedInt itempad_option;
00196 
00199     OFBool ignore_missing_tags_option;
00200 
00203     OFBool no_reservation_checks;
00204 
00207     OFBool ignore_un_modifies;
00208 
00210     OFList<MdfJob> *jobs;
00211 
00213     OFList<OFString> *files;
00214 
00217     MdfConsoleEngine &operator=(const MdfConsoleEngine &);
00218 
00221     MdfConsoleEngine(const MdfConsoleEngine &);
00222 };
00223 
00224 #endif // MDFCONEN_H
00225 
00226 
00227 /*
00228 ** CVS/RCS Log:
00229 ** $Log: mdfconen.h,v $
00230 ** Revision 1.19  2010-10-14 13:17:52  joergr
00231 ** Updated copyright header. Added reference to COPYRIGHT file.
00232 **
00233 ** Revision 1.18  2010-05-20 15:45:21  joergr
00234 ** Removed some unnecessary include directives.
00235 **
00236 ** Revision 1.17  2009-11-04 09:58:06  uli
00237 ** Switched to logging mechanism provided by the "new" oflog module
00238 **
00239 ** Revision 1.16  2009-01-15 16:11:55  onken
00240 ** Reworked dcmodify to work with the new DcmPath classes for supporting
00241 ** wildcard paths and automatic insertion of missing attributes and items.
00242 ** Added options for private tag handling and modification of UN values and
00243 ** for ignoring errors resulting from missing tags during modify and erase
00244 ** operations. Further cleanups.
00245 **
00246 ** Revision 1.15  2008-06-23 13:39:16  joergr
00247 ** Fixed inconsistencies in Doxygen API documentation.
00248 **
00249 ** Revision 1.14  2006/12/06 09:31:49  onken
00250 ** Added "--no-backup" option to prevent dcmodify from creating backup files
00251 **
00252 ** Revision 1.13  2006/11/23 15:32:58  onken
00253 ** Made member variables private (before: protected)
00254 **
00255 ** Revision 1.12  2005/12/08 15:46:50  meichel
00256 ** Updated Makefiles to correctly install header files
00257 **
00258 ** Revision 1.11  2005/12/02 09:19:26  joergr
00259 ** Added new command line option that checks whether a given file starts with a
00260 ** valid DICOM meta header.
00261 **
00262 ** Revision 1.10  2004/11/05 17:17:24  onken
00263 ** Added input and output options for dcmodify. minor code enhancements.
00264 **
00265 ** Revision 1.9  2004/10/22 16:53:26  onken
00266 ** - fixed ignore-errors-option
00267 ** - major enhancements for supporting private tags
00268 ** - removed '0 Errors' output
00269 ** - modifications to groups 0000,0001,0002,0003,0005 and 0007 are blocked,
00270 **   removing tags with group 0001,0003,0005 and 0007 is still possible
00271 ** - UID options:
00272 **   - generate new study, series and instance UIDs
00273 **   - When changing UIDs in dataset, related metaheader tags are updated
00274 **     automatically
00275 ** - minor code improvements
00276 **
00277 ** Revision 1.8  2004/04/19 14:45:07  onken
00278 ** Restructured code to avoid default parameter values for "complex types" like
00279 ** OFString. Required for Sun CC 2.0.1.
00280 **
00281 ** Revision 1.7  2003/12/10 16:19:20  onken
00282 ** Changed API of MdfDatasetManager, so that its transparent for user, whether
00283 ** he wants to modify itemtags or tags at 1. level.
00284 **
00285 ** Complete rewrite of MdfConsoleEngine. It doesn't support a batchfile any more,
00286 ** but now a user can give different modify-options at the same time on
00287 ** commandline. Other purifications and simplifications were made.
00288 **
00289 ** Revision 1.6  2003/11/11 10:55:51  onken
00290 ** - debug-mechanism doesn't use debug(..) any more
00291 ** - comments purified
00292 ** - headers adjustet to debug-modifications
00293 **
00294 ** Revision 1.5  2003/10/13 14:51:49  onken
00295 ** improved backup-strategy
00296 **
00297 ** Revision 1.4  2003/10/01 14:04:03  onken
00298 ** Corrected doxygen-information in headerfiles
00299 **
00300 ** Revision 1.3  2003/09/19 12:43:54  onken
00301 ** major bug fixes, corrections for "dcmtk-coding-style", better error-handling
00302 **
00303 ** Revision 1.2  2003/07/09 12:13:13  meichel
00304 ** Included dcmodify in MSVC build system, updated headers
00305 **
00306 ** Revision 1.1  2003/06/26 09:17:18  onken
00307 ** Added commandline-application dcmodify.
00308 **
00309 **
00310 */


Generated on 6 Jan 2011 for OFFIS DCMTK Version 3.6.0 by Doxygen 1.5.1