OFFIS DCMTK  Version 3.6.0
dicomot.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: dcmimage
15  *
16  * Author: Joerg Riesmeier
17  *
18  * Purpose: DicomColorMonochromeTemplate (Header)
19  *
20  * Last Update: $Author: joergr $
21  * Update Date: $Date: 2010-10-14 13:16:29 $
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 DICOMOT_H
31 #define DICOMOT_H
32 
33 #include "dcmtk/config/osconfig.h"
34 
35 #include "dcmtk/dcmimgle/dimopxt.h"
36 #include "dcmtk/dcmimage/dicopx.h"
37 
38 
39 /*---------------------*
40  * class declaration *
41  *---------------------*/
42 
46 template<class T>
48  : public DiMonoPixelTemplate<T>
49 {
50 
51  public:
52 
62  DiMonoModality *modality,
63  const double red,
64  const double green,
65  const double blue)
66  : DiMonoPixelTemplate<T>(pixel, modality)
67  {
68  if ((pixel != NULL) && (pixel->getCount() > 0))
69  {
70  convert(OFstatic_cast(const T **, OFconst_cast(void *, pixel->getData())), red, green, blue);
71  this->determineMinMax();
72  }
73  }
74 
78  {
79  }
80 
81 
82  private:
83 
91  void convert(const T *pixel[3],
92  const double red,
93  const double green,
94  const double blue)
95  {
96  if (pixel != NULL)
97  {
98  this->Data = new T[this->Count];
99  if (this->Data != NULL)
100  {
101  register const T *r = pixel[0];
102  register const T *g = pixel[1];
103  register const T *b = pixel[2];
104  register T *q = this->Data;
105  register unsigned long i;
106  for (i = this->Count; i != 0; i--)
107  {
108  *(q++) = OFstatic_cast(T, OFstatic_cast(double, *(r++)) * red +
109  OFstatic_cast(double, *(g++)) * green +
110  OFstatic_cast(double, *(b++)) * blue);
111  }
112  }
113  }
114  }
115 };
116 
117 
118 #endif
119 
120 
121 /*
122  *
123  * CVS/RCS Log:
124  * $Log: dicomot.h,v $
125  * Revision 1.16 2010-10-14 13:16:29 joergr
126  * Updated copyright header. Added reference to COPYRIGHT file.
127  *
128  * Revision 1.15 2005/12/08 16:01:31 meichel
129  * Changed include path schema for all DCMTK header files
130  *
131  * Revision 1.14 2004/04/21 10:00:31 meichel
132  * Minor modifications for compilation with gcc 3.4.0
133  *
134  * Revision 1.13 2004/02/06 11:18:18 joergr
135  * Distinguish more clearly between const and non-const access to pixel data.
136  *
137  * Revision 1.12 2003/12/23 11:21:12 joergr
138  * Adapted type casts to new-style typecast operators defined in ofcast.h.
139  * Removed leading underscore characters from preprocessor symbols (reserved
140  * symbols). Added missing API documentation. Updated copyright header.
141  *
142  * Revision 1.11 2001/11/09 16:41:34 joergr
143  * Removed 'inline' specifier from certain methods.
144  *
145  * Revision 1.10 2001/06/01 15:49:28 meichel
146  * Updated copyright header
147  *
148  * Revision 1.9 2000/03/08 16:21:50 meichel
149  * Updated copyright header.
150  *
151  * Revision 1.8 1999/09/17 14:03:42 joergr
152  * Enhanced efficiency of some "for" loops.
153  *
154  * Revision 1.7 1999/05/31 13:01:13 joergr
155  * Corrected bug concerning the conversion of color images to grayscale.
156  *
157  * Revision 1.6 1999/04/28 12:51:58 joergr
158  * Corrected some typos, comments and formatting.
159  *
160  * Revision 1.5 1999/01/20 14:40:41 joergr
161  * Replaced invocation of getCount() by member variable Count where possible.
162  *
163  * Revision 1.4 1998/11/27 13:43:54 joergr
164  * Added copyright message.
165  *
166  * Revision 1.3 1998/05/11 14:53:11 joergr
167  * Added CVS/RCS header to each file.
168  *
169  *
170  */


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