00001 /* 00002 * 00003 * Copyright (C) 2001-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 to control conversion of image format to DICOM 00019 * 00020 * Last Update: $Author: joergr $ 00021 * Update Date: $Date: 2010-10-14 13:15:46 $ 00022 * CVS/RCS Revision: $Revision: 1.13 $ 00023 * Status: $State: Exp $ 00024 * 00025 * CVS/RCS Log at end of file 00026 * 00027 */ 00028 00029 #ifndef I2D_H 00030 #define I2D_H 00031 00032 #include "dcmtk/config/osconfig.h" 00033 #include "dcmtk/dcmdata/libi2d/i2doutpl.h" 00034 #include "dcmtk/dcmdata/libi2d/i2dplvlp.h" 00035 #include "dcmtk/dcmdata/libi2d/i2dplsc.h" 00036 #include "dcmtk/dcmdata/libi2d/i2djpgs.h" 00037 #include "dcmtk/dcmdata/dcpixel.h" 00038 00039 class Image2Dcm 00040 { 00041 00042 public: 00043 00047 Image2Dcm(); 00048 00059 OFCondition convert(I2DImgSource *inputPlug, 00060 I2DOutputPlug *outPlug, 00061 DcmDataset*& resultDset, 00062 E_TransferSyntax& proposedTS); 00063 00069 void setTemplateFile(const OFString& file); 00070 00075 void setSeriesFrom(const OFString& file); 00076 00081 void setStudyFrom(const OFString& file); 00082 00089 void setIncrementInstanceNumber(OFBool incInstNo); 00090 00101 void setISOLatin1(OFBool insertLatin1); 00102 00114 void setOverrideKeys(const OFList<OFString>& ovkeys); 00115 00126 void setValidityChecking(OFBool doChecks, 00127 OFBool insertMissingType2 = OFTrue, 00128 OFBool inventMissingType1 = OFTrue); 00129 00133 ~Image2Dcm(); 00134 00135 protected: 00136 00142 void cleanupTemplate(DcmDataset *targetDset); 00143 00149 OFCondition applyStudyOrSeriesFromFile(DcmDataset *targetDset); 00150 00155 OFCondition incrementInstanceNumber(DcmDataset *targetDset); 00156 00162 OFCondition generateUIDs(DcmDataset *dset); 00163 00171 OFCondition readAndInsertPixelData( I2DImgSource* imageSource, 00172 DcmDataset* dset, 00173 E_TransferSyntax& outputTS); 00174 00180 OFString isValid(DcmDataset& dataset) const; 00181 00186 OFCondition applyOverrideKeys(DcmDataset *outputDset); 00187 00193 OFCondition insertLatin1(DcmDataset *outputDset); 00194 00203 OFString checkAndInventType1Attrib(const DcmTagKey& key, 00204 DcmDataset* targetDset, 00205 const OFString& defaultValue = "") const; 00206 00207 00214 OFString checkAndInventType2Attrib(const DcmTagKey& key, 00215 DcmDataset* targetDset) const; 00216 00217 private: 00218 00226 OFCondition insertEncapsulatedPixelData(DcmDataset* dset, 00227 char *pixData, 00228 Uint32 length, 00229 const E_TransferSyntax& outputTS) const; 00230 00231 /* Attributes for writing DICOM dataset */ 00232 00235 OFList<OFString> m_overrideKeys; 00236 00240 OFString m_templateFile; 00241 00243 OFBool m_readStudyLevel; 00244 00246 OFBool m_readSeriesLevel; 00247 00249 OFString m_studySeriesFile; 00250 00252 OFBool m_incInstNoFromFile; 00253 00256 OFBool m_disableAttribChecks; 00257 00260 OFBool m_inventMissingType2Attribs; 00261 00264 OFBool m_inventMissingType1Attribs; 00265 00269 OFBool m_insertLatin1; 00270 }; 00271 00272 #endif // I2D_H 00273 00274 /* 00275 * CVS/RCS Log: 00276 * $Log: i2d.h,v $ 00277 * Revision 1.13 2010-10-14 13:15:46 joergr 00278 * Updated copyright header. Added reference to COPYRIGHT file. 00279 * 00280 * Revision 1.12 2010-08-09 13:03:07 joergr 00281 * Updated data dictionary to 2009 edition of the DICOM standard. From now on, 00282 * the official "keyword" is used for the attribute name which results in a 00283 * number of minor changes (e.g. "PatientsName" is now called "PatientName"). 00284 * 00285 * Revision 1.11 2010-03-25 09:44:07 onken 00286 * Pixel data is now already marked with the correct transfer syntax in memory 00287 * not only when writing to disk. This permits conversion in memory, e. g. for 00288 * sending the converted DICOM images directly over the network. 00289 * 00290 * Revision 1.10 2009-11-04 09:58:08 uli 00291 * Switched to logging mechanism provided by the "new" oflog module 00292 * 00293 * Revision 1.9 2009-09-30 08:05:25 uli 00294 * Stop including dctk.h in libi2d's header files. 00295 * 00296 * Revision 1.8 2009-07-16 14:23:37 onken 00297 * Extended Image2Dcm engine to also work for uncompressed pixel data input. 00298 * 00299 * Revision 1.7 2009-07-10 13:16:16 onken 00300 * Added path functionality for --key option and lets the code make use 00301 * of the DcmPath classes. 00302 * 00303 * Revision 1.6 2009-03-31 13:06:09 onken 00304 * Changed implementation of lossy compression attribute detection and writing. 00305 * 00306 * Revision 1.4 2009-01-16 09:51:55 onken 00307 * Completed doxygen documentation for libi2d. 00308 * 00309 * Revision 1.3 2008-01-16 16:32:23 onken 00310 * Fixed some empty or doubled log messages in libi2d files. 00311 * 00312 * Revision 1.2 2008-01-16 15:07:40 onken 00313 * Moved library "i2dlib" from /dcmdata/libsrc/i2dlib to /dcmdata/libi2d 00314 * 00315 * Revision 1.2 2008-01-11 14:17:53 onken 00316 * Added various options to i2dlib. Changed logging to use a configurable 00317 * logstream. Added output plugin for the new Multiframe Secondary Capture SOP 00318 * Classes. Added mode for JPEG plugin to copy exsiting APPn markers (except 00319 * JFIF). Changed img2dcm default behaviour to invent type1/type2 attributes (no 00320 * need for templates any more). Added some bug fixes. 00321 * 00322 * Revision 1.1 2007/11/08 15:58:55 onken 00323 * Initial checkin of img2dcm application and corresponding library i2dlib. 00324 * 00325 * 00326 */