📄 didispfn.h
字号:
/* * * Copyright (C) 1996-2005, OFFIS * * This software and supporting documentation were developed by * * Kuratorium OFFIS e.V. * Healthcare Information and Communication Systems * Escherweg 2 * D-26121 Oldenburg, Germany * * THIS SOFTWARE IS MADE AVAILABLE, AS IS, AND OFFIS MAKES NO WARRANTY * REGARDING THE SOFTWARE, ITS PERFORMANCE, ITS MERCHANTABILITY OR * FITNESS FOR ANY PARTICULAR USE, FREEDOM FROM ANY COMPUTER DISEASES OR * ITS CONFORMITY TO ANY SPECIFICATION. THE ENTIRE RISK AS TO QUALITY AND * PERFORMANCE OF THE SOFTWARE IS WITH THE USER. * * Module: dcmimgle * * Author: Joerg Riesmeier * * Purpose: DicomDisplayFunction (Header) * * Last Update: $Author: meichel $ * Update Date: $Date: 2005/12/08 16:47:37 $ * CVS/RCS Revision: $Revision: 1.23 $ * Status: $State: Exp $ * * CVS/RCS Log at end of file * */#ifndef DIDISPFN_H#define DIDISPFN_H#include "dcmtk/config/osconfig.h"#include "dcmtk/dcmimgle/didislut.h"/*---------------------* * macro definitions * *---------------------*/#define MAX_DISPLAY_FUNCTIONS 2#define MAX_NUMBER_OF_TABLES 15#define WIDTH_OF_PVALUES 16/*---------------------* * class declaration * *---------------------*//** Class to handle hardcopy and softcopy device characteristics file * and manage display LUTs (for calibration) */class DiDisplayFunction{ public: /** output device type */ enum E_DeviceType { /// monitor (softcopy output device), values expected to be in luminance (cd/m^2) EDT_Monitor, /// camera (softcopy input device), values expected to be in luminance (cd/m^2) EDT_Camera, /// printer (hardcopy output device), values expected to be in optical density (OD) EDT_Printer, /// scanner (hardcopy input device), values expected to be in optical density (OD) EDT_Scanner }; /** constructor, read device characteristics file. * Keywords: "max" for maximum DDL (device driving level, required at first position) * "amb" for ambient light and "lum" for illumination (both optional) * "ord" for the order of the polynomial curve fitting algorithm used to interpolate * the given base points (0 or absent = use cubic spline interpolation) * ** @param filename name of the characteristics file (luminance/OD for each DDL) * @param deviceType type of the output device (default: monitor) * @param ord order of the polynomial curve fitting algorithm used to interpolate * the given base points (-1 = use file setting, 0 = cubic spline) */ DiDisplayFunction(const char *filename, const E_DeviceType deviceType = EDT_Monitor, const signed int ord = -1); /** constructor, use given array of luminance/OD values. UNTESTED * Values must be sorted and complete (i.e. there must be an entry for each DDL). * The given arrays are copied internally. * ** @param val_tab pointer to array with luminance/OD values * @param count number of array elements (should be equal to 'max + 1') * @param max maximum DDL (device driving level) * @param deviceType type of the output device (default: monitor) * @param ord order of the polynomial curve fitting algorithm used to interpolate * the given base points (0 or negative = use cubic spline interpolation) */ DiDisplayFunction(const double *val_tab, const unsigned long count, const Uint16 max = 255, const E_DeviceType deviceType = EDT_Monitor, const signed int ord = 0); /** constructor, use given array of DDL and luminance/OD values. UNTESTED * Values will be automatically sorted and missing values will be interpolated. * The given arrays are copied internally. * ** @param ddl_tab pointer to array with DDL values (must be with the interval 0..max) * @param val_tab pointer to array with luminance/OD values * @param count number of array elements (2..65536) * @param max maximum DDL (device driving level) * @param deviceType type of the output device (default: monitor) * @param ord order of the polynomial curve fitting algorithm used to interpolate * the given base points (0 or negative = use cubic spline interpolation) */ DiDisplayFunction(const Uint16 *ddl_tab, const double *val_tab, const unsigned long count, const Uint16 max = 255, const E_DeviceType deviceType = EDT_Monitor, const signed int ord = 0); /** constructor, compute luminance/OD values automatically within the specified range. * Initial values for hardcopy: "lum" = 2000, "amb" = 10, for softcopy: "amb" = 0. * ** @param val_min minimum luminance/OD value * @param val_max maximum luminance/OD value * @param count number of DDLs (device driving level, 1..65536) * @param deviceType type of the output device (default: monitor) * @param ord order of the polynomial curve fitting algorithm used to interpolate * the given base points (0 or negative = use cubic spline interpolation) */ DiDisplayFunction(const double val_min, const double val_max, const unsigned long count = 256, const E_DeviceType deviceType = EDT_Monitor, const signed int ord = 0); /** destructor */ virtual ~DiDisplayFunction(); /** check whether DisplayFunction is valid * ** @return status, true if valid, false otherwise */ inline int isValid() const { return Valid; } /** get output device type (monitor, camera, printer or scanner) * ** @return output device type */ inline E_DeviceType getDeviceType() const { return DeviceType; } /** get maximum DDL value. * The minimum DDL value is always 0. * ** @return maximum DDL value */ inline Uint16 getMaxDDLValue() const { return MaxDDLValue; } /** get minimum luminance/OD value from the characteristic curve. * In case of a usually monotonous characteristic curve the value is * equivalent to the first/last entry of the array. * ** @return minimum luminance/OD value, 0 in case of error */ inline double getMinValue() const { return MinValue; } /** get maximum luminance/OD value from the characteristic curve. * In case of a usually monotonous characteristic curve the value is * equivalent to the last/first entry of the array. * ** @return maximum luminance/OD value, 0 in case of error */ inline double getMaxValue() const { return MaxValue; } /** get the luminance/OD value for a given DDL. * Looks up a luminance/OD value in the device's characteristic curve. * Please note that neither ambient light/illumination nor min/max * densitity are used. * ** @param ddl DDL (device driving level) to be looked up * ** @return luminance/OD value if successful, -1 otherwise */ double getValueforDDL(const Uint16 ddl) const; /** get the DDL for a given luminance/OD value. * Determines the DDL from the device's characteristic curve which is * mapped to the closest possible luminance/OD value. * Please note that neither ambient light/illumination nor min/max * densitity are used. * ** @param value luminance/OD value to be looked up * ** @return DDL (device driving level) if successful, 0 otherwise */ Uint16 getDDLforValue(const double value) const; /** create look-up table with specified number of entries * ** @param bits depth of input values * @param count number of LUT entries (default: 0 = computed automatically) * ** @return pointer to created LUT if successful, NULL otherwise */ const DiDisplayLUT *getLookupTable(const int bits, unsigned long count = 0); /** delete specified LUT * ** @param bits depth of input values of the LUT to be deleted * ** @return status, true if valid, false otherwise */ int deleteLookupTable(const int bits); /** write curve data to a text file (abstract method) * ** @param filename name of the text file to which the data should be written * @param mode write CC and PSC to file if OFTrue * ** @return status, true if successful, false otherwise */ virtual int writeCurveData(const char *filename, const OFBool mode = OFTrue) = 0; /** get (reflected) ambient light value. * measured in cd/m^2. * ** @return current ambient light value */ inline double getAmbientLightValue() const { return AmbientLight; } /** set (reflected) ambient light value. * measured in cd/m^2. applicable to softcopy and hardcopy devices. * typical values: 0.5-5 for softcopy devices, 10 for transmissive hardcopy * printer and 0 for reflective hardcopy printers. * ** @param value ambient light value to be set (>= 0) * ** @return status, true if successful, false otherwise */ virtual int setAmbientLightValue(const double value); /** get illumination value. * measured in cd/m^2. * ** @return current illumination value */ inline double getIlluminationValue() const { return Illumination; } /** set illumination value. * measured in cd/m^2. applicable to hardcopy devices only. * typical values: 2000 for transmissive hardcopy printer and 150 for * reflective hardcopy printers. * ** @param value illumination value to be set (>= 0) * ** @return status, true if successful, false otherwise */ virtual int setIlluminationValue(const double value);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -