OFFIS DCMTK  Version 3.6.0
dimorot.h
1 /*
2  *
3  * Copyright (C) 1996-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: DicomMonochromeRotateTemplate (Header)
19  *
20  * Last Update: $Author: joergr $
21  * Update Date: $Date: 2011-11-17 16:13:16 $
22  * CVS/RCS Revision: $Revision: 1.17 $
23  * Status: $State: Exp $
24  *
25  * CVS/RCS Log at end of file
26  *
27  */
28 
29 
30 #ifndef DIMOROT_H
31 #define DIMOROT_H
32 
33 #include "dcmtk/config/osconfig.h"
34 #include "dcmtk/ofstd/ofcast.h"
35 
36 #include "dcmtk/dcmimgle/dimopxt.h"
37 #include "dcmtk/dcmimgle/dirotat.h"
38 
39 
40 /*---------------------*
41  * class declaration *
42  *---------------------*/
43 
47 template<class T>
49  : public DiMonoPixelTemplate<T>,
50  protected DiRotateTemplate<T>
51 {
52 
53  public:
54 
66  const Uint16 src_cols,
67  const Uint16 src_rows,
68  const Uint16 dest_cols,
69  const Uint16 dest_rows,
70  const Uint32 frames,
71  const int degree)
72  : DiMonoPixelTemplate<T>(pixel, OFstatic_cast(unsigned long, dest_cols) * OFstatic_cast(unsigned long, dest_rows) * frames),
73  DiRotateTemplate<T>(1, src_cols, src_rows, dest_cols, dest_rows, frames)
74  {
75  if ((pixel != NULL) && (pixel->getCount() > 0))
76  {
77  if (pixel->getCount() == OFstatic_cast(unsigned long, src_cols) * OFstatic_cast(unsigned long, src_rows) * frames)
78  rotate(OFstatic_cast(const T *, pixel->getData()), degree);
79  else {
80  DCMIMGLE_WARN("could not rotate image ... corrupted data");
81  }
82  }
83  }
84 
88  {
89  }
90 
91 
92  private:
93 
99  inline void rotate(const T *pixel,
100  const int degree)
101  {
102  if (pixel != NULL)
103  {
104  this->Data = new T[DiMonoPixelTemplate<T>::getCount()];
105  if (this->Data != NULL)
106  {
107  if (degree == 90)
108  this->rotateRight(&pixel, &(this->Data));
109  else if (degree == 180)
110  this->rotateTopDown(&pixel, &(this->Data));
111  else if (degree == 270)
112  this->rotateLeft(&pixel, &(this->Data));
113  }
114  }
115  }
116 };
117 
118 
119 #endif
120 
121 
122 /*
123  *
124  * CVS/RCS Log:
125  * $Log: dimorot.h,v $
126  * Revision 1.17 2011-11-17 16:13:16 joergr
127  * Minor fixes to keep XCode 4.2 on Mac OS X Lion (clang compiler) quiet.
128  *
129  * Revision 1.16 2010-10-14 13:16:26 joergr
130  * Updated copyright header. Added reference to COPYRIGHT file.
131  *
132  * Revision 1.15 2010-03-01 09:08:47 uli
133  * Removed some unnecessary include directives in the headers.
134  *
135  * Revision 1.14 2009-10-28 14:38:17 joergr
136  * Fixed minor issues in log output.
137  *
138  * Revision 1.13 2009-10-28 09:53:40 uli
139  * Switched to logging mechanism provided by the "new" oflog module.
140  *
141  * Revision 1.12 2006-08-15 16:30:11 meichel
142  * Updated the code in module dcmimgle to correctly compile when
143  * all standard C++ classes remain in namespace std.
144  *
145  * Revision 1.11 2005/12/08 16:47:57 meichel
146  * Changed include path schema for all DCMTK header files
147  *
148  * Revision 1.10 2004/04/21 10:00:36 meichel
149  * Minor modifications for compilation with gcc 3.4.0
150  *
151  * Revision 1.9 2003/12/08 18:47:49 joergr
152  * Adapted type casts to new-style typecast operators defined in ofcast.h.
153  * Removed leading underscore characters from preprocessor symbols (reserved
154  * symbols). Updated copyright header.
155  *
156  * Revision 1.8 2001/06/01 15:49:48 meichel
157  * Updated copyright header
158  *
159  * Revision 1.7 2000/09/12 10:04:45 joergr
160  * Corrected bug: wrong parameter for attribute search routine led to crashes
161  * when multiple pixel data attributes were contained in the dataset (e.g.
162  * IconImageSequence). Added new checking routines to avoid crashes when
163  * processing corrupted image data.
164  *
165  * Revision 1.6 2000/03/08 16:24:21 meichel
166  * Updated copyright header.
167  *
168  * Revision 1.5 1999/09/17 12:43:23 joergr
169  * Added/changed/completed DOC++ style comments in the header files.
170  *
171  * Revision 1.4 1999/03/24 17:20:17 joergr
172  * Added/Modified comments and formatting.
173  *
174  * Revision 1.3 1999/02/11 16:40:46 joergr
175  * Corrected some typos and formatting.
176  *
177  * Revision 1.2 1998/12/14 17:26:26 joergr
178  * Corrected a typo.
179  *
180  * Revision 1.1 1998/11/27 14:57:48 joergr
181  * Added copyright message.
182  * Added methods and classes for flipping and rotating, changed for
183  * scaling and clipping.
184  *
185  *
186  */


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