00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
#ifndef DICOROT_H
00035
#define DICOROT_H
00036
00037
#include "osconfig.h"
00038
#include "dctypes.h"
00039
00040
#include "dicopxt.h"
00041
#include "dirotat.h"
00042
00043
00044
00045
00046
00047
00051
template<
class T>
00052 class DiColorRotateTemplate
00053 :
public DiColorPixelTemplate<T>,
00054
protected DiRotateTemplate<T>
00055 {
00056
00057
public:
00058
00069 DiColorRotateTemplate(
const DiColorPixel *pixel,
00070
const Uint16 src_cols,
00071
const Uint16 src_rows,
00072
const Uint16 dest_cols,
00073
const Uint16 dest_rows,
00074
const Uint32 frames,
00075
const int degree)
00076 :
DiColorPixelTemplate<T>(pixel, OFstatic_cast(unsigned long, dest_cols) * OFstatic_cast(unsigned long, dest_rows) * frames),
00077
DiRotateTemplate<T>(3, src_cols, src_rows, dest_cols, dest_rows, frames)
00078 {
00079
if ((pixel != NULL) && (pixel->
getCount() > 0))
00080 {
00081
if (pixel->
getCount() == OFstatic_cast(
unsigned long, src_cols) * OFstatic_cast(
unsigned long, src_rows) * frames)
00082
rotate(OFstatic_cast(
const T **, OFconst_cast(
void *, pixel->
getData())), degree);
00083
else {
00084
if (
DicomImageClass::checkDebugLevel(DicomImageClass::DL_Warnings))
00085 {
00086 ofConsole.lockCerr() <<
"WARNING: could not rotate image ... corrupted data." << endl;
00087 ofConsole.unlockCerr();
00088 }
00089 }
00090 }
00091 }
00092
00095 ~DiColorRotateTemplate()
00096 {
00097 }
00098
00099
00100
private:
00101
00107 inline void rotate(
const T *pixel[3],
00108
const int degree)
00109 {
00110
if (
Init(pixel))
00111 {
00112
if (degree == 90)
00113
rotateRight(pixel, this->Data);
00114
else if (degree == 180)
00115
rotateTopDown(pixel, this->Data);
00116
else if (degree == 270)
00117
rotateLeft(pixel, this->Data);
00118 }
00119 }
00120 };
00121
00122
00123
#endif
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163