OFFIS DCMTK  Version 3.6.0
dicorot.h
1 /*
2  *
3  * Copyright (C) 1998-2011, OFFIS e.V.
4  * All rights reserved. See COPYRIGHT file for details.
5  *
6  * This software and supporting documentation were developed by
7  *
8  * OFFIS e.V.
9  * R&D Division Health
10  * Escherweg 2
11  * D-26121 Oldenburg, Germany
12  *
13  *
14  * Module: dcmimgle
15  *
16  * Author: Joerg Riesmeier
17  *
18  * Purpose: DicomColorRotateTemplate (Header)
19  *
20  * Last Update: $Author: joergr $
21  * Update Date: $Date: 2011-11-17 16:13:14 $
22  * CVS/RCS Revision: $Revision: 1.16 $
23  * Status: $State: Exp $
24  *
25  * CVS/RCS Log at end of file
26  *
27  */
28 
29 
30 #ifndef DICOROT_H
31 #define DICOROT_H
32 
33 #include "dcmtk/config/osconfig.h"
34 
35 #include "dcmtk/dcmimage/dicopxt.h"
36 #include "dcmtk/dcmimgle/dirotat.h"
37 
38 
39 /*---------------------*
40  * class declaration *
41  *---------------------*/
42 
46 template<class T>
48  : public DiColorPixelTemplate<T>,
49  protected DiRotateTemplate<T>
50 {
51 
52  public:
53 
65  const Uint16 src_cols,
66  const Uint16 src_rows,
67  const Uint16 dest_cols,
68  const Uint16 dest_rows,
69  const Uint32 frames,
70  const int degree)
71  : DiColorPixelTemplate<T>(pixel, OFstatic_cast(unsigned long, dest_cols) * OFstatic_cast(unsigned long, dest_rows) * frames),
72  DiRotateTemplate<T>(3, src_cols, src_rows, dest_cols, dest_rows, frames)
73  {
74  if ((pixel != NULL) && (pixel->getCount() > 0))
75  {
76  if (pixel->getCount() == OFstatic_cast(unsigned long, src_cols) * OFstatic_cast(unsigned long, src_rows) * frames)
77  rotate(OFstatic_cast(const T **, OFconst_cast(void *, pixel->getData())), degree);
78  else {
79  DCMIMAGE_WARN("could not rotate image ... corrupted data");
80  }
81  }
82  }
83 
87  {
88  }
89 
90 
91  private:
92 
98  inline void rotate(const T *pixel[3],
99  const int degree)
100  {
101  if (this->Init(pixel))
102  {
103  if (degree == 90)
104  this->rotateRight(pixel, this->Data);
105  else if (degree == 180)
106  this->rotateTopDown(pixel, this->Data);
107  else if (degree == 270)
108  this->rotateLeft(pixel, this->Data);
109  }
110  }
111 };
112 
113 
114 #endif
115 
116 
117 /*
118  *
119  * CVS/RCS Log:
120  * $Log: dicorot.h,v $
121  * Revision 1.16 2011-11-17 16:13:14 joergr
122  * Minor fixes to keep XCode 4.2 on Mac OS X Lion (clang compiler) quiet.
123  *
124  * Revision 1.15 2010-10-14 13:16:29 joergr
125  * Updated copyright header. Added reference to COPYRIGHT file.
126  *
127  * Revision 1.14 2010-03-01 09:08:46 uli
128  * Removed some unnecessary include directives in the headers.
129  *
130  * Revision 1.13 2009-10-14 10:25:13 joergr
131  * Fixed minor issues in log output. Also updated copyright date (if required).
132  *
133  * Revision 1.12 2009-10-13 14:08:33 uli
134  * Switched to logging mechanism provided by the "new" oflog module
135  *
136  * Revision 1.11 2006-08-15 16:35:01 meichel
137  * Updated the code in module dcmimage to correctly compile when
138  * all standard C++ classes remain in namespace std.
139  *
140  * Revision 1.10 2005/12/08 16:01:36 meichel
141  * Changed include path schema for all DCMTK header files
142  *
143  * Revision 1.9 2004/04/21 10:00:31 meichel
144  * Minor modifications for compilation with gcc 3.4.0
145  *
146  * Revision 1.8 2004/02/06 11:18:18 joergr
147  * Distinguish more clearly between const and non-const access to pixel data.
148  *
149  * Revision 1.7 2003/12/23 11:44:32 joergr
150  * Adapted type casts to new-style typecast operators defined in ofcast.h.
151  * Removed leading underscore characters from preprocessor symbols (reserved
152  * symbols). Updated copyright header.
153  *
154  * Revision 1.6 2001/11/09 16:45:00 joergr
155  * Updated/Enhanced comments.
156  *
157  * Revision 1.5 2001/06/01 15:49:30 meichel
158  * Updated copyright header
159  *
160  * Revision 1.4 2000/12/08 14:06:01 joergr
161  * Added new checking routines to avoid crashes when processing corrupted image
162  * data.
163  *
164  * Revision 1.3 2000/03/08 16:21:51 meichel
165  * Updated copyright header.
166  *
167  * Revision 1.2 1999/04/28 12:51:59 joergr
168  * Corrected some typos, comments and formatting.
169  *
170  * Revision 1.1 1998/11/27 14:59:36 joergr
171  * Added copyright message.
172  * Added methods and classes for flipping and rotating, changed for
173  * scaling and clipping.
174  *
175  *
176  */


Generated on Thu Dec 20 2012 for OFFIS DCMTK Version 3.6.0 by Doxygen 1.8.2