00001 /* 00002 * 00003 * Copyright (C) 1996-2010, OFFIS e.V. 00004 * All rights reserved. See COPYRIGHT file for details. 00005 * 00006 * This software and supporting documentation were developed by 00007 * 00008 * OFFIS e.V. 00009 * R&D Division Health 00010 * Escherweg 2 00011 * D-26121 Oldenburg, Germany 00012 * 00013 * 00014 * Module: dcmimgle 00015 * 00016 * Author: Joerg Riesmeier 00017 * 00018 * Purpose: DicomTransTemplate (Header) 00019 * 00020 * Last Update: $Author: joergr $ 00021 * Update Date: $Date: 2010-10-14 13:16:27 $ 00022 * CVS/RCS Revision: $Revision: 1.17 $ 00023 * Status: $State: Exp $ 00024 * 00025 * CVS/RCS Log at end of file 00026 * 00027 */ 00028 00029 00030 #ifndef DITRANST_H 00031 #define DITRANST_H 00032 00033 #include "dcmtk/config/osconfig.h" 00034 #include "dcmtk/ofstd/oftypes.h" 00035 #include "dcmtk/ofstd/ofcast.h" 00036 00037 #include "dcmtk/ofstd/ofbmanip.h" 00038 00039 #include "dcmtk/dcmimgle/diutils.h" 00040 00041 00042 /*---------------------* 00043 * class declaration * 00044 *---------------------*/ 00045 00049 template<class T> 00050 class DiTransTemplate 00051 { 00052 00053 protected: 00054 00065 DiTransTemplate(const int planes, 00066 const Uint16 src_x, 00067 const Uint16 src_y, 00068 const Uint16 dest_x, 00069 const Uint16 dest_y, 00070 const Uint32 frames, 00071 const int bits = 0) 00072 : Planes(planes), 00073 Src_X(src_x), 00074 Src_Y(src_y), 00075 Dest_X(dest_x), 00076 Dest_Y(dest_y), 00077 Frames(frames), 00078 Bits(((bits < 1) || (bits > OFstatic_cast(int, bitsof(T)))) ? OFstatic_cast(int, bitsof(T)) : bits) 00079 { 00080 } 00081 00084 virtual ~DiTransTemplate() 00085 { 00086 } 00087 00093 inline void copyPixel(const T *src[], 00094 T *dest[]) 00095 { 00096 const unsigned long count = OFstatic_cast(unsigned long, Dest_X) * OFstatic_cast(unsigned long, Dest_Y) * Frames; 00097 for (int j = 0; j < Planes; ++j) 00098 OFBitmanipTemplate<T>::copyMem(src[j], dest[j], count); 00099 } 00100 00106 inline void fillPixel(T *dest[], 00107 const T value) 00108 { 00109 const unsigned long count = OFstatic_cast(unsigned long, Dest_X) * OFstatic_cast(unsigned long, Dest_Y) * Frames; 00110 for (int j = 0; j < Planes; ++j) 00111 OFBitmanipTemplate<T>::setMem(dest[j], value, count); 00112 } 00113 00118 inline void clearPixel(T *dest[]) 00119 { 00120 const unsigned long count = OFstatic_cast(unsigned long, Dest_X) * OFstatic_cast(unsigned long, Dest_Y) * Frames; 00121 for (int j = 0; j < Planes; ++j) 00122 OFBitmanipTemplate<T>::zeroMem(dest[j], count); 00123 } 00124 00125 00127 /*const*/ int Planes; // allow later changing to avoid warnings on Irix 00128 00130 /*const*/ Uint16 Src_X; // add 'const' when interpolated scaling with clipping is fully implemented 00132 /*const*/ Uint16 Src_Y; // ... dito ... 00134 const Uint16 Dest_X; 00136 const Uint16 Dest_Y; 00137 00139 const Uint32 Frames; 00141 const int Bits; 00142 }; 00143 00144 00145 #endif 00146 00147 00148 /* 00149 * 00150 * CVS/RCS Log: 00151 * $Log: ditranst.h,v $ 00152 * Revision 1.17 2010-10-14 13:16:27 joergr 00153 * Updated copyright header. Added reference to COPYRIGHT file. 00154 * 00155 * Revision 1.16 2010-03-01 09:08:47 uli 00156 * Removed some unnecessary include directives in the headers. 00157 * 00158 * Revision 1.15 2008-05-20 10:07:31 joergr 00159 * Added new method that clears the destination image (set pixel values to 0). 00160 * 00161 * Revision 1.14 2005/12/08 16:48:11 meichel 00162 * Changed include path schema for all DCMTK header files 00163 * 00164 * Revision 1.13 2003/12/23 15:53:22 joergr 00165 * Replaced post-increment/decrement operators by pre-increment/decrement 00166 * operators where appropriate (e.g. 'i++' by '++i'). 00167 * 00168 * Revision 1.12 2003/12/08 18:51:26 joergr 00169 * Adapted type casts to new-style typecast operators defined in ofcast.h. 00170 * Removed leading underscore characters from preprocessor symbols (reserved 00171 * symbols). Updated copyright header. 00172 * 00173 * Revision 1.11 2003/06/02 17:08:07 joergr 00174 * Added include statement for "diutils.h". 00175 * 00176 * Revision 1.10 2001/06/01 15:49:52 meichel 00177 * Updated copyright header 00178 * 00179 * Revision 1.9 2000/03/08 16:24:25 meichel 00180 * Updated copyright header. 00181 * 00182 * Revision 1.8 2000/03/02 12:51:37 joergr 00183 * Rewrote variable initialization in class contructors to avoid warnings 00184 * reported on Irix. 00185 * 00186 * Revision 1.7 1999/09/17 13:08:12 joergr 00187 * Added/changed/completed DOC++ style comments in the header files. 00188 * 00189 * Revision 1.6 1999/08/25 16:41:56 joergr 00190 * Added new feature: Allow clipping region to be outside the image 00191 * (overlapping). 00192 * 00193 * Revision 1.5 1999/05/03 11:09:32 joergr 00194 * Minor code purifications to keep Sun CC 2.0.1 quiet. 00195 * 00196 * Revision 1.4 1999/03/24 17:20:27 joergr 00197 * Added/Modified comments and formatting. 00198 * 00199 * Revision 1.3 1999/02/11 16:42:52 joergr 00200 * Corrected some typos and formatting. 00201 * 00202 * Revision 1.2 1998/12/22 14:42:23 joergr 00203 * Removed const declaration (as long as interpolated scaling isn't completed). 00204 * 00205 * Revision 1.1 1998/11/27 15:48:10 joergr 00206 * Added copyright message. 00207 * Added support for new bit manipulation class. 00208 * 00209 * Revision 1.2 1998/05/11 14:53:30 joergr 00210 * Added CVS/RCS header to each file. 00211 * 00212 * 00213 */