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


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