00001 /* 00002 * 00003 * Copyright (C) 1998-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: DicomColorFlipTemplate (Header) 00023 * 00024 * Last Update: $Author: meichel $ 00025 * Update Date: $Date: 2005/12/08 16:01:29 $ 00026 * CVS/RCS Revision: $Revision: 1.10 $ 00027 * Status: $State: Exp $ 00028 * 00029 * CVS/RCS Log at end of file 00030 * 00031 */ 00032 00033 00034 #ifndef DICOFLT_H 00035 #define DICOFLT_H 00036 00037 #include "dcmtk/config/osconfig.h" 00038 #include "dcmtk/dcmdata/dctypes.h" 00039 00040 #include "dcmtk/dcmimage/dicopxt.h" 00041 #include "dcmtk/dcmimgle/diflipt.h" 00042 00043 00044 /*---------------------* 00045 * class declaration * 00046 *---------------------*/ 00047 00051 template<class T> 00052 class DiColorFlipTemplate 00053 : public DiColorPixelTemplate<T>, 00054 protected DiFlipTemplate<T> 00055 { 00056 00057 public: 00058 00068 DiColorFlipTemplate(const DiColorPixel *pixel, 00069 const Uint16 columns, 00070 const Uint16 rows, 00071 const Uint32 frames, 00072 const int horz, 00073 const int vert) 00074 : DiColorPixelTemplate<T>(pixel, OFstatic_cast(unsigned long, columns) * OFstatic_cast(unsigned long, rows) * frames), 00075 DiFlipTemplate<T>(3, columns, rows, frames) 00076 { 00077 if ((pixel != NULL) && (pixel->getCount() > 0)) 00078 { 00079 if (pixel->getCount() == OFstatic_cast(unsigned long, columns) * OFstatic_cast(unsigned long, rows) * frames) 00080 flip(OFstatic_cast(const T **, OFconst_cast(void *, pixel->getData())), horz, vert); 00081 else { 00082 if (DicomImageClass::checkDebugLevel(DicomImageClass::DL_Warnings)) 00083 { 00084 ofConsole.lockCerr() << "WARNING: could not flip image ... corrupted data." << endl; 00085 ofConsole.unlockCerr(); 00086 } 00087 } 00088 } 00089 } 00090 00093 ~DiColorFlipTemplate() 00094 { 00095 } 00096 00097 00098 private: 00099 00106 inline void flip(const T *pixel[3], 00107 const int horz, 00108 const int vert) 00109 { 00110 if (Init(pixel)) 00111 { 00112 if (horz && vert) 00113 flipHorzVert(pixel, this->Data); 00114 else if (horz) 00115 flipHorz(pixel, this->Data); 00116 else if (vert) 00117 flipVert(pixel, this->Data); 00118 } 00119 } 00120 }; 00121 00122 00123 #endif 00124 00125 00126 /* 00127 * 00128 * CVS/RCS Log: 00129 * $Log: dicoflt.h,v $ 00130 * Revision 1.10 2005/12/08 16:01:29 meichel 00131 * Changed include path schema for all DCMTK header files 00132 * 00133 * Revision 1.9 2004/04/21 10:00:31 meichel 00134 * Minor modifications for compilation with gcc 3.4.0 00135 * 00136 * Revision 1.8 2004/02/06 11:18:18 joergr 00137 * Distinguish more clearly between const and non-const access to pixel data. 00138 * 00139 * Revision 1.7 2003/12/23 11:19:40 joergr 00140 * Adapted type casts to new-style typecast operators defined in ofcast.h. 00141 * Removed leading underscore characters from preprocessor symbols (reserved 00142 * symbols). Updated copyright header. 00143 * 00144 * Revision 1.6 2001/11/09 16:41:15 joergr 00145 * Updated/Enhanced comments. 00146 * Removed 'inline' specifier from certain methods. 00147 * 00148 * Revision 1.5 2001/06/01 15:49:28 meichel 00149 * Updated copyright header 00150 * 00151 * Revision 1.4 2000/12/08 14:06:01 joergr 00152 * Added new checking routines to avoid crashes when processing corrupted image 00153 * data. 00154 * 00155 * Revision 1.3 2000/03/08 16:21:49 meichel 00156 * Updated copyright header. 00157 * 00158 * Revision 1.2 1999/04/28 12:51:57 joergr 00159 * Corrected some typos, comments and formatting. 00160 * 00161 * Revision 1.1 1998/11/27 14:59:36 joergr 00162 * Added copyright message. 00163 * Added methods and classes for flipping and rotating, changed for 00164 * scaling and clipping. 00165 * 00166 * Revision 1.4 1998/05/11 14:53:19 joergr 00167 * Added CVS/RCS header to each file. 00168 * 00169 * 00170 */