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 DIMOFLT_H
00035 #define DIMOFLT_H
00036
00037 #include "dcmtk/config/osconfig.h"
00038 #include "dcmtk/dcmdata/dctypes.h"
00039 #include "dcmtk/ofstd/ofcast.h"
00040
00041 #include "dcmtk/dcmimgle/dimopxt.h"
00042 #include "dcmtk/dcmimgle/diflipt.h"
00043
00044
00045
00046
00047
00048
00052 template<class T>
00053 class DiMonoFlipTemplate
00054 : public DiMonoPixelTemplate<T>,
00055 protected DiFlipTemplate<T>
00056 {
00057
00058 public:
00059
00069 DiMonoFlipTemplate(const DiMonoPixel *pixel,
00070 const Uint16 columns,
00071 const Uint16 rows,
00072 const Uint32 frames,
00073 const int horz,
00074 const int vert)
00075 : DiMonoPixelTemplate<T>(pixel, OFstatic_cast(unsigned long, columns) * OFstatic_cast(unsigned long, rows) * frames),
00076 DiFlipTemplate<T>(1, columns, rows, frames)
00077 {
00078 if ((pixel != NULL) && (pixel->getCount() > 0))
00079 {
00080 if (pixel->getCount() == OFstatic_cast(unsigned long, columns) * OFstatic_cast(unsigned long, rows) * frames)
00081 flip(OFstatic_cast(const T *, pixel->getData()), horz, vert);
00082 else {
00083 if (DicomImageClass::checkDebugLevel(DicomImageClass::DL_Warnings))
00084 {
00085 ofConsole.lockCerr() << "WARNING: could not flip image ... corrupted data." << endl;
00086 ofConsole.unlockCerr();
00087 }
00088 }
00089 }
00090 }
00091
00094 ~DiMonoFlipTemplate()
00095 {
00096 }
00097
00098
00099 private:
00100
00107 inline void flip(const T *pixel,
00108 const int horz,
00109 const int vert)
00110 {
00111 if (pixel != NULL)
00112 {
00113 this->Data = new T[this->getCount()];
00114 if (this->Data != NULL)
00115 {
00116 if (horz && vert)
00117 flipHorzVert(&pixel, &this->Data);
00118 else if (horz)
00119 flipHorz(&pixel, &this->Data);
00120 else if (vert)
00121 flipVert(&pixel, &this->Data);
00122 }
00123 }
00124 }
00125 };
00126
00127
00128 #endif
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
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173