00001 /* 00002 * 00003 * Copyright (C) 1996-2005, 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: dcmimage 00019 * 00020 * Author: Joerg Riesmeier 00021 * 00022 * Purpose: DicomColorImage (Header) 00023 * 00024 * Last Update: $Author: meichel $ 00025 * Update Date: $Date: 2005/12/08 16:01:30 $ 00026 * CVS/RCS Revision: $Revision: 1.23 $ 00027 * Status: $State: Exp $ 00028 * 00029 * CVS/RCS Log at end of file 00030 * 00031 */ 00032 00033 00034 #ifndef DICOIMG_H 00035 #define DICOIMG_H 00036 00037 #include "dcmtk/config/osconfig.h" 00038 #include "dcmtk/dcmdata/dctypes.h" 00039 00040 #include "dcmtk/dcmimgle/diimage.h" 00041 #include "dcmtk/dcmimage/dicopx.h" 00042 #include "dcmtk/dcmimgle/diutils.h" 00043 00044 00045 /*------------------------* 00046 * forward declarations * 00047 *------------------------*/ 00048 00049 class DiColorOutputPixel; 00050 00051 00052 /*---------------------* 00053 * class declaration * 00054 *---------------------*/ 00055 00058 class DiColorImage 00059 : public DiImage 00060 { 00061 00062 public: 00063 00071 DiColorImage(const DiDocument *docu, 00072 const EI_Status status, 00073 const int spp, 00074 const OFBool rgb = OFTrue); 00075 00078 virtual ~DiColorImage(); 00079 00084 virtual EP_Interpretation getInternalColorModel() const 00085 { 00086 return (RGBColorModel) ? EPI_RGB : EPI_YBR_Full; 00087 } 00088 00095 virtual unsigned long getOutputDataSize(const int bits = 0) const; 00096 00109 const void *getOutputData(const unsigned long frame, 00110 const int bits, 00111 const int planar = 0); 00112 00127 int getOutputData(void *buffer, 00128 const unsigned long size, 00129 const unsigned long frame, 00130 const int bits, 00131 const int planar = 0); 00132 00140 const void *getOutputPlane(const int plane) const; 00141 00145 void deleteOutputData(); 00146 00154 DiImage *createImage(const unsigned long fstart, 00155 const unsigned long fcount) const; 00156 00175 DiImage *createScale(const signed long left_pos, 00176 const signed long top_pos, 00177 const unsigned long src_cols, 00178 const unsigned long src_rows, 00179 const unsigned long dest_cols, 00180 const unsigned long dest_rows, 00181 const int interpolate, 00182 const int aspect, 00183 const Uint16 pvalue) const; 00184 00194 int flip(const int horz, 00195 const int vert); 00196 00204 DiImage *createFlip(const int horz, 00205 const int vert) const; 00206 00215 int rotate(const int degree); 00216 00223 DiImage *createRotate(const int degree) const; 00224 00233 DiImage *createMono(const double red, 00234 const double green, 00235 const double blue) const; 00236 00241 const DiPixel *getInterData() const 00242 { 00243 return InterData; 00244 } 00245 00250 const DiColorPixel *getColorInterData() const 00251 { 00252 return InterData; 00253 } 00254 00267 unsigned long createDIB(void *&data, 00268 const unsigned long size, 00269 const unsigned long frame, 00270 const int bits, 00271 const int upsideDown, 00272 const int padding = 1); 00273 00283 unsigned long createAWTBitmap(void *&data, 00284 const unsigned long frame, 00285 const int bits); 00286 00294 int writeImageToDataset(DcmItem &dataset, 00295 const int mode); 00296 00306 int writePPM(ostream &stream, 00307 const unsigned long frame, 00308 const int bits); 00309 00319 int writePPM(FILE *stream, 00320 const unsigned long frame, 00321 const int bits); 00322 00331 int writeRawPPM(FILE *stream, 00332 const unsigned long frame, 00333 const int bits); 00334 00343 int writeBMP(FILE *stream, 00344 const unsigned long frame, 00345 const int bits); 00346 00347 00348 protected: 00349 00356 DiColorImage(const DiColorImage *image, 00357 const unsigned long fstart, 00358 const unsigned long fcount); 00359 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.23 2005/12/08 16:01:30 meichel 00461 * Changed include path schema for all DCMTK header files 00462 * 00463 * Revision 1.22 2005/03/09 17:45:08 joergr 00464 * Added mode to writeImageToDataset() - only used for monochrome images. 00465 * 00466 * Revision 1.21 2004/07/20 18:13:16 joergr 00467 * Added API method to "officially" access the internal intermediate pixel data 00468 * representation (e.g. to get Hounsfield Units for CT images). 00469 * 00470 * Revision 1.20 2004/02/06 11:18:18 joergr 00471 * Distinguish more clearly between const and non-const access to pixel data. 00472 * 00473 * Revision 1.19 2003/12/17 18:10:56 joergr 00474 * Removed leading underscore characters from preprocessor symbols (reserved 00475 * symbols). 00476 * 00477 * Revision 1.18 2003/06/12 15:09:41 joergr 00478 * Fixed inconsistent API documentation reported by Doxygen. 00479 * 00480 * Revision 1.17 2003/05/20 09:26:05 joergr 00481 * Added method returning the number of bytes required to store a single 00482 * rendered frame: getOutputDataSize(). 00483 * 00484 * Revision 1.16 2002/12/09 13:37:51 joergr 00485 * Renamed parameter/local variable to avoid name clashes with global 00486 * declaration left and/or right (used for as iostream manipulators). 00487 * 00488 * Revision 1.15 2002/08/02 15:07:02 joergr 00489 * Added function to write the current image (not only a selected frame) to a 00490 * DICOM dataset. 00491 * 00492 * Revision 1.14 2002/01/29 17:07:07 joergr 00493 * Added optional flag to the "Windows DIB" methods allowing to switch off the 00494 * scanline padding. 00495 * 00496 * Revision 1.13 2001/11/27 18:22:17 joergr 00497 * Added support for plugable output formats in class DicomImage. First 00498 * implementation is JPEG. 00499 * 00500 * Revision 1.12 2001/11/09 16:38:36 joergr 00501 * Added support for Windows BMP file format. 00502 * Enhanced and renamed createTrueColorDIB() method. 00503 * Updated/Enhanced comments. 00504 * 00505 * Revision 1.11 2001/09/28 13:55:40 joergr 00506 * Added new flag (CIF_KeepYCbCrColorModel) which avoids conversion of YCbCr 00507 * color models to RGB. 00508 * 00509 * Revision 1.10 2001/06/01 15:49:28 meichel 00510 * Updated copyright header 00511 * 00512 * Revision 1.9 2000/03/08 16:21:50 meichel 00513 * Updated copyright header. 00514 * 00515 * Revision 1.8 1999/08/25 16:58:06 joergr 00516 * Added new feature: Allow clipping region to be outside the image 00517 * (overlapping). 00518 * 00519 * Revision 1.7 1999/04/28 12:51:57 joergr 00520 * Corrected some typos, comments and formatting. 00521 * 00522 * Revision 1.6 1999/01/20 14:39:52 joergr 00523 * Added new output method to fill external memory buffer with rendered pixel 00524 * data. 00525 * 00526 * Revision 1.5 1998/11/27 13:43:29 joergr 00527 * Added methods and constructors for flipping and rotating, changed for 00528 * scaling and clipping. 00529 * 00530 * Revision 1.4 1998/07/01 08:39:18 joergr 00531 * Minor changes to avoid compiler warnings (gcc 2.8.1 with additional 00532 * options), e.g. add copy constructors. 00533 * 00534 * Revision 1.3 1998/05/11 14:53:11 joergr 00535 * Added CVS/RCS header to each file. 00536 * 00537 * 00538 */