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: dcmimgle 00015 * 00016 * Author: Joerg Riesmeier 00017 * 00018 * Purpose: DicomDisplayFunction (Header) 00019 * 00020 * Last Update: $Author: joergr $ 00021 * Update Date: $Date: 2010-10-14 13:16:26 $ 00022 * CVS/RCS Revision: $Revision: 1.25 $ 00023 * Status: $State: Exp $ 00024 * 00025 * CVS/RCS Log at end of file 00026 * 00027 */ 00028 00029 00030 #ifndef DIDISPFN_H 00031 #define DIDISPFN_H 00032 00033 #include "dcmtk/config/osconfig.h" 00034 00035 #include "dcmtk/ofstd/oftypes.h" 00036 00037 /*------------------------* 00038 * forward declarations * 00039 *------------------------*/ 00040 00041 class DiDisplayLUT; 00042 00043 00044 /*---------------------* 00045 * macro definitions * 00046 *---------------------*/ 00047 00048 #define MAX_DISPLAY_FUNCTIONS 2 00049 #define MAX_NUMBER_OF_TABLES 15 00050 #define WIDTH_OF_PVALUES 16 00051 00052 00053 /*---------------------* 00054 * class declaration * 00055 *---------------------*/ 00056 00060 class DiDisplayFunction 00061 { 00062 00063 public: 00064 00067 enum E_DeviceType 00068 { 00070 EDT_Monitor, 00072 EDT_Camera, 00074 EDT_Printer, 00076 EDT_Scanner 00077 }; 00078 00090 DiDisplayFunction(const char *filename, 00091 const E_DeviceType deviceType = EDT_Monitor, 00092 const signed int ord = -1); 00093 00105 DiDisplayFunction(const double *val_tab, 00106 const unsigned long count, 00107 const Uint16 max = 255, 00108 const E_DeviceType deviceType = EDT_Monitor, 00109 const signed int ord = 0); 00110 00123 DiDisplayFunction(const Uint16 *ddl_tab, 00124 const double *val_tab, 00125 const unsigned long count, 00126 const Uint16 max = 255, 00127 const E_DeviceType deviceType = EDT_Monitor, 00128 const signed int ord = 0); 00129 00140 DiDisplayFunction(const double val_min, 00141 const double val_max, 00142 const unsigned long count = 256, 00143 const E_DeviceType deviceType = EDT_Monitor, 00144 const signed int ord = 0); 00145 00148 virtual ~DiDisplayFunction(); 00149 00154 inline int isValid() const 00155 { 00156 return Valid; 00157 } 00158 00163 inline E_DeviceType getDeviceType() const 00164 { 00165 return DeviceType; 00166 } 00167 00173 inline Uint16 getMaxDDLValue() const 00174 { 00175 return MaxDDLValue; 00176 } 00177 00184 inline double getMinValue() const 00185 { 00186 return MinValue; 00187 } 00188 00195 inline double getMaxValue() const 00196 { 00197 return MaxValue; 00198 } 00199 00209 double getValueforDDL(const Uint16 ddl) const; 00210 00221 Uint16 getDDLforValue(const double value) const; 00222 00230 const DiDisplayLUT *getLookupTable(const int bits, 00231 unsigned long count = 0); 00232 00239 int deleteLookupTable(const int bits); 00240 00248 virtual int writeCurveData(const char *filename, 00249 const OFBool mode = OFTrue) = 0; 00250 00256 inline double getAmbientLightValue() const 00257 { 00258 return AmbientLight; 00259 } 00260 00270 virtual int setAmbientLightValue(const double value); 00271 00277 inline double getIlluminationValue() const 00278 { 00279 return Illumination; 00280 } 00281 00291 virtual int setIlluminationValue(const double value); 00292 00298 inline double getMinDensityValue() const 00299 { 00300 return MinDensity; 00301 } 00302 00311 virtual int setMinDensityValue(const double value); 00312 00318 inline double getMaxDensityValue() const 00319 { 00320 return MaxDensity; 00321 } 00322 00331 virtual int setMaxDensityValue(const double value); 00332 00338 double getMinLuminanceValue() const; 00339 00345 double getMaxLuminanceValue() const; 00346 00352 inline signed int getPolynomialOrder() const 00353 { 00354 return Order; 00355 } 00356 00365 double convertODtoLum(const double value, 00366 const OFBool useAmb = OFTrue) const; 00367 00377 static double convertODtoLum(const double value, 00378 const double ambient, 00379 const double illum); 00380 00381 00382 protected: 00383 00390 virtual DiDisplayLUT *getDisplayLUT(unsigned long count) = 0; 00391 00398 int readConfigFile(const char *filename); 00399 00407 int createSortedTable(const Uint16 *ddl_tab, 00408 const double *val_tab); 00409 00420 double *convertODtoLumTable(const double *od_tab, 00421 const unsigned long count, 00422 const OFBool useAmb); 00423 00426 int interpolateValues(); 00427 00432 int calculateMinMax(); 00433 00439 int checkMinMaxDensity() const; 00440 00442 int Valid; 00443 00445 const E_DeviceType DeviceType; 00446 00448 unsigned long ValueCount; 00450 Uint16 MaxDDLValue; 00452 signed int Order; 00453 00455 double AmbientLight; 00457 double Illumination; 00458 00460 double MinDensity; 00462 double MaxDensity; 00463 00465 Uint16 *DDLValue; 00467 double *LODValue; 00468 00470 double MinValue; 00472 double MaxValue; 00473 00475 static const int MinBits; 00477 static const int MaxBits; 00478 00480 DiDisplayLUT *LookupTable[MAX_NUMBER_OF_TABLES]; 00481 00482 00483 private: 00484 00485 // --- declarations to avoid compiler warnings 00486 00487 DiDisplayFunction(const DiDisplayFunction &); 00488 DiDisplayFunction &operator=(const DiDisplayFunction &); 00489 }; 00490 00491 00492 #endif 00493 00494 00495 /* 00496 * 00497 * CVS/RCS Log: 00498 * $Log: didispfn.h,v $ 00499 * Revision 1.25 2010-10-14 13:16:26 joergr 00500 * Updated copyright header. Added reference to COPYRIGHT file. 00501 * 00502 * Revision 1.24 2010-03-01 09:08:46 uli 00503 * Removed some unnecessary include directives in the headers. 00504 * 00505 * Revision 1.23 2005-12-08 16:47:37 meichel 00506 * Changed include path schema for all DCMTK header files 00507 * 00508 * Revision 1.22 2003/12/08 18:18:35 joergr 00509 * Removed leading underscore characters from preprocessor symbols (reserved 00510 * symbols). Updated CVS header. 00511 * 00512 * Revision 1.21 2003/03/12 14:56:14 joergr 00513 * Removed default value from parameter "useAmb" in method convertODtoLumTable. 00514 * 00515 * Revision 1.20 2003/02/12 11:35:16 joergr 00516 * Added Dmin/max support to CIELAB calibration routines. 00517 * 00518 * Revision 1.19 2003/02/11 16:32:02 joergr 00519 * Added two new functions to determine the luminance/OD value of a particular 00520 * DDL according to the device's characteristic curve and vice versa. 00521 * 00522 * Revision 1.18 2003/02/11 10:01:14 joergr 00523 * Added support for Dmin/max to calibration routines (required for printers). 00524 * 00525 * Revision 1.17 2002/07/19 08:24:21 joergr 00526 * Enhanced/corrected comments. 00527 * 00528 * Revision 1.16 2002/07/18 12:29:08 joergr 00529 * Added support for hardcopy and softcopy input devices (camera and scanner). 00530 * Added polygonal curve fitting algorithm as an alternate interpolation 00531 * method. 00532 * 00533 * Revision 1.15 2002/07/03 13:50:24 joergr 00534 * Fixed inconsistencies regarding the handling of ambient light. 00535 * 00536 * Revision 1.14 2002/07/02 16:23:42 joergr 00537 * Added support for hardcopy devices to the calibrated output routines. 00538 * 00539 * Revision 1.13 2001/06/01 15:49:40 meichel 00540 * Updated copyright header 00541 * 00542 * Revision 1.12 2000/03/08 16:24:15 meichel 00543 * Updated copyright header. 00544 * 00545 * Revision 1.11 2000/03/06 18:19:35 joergr 00546 * Moved get-method to base class, renamed method and made method virtual to 00547 * avoid hiding of methods (reported by Sun CC 4.2). 00548 * 00549 * Revision 1.10 1999/10/18 15:05:51 joergr 00550 * Enhanced command line tool dcmdspfn (added new options). 00551 * 00552 * Revision 1.9 1999/10/18 10:15:50 joergr 00553 * Moved min/max value determination to display function base class. Now the 00554 * actual min/max values are also used for GSDFunction (instead of first and 00555 * last luminance value). 00556 * 00557 * Revision 1.8 1999/09/17 12:08:24 joergr 00558 * Added/changed/completed DOC++ style comments in the header files. 00559 * 00560 * Revision 1.7 1999/09/10 08:45:18 joergr 00561 * Added support for CIELAB display function. 00562 * 00563 * Revision 1.6 1999/03/24 17:19:20 joergr 00564 * Added/Modified comments and formatting. 00565 * Added support for Barten transformation from 2 to 7 bits input (now: 2-16). 00566 * 00567 * Revision 1.5 1999/03/03 11:47:42 joergr 00568 * Added support to specify ambient light value (re: Barten transformation). 00569 * 00570 * Revision 1.4 1999/02/23 16:55:32 joergr 00571 * Added tool to export display curves to a text file. 00572 * 00573 * Revision 1.3 1999/02/11 15:44:22 joergr 00574 * Removed unused parameter / member variable. 00575 * 00576 * Revision 1.2 1999/02/05 16:43:12 joergr 00577 * Added optional parameter to method convertPValueToDDL to specify width 00578 * of output data (number of bits). 00579 * 00580 * Revision 1.1 1999/02/03 17:46:37 joergr 00581 * Added support for calibration according to Barten transformation (incl. 00582 * a DISPLAY file describing the monitor characteristic). 00583 * 00584 * 00585 */