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: DicomMonochromeRotateTemplate (Header) 00019 * 00020 * Last Update: $Author: joergr $ 00021 * Update Date: $Date: 2010-10-14 13:16:26 $ 00022 * CVS/RCS Revision: $Revision: 1.16 $ 00023 * Status: $State: Exp $ 00024 * 00025 * CVS/RCS Log at end of file 00026 * 00027 */ 00028 00029 00030 #ifndef DIMOROT_H 00031 #define DIMOROT_H 00032 00033 #include "dcmtk/config/osconfig.h" 00034 #include "dcmtk/ofstd/ofcast.h" 00035 00036 #include "dcmtk/dcmimgle/dimopxt.h" 00037 #include "dcmtk/dcmimgle/dirotat.h" 00038 00039 00040 /*---------------------* 00041 * class declaration * 00042 *---------------------*/ 00043 00047 template<class T> 00048 class DiMonoRotateTemplate 00049 : public DiMonoPixelTemplate<T>, 00050 protected DiRotateTemplate<T> 00051 { 00052 00053 public: 00054 00065 DiMonoRotateTemplate(const DiMonoPixel *pixel, 00066 const Uint16 src_cols, 00067 const Uint16 src_rows, 00068 const Uint16 dest_cols, 00069 const Uint16 dest_rows, 00070 const Uint32 frames, 00071 const int degree) 00072 : DiMonoPixelTemplate<T>(pixel, OFstatic_cast(unsigned long, dest_cols) * OFstatic_cast(unsigned long, dest_rows) * frames), 00073 DiRotateTemplate<T>(1, src_cols, src_rows, dest_cols, dest_rows, frames) 00074 { 00075 if ((pixel != NULL) && (pixel->getCount() > 0)) 00076 { 00077 if (pixel->getCount() == OFstatic_cast(unsigned long, src_cols) * OFstatic_cast(unsigned long, src_rows) * frames) 00078 rotate(OFstatic_cast(const T *, pixel->getData()), degree); 00079 else { 00080 DCMIMGLE_WARN("could not rotate image ... corrupted data"); 00081 } 00082 } 00083 } 00084 00087 ~DiMonoRotateTemplate() 00088 { 00089 } 00090 00091 00092 private: 00093 00099 inline void rotate(const T *pixel, 00100 const int degree) 00101 { 00102 if (pixel != NULL) 00103 { 00104 this->Data = new T[DiMonoPixelTemplate<T>::getCount()]; 00105 if (this->Data != NULL) 00106 { 00107 if (degree == 90) 00108 rotateRight(&pixel, &(this->Data)); 00109 else if (degree == 180) 00110 rotateTopDown(&pixel, &(this->Data)); 00111 else if (degree == 270) 00112 rotateLeft(&pixel, &(this->Data)); 00113 } 00114 } 00115 } 00116 }; 00117 00118 00119 #endif 00120 00121 00122 /* 00123 * 00124 * CVS/RCS Log: 00125 * $Log: dimorot.h,v $ 00126 * Revision 1.16 2010-10-14 13:16:26 joergr 00127 * Updated copyright header. Added reference to COPYRIGHT file. 00128 * 00129 * Revision 1.15 2010-03-01 09:08:47 uli 00130 * Removed some unnecessary include directives in the headers. 00131 * 00132 * Revision 1.14 2009-10-28 14:38:17 joergr 00133 * Fixed minor issues in log output. 00134 * 00135 * Revision 1.13 2009-10-28 09:53:40 uli 00136 * Switched to logging mechanism provided by the "new" oflog module. 00137 * 00138 * Revision 1.12 2006-08-15 16:30:11 meichel 00139 * Updated the code in module dcmimgle to correctly compile when 00140 * all standard C++ classes remain in namespace std. 00141 * 00142 * Revision 1.11 2005/12/08 16:47:57 meichel 00143 * Changed include path schema for all DCMTK header files 00144 * 00145 * Revision 1.10 2004/04/21 10:00:36 meichel 00146 * Minor modifications for compilation with gcc 3.4.0 00147 * 00148 * Revision 1.9 2003/12/08 18:47:49 joergr 00149 * Adapted type casts to new-style typecast operators defined in ofcast.h. 00150 * Removed leading underscore characters from preprocessor symbols (reserved 00151 * symbols). Updated copyright header. 00152 * 00153 * Revision 1.8 2001/06/01 15:49:48 meichel 00154 * Updated copyright header 00155 * 00156 * Revision 1.7 2000/09/12 10:04:45 joergr 00157 * Corrected bug: wrong parameter for attribute search routine led to crashes 00158 * when multiple pixel data attributes were contained in the dataset (e.g. 00159 * IconImageSequence). Added new checking routines to avoid crashes when 00160 * processing corrupted image data. 00161 * 00162 * Revision 1.6 2000/03/08 16:24:21 meichel 00163 * Updated copyright header. 00164 * 00165 * Revision 1.5 1999/09/17 12:43:23 joergr 00166 * Added/changed/completed DOC++ style comments in the header files. 00167 * 00168 * Revision 1.4 1999/03/24 17:20:17 joergr 00169 * Added/Modified comments and formatting. 00170 * 00171 * Revision 1.3 1999/02/11 16:40:46 joergr 00172 * Corrected some typos and formatting. 00173 * 00174 * Revision 1.2 1998/12/14 17:26:26 joergr 00175 * Corrected a typo. 00176 * 00177 * Revision 1.1 1998/11/27 14:57:48 joergr 00178 * Added copyright message. 00179 * Added methods and classes for flipping and rotating, changed for 00180 * scaling and clipping. 00181 * 00182 * 00183 */