00001 /* 00002 * 00003 * Copyright (C) 2003-2005, OFFIS 00004 * 00005 * This software and supporting documentation were developed by 00006 * 00007 * Kuratorium OFFIS e.V. 00008 * Healthcare Information and Communication Systems 00009 * Escherweg 2 00010 * D-26121 Oldenburg, Germany 00011 * 00012 * THIS SOFTWARE IS MADE AVAILABLE, AS IS, AND OFFIS MAKES NO WARRANTY 00013 * REGARDING THE SOFTWARE, ITS PERFORMANCE, ITS MERCHANTABILITY OR 00014 * FITNESS FOR ANY PARTICULAR USE, FREEDOM FROM ANY COMPUTER DISEASES OR 00015 * ITS CONFORMITY TO ANY SPECIFICATION. THE ENTIRE RISK AS TO QUALITY AND 00016 * PERFORMANCE OF THE SOFTWARE IS WITH THE USER. 00017 * 00018 * Module: dcmdata 00019 * 00020 * Author: Michael Onken 00021 * 00022 * Purpose: Class for modifying DICOM files from comandline 00023 * 00024 * Last Update: $Author: meichel $ 00025 * Update Date: $Date: 2005/12/08 15:46:50 $ 00026 * CVS/RCS Revision: $Revision: 1.12 $ 00027 * Status: $State: Exp $ 00028 * 00029 * CVS/RCS Log at end of file 00030 * 00031 */ 00032 00033 #ifndef MDFCONEN_H 00034 #define MDFCONEN_H 00035 00036 #include "dcmtk/config/osconfig.h" // make sure OS specific configuration is included first 00037 #include "mdfdsman.h" 00038 #include "dcmtk/ofstd/oftypes.h" 00039 #include "dcmtk/ofstd/ofconapp.h" 00040 #include "dcmtk/ofstd/oflist.h" 00041 #include "dcmtk/ofstd/ofcond.h" 00042 #include "dcmtk/dcmdata/dctagkey.h" 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, char *argv[], 00080 const char* appl_name); 00081 00084 ~MdfConsoleEngine(); 00085 00091 int startProvidingService(); 00092 00093 protected: 00095 OFConsoleApplication *app; 00097 OFCommandLine *cmd; 00099 MdfDatasetManager *ds_man; 00101 OFBool verbose_option; 00103 OFBool debug_option; 00105 OFBool ignore_errors_option; 00106 //if false, metaheader UIDs are not updated when related dataset UIDs change 00107 OFBool update_metaheader_uids_option; 00109 E_FileReadMode read_mode_option; 00111 E_TransferSyntax input_xfer_option; 00112 00114 OFBool output_dataset_option; 00116 E_TransferSyntax output_xfer_option; 00118 E_GrpLenEncoding glenc_option; 00120 E_EncodingType enctype_option; 00122 E_PaddingEncoding padenc_option; 00124 OFCmdUnsignedInt filepad_option; 00125 OFCmdUnsignedInt itempad_option; 00126 00128 OFList<MdfJob> *jobs; 00130 OFList<OFString> *files; 00131 00135 void parseNonJobOptions(); 00136 00141 void parseCommandLine(); 00142 00150 void splitPathAndValue(const OFString &whole, 00151 OFString &path, 00152 OFString &value); 00153 00158 int executeJob(const MdfJob &job); 00159 00165 OFCondition loadFile(const char* filename); 00166 00171 OFCondition backupFile(const char *file_name); 00172 00177 OFCondition restoreFile(const char *filename); 00178 00186 void debugMsg(const OFBool &condition, 00187 const OFString &s1, 00188 const OFString &s2, 00189 const OFString &s3); 00190 00191 private: 00192 00195 MdfConsoleEngine &operator=(const MdfConsoleEngine &); 00196 00199 MdfConsoleEngine(const MdfConsoleEngine &); 00200 00201 }; 00202 00203 #endif //MDFCONEN_H 00204 00205 /* 00206 ** CVS/RCS Log: 00207 ** $Log: mdfconen.h,v $ 00208 ** Revision 1.12 2005/12/08 15:46:50 meichel 00209 ** Updated Makefiles to correctly install header files 00210 ** 00211 ** Revision 1.11 2005/12/02 09:19:26 joergr 00212 ** Added new command line option that checks whether a given file starts with a 00213 ** valid DICOM meta header. 00214 ** 00215 ** Revision 1.10 2004/11/05 17:17:24 onken 00216 ** Added input and output options for dcmodify. minor code enhancements. 00217 ** 00218 ** Revision 1.9 2004/10/22 16:53:26 onken 00219 ** - fixed ignore-errors-option 00220 ** - major enhancements for supporting private tags 00221 ** - removed '0 Errors' output 00222 ** - modifications to groups 0000,0001,0002,0003,0005 and 0007 are blocked, 00223 ** removing tags with group 0001,0003,0005 and 0007 is still possible 00224 ** - UID options: 00225 ** - generate new study, series and instance UIDs 00226 ** - When changing UIDs in dataset, related metaheader tags are updated 00227 ** automatically 00228 ** - minor code improvements 00229 ** 00230 ** Revision 1.8 2004/04/19 14:45:07 onken 00231 ** Restructured code to avoid default parameter values for "complex types" like 00232 ** OFString. Required for Sun CC 2.0.1. 00233 ** 00234 ** Revision 1.7 2003/12/10 16:19:20 onken 00235 ** Changed API of MdfDatasetManager, so that its transparent for user, whether 00236 ** he wants to modify itemtags or tags at 1. level. 00237 ** 00238 ** Complete rewrite of MdfConsoleEngine. It doesn't support a batchfile any more, 00239 ** but now a user can give different modify-options at the same time on 00240 ** commandline. Other purifications and simplifications were made. 00241 ** 00242 ** Revision 1.6 2003/11/11 10:55:51 onken 00243 ** - debug-mechanism doesn't use debug(..) any more 00244 ** - comments purified 00245 ** - headers adjustet to debug-modifications 00246 ** 00247 ** Revision 1.5 2003/10/13 14:51:49 onken 00248 ** improved backup-strategy 00249 ** 00250 ** Revision 1.4 2003/10/01 14:04:03 onken 00251 ** Corrected doxygen-information in headerfiles 00252 ** 00253 ** Revision 1.3 2003/09/19 12:43:54 onken 00254 ** major bug fixes, corrections for "dcmtk-coding-style", better error-handling 00255 ** 00256 ** Revision 1.2 2003/07/09 12:13:13 meichel 00257 ** Included dcmodify in MSVC build system, updated headers 00258 ** 00259 ** Revision 1.1 2003/06/26 09:17:18 onken 00260 ** Added commandline-application dcmodify. 00261 ** 00262 ** 00263 */