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: dcmimage 00019 * 00020 * Author: Joerg Riesmeier 00021 * 00022 * Purpose: DicomColorScaleTemplate (Header) 00023 * 00024 * Last Update: $Author: meichel $ 00025 * Update Date: $Date: 2005/12/08 16:01:37 $ 00026 * CVS/RCS Revision: $Revision: 1.16 $ 00027 * Status: $State: Exp $ 00028 * 00029 * CVS/RCS Log at end of file 00030 * 00031 */ 00032 00033 00034 #ifndef DICOSCT_H 00035 #define DICOSCT_H 00036 00037 #include "dcmtk/config/osconfig.h" 00038 #include "dcmtk/dcmdata/dctypes.h" 00039 00040 #include "dcmtk/dcmimage/dicopx.h" 00041 #include "dcmtk/dcmimgle/discalet.h" 00042 00043 00044 /*---------------------* 00045 * class declaration * 00046 *---------------------*/ 00047 00050 template<class T> 00051 class DiColorScaleTemplate 00052 : public DiColorPixelTemplate<T>, 00053 protected DiScaleTemplate<T> 00054 { 00055 00056 public: 00057 00073 DiColorScaleTemplate(const DiColorPixel *pixel, 00074 const Uint16 columns, 00075 const Uint16 rows, 00076 const signed long left_pos, 00077 const signed long top_pos, 00078 const Uint16 src_cols, 00079 const Uint16 src_rows, 00080 const Uint16 dest_cols, 00081 const Uint16 dest_rows, 00082 const Uint32 frames, 00083 const int bits, 00084 const int interpolate) 00085 : DiColorPixelTemplate<T>(pixel, OFstatic_cast(unsigned long, dest_cols) * OFstatic_cast(unsigned long, dest_rows) * frames), 00086 DiScaleTemplate<T>(3, columns, rows, left_pos, top_pos, src_cols, src_rows, dest_cols, dest_rows, frames, bits) 00087 { 00088 if ((pixel != NULL) && (pixel->getCount() > 0)) 00089 { 00090 if (pixel->getCount() == OFstatic_cast(unsigned long, columns) * OFstatic_cast(unsigned long, rows) * frames) 00091 scale(OFstatic_cast(const T **, OFconst_cast(void *, pixel->getData())), interpolate); 00092 else { 00093 if (DicomImageClass::checkDebugLevel(DicomImageClass::DL_Warnings)) 00094 { 00095 ofConsole.lockCerr() << "WARNING: could not scale image ... corrupted data." << endl; 00096 ofConsole.unlockCerr(); 00097 } 00098 } 00099 } 00100 } 00101 00104 virtual ~DiColorScaleTemplate() 00105 { 00106 } 00107 00108 00109 private: 00110 00116 inline void scale(const T *pixel[3], 00117 const int interpolate) 00118 { 00119 if (Init(pixel)) 00120 scaleData(pixel, this->Data, interpolate); 00121 } 00122 }; 00123 00124 00125 #endif 00126 00127 00128 /* 00129 * 00130 * CVS/RCS Log: 00131 * $Log: dicosct.h,v $ 00132 * Revision 1.16 2005/12/08 16:01:37 meichel 00133 * Changed include path schema for all DCMTK header files 00134 * 00135 * Revision 1.15 2004/04/21 10:00:31 meichel 00136 * Minor modifications for compilation with gcc 3.4.0 00137 * 00138 * Revision 1.14 2004/02/06 11:18:18 joergr 00139 * Distinguish more clearly between const and non-const access to pixel data. 00140 * 00141 * Revision 1.13 2003/12/23 11:45:54 joergr 00142 * Adapted type casts to new-style typecast operators defined in ofcast.h. 00143 * Removed leading underscore characters from preprocessor symbols (reserved 00144 * symbols). Updated copyright header. 00145 * 00146 * Revision 1.12 2002/12/09 13:37:52 joergr 00147 * Renamed parameter/local variable to avoid name clashes with global 00148 * declaration left and/or right (used for as iostream manipulators). 00149 * 00150 * Revision 1.11 2001/11/09 16:45:23 joergr 00151 * Updated/Enhanced comments. 00152 * 00153 * Revision 1.10 2001/06/01 15:49:30 meichel 00154 * Updated copyright header 00155 * 00156 * Revision 1.9 2000/12/08 14:06:02 joergr 00157 * Added new checking routines to avoid crashes when processing corrupted image 00158 * data. 00159 * 00160 * Revision 1.8 2000/03/08 16:21:52 meichel 00161 * Updated copyright header. 00162 * 00163 * Revision 1.7 1999/08/25 16:58:06 joergr 00164 * Added new feature: Allow clipping region to be outside the image 00165 * (overlapping). 00166 * 00167 * Revision 1.6 1999/04/28 12:52:00 joergr 00168 * Corrected some typos, comments and formatting. 00169 * 00170 * Revision 1.5 1998/11/27 13:51:07 joergr 00171 * Added copyright message. 00172 * 00173 * Revision 1.4 1998/05/11 14:53:14 joergr 00174 * Added CVS/RCS header to each file. 00175 * 00176 * 00177 */