00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
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
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
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
00484
00485 DiDisplayFunction(const DiDisplayFunction &);
00486 DiDisplayFunction &operator=(const DiDisplayFunction &);
00487 };
00488
00489
00490 #endif
00491
00492
00493
00494
00495
00496
00497
00498
00499
00500
00501
00502
00503
00504
00505
00506
00507
00508
00509
00510
00511
00512
00513
00514
00515
00516
00517
00518
00519
00520
00521
00522
00523
00524
00525
00526
00527
00528
00529
00530
00531
00532
00533
00534
00535
00536
00537
00538
00539
00540
00541
00542
00543
00544
00545
00546
00547
00548
00549
00550
00551
00552
00553
00554
00555
00556
00557
00558
00559
00560
00561
00562
00563
00564
00565
00566
00567
00568
00569
00570
00571
00572
00573
00574
00575
00576
00577