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 #ifndef DIDISPFN_H
00031 #define DIDISPFN_H
00032
00033 #include "dcmtk/config/osconfig.h"
00034
00035 #include "dcmtk/ofstd/oftypes.h"
00036
00037
00038
00039
00040
00041 class DiDisplayLUT;
00042
00043
00044
00045
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
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
00486
00487 DiDisplayFunction(const DiDisplayFunction &);
00488 DiDisplayFunction &operator=(const DiDisplayFunction &);
00489 };
00490
00491
00492 #endif
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
00578
00579
00580
00581
00582
00583
00584
00585