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: dcmimgle 00019 * 00020 * Author: Joerg Riesmeier 00021 * 00022 * Purpose: DicomDisplayFunction (Header) 00023 * 00024 * Last Update: $Author: meichel $ 00025 * Update Date: $Date: 2005/12/08 16:47:37 $ 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 DIDISPFN_H 00035 #define DIDISPFN_H 00036 00037 #include "dcmtk/config/osconfig.h" 00038 00039 #include "dcmtk/dcmimgle/didislut.h" 00040 00041 00042 /*---------------------* 00043 * macro definitions * 00044 *---------------------*/ 00045 00046 #define MAX_DISPLAY_FUNCTIONS 2 00047 #define MAX_NUMBER_OF_TABLES 15 00048 #define WIDTH_OF_PVALUES 16 00049 00050 00051 /*---------------------* 00052 * class declaration * 00053 *---------------------*/ 00054 00058 class DiDisplayFunction 00059 { 00060 00061 public: 00062 00065 enum E_DeviceType 00066 { 00068 EDT_Monitor, 00070 EDT_Camera, 00072 EDT_Printer, 00074 EDT_Scanner 00075 }; 00076 00088 DiDisplayFunction(const char *filename, 00089 const E_DeviceType deviceType = EDT_Monitor, 00090 const signed int ord = -1); 00091 00103 DiDisplayFunction(const double *val_tab, 00104 const unsigned long count, 00105 const Uint16 max = 255, 00106 const E_DeviceType deviceType = EDT_Monitor, 00107 const signed int ord = 0); 00108 00121 DiDisplayFunction(const Uint16 *ddl_tab, 00122 const double *val_tab, 00123 const unsigned long count, 00124 const Uint16 max = 255, 00125 const E_DeviceType deviceType = EDT_Monitor, 00126 const signed int ord = 0); 00127 00138 DiDisplayFunction(const double val_min, 00139 const double val_max, 00140 const unsigned long count = 256, 00141 const E_DeviceType deviceType = EDT_Monitor, 00142 const signed int ord = 0); 00143 00146 virtual ~DiDisplayFunction(); 00147 00152 inline int isValid() const 00153 { 00154 return Valid; 00155 } 00156 00161 inline E_DeviceType getDeviceType() const 00162 { 00163 return DeviceType; 00164 } 00165 00171 inline Uint16 getMaxDDLValue() const 00172 { 00173 return MaxDDLValue; 00174 } 00175 00182 inline double getMinValue() const 00183 { 00184 return MinValue; 00185 } 00186 00193 inline double getMaxValue() const 00194 { 00195 return MaxValue; 00196 } 00197 00207 double getValueforDDL(const Uint16 ddl) const; 00208 00219 Uint16 getDDLforValue(const double value) const; 00220 00228 const DiDisplayLUT *getLookupTable(const int bits, 00229 unsigned long count = 0); 00230 00237 int deleteLookupTable(const int bits); 00238 00246 virtual int writeCurveData(const char *filename, 00247 const OFBool mode = OFTrue) = 0; 00248 00254 inline double getAmbientLightValue() const 00255 { 00256 return AmbientLight; 00257 } 00258 00268 virtual int setAmbientLightValue(const double value); 00269 00275 inline double getIlluminationValue() const 00276 { 00277 return Illumination; 00278 } 00279 00289 virtual int setIlluminationValue(const double value); 00290 00296 inline double getMinDensityValue() const 00297 { 00298 return MinDensity; 00299 } 00300 00309 virtual int setMinDensityValue(const double value); 00310 00316 inline double getMaxDensityValue() const 00317 { 00318 return MaxDensity; 00319 } 00320 00329 virtual int setMaxDensityValue(const double value); 00330 00336 double getMinLuminanceValue() const; 00337 00343 double getMaxLuminanceValue() const; 00344 00350 inline signed int getPolynomialOrder() const 00351 { 00352 return Order; 00353 } 00354 00363 double convertODtoLum(const double value, 00364 const OFBool useAmb = OFTrue) const; 00365 00375 static double convertODtoLum(const double value, 00376 const double ambient, 00377 const double illum); 00378 00379 00380 protected: 00381 00388 virtual DiDisplayLUT *getDisplayLUT(unsigned long count) = 0; 00389 00396 int readConfigFile(const char *filename); 00397 00405 int createSortedTable(const Uint16 *ddl_tab, 00406 const double *val_tab); 00407 00418 double *convertODtoLumTable(const double *od_tab, 00419 const unsigned long count, 00420 const OFBool useAmb); 00421 00424 int interpolateValues(); 00425 00430 int calculateMinMax(); 00431 00437 int checkMinMaxDensity() const; 00438 00440 int Valid; 00441 00443 const E_DeviceType DeviceType; 00444 00446 unsigned long ValueCount; 00448 Uint16 MaxDDLValue; 00450 signed int Order; 00451 00453 double AmbientLight; 00455 double Illumination; 00456 00458 double MinDensity; 00460 double MaxDensity; 00461 00463 Uint16 *DDLValue; 00465 double *LODValue; 00466 00468 double MinValue; 00470 double MaxValue; 00471 00473 static const int MinBits; 00475 static const int MaxBits; 00476 00478 DiDisplayLUT *LookupTable[MAX_NUMBER_OF_TABLES]; 00479 00480 00481 private: 00482 00483 // --- declarations to avoid compiler warnings 00484 00485 DiDisplayFunction(const DiDisplayFunction &); 00486 DiDisplayFunction &operator=(const DiDisplayFunction &); 00487 }; 00488 00489 00490 #endif 00491 00492 00493 /* 00494 * 00495 * CVS/RCS Log: 00496 * $Log: didispfn.h,v $ 00497 * Revision 1.23 2005/12/08 16:47:37 meichel 00498 * Changed include path schema for all DCMTK header files 00499 * 00500 * Revision 1.22 2003/12/08 18:18:35 joergr 00501 * Removed leading underscore characters from preprocessor symbols (reserved 00502 * symbols). Updated CVS header. 00503 * 00504 * Revision 1.21 2003/03/12 14:56:14 joergr 00505 * Removed default value from parameter "useAmb" in method convertODtoLumTable. 00506 * 00507 * Revision 1.20 2003/02/12 11:35:16 joergr 00508 * Added Dmin/max support to CIELAB calibration routines. 00509 * 00510 * Revision 1.19 2003/02/11 16:32:02 joergr 00511 * Added two new functions to determine the luminance/OD value of a particular 00512 * DDL according to the device's characteristic curve and vice versa. 00513 * 00514 * Revision 1.18 2003/02/11 10:01:14 joergr 00515 * Added support for Dmin/max to calibration routines (required for printers). 00516 * 00517 * Revision 1.17 2002/07/19 08:24:21 joergr 00518 * Enhanced/corrected comments. 00519 * 00520 * Revision 1.16 2002/07/18 12:29:08 joergr 00521 * Added support for hardcopy and softcopy input devices (camera and scanner). 00522 * Added polygonal curve fitting algorithm as an alternate interpolation 00523 * method. 00524 * 00525 * Revision 1.15 2002/07/03 13:50:24 joergr 00526 * Fixed inconsistencies regarding the handling of ambient light. 00527 * 00528 * Revision 1.14 2002/07/02 16:23:42 joergr 00529 * Added support for hardcopy devices to the calibrated output routines. 00530 * 00531 * Revision 1.13 2001/06/01 15:49:40 meichel 00532 * Updated copyright header 00533 * 00534 * Revision 1.12 2000/03/08 16:24:15 meichel 00535 * Updated copyright header. 00536 * 00537 * Revision 1.11 2000/03/06 18:19:35 joergr 00538 * Moved get-method to base class, renamed method and made method virtual to 00539 * avoid hiding of methods (reported by Sun CC 4.2). 00540 * 00541 * Revision 1.10 1999/10/18 15:05:51 joergr 00542 * Enhanced command line tool dcmdspfn (added new options). 00543 * 00544 * Revision 1.9 1999/10/18 10:15:50 joergr 00545 * Moved min/max value determination to display function base class. Now the 00546 * actual min/max values are also used for GSDFunction (instead of first and 00547 * last luminance value). 00548 * 00549 * Revision 1.8 1999/09/17 12:08:24 joergr 00550 * Added/changed/completed DOC++ style comments in the header files. 00551 * 00552 * Revision 1.7 1999/09/10 08:45:18 joergr 00553 * Added support for CIELAB display function. 00554 * 00555 * Revision 1.6 1999/03/24 17:19:20 joergr 00556 * Added/Modified comments and formatting. 00557 * Added support for Barten transformation from 2 to 7 bits input (now: 2-16). 00558 * 00559 * Revision 1.5 1999/03/03 11:47:42 joergr 00560 * Added support to specify ambient light value (re: Barten transformation). 00561 * 00562 * Revision 1.4 1999/02/23 16:55:32 joergr 00563 * Added tool to export display curves to a text file. 00564 * 00565 * Revision 1.3 1999/02/11 15:44:22 joergr 00566 * Removed unused parameter / member variable. 00567 * 00568 * Revision 1.2 1999/02/05 16:43:12 joergr 00569 * Added optional parameter to method convertPValueToDDL to specify width 00570 * of output data (number of bits). 00571 * 00572 * Revision 1.1 1999/02/03 17:46:37 joergr 00573 * Added support for calibration according to Barten transformation (incl. 00574 * a DISPLAY file describing the monitor characteristic). 00575 * 00576 * 00577 */