00001 /* 00002 * 00003 * Copyright (C) 1998-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: dcmimage 00015 * 00016 * Author: Joerg Riesmeier 00017 * 00018 * Purpose: DicomColorFlipTemplate (Header) 00019 * 00020 * Last Update: $Author: joergr $ 00021 * Update Date: $Date: 2010-10-14 13:16:29 $ 00022 * CVS/RCS Revision: $Revision: 1.15 $ 00023 * Status: $State: Exp $ 00024 * 00025 * CVS/RCS Log at end of file 00026 * 00027 */ 00028 00029 00030 #ifndef DICOFLT_H 00031 #define DICOFLT_H 00032 00033 #include "dcmtk/config/osconfig.h" 00034 00035 #include "dcmtk/dcmimage/dicopxt.h" 00036 #include "dcmtk/dcmimgle/diflipt.h" 00037 00038 00039 /*---------------------* 00040 * class declaration * 00041 *---------------------*/ 00042 00046 template<class T> 00047 class DiColorFlipTemplate 00048 : public DiColorPixelTemplate<T>, 00049 protected DiFlipTemplate<T> 00050 { 00051 00052 public: 00053 00063 DiColorFlipTemplate(const DiColorPixel *pixel, 00064 const Uint16 columns, 00065 const Uint16 rows, 00066 const Uint32 frames, 00067 const int horz, 00068 const int vert) 00069 : DiColorPixelTemplate<T>(pixel, OFstatic_cast(unsigned long, columns) * OFstatic_cast(unsigned long, rows) * frames), 00070 DiFlipTemplate<T>(3, columns, rows, frames) 00071 { 00072 if ((pixel != NULL) && (pixel->getCount() > 0)) 00073 { 00074 if (pixel->getCount() == OFstatic_cast(unsigned long, columns) * OFstatic_cast(unsigned long, rows) * frames) 00075 flip(OFstatic_cast(const T **, OFconst_cast(void *, pixel->getData())), horz, vert); 00076 else { 00077 DCMIMAGE_WARN("could not flip image ... corrupted data"); 00078 } 00079 } 00080 } 00081 00084 ~DiColorFlipTemplate() 00085 { 00086 } 00087 00088 00089 private: 00090 00097 inline void flip(const T *pixel[3], 00098 const int horz, 00099 const int vert) 00100 { 00101 if (Init(pixel)) 00102 { 00103 if (horz && vert) 00104 flipHorzVert(pixel, this->Data); 00105 else if (horz) 00106 flipHorz(pixel, this->Data); 00107 else if (vert) 00108 flipVert(pixel, this->Data); 00109 } 00110 } 00111 }; 00112 00113 00114 #endif 00115 00116 00117 /* 00118 * 00119 * CVS/RCS Log: 00120 * $Log: dicoflt.h,v $ 00121 * Revision 1.15 2010-10-14 13:16:29 joergr 00122 * Updated copyright header. Added reference to COPYRIGHT file. 00123 * 00124 * Revision 1.14 2010-03-01 09:08:46 uli 00125 * Removed some unnecessary include directives in the headers. 00126 * 00127 * Revision 1.13 2009-10-14 10:25:13 joergr 00128 * Fixed minor issues in log output. Also updated copyright date (if required). 00129 * 00130 * Revision 1.12 2009-10-13 14:08:33 uli 00131 * Switched to logging mechanism provided by the "new" oflog module 00132 * 00133 * Revision 1.11 2006-08-15 16:35:01 meichel 00134 * Updated the code in module dcmimage to correctly compile when 00135 * all standard C++ classes remain in namespace std. 00136 * 00137 * Revision 1.10 2005/12/08 16:01:29 meichel 00138 * Changed include path schema for all DCMTK header files 00139 * 00140 * Revision 1.9 2004/04/21 10:00:31 meichel 00141 * Minor modifications for compilation with gcc 3.4.0 00142 * 00143 * Revision 1.8 2004/02/06 11:18:18 joergr 00144 * Distinguish more clearly between const and non-const access to pixel data. 00145 * 00146 * Revision 1.7 2003/12/23 11:19:40 joergr 00147 * Adapted type casts to new-style typecast operators defined in ofcast.h. 00148 * Removed leading underscore characters from preprocessor symbols (reserved 00149 * symbols). Updated copyright header. 00150 * 00151 * Revision 1.6 2001/11/09 16:41:15 joergr 00152 * Updated/Enhanced comments. 00153 * Removed 'inline' specifier from certain methods. 00154 * 00155 * Revision 1.5 2001/06/01 15:49:28 meichel 00156 * Updated copyright header 00157 * 00158 * Revision 1.4 2000/12/08 14:06:01 joergr 00159 * Added new checking routines to avoid crashes when processing corrupted image 00160 * data. 00161 * 00162 * Revision 1.3 2000/03/08 16:21:49 meichel 00163 * Updated copyright header. 00164 * 00165 * Revision 1.2 1999/04/28 12:51:57 joergr 00166 * Corrected some typos, comments and formatting. 00167 * 00168 * Revision 1.1 1998/11/27 14:59:36 joergr 00169 * Added copyright message. 00170 * Added methods and classes for flipping and rotating, changed for 00171 * scaling and clipping. 00172 * 00173 * Revision 1.4 1998/05/11 14:53:19 joergr 00174 * Added CVS/RCS header to each file. 00175 * 00176 * 00177 */