dcmimage/include/dcmtk/dcmimage/dicoimg.h

00001 /*
00002  *
00003  *  Copyright (C) 1996-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:  dcmimage
00015  *
00016  *  Author:  Joerg Riesmeier
00017  *
00018  *  Purpose: DicomColorImage (Header)
00019  *
00020  *  Last Update:         $Author: joergr $
00021  *  Update Date:         $Date: 2010-10-14 13:16:29 $
00022  *  CVS/RCS Revision:    $Revision: 1.30 $
00023  *  Status:              $State: Exp $
00024  *
00025  *  CVS/RCS Log at end of file
00026  *
00027  */
00028 
00029 
00030 #ifndef DICOIMG_H
00031 #define DICOIMG_H
00032 
00033 #include "dcmtk/config/osconfig.h"
00034 
00035 #include "dcmtk/dcmimgle/diimage.h"
00036 #include "dcmtk/dcmimage/dicopx.h"
00037 
00038 
00039 /*------------------------*
00040  *  forward declarations  *
00041  *------------------------*/
00042 
00043 class DiColorOutputPixel;
00044 
00045 
00046 /*---------------------*
00047  *  class declaration  *
00048  *---------------------*/
00049 
00052 class DiColorImage
00053   : public DiImage
00054 {
00055 
00056  public:
00057 
00065     DiColorImage(const DiDocument *docu,
00066                  const EI_Status status,
00067                  const int spp,
00068                  const OFBool rgb = OFTrue);
00069 
00072     virtual ~DiColorImage();
00073 
00078     virtual EP_Interpretation getInternalColorModel() const
00079     {
00080         return (RGBColorModel) ? EPI_RGB : EPI_YBR_Full;
00081     }
00082 
00089     virtual unsigned long getOutputDataSize(const int bits = 0) const;
00090 
00103     const void *getOutputData(const unsigned long frame,
00104                               const int bits,
00105                               const int planar = 0);
00106 
00121     int getOutputData(void *buffer,
00122                       const unsigned long size,
00123                       const unsigned long frame,
00124                       const int bits,
00125                       const int planar = 0);
00126 
00134     const void *getOutputPlane(const int plane) const;
00135 
00139     void deleteOutputData();
00140 
00148     DiImage *createImage(const unsigned long fstart,
00149                          const unsigned long fcount) const;
00150 
00171     DiImage *createScale(const signed long left_pos,
00172                          const signed long top_pos,
00173                          const unsigned long src_cols,
00174                          const unsigned long src_rows,
00175                          const unsigned long dest_cols,
00176                          const unsigned long dest_rows,
00177                          const int interpolate,
00178                          const int aspect,
00179                          const Uint16 pvalue) const;
00180 
00190     int flip(const int horz,
00191              const int vert);
00192 
00200     DiImage *createFlip(const int horz,
00201                         const int vert) const;
00202 
00211     int rotate(const int degree);
00212 
00219     DiImage *createRotate(const int degree) const;
00220 
00229     DiImage *createMono(const double red,
00230                         const double green,
00231                         const double blue) const;
00232 
00237     const DiPixel *getInterData() const
00238     {
00239         return InterData;
00240     }
00241 
00246     const DiColorPixel *getColorInterData() const
00247     {
00248         return InterData;
00249     }
00250 
00263     unsigned long createDIB(void *&data,
00264                             const unsigned long size,
00265                             const unsigned long frame,
00266                             const int bits,
00267                             const int upsideDown,
00268                             const int padding = 1);
00269 
00279     unsigned long createAWTBitmap(void *&data,
00280                                   const unsigned long frame,
00281                                   const int bits);
00282 
00291     int writeImageToDataset(DcmItem &dataset,
00292                             const int mode,
00293                             const int planar);
00294 
00304     int writePPM(STD_NAMESPACE ostream& stream,
00305                  const unsigned long frame,
00306                  const int bits);
00307 
00317     int writePPM(FILE *stream,
00318                  const unsigned long frame,
00319                  const int bits);
00320 
00329     int writeRawPPM(FILE *stream,
00330                     const unsigned long frame,
00331                     const int bits);
00332 
00341     int writeBMP(FILE *stream,
00342                  const unsigned long frame,
00343                  const int bits);
00344 
00345 
00346  protected:
00347 
00354     DiColorImage(const DiColorImage *image,
00355                  const unsigned long fstart,
00356                  const unsigned long fcount);
00357 
00376     DiColorImage(const DiColorImage *image,
00377                  const signed long left_pos,
00378                  const signed long top_pos,
00379                  const Uint16 src_cols,
00380                  const Uint16 src_rows,
00381                  const Uint16 dest_cols,
00382                  const Uint16 dest_rows,
00383                  const int interpolate = 0,
00384                  const int aspect = 0);
00385 
00392     DiColorImage(const DiColorImage *image,
00393                  const int horz,
00394                  const int vert);
00395 
00401     DiColorImage(const DiColorImage *image,
00402                  const int degree);
00403 
00408     int checkInterData(const int mode = 1);
00409 
00421     const void *getData(void *buffer,
00422                         const unsigned long size,
00423                         const unsigned long frame,
00424                         const int bits,
00425                         const int planar);
00426 
00432     virtual void updateImagePixelModuleAttributes(DcmItem &dataset);
00433 
00435     const OFBool RGBColorModel;
00436 
00438     DiColorPixel *InterData;
00439 
00440 
00441  private:
00442 
00444     DiColorOutputPixel *OutputData;
00445 
00446  // --- declarations to avoid compiler warnings
00447 
00448     DiColorImage(const DiColorImage &);
00449     DiColorImage &operator=(const DiColorImage &);
00450 };
00451 
00452 
00453 #endif
00454 
00455 
00456 /*
00457  *
00458  * CVS/RCS Log:
00459  * $Log: dicoimg.h,v $
00460  * Revision 1.30  2010-10-14 13:16:29  joergr
00461  * Updated copyright header. Added reference to COPYRIGHT file.
00462  *
00463  * Revision 1.29  2010-03-01 09:08:46  uli
00464  * Removed some unnecessary include directives in the headers.
00465  *
00466  * Revision 1.28  2008-07-11 08:36:05  joergr
00467  * Fixed typo in API documentation.
00468  *
00469  * Revision 1.27  2008-05-20 10:38:50  joergr
00470  * Added new bilinear and bicubic scaling algorithms for image magnification.
00471  *
00472  * Revision 1.26  2008-05-13 10:03:08  joergr
00473  * Added new parameter to writeImageToDataset() in order to affect the planar
00474  * configuration of the output image/dataset. Changed behaviour: By default,
00475  * the output now uses the same planar configuration as the "original" image
00476  * (previously: always color-by-plane).
00477  *
00478  * Revision 1.25  2006/08/15 16:35:01  meichel
00479  * Updated the code in module dcmimage to correctly compile when
00480  *   all standard C++ classes remain in namespace std.
00481  *
00482  * Revision 1.24  2006/07/10 10:57:50  joergr
00483  * Added support for 32-bit BMP images.
00484  *
00485  * Revision 1.23  2005/12/08 16:01:30  meichel
00486  * Changed include path schema for all DCMTK header files
00487  *
00488  * Revision 1.22  2005/03/09 17:45:08  joergr
00489  * Added mode to writeImageToDataset() - only used for monochrome images.
00490  *
00491  * Revision 1.21  2004/07/20 18:13:16  joergr
00492  * Added API method to "officially" access the internal intermediate pixel data
00493  * representation (e.g. to get Hounsfield Units for CT images).
00494  *
00495  * Revision 1.20  2004/02/06 11:18:18  joergr
00496  * Distinguish more clearly between const and non-const access to pixel data.
00497  *
00498  * Revision 1.19  2003/12/17 18:10:56  joergr
00499  * Removed leading underscore characters from preprocessor symbols (reserved
00500  * symbols).
00501  *
00502  * Revision 1.18  2003/06/12 15:09:41  joergr
00503  * Fixed inconsistent API documentation reported by Doxygen.
00504  *
00505  * Revision 1.17  2003/05/20 09:26:05  joergr
00506  * Added method returning the number of bytes required to store a single
00507  * rendered frame: getOutputDataSize().
00508  *
00509  * Revision 1.16  2002/12/09 13:37:51  joergr
00510  * Renamed parameter/local variable to avoid name clashes with global
00511  * declaration left and/or right (used for as iostream manipulators).
00512  *
00513  * Revision 1.15  2002/08/02 15:07:02  joergr
00514  * Added function to write the current image (not only a selected frame) to a
00515  * DICOM dataset.
00516  *
00517  * Revision 1.14  2002/01/29 17:07:07  joergr
00518  * Added optional flag to the "Windows DIB" methods allowing to switch off the
00519  * scanline padding.
00520  *
00521  * Revision 1.13  2001/11/27 18:22:17  joergr
00522  * Added support for plugable output formats in class DicomImage. First
00523  * implementation is JPEG.
00524  *
00525  * Revision 1.12  2001/11/09 16:38:36  joergr
00526  * Added support for Windows BMP file format.
00527  * Enhanced and renamed createTrueColorDIB() method.
00528  * Updated/Enhanced comments.
00529  *
00530  * Revision 1.11  2001/09/28 13:55:40  joergr
00531  * Added new flag (CIF_KeepYCbCrColorModel) which avoids conversion of YCbCr
00532  * color models to RGB.
00533  *
00534  * Revision 1.10  2001/06/01 15:49:28  meichel
00535  * Updated copyright header
00536  *
00537  * Revision 1.9  2000/03/08 16:21:50  meichel
00538  * Updated copyright header.
00539  *
00540  * Revision 1.8  1999/08/25 16:58:06  joergr
00541  * Added new feature: Allow clipping region to be outside the image
00542  * (overlapping).
00543  *
00544  * Revision 1.7  1999/04/28 12:51:57  joergr
00545  * Corrected some typos, comments and formatting.
00546  *
00547  * Revision 1.6  1999/01/20 14:39:52  joergr
00548  * Added new output method to fill external memory buffer with rendered pixel
00549  * data.
00550  *
00551  * Revision 1.5  1998/11/27 13:43:29  joergr
00552  * Added methods and constructors for flipping and rotating, changed for
00553  * scaling and clipping.
00554  *
00555  * Revision 1.4  1998/07/01 08:39:18  joergr
00556  * Minor changes to avoid compiler warnings (gcc 2.8.1 with additional
00557  * options), e.g. add copy constructors.
00558  *
00559  * Revision 1.3  1998/05/11 14:53:11  joergr
00560  * Added CVS/RCS header to each file.
00561  *
00562  *
00563  */


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