OFFIS DCMTK  Version 3.6.0
ditranst.h
1 /*
2  *
3  * Copyright (C) 1996-2010, 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: DicomTransTemplate (Header)
19  *
20  * Last Update: $Author: joergr $
21  * Update Date: $Date: 2010-10-14 13:16:27 $
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 DITRANST_H
31 #define DITRANST_H
32 
33 #include "dcmtk/config/osconfig.h"
34 #include "dcmtk/ofstd/oftypes.h"
35 #include "dcmtk/ofstd/ofcast.h"
36 
37 #include "dcmtk/ofstd/ofbmanip.h"
38 
39 #include "dcmtk/dcmimgle/diutils.h"
40 
41 
42 /*---------------------*
43  * class declaration *
44  *---------------------*/
45 
49 template<class T>
51 {
52 
53  protected:
54 
65  DiTransTemplate(const int planes,
66  const Uint16 src_x,
67  const Uint16 src_y,
68  const Uint16 dest_x,
69  const Uint16 dest_y,
70  const Uint32 frames,
71  const int bits = 0)
72  : Planes(planes),
73  Src_X(src_x),
74  Src_Y(src_y),
75  Dest_X(dest_x),
76  Dest_Y(dest_y),
77  Frames(frames),
78  Bits(((bits < 1) || (bits > OFstatic_cast(int, bitsof(T)))) ? OFstatic_cast(int, bitsof(T)) : bits)
79  {
80  }
81 
84  virtual ~DiTransTemplate()
85  {
86  }
87 
93  inline void copyPixel(const T *src[],
94  T *dest[])
95  {
96  const unsigned long count = OFstatic_cast(unsigned long, Dest_X) * OFstatic_cast(unsigned long, Dest_Y) * Frames;
97  for (int j = 0; j < Planes; ++j)
98  OFBitmanipTemplate<T>::copyMem(src[j], dest[j], count);
99  }
100 
106  inline void fillPixel(T *dest[],
107  const T value)
108  {
109  const unsigned long count = OFstatic_cast(unsigned long, Dest_X) * OFstatic_cast(unsigned long, Dest_Y) * Frames;
110  for (int j = 0; j < Planes; ++j)
111  OFBitmanipTemplate<T>::setMem(dest[j], value, count);
112  }
113 
118  inline void clearPixel(T *dest[])
119  {
120  const unsigned long count = OFstatic_cast(unsigned long, Dest_X) * OFstatic_cast(unsigned long, Dest_Y) * Frames;
121  for (int j = 0; j < Planes; ++j)
122  OFBitmanipTemplate<T>::zeroMem(dest[j], count);
123  }
124 
125 
127  /*const*/ int Planes; // allow later changing to avoid warnings on Irix
128 
130  /*const*/ Uint16 Src_X; // add 'const' when interpolated scaling with clipping is fully implemented
132  /*const*/ Uint16 Src_Y; // ... dito ...
134  const Uint16 Dest_X;
136  const Uint16 Dest_Y;
137 
139  const Uint32 Frames;
141  const int Bits;
142 };
143 
144 
145 #endif
146 
147 
148 /*
149  *
150  * CVS/RCS Log:
151  * $Log: ditranst.h,v $
152  * Revision 1.17 2010-10-14 13:16:27 joergr
153  * Updated copyright header. Added reference to COPYRIGHT file.
154  *
155  * Revision 1.16 2010-03-01 09:08:47 uli
156  * Removed some unnecessary include directives in the headers.
157  *
158  * Revision 1.15 2008-05-20 10:07:31 joergr
159  * Added new method that clears the destination image (set pixel values to 0).
160  *
161  * Revision 1.14 2005/12/08 16:48:11 meichel
162  * Changed include path schema for all DCMTK header files
163  *
164  * Revision 1.13 2003/12/23 15:53:22 joergr
165  * Replaced post-increment/decrement operators by pre-increment/decrement
166  * operators where appropriate (e.g. 'i++' by '++i').
167  *
168  * Revision 1.12 2003/12/08 18:51:26 joergr
169  * Adapted type casts to new-style typecast operators defined in ofcast.h.
170  * Removed leading underscore characters from preprocessor symbols (reserved
171  * symbols). Updated copyright header.
172  *
173  * Revision 1.11 2003/06/02 17:08:07 joergr
174  * Added include statement for "diutils.h".
175  *
176  * Revision 1.10 2001/06/01 15:49:52 meichel
177  * Updated copyright header
178  *
179  * Revision 1.9 2000/03/08 16:24:25 meichel
180  * Updated copyright header.
181  *
182  * Revision 1.8 2000/03/02 12:51:37 joergr
183  * Rewrote variable initialization in class contructors to avoid warnings
184  * reported on Irix.
185  *
186  * Revision 1.7 1999/09/17 13:08:12 joergr
187  * Added/changed/completed DOC++ style comments in the header files.
188  *
189  * Revision 1.6 1999/08/25 16:41:56 joergr
190  * Added new feature: Allow clipping region to be outside the image
191  * (overlapping).
192  *
193  * Revision 1.5 1999/05/03 11:09:32 joergr
194  * Minor code purifications to keep Sun CC 2.0.1 quiet.
195  *
196  * Revision 1.4 1999/03/24 17:20:27 joergr
197  * Added/Modified comments and formatting.
198  *
199  * Revision 1.3 1999/02/11 16:42:52 joergr
200  * Corrected some typos and formatting.
201  *
202  * Revision 1.2 1998/12/22 14:42:23 joergr
203  * Removed const declaration (as long as interpolated scaling isn't completed).
204  *
205  * Revision 1.1 1998/11/27 15:48:10 joergr
206  * Added copyright message.
207  * Added support for new bit manipulation class.
208  *
209  * Revision 1.2 1998/05/11 14:53:30 joergr
210  * Added CVS/RCS header to each file.
211  *
212  *
213  */


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