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: DicomTransTemplate (Header) 00023 * 00024 * Last Update: $Author: meichel $ 00025 * Update Date: $Date: 2005/12/08 16:48:11 $ 00026 * CVS/RCS Revision: $Revision: 1.14 $ 00027 * Status: $State: Exp $ 00028 * 00029 * CVS/RCS Log at end of file 00030 * 00031 */ 00032 00033 00034 #ifndef DITRANST_H 00035 #define DITRANST_H 00036 00037 #include "dcmtk/config/osconfig.h" 00038 #include "dcmtk/dcmdata/dctypes.h" 00039 #include "dcmtk/ofstd/ofcast.h" 00040 00041 #include "dcmtk/dcmimgle/diutils.h" 00042 #include "dcmtk/ofstd/ofbmanip.h" 00043 00044 00045 /*---------------------* 00046 * class declaration * 00047 *---------------------*/ 00048 00052 template<class T> 00053 class DiTransTemplate 00054 { 00055 00056 protected: 00057 00068 DiTransTemplate(const int planes, 00069 const Uint16 src_x, 00070 const Uint16 src_y, 00071 const Uint16 dest_x, 00072 const Uint16 dest_y, 00073 const Uint32 frames, 00074 const int bits = 0) 00075 : Planes(planes), 00076 Src_X(src_x), 00077 Src_Y(src_y), 00078 Dest_X(dest_x), 00079 Dest_Y(dest_y), 00080 Frames(frames), 00081 Bits(((bits < 1) || (bits > OFstatic_cast(int, bitsof(T)))) ? OFstatic_cast(int, bitsof(T)) : bits) 00082 { 00083 } 00084 00087 virtual ~DiTransTemplate() 00088 { 00089 } 00090 00096 inline void copyPixel(const T *src[], 00097 T *dest[]) 00098 { 00099 const unsigned long count = OFstatic_cast(unsigned long, Dest_X) * OFstatic_cast(unsigned long, Dest_Y) * Frames; 00100 for (int j = 0; j < Planes; ++j) 00101 OFBitmanipTemplate<T>::copyMem(src[j], dest[j], count); 00102 } 00103 00109 inline void fillPixel(T *dest[], 00110 const T value) 00111 { 00112 const unsigned long count = OFstatic_cast(unsigned long, Dest_X) * OFstatic_cast(unsigned long, Dest_Y) * Frames; 00113 for (int j = 0; j < Planes; ++j) 00114 OFBitmanipTemplate<T>::setMem(dest[j], value, count); 00115 } 00116 00117 00119 /*const*/ int Planes; // allow later changing to avoid warnings on Irix 00120 00122 /*const*/ Uint16 Src_X; // add 'const' when interpolated scaling with clipping is fully implemented 00124 /*const*/ Uint16 Src_Y; // ... dito ... 00126 const Uint16 Dest_X; 00128 const Uint16 Dest_Y; 00129 00131 const Uint32 Frames; 00133 const int Bits; 00134 }; 00135 00136 00137 #endif 00138 00139 00140 /* 00141 * 00142 * CVS/RCS Log: 00143 * $Log: ditranst.h,v $ 00144 * Revision 1.14 2005/12/08 16:48:11 meichel 00145 * Changed include path schema for all DCMTK header files 00146 * 00147 * Revision 1.13 2003/12/23 15:53:22 joergr 00148 * Replaced post-increment/decrement operators by pre-increment/decrement 00149 * operators where appropriate (e.g. 'i++' by '++i'). 00150 * 00151 * Revision 1.12 2003/12/08 18:51:26 joergr 00152 * Adapted type casts to new-style typecast operators defined in ofcast.h. 00153 * Removed leading underscore characters from preprocessor symbols (reserved 00154 * symbols). Updated copyright header. 00155 * 00156 * Revision 1.11 2003/06/02 17:08:07 joergr 00157 * Added include statement for "diutils.h". 00158 * 00159 * Revision 1.10 2001/06/01 15:49:52 meichel 00160 * Updated copyright header 00161 * 00162 * Revision 1.9 2000/03/08 16:24:25 meichel 00163 * Updated copyright header. 00164 * 00165 * Revision 1.8 2000/03/02 12:51:37 joergr 00166 * Rewrote variable initialization in class contructors to avoid warnings 00167 * reported on Irix. 00168 * 00169 * Revision 1.7 1999/09/17 13:08:12 joergr 00170 * Added/changed/completed DOC++ style comments in the header files. 00171 * 00172 * Revision 1.6 1999/08/25 16:41:56 joergr 00173 * Added new feature: Allow clipping region to be outside the image 00174 * (overlapping). 00175 * 00176 * Revision 1.5 1999/05/03 11:09:32 joergr 00177 * Minor code purifications to keep Sun CC 2.0.1 quiet. 00178 * 00179 * Revision 1.4 1999/03/24 17:20:27 joergr 00180 * Added/Modified comments and formatting. 00181 * 00182 * Revision 1.3 1999/02/11 16:42:52 joergr 00183 * Corrected some typos and formatting. 00184 * 00185 * Revision 1.2 1998/12/22 14:42:23 joergr 00186 * Removed const declaration (as long as interpolated scaling isn't completed). 00187 * 00188 * Revision 1.1 1998/11/27 15:48:10 joergr 00189 * Added copyright message. 00190 * Added support for new bit manipulation class. 00191 * 00192 * Revision 1.2 1998/05/11 14:53:30 joergr 00193 * Added CVS/RCS header to each file. 00194 * 00195 * 00196 */