OFFIS DCMTK  Version 3.6.0
dimosct.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: DicomMonochromeScaleTemplate (Header)
19  *
20  * Last Update: $Author: joergr $
21  * Update Date: $Date: 2011-11-17 16:13:16 $
22  * CVS/RCS Revision: $Revision: 1.21 $
23  * Status: $State: Exp $
24  *
25  * CVS/RCS Log at end of file
26  *
27  */
28 
29 
30 #ifndef DIMOSCT_H
31 #define DIMOSCT_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/discalet.h"
38 #include "dcmtk/dcmimgle/didispfn.h"
39 
40 
41 /*---------------------*
42  * class declaration *
43  *---------------------*/
44 
47 template<class T>
49  : public DiMonoPixelTemplate<T>,
50  protected DiScaleTemplate<T>
51 {
52 
53  public:
54 
72  const Uint16 columns,
73  const Uint16 rows,
74  const signed long left_pos,
75  const signed long top_pos,
76  const Uint16 src_cols,
77  const Uint16 src_rows,
78  const Uint16 dest_cols,
79  const Uint16 dest_rows,
80  const Uint32 frames,
81  const int bits,
82  const int interpolate,
83  const Uint16 pvalue)
84  : DiMonoPixelTemplate<T>(pixel, OFstatic_cast(unsigned long, dest_cols) * OFstatic_cast(unsigned long, dest_rows) * frames),
85  DiScaleTemplate<T>(1, columns, rows, left_pos, top_pos, src_cols, src_rows, dest_cols, dest_rows, frames, bits)
86  {
87  if ((pixel != NULL) && (pixel->getCount() > 0))
88  {
89  if (pixel->getCount() == OFstatic_cast(unsigned long, columns) * OFstatic_cast(unsigned long, rows) * frames)
90  {
91  scale(OFstatic_cast(const T *, pixel->getData()), pixel->getBits(), interpolate, pvalue);
92  this->determineMinMax();
93  } else {
94  DCMIMGLE_WARN("could not scale image ... corrupted data");
95  }
96  }
97  }
98 
102  {
103  }
104 
105 
106  private:
107 
115  inline void scale(const T *pixel,
116  const unsigned int bits,
117  const int interpolate,
118  const Uint16 pvalue)
119  {
120  if (pixel != NULL)
121  {
122  this->Data = new T[this->getCount()];
123  if (this->Data != NULL)
124  {
125  const T value = OFstatic_cast(T, OFstatic_cast(double, DicomImageClass::maxval(bits)) *
126  OFstatic_cast(double, pvalue) / OFstatic_cast(double, DicomImageClass::maxval(WIDTH_OF_PVALUES)));
127  this->scaleData(&pixel, &this->Data, interpolate, value);
128  }
129  }
130  }
131 };
132 
133 
134 #endif
135 
136 
137 /*
138  *
139  * CVS/RCS Log:
140  * $Log: dimosct.h,v $
141  * Revision 1.21 2011-11-17 16:13:16 joergr
142  * Minor fixes to keep XCode 4.2 on Mac OS X Lion (clang compiler) quiet.
143  *
144  * Revision 1.20 2010-10-14 13:16:26 joergr
145  * Updated copyright header. Added reference to COPYRIGHT file.
146  *
147  * Revision 1.19 2010-03-01 09:08:47 uli
148  * Removed some unnecessary include directives in the headers.
149  *
150  * Revision 1.18 2009-10-28 14:38:17 joergr
151  * Fixed minor issues in log output.
152  *
153  * Revision 1.17 2009-10-28 09:53:40 uli
154  * Switched to logging mechanism provided by the "new" oflog module.
155  *
156  * Revision 1.16 2008-05-20 13:12:48 joergr
157  * Fixed issue with signed pixel data in bicubic interpolation algorithm.
158  *
159  * Revision 1.15 2006/08/15 16:30:11 meichel
160  * Updated the code in module dcmimgle to correctly compile when
161  * all standard C++ classes remain in namespace std.
162  *
163  * Revision 1.14 2005/12/08 16:47:58 meichel
164  * Changed include path schema for all DCMTK header files
165  *
166  * Revision 1.13 2004/04/21 10:00:36 meichel
167  * Minor modifications for compilation with gcc 3.4.0
168  *
169  * Revision 1.12 2003/12/09 10:04:45 joergr
170  * Adapted type casts to new-style typecast operators defined in ofcast.h.
171  * Removed leading underscore characters from preprocessor symbols (reserved
172  * symbols). Updated copyright header.
173  *
174  * Revision 1.11 2002/12/09 13:32:54 joergr
175  * Renamed parameter/local variable to avoid name clashes with global
176  * declaration left and/or right (used for as iostream manipulators).
177  *
178  * Revision 1.10 2001/06/01 15:49:48 meichel
179  * Updated copyright header
180  *
181  * Revision 1.9 2000/09/12 10:04:45 joergr
182  * Corrected bug: wrong parameter for attribute search routine led to crashes
183  * when multiple pixel data attributes were contained in the dataset (e.g.
184  * IconImageSequence). Added new checking routines to avoid crashes when
185  * processing corrupted image data.
186  *
187  * Revision 1.8 2000/03/08 16:24:21 meichel
188  * Updated copyright header.
189  *
190  * Revision 1.7 1999/09/17 12:43:24 joergr
191  * Added/changed/completed DOC++ style comments in the header files.
192  *
193  * Revision 1.6 1999/09/07 09:49:39 joergr
194  * Removed register variable declaration to avoid compiler warnings.
195  *
196  * Revision 1.5 1999/08/25 16:41:54 joergr
197  * Added new feature: Allow clipping region to be outside the image
198  * (overlapping).
199  *
200  * Revision 1.4 1999/03/24 17:20:18 joergr
201  * Added/Modified comments and formatting.
202  *
203  * Revision 1.3 1999/02/11 16:41:10 joergr
204  * Corrected some typos and formatting.
205  *
206  * Revision 1.2 1998/12/16 16:36:11 joergr
207  * *** empty log message ***
208  *
209  * Revision 1.1 1998/11/27 15:39:32 joergr
210  * Added copyright message.
211  * Combined clipping and scaling methods.
212  *
213  * Revision 1.4 1998/05/11 14:53:24 joergr
214  * Added CVS/RCS header to each file.
215  *
216  *
217  */


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