OFFIS DCMTK  Version 3.6.0
i2d.h
1 /*
2  *
3  * Copyright (C) 2001-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 to control conversion of image format to DICOM
19  *
20  * Last Update: $Author: joergr $
21  * Update Date: $Date: 2010-10-14 13:15:46 $
22  * CVS/RCS Revision: $Revision: 1.13 $
23  * Status: $State: Exp $
24  *
25  * CVS/RCS Log at end of file
26  *
27  */
28 
29 #ifndef I2D_H
30 #define I2D_H
31 
32 #include "dcmtk/config/osconfig.h"
33 #include "dcmtk/dcmdata/libi2d/i2doutpl.h"
34 #include "dcmtk/dcmdata/libi2d/i2dplvlp.h"
35 #include "dcmtk/dcmdata/libi2d/i2dplsc.h"
36 #include "dcmtk/dcmdata/libi2d/i2djpgs.h"
37 #include "dcmtk/dcmdata/dcpixel.h"
38 
39 class Image2Dcm
40 {
41 
42 public:
43 
47  Image2Dcm();
48 
59  OFCondition convert(I2DImgSource *inputPlug,
60  I2DOutputPlug *outPlug,
61  DcmDataset*& resultDset,
62  E_TransferSyntax& proposedTS);
63 
69  void setTemplateFile(const OFString& file);
70 
75  void setSeriesFrom(const OFString& file);
76 
81  void setStudyFrom(const OFString& file);
82 
89  void setIncrementInstanceNumber(OFBool incInstNo);
90 
101  void setISOLatin1(OFBool insertLatin1);
102 
114  void setOverrideKeys(const OFList<OFString>& ovkeys);
115 
126  void setValidityChecking(OFBool doChecks,
127  OFBool insertMissingType2 = OFTrue,
128  OFBool inventMissingType1 = OFTrue);
129 
133  ~Image2Dcm();
134 
135 protected:
136 
142  void cleanupTemplate(DcmDataset *targetDset);
143 
150 
156 
163 
172  DcmDataset* dset,
173  E_TransferSyntax& outputTS);
174 
180  OFString isValid(DcmDataset& dataset) const;
181 
187 
193  OFCondition insertLatin1(DcmDataset *outputDset);
194 
204  DcmDataset* targetDset,
205  const OFString& defaultValue = "") const;
206 
207 
215  DcmDataset* targetDset) const;
216 
217 private:
218 
227  char *pixData,
228  Uint32 length,
229  const E_TransferSyntax& outputTS) const;
230 
231  /* Attributes for writing DICOM dataset */
232 
236 
241 
244 
247 
250 
253 
257 
261 
265 
270 };
271 
272 #endif // I2D_H
273 
274 /*
275  * CVS/RCS Log:
276  * $Log: i2d.h,v $
277  * Revision 1.13 2010-10-14 13:15:46 joergr
278  * Updated copyright header. Added reference to COPYRIGHT file.
279  *
280  * Revision 1.12 2010-08-09 13:03:07 joergr
281  * Updated data dictionary to 2009 edition of the DICOM standard. From now on,
282  * the official "keyword" is used for the attribute name which results in a
283  * number of minor changes (e.g. "PatientsName" is now called "PatientName").
284  *
285  * Revision 1.11 2010-03-25 09:44:07 onken
286  * Pixel data is now already marked with the correct transfer syntax in memory
287  * not only when writing to disk. This permits conversion in memory, e. g. for
288  * sending the converted DICOM images directly over the network.
289  *
290  * Revision 1.10 2009-11-04 09:58:08 uli
291  * Switched to logging mechanism provided by the "new" oflog module
292  *
293  * Revision 1.9 2009-09-30 08:05:25 uli
294  * Stop including dctk.h in libi2d's header files.
295  *
296  * Revision 1.8 2009-07-16 14:23:37 onken
297  * Extended Image2Dcm engine to also work for uncompressed pixel data input.
298  *
299  * Revision 1.7 2009-07-10 13:16:16 onken
300  * Added path functionality for --key option and lets the code make use
301  * of the DcmPath classes.
302  *
303  * Revision 1.6 2009-03-31 13:06:09 onken
304  * Changed implementation of lossy compression attribute detection and writing.
305  *
306  * Revision 1.4 2009-01-16 09:51:55 onken
307  * Completed doxygen documentation for libi2d.
308  *
309  * Revision 1.3 2008-01-16 16:32:23 onken
310  * Fixed some empty or doubled log messages in libi2d files.
311  *
312  * Revision 1.2 2008-01-16 15:07:40 onken
313  * Moved library "i2dlib" from /dcmdata/libsrc/i2dlib to /dcmdata/libi2d
314  *
315  * Revision 1.2 2008-01-11 14:17:53 onken
316  * Added various options to i2dlib. Changed logging to use a configurable
317  * logstream. Added output plugin for the new Multiframe Secondary Capture SOP
318  * Classes. Added mode for JPEG plugin to copy exsiting APPn markers (except
319  * JFIF). Changed img2dcm default behaviour to invent type1/type2 attributes (no
320  * need for templates any more). Added some bug fixes.
321  *
322  * Revision 1.1 2007/11/08 15:58:55 onken
323  * Initial checkin of img2dcm application and corresponding library i2dlib.
324  *
325  *
326  */
void setISOLatin1(OFBool insertLatin1)
Enables/disables autotmatic insertion of the value "ISO_IR100" as a value for the Specific Character ...
void setStudyFrom(const OFString &file)
Set file from which patient/study/series data should be imported from.
class maintaining a attribute tag (group and element number)
Definition: dctagkey.h:46
OFCondition applyStudyOrSeriesFromFile(DcmDataset *targetDset)
Parses patient/study/series level attributes from file as defined on command line and fills internal ...
OFBool m_inventMissingType1Attribs
If true, missing type 1 elements are inserted automatically with a predefined value, if possible.
Definition: i2d.h:264
OFBool m_disableAttribChecks
If true, some simple attribute checks (missing type 2 attributes or missing type 1 values) are omitte...
Definition: i2d.h:256
~Image2Dcm()
Destructor, frees plugin memory.
OFList< OFString > m_overrideKeys
These attributes are applied to the dataset after conversion (and are not checked by the isValid() fu...
Definition: i2d.h:235
OFString m_studySeriesFile
File to read study and series from.
Definition: i2d.h:249
Image2Dcm()
Constructor, initializes command line options.
OFBool m_readSeriesLevel
If true, patient, study and series data is read from file.
Definition: i2d.h:246
void setSeriesFrom(const OFString &file)
Set file from which patient/study/series data should be imported from.
void setOverrideKeys(const OFList< OFString > &ovkeys)
Specifies some attributes that should be inserted after conversion.
OFCondition convert(I2DImgSource *inputPlug, I2DOutputPlug *outPlug, DcmDataset *&resultDset, E_TransferSyntax &proposedTS)
Start the conversion.
void setTemplateFile(const OFString &file)
Sets a DICOM file that should serve as a template for the resulting DICOM object. ...
OFString checkAndInventType1Attrib(const DcmTagKey &key, DcmDataset *targetDset, const OFString &defaultValue="") const
Check whether given type 1 attribute is present and has a length > 0.
Definition: i2d.h:39
OFBool m_readStudyLevel
If true, patient and study data is read from file.
Definition: i2d.h:243
OFCondition generateUIDs(DcmDataset *dset)
Generates and inserts missing UIDs, ie UIDs not taken over from –dataset-from –study from and –ser...
OFBool m_incInstNoFromFile
If true, Instance Number ist read from file and incremented by 1.
Definition: i2d.h:252
OFCondition readAndInsertPixelData(I2DImgSource *imageSource, DcmDataset *dset, E_TransferSyntax &outputTS)
Reads pixel data and corresponding attributes like rows etc.
void cleanupTemplate(DcmDataset *targetDset)
Cleans up template for future insertion of pixel data information, ie generally removes attributes fr...
OFCondition applyOverrideKeys(DcmDataset *outputDset)
Copy override keys over existing keys in given dataset.
void setIncrementInstanceNumber(OFBool incInstNo)
Enables/Disables incrementing instance number taken over from DICOM file.
a class handling the DICOM dataset format (files without meta header)
Definition: dcdatset.h:46
OFCondition insertEncapsulatedPixelData(DcmDataset *dset, char *pixData, Uint32 length, const E_TransferSyntax &outputTS) const
Correctly inserts encapsulated pixel data.
OFCondition insertLatin1(DcmDataset *outputDset)
Inserts "ISO_IR100" in the attribute "Specific Character Set".
OFString isValid(DcmDataset &dataset) const
Do some completeness / validity checks.
a simple string class that implements a subset of std::string.
Definition: ofstring.h:86
void setValidityChecking(OFBool doChecks, OFBool insertMissingType2=OFTrue, OFBool inventMissingType1=OFTrue)
Enable/Disable basic validity checks for output dataset.
OFBool m_insertLatin1
If enabled, ISO_IR100 (ISO Latin 1) is inserted as a standard value for attribute "Specific Character...
Definition: i2d.h:269
OFString checkAndInventType2Attrib(const DcmTagKey &key, DcmDataset *targetDset) const
Inserts an empty element with the given tag into a dataset.
OFCondition incrementInstanceNumber(DcmDataset *targetDset)
Increments instance number in given dataset.
OFBool m_inventMissingType2Attribs
If true, missing type 2 elements are inserted automatically (empty value).
Definition: i2d.h:260
General purpose class for condition codes.
Definition: ofcond.h:305
OFString m_templateFile
If not empty, the DICOM file specified in this variable is used as a base for the DICOM image file to...
Definition: i2d.h:240


Generated on Thu Aug 27 2015 for OFFIS DCMTK Version 3.6.0 by Doxygen 1.8.9.1