OFFIS DCMTK  Version 3.6.0
dicoimg.h
1 /*
2  *
3  * Copyright (C) 1996-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: dcmimage
15  *
16  * Author: Joerg Riesmeier
17  *
18  * Purpose: DicomColorImage (Header)
19  *
20  * Last Update: $Author: joergr $
21  * Update Date: $Date: 2010-10-14 13:16:29 $
22  * CVS/RCS Revision: $Revision: 1.30 $
23  * Status: $State: Exp $
24  *
25  * CVS/RCS Log at end of file
26  *
27  */
28 
29 
30 #ifndef DICOIMG_H
31 #define DICOIMG_H
32 
33 #include "dcmtk/config/osconfig.h"
34 
35 #include "dcmtk/dcmimgle/diimage.h"
36 #include "dcmtk/dcmimage/dicopx.h"
37 
38 
39 /*------------------------*
40  * forward declarations *
41  *------------------------*/
42 
43 class DiColorOutputPixel;
44 
45 
46 /*---------------------*
47  * class declaration *
48  *---------------------*/
49 
53  : public DiImage
54 {
55 
56  public:
57 
65  DiColorImage(const DiDocument *docu,
66  const EI_Status status,
67  const int spp,
68  const OFBool rgb = OFTrue);
69 
72  virtual ~DiColorImage();
73 
78  virtual EP_Interpretation getInternalColorModel() const
79  {
80  return (RGBColorModel) ? EPI_RGB : EPI_YBR_Full;
81  }
82 
89  virtual unsigned long getOutputDataSize(const int bits = 0) const;
90 
103  const void *getOutputData(const unsigned long frame,
104  const int bits,
105  const int planar = 0);
106 
121  int getOutputData(void *buffer,
122  const unsigned long size,
123  const unsigned long frame,
124  const int bits,
125  const int planar = 0);
126 
134  const void *getOutputPlane(const int plane) const;
135 
139  void deleteOutputData();
140 
148  DiImage *createImage(const unsigned long fstart,
149  const unsigned long fcount) const;
150 
171  DiImage *createScale(const signed long left_pos,
172  const signed long top_pos,
173  const unsigned long src_cols,
174  const unsigned long src_rows,
175  const unsigned long dest_cols,
176  const unsigned long dest_rows,
177  const int interpolate,
178  const int aspect,
179  const Uint16 pvalue) const;
180 
190  int flip(const int horz,
191  const int vert);
192 
200  DiImage *createFlip(const int horz,
201  const int vert) const;
202 
211  int rotate(const int degree);
212 
219  DiImage *createRotate(const int degree) const;
220 
229  DiImage *createMono(const double red,
230  const double green,
231  const double blue) const;
232 
237  const DiPixel *getInterData() const
238  {
239  return InterData;
240  }
241 
247  {
248  return InterData;
249  }
250 
263  unsigned long createDIB(void *&data,
264  const unsigned long size,
265  const unsigned long frame,
266  const int bits,
267  const int upsideDown,
268  const int padding = 1);
269 
279  unsigned long createAWTBitmap(void *&data,
280  const unsigned long frame,
281  const int bits);
282 
291  int writeImageToDataset(DcmItem &dataset,
292  const int mode,
293  const int planar);
294 
304  int writePPM(STD_NAMESPACE ostream& stream,
305  const unsigned long frame,
306  const int bits);
307 
317  int writePPM(FILE *stream,
318  const unsigned long frame,
319  const int bits);
320 
329  int writeRawPPM(FILE *stream,
330  const unsigned long frame,
331  const int bits);
332 
341  int writeBMP(FILE *stream,
342  const unsigned long frame,
343  const int bits);
344 
345 
346  protected:
347 
354  DiColorImage(const DiColorImage *image,
355  const unsigned long fstart,
356  const unsigned long fcount);
357 
376  DiColorImage(const DiColorImage *image,
377  const signed long left_pos,
378  const signed long top_pos,
379  const Uint16 src_cols,
380  const Uint16 src_rows,
381  const Uint16 dest_cols,
382  const Uint16 dest_rows,
383  const int interpolate = 0,
384  const int aspect = 0);
385 
392  DiColorImage(const DiColorImage *image,
393  const int horz,
394  const int vert);
395 
401  DiColorImage(const DiColorImage *image,
402  const int degree);
403 
408  int checkInterData(const int mode = 1);
409 
421  const void *getData(void *buffer,
422  const unsigned long size,
423  const unsigned long frame,
424  const int bits,
425  const int planar);
426 
432  virtual void updateImagePixelModuleAttributes(DcmItem &dataset);
433 
435  const OFBool RGBColorModel;
436 
439 
440 
441  private:
442 
445 
446  // --- declarations to avoid compiler warnings
447 
448  DiColorImage(const DiColorImage &);
449  DiColorImage &operator=(const DiColorImage &);
450 };
451 
452 
453 #endif
454 
455 
456 /*
457  *
458  * CVS/RCS Log:
459  * $Log: dicoimg.h,v $
460  * Revision 1.30 2010-10-14 13:16:29 joergr
461  * Updated copyright header. Added reference to COPYRIGHT file.
462  *
463  * Revision 1.29 2010-03-01 09:08:46 uli
464  * Removed some unnecessary include directives in the headers.
465  *
466  * Revision 1.28 2008-07-11 08:36:05 joergr
467  * Fixed typo in API documentation.
468  *
469  * Revision 1.27 2008-05-20 10:38:50 joergr
470  * Added new bilinear and bicubic scaling algorithms for image magnification.
471  *
472  * Revision 1.26 2008-05-13 10:03:08 joergr
473  * Added new parameter to writeImageToDataset() in order to affect the planar
474  * configuration of the output image/dataset. Changed behaviour: By default,
475  * the output now uses the same planar configuration as the "original" image
476  * (previously: always color-by-plane).
477  *
478  * Revision 1.25 2006/08/15 16:35:01 meichel
479  * Updated the code in module dcmimage to correctly compile when
480  * all standard C++ classes remain in namespace std.
481  *
482  * Revision 1.24 2006/07/10 10:57:50 joergr
483  * Added support for 32-bit BMP images.
484  *
485  * Revision 1.23 2005/12/08 16:01:30 meichel
486  * Changed include path schema for all DCMTK header files
487  *
488  * Revision 1.22 2005/03/09 17:45:08 joergr
489  * Added mode to writeImageToDataset() - only used for monochrome images.
490  *
491  * Revision 1.21 2004/07/20 18:13:16 joergr
492  * Added API method to "officially" access the internal intermediate pixel data
493  * representation (e.g. to get Hounsfield Units for CT images).
494  *
495  * Revision 1.20 2004/02/06 11:18:18 joergr
496  * Distinguish more clearly between const and non-const access to pixel data.
497  *
498  * Revision 1.19 2003/12/17 18:10:56 joergr
499  * Removed leading underscore characters from preprocessor symbols (reserved
500  * symbols).
501  *
502  * Revision 1.18 2003/06/12 15:09:41 joergr
503  * Fixed inconsistent API documentation reported by Doxygen.
504  *
505  * Revision 1.17 2003/05/20 09:26:05 joergr
506  * Added method returning the number of bytes required to store a single
507  * rendered frame: getOutputDataSize().
508  *
509  * Revision 1.16 2002/12/09 13:37:51 joergr
510  * Renamed parameter/local variable to avoid name clashes with global
511  * declaration left and/or right (used for as iostream manipulators).
512  *
513  * Revision 1.15 2002/08/02 15:07:02 joergr
514  * Added function to write the current image (not only a selected frame) to a
515  * DICOM dataset.
516  *
517  * Revision 1.14 2002/01/29 17:07:07 joergr
518  * Added optional flag to the "Windows DIB" methods allowing to switch off the
519  * scanline padding.
520  *
521  * Revision 1.13 2001/11/27 18:22:17 joergr
522  * Added support for plugable output formats in class DicomImage. First
523  * implementation is JPEG.
524  *
525  * Revision 1.12 2001/11/09 16:38:36 joergr
526  * Added support for Windows BMP file format.
527  * Enhanced and renamed createTrueColorDIB() method.
528  * Updated/Enhanced comments.
529  *
530  * Revision 1.11 2001/09/28 13:55:40 joergr
531  * Added new flag (CIF_KeepYCbCrColorModel) which avoids conversion of YCbCr
532  * color models to RGB.
533  *
534  * Revision 1.10 2001/06/01 15:49:28 meichel
535  * Updated copyright header
536  *
537  * Revision 1.9 2000/03/08 16:21:50 meichel
538  * Updated copyright header.
539  *
540  * Revision 1.8 1999/08/25 16:58:06 joergr
541  * Added new feature: Allow clipping region to be outside the image
542  * (overlapping).
543  *
544  * Revision 1.7 1999/04/28 12:51:57 joergr
545  * Corrected some typos, comments and formatting.
546  *
547  * Revision 1.6 1999/01/20 14:39:52 joergr
548  * Added new output method to fill external memory buffer with rendered pixel
549  * data.
550  *
551  * Revision 1.5 1998/11/27 13:43:29 joergr
552  * Added methods and constructors for flipping and rotating, changed for
553  * scaling and clipping.
554  *
555  * Revision 1.4 1998/07/01 08:39:18 joergr
556  * Minor changes to avoid compiler warnings (gcc 2.8.1 with additional
557  * options), e.g. add copy constructors.
558  *
559  * Revision 1.3 1998/05/11 14:53:11 joergr
560  * Added CVS/RCS header to each file.
561  *
562  *
563  */


Generated on Thu Dec 20 2012 for OFFIS DCMTK Version 3.6.0 by Doxygen 1.8.2