Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | Related Pages

dcfilefo.h

00001 /*
00002  *
00003  *  Copyright (C) 1994-2002, 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:  Gerd Ehlers, Andreas Barth
00021  *
00022  *  Purpose: Interface of class DcmFileFormat
00023  *
00024  *  Last Update:      $Author: joergr $
00025  *  Update Date:      $Date: 2002/12/06 12:49:10 $
00026  *  Source File:      $Source: /share/dicom/cvs-depot/dcmtk/dcmdata/include/dcfilefo.h,v $
00027  *  CVS/RCS Revision: $Revision: 1.22 $
00028  *  Status:           $State: Exp $
00029  *
00030  *  CVS/RCS Log at end of file
00031  *
00032  */
00033 
00034 
00035 #ifndef DCFILEFO_H
00036 #define DCFILEFO_H
00037 
00038 #include "osconfig.h"    /* make sure OS specific configuration is included first */
00039 
00040 #include "ofconsol.h"
00041 #include "dctypes.h"
00042 #include "dcerror.h"
00043 #include "dcsequen.h"
00044 #include "dcdatset.h"
00045 
00046 
00047 // forward declarations
00048 class DcmMetaInfo;
00049 class DcmInputStream;
00050 class DcmOutputStream;
00051 class DcmRepresentationParameter;
00052 
00053 
00056 class DcmFileFormat
00057   : public DcmSequenceOfItems
00058 {
00059 
00060  public:
00061 
00064     DcmFileFormat();
00065 
00066     DcmFileFormat(DcmDataset *dataset);
00067 
00071     DcmFileFormat(const DcmFileFormat &old);
00072 
00075     virtual ~DcmFileFormat();
00076 
00081     DcmFileFormat &operator=(const DcmFileFormat &obj);
00082 
00086     virtual DcmEVR ident() const;
00087 
00095     virtual void print(ostream &out,
00096                        const size_t flags = 0,
00097                        const int level = 0,
00098                        const char *pixelFileName = NULL,
00099                        size_t *pixelCounter = NULL);
00100 
00101     virtual OFCondition validateMetaInfo(E_TransferSyntax oxfer);
00102 
00103     DcmMetaInfo *getMetaInfo();
00104     DcmDataset  *getDataset();
00105     DcmDataset  *getAndRemoveDataset();
00106 
00107     virtual Uint32 calcElementLength(const E_TransferSyntax xfer,
00108                                      const E_EncodingType enctype);
00109 
00110     virtual OFBool canWriteXfer(const E_TransferSyntax newXfer,
00111                                 const E_TransferSyntax oldXfer = EXS_Unknown);
00112 
00113     virtual OFCondition read(DcmInputStream &inStream,
00114                              const E_TransferSyntax xfer = EXS_Unknown,
00115                              const E_GrpLenEncoding glenc = EGL_noChange,
00116                              const Uint32 maxReadLength = DCM_MaxReadLength);
00117 
00124     virtual OFCondition write(DcmOutputStream &outStream,
00125                               const E_TransferSyntax oxfer,
00126                               const E_EncodingType enctype = EET_UndefinedLength);
00127 
00128     virtual OFCondition write(DcmOutputStream &outStream,
00129                               const E_TransferSyntax oxfer,
00130                               const E_EncodingType enctype,
00131                               const E_GrpLenEncoding glenc,
00132                               const E_PaddingEncoding padenc = EPD_noChange,
00133                               const Uint32 padlen = 0,
00134                               const Uint32 subPadlen = 0,
00135                               Uint32 instanceLength = 0);
00136 
00143     virtual OFCondition writeXML(ostream &out,
00144                                  const size_t flags = 0);
00145 
00159     virtual OFCondition loadFile(const char *fileName,
00160                                  const E_TransferSyntax readXfer = EXS_Unknown,
00161                                  const E_GrpLenEncoding groupLength = EGL_noChange,
00162                                  const Uint32 maxReadLength = DCM_MaxReadLength,
00163                                  OFBool isDataset = OFFalse);
00164 
00176     virtual OFCondition saveFile(const char *fileName,
00177                                  const E_TransferSyntax writeXfer = EXS_Unknown,
00178                                  const E_EncodingType encodingType = EET_UndefinedLength,
00179                                  const E_GrpLenEncoding groupLength = EGL_recalcGL,
00180                                  const E_PaddingEncoding padEncoding = EPD_noChange,
00181                                  const Uint32 padLength = 0,
00182                                  const Uint32 subPadLength = 0,
00183                                  OFBool isDataset = OFFalse);
00184 
00185     // methods for different pixel representations
00186 
00187     // choose Representation changes the representation of
00188     // PixelData Elements in the data set to the given representation
00189     // If the representation does not exists it creates one.
00190     OFCondition chooseRepresentation(const E_TransferSyntax repType,
00191                                      const DcmRepresentationParameter *repParam)
00192     {
00193         return getDataset()->chooseRepresentation(repType, repParam);
00194     }
00195 
00196     // checks if all PixelData elements have a conforming representation
00197     // (for definition of conforming representation see dcpixel.h).
00198     // if one PixelData element has no conforming representation
00199     // OFFalse is returned.
00200     OFBool hasRepresentation(const E_TransferSyntax repType,
00201                              const DcmRepresentationParameter *repParam)
00202     {
00203         return getDataset()->hasRepresentation(repType, repParam);
00204     }
00205 
00208     void removeAllButOriginalRepresentations()
00209     {
00210         getDataset()->removeAllButOriginalRepresentations();
00211     }
00212 
00216     void removeAllButCurrentRepresentations()
00217     {
00218         getDataset()->removeAllButCurrentRepresentations();
00219     }
00220 
00221 
00222 // The following methods have no meaning in DcmFileFormat and shall not be
00223 // called. Since it is not possible to delete inherited methods from a class
00224 // stubs are defined that create an error.
00225 
00226     virtual OFCondition insertItem(DcmItem *item,
00227                                    const unsigned long where = DCM_EndOfListIndex);
00228     virtual DcmItem *remove(const unsigned long num);
00229     virtual DcmItem *remove(DcmItem *item);
00230     virtual OFCondition clear();
00231 
00232 
00233   private:
00234 
00235     OFCondition checkValue(DcmMetaInfo *metainfo,
00236                            DcmDataset *dataset,
00237                            const DcmTagKey &atagkey,
00238                            DcmObject *obj,
00239                            const E_TransferSyntax oxfer);
00240 
00241     E_TransferSyntax lookForXfer(DcmMetaInfo *metainfo);
00242 };
00243 
00244 
00245 #endif // DCFILEFO_H
00246 
00247 
00248 /*
00249 ** CVS/RCS Log:
00250 ** $Log: dcfilefo.h,v $
00251 ** Revision 1.22  2002/12/06 12:49:10  joergr
00252 ** Enhanced "print()" function by re-working the implementation and replacing
00253 ** the boolean "showFullData" parameter by a more general integer flag.
00254 ** Added doc++ documentation.
00255 ** Made source code formatting more consistent with other modules/files.
00256 **
00257 ** Revision 1.21  2002/08/27 16:55:32  meichel
00258 ** Initial release of new DICOM I/O stream classes that add support for stream
00259 **   compression (deflated little endian explicit VR transfer syntax)
00260 **
00261 ** Revision 1.20  2002/08/20 12:18:35  meichel
00262 ** Changed parameter list of loadFile and saveFile methods in class
00263 **   DcmFileFormat. Removed loadFile and saveFile from class DcmObject.
00264 **
00265 ** Revision 1.19  2002/04/25 09:39:47  joergr
00266 ** Added support for XML output of DICOM objects.
00267 **
00268 ** Revision 1.18  2002/04/11 12:22:51  joergr
00269 ** Added new methods for loading and saving DICOM files.
00270 **
00271 ** Revision 1.17  2001/09/25 17:19:26  meichel
00272 ** Adapted dcmdata to class OFCondition
00273 **
00274 ** Revision 1.16  2001/06/01 15:48:40  meichel
00275 ** Updated copyright header
00276 **
00277 ** Revision 1.15  2000/04/14 15:31:32  meichel
00278 ** Removed default value from output stream passed to print() method.
00279 **   Required for use in multi-thread environments.
00280 **
00281 ** Revision 1.14  2000/03/08 16:26:14  meichel
00282 ** Updated copyright header.
00283 **
00284 ** Revision 1.13  2000/03/03 14:05:23  meichel
00285 ** Implemented library support for redirecting error messages into memory
00286 **   instead of printing them to stdout/stderr for GUI applications.
00287 **
00288 ** Revision 1.12  2000/02/10 10:50:51  joergr
00289 ** Added new feature to dcmdump (enhanced print method of dcmdata): write
00290 ** pixel data/item value fields to raw files.
00291 **
00292 ** Revision 1.11  1999/03/31 09:24:38  meichel
00293 ** Updated copyright header in module dcmdata
00294 **
00295 ** Revision 1.10  1998/11/12 16:47:39  meichel
00296 ** Implemented operator= for all classes derived from DcmObject.
00297 **
00298 ** Revision 1.9  1997/07/21 08:14:39  andreas
00299 ** - New environment for encapsulated pixel representations. DcmPixelData
00300 **   can contain different representations and uses codecs to convert
00301 **   between them. Codecs are derived from the DcmCodec class. New error
00302 **   codes are introduced for handling of representations. New internal
00303 **   value representation (only for ident()) for PixelData
00304 ** - Replace all boolean types (BOOLEAN, CTNBOOLEAN, DICOM_BOOL, BOOL)
00305 **   with one unique boolean type OFBool.
00306 **
00307 ** Revision 1.8  1997/05/27 13:48:27  andreas
00308 ** - Add method canWriteXfer to class DcmObject and all derived classes.
00309 **   This method checks whether it is possible to convert the original
00310 **   transfer syntax to an new transfer syntax. The check is used in the
00311 **   dcmconv utility to prohibit the change of a compressed transfer
00312 **   syntax to a uncompressed.
00313 **
00314 ** Revision 1.7  1997/05/16 08:23:47  andreas
00315 ** - Revised handling of GroupLength elements and support of
00316 **   DataSetTrailingPadding elements. The enumeratio E_GrpLenEncoding
00317 **   got additional enumeration values (for a description see dctypes.h).
00318 **   addGroupLength and removeGroupLength methods are replaced by
00319 **   computeGroupLengthAndPadding. To support Padding, the parameters of
00320 **   element and sequence write functions changed.
00321 ** - Added a new method calcElementLength to calculate the length of an
00322 **   element, item or sequence. For elements it returns the length of
00323 **   tag, length field, vr field, and value length, for item and
00324 **   sequences it returns the length of the whole item. sequence including
00325 **   the Delimitation tag (if appropriate).  It can never return
00326 **   UndefinedLength.
00327 **
00328 ** Revision 1.6  1996/08/05 08:45:21  andreas
00329 ** new print routine with additional parameters:
00330 **         - print into files
00331 **         - fix output length for elements
00332 ** corrected error in search routine with parameter ESM_fromStackTop
00333 **
00334 ** Revision 1.5  1996/07/29 15:46:23  andreas
00335 ** Add method getAndRemoveDataset to remove connection of dataset from fileformat
00336 **
00337 ** Revision 1.4  1996/01/09 11:06:15  andreas
00338 ** New Support for Visual C++
00339 ** Correct problems with inconsistent const declarations
00340 **
00341 ** Revision 1.3  1996/01/05 13:22:55  andreas
00342 ** - changed to support new streaming facilities
00343 ** - more cleanups
00344 ** - merged read / write methods for block and file transfer
00345 **
00346 */


Generated on 29 Apr 2005 for OFFIS DCMTK Version 3.5.3 by Doxygen 1.4.2