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: DicomMonochrome2Image (Source)
19  *
20  */
21 
22 
23 #include "dcmtk/config/osconfig.h"
24 #include "dcmtk/dcmdata/dctypes.h"
25 
26 #include "dcmtk/dcmimgle/dimo2img.h"
27 #include "dcmtk/dcmimgle/diutils.h"
28 
29 
30 /*----------------*
31  *  constructors  *
32  *----------------*/
33 
DiMono2Image(const DiDocument * docu,const EI_Status status)34 DiMono2Image::DiMono2Image(const DiDocument *docu,
35                            const EI_Status status)
36   : DiMonoImage(docu, status)
37 {
38 }
39 
40 
DiMono2Image(const DiDocument * docu,const EI_Status status,const double slope,const double intercept)41 DiMono2Image::DiMono2Image(const DiDocument *docu,
42                            const EI_Status status,
43                            const double slope,
44                            const double intercept)
45   : DiMonoImage(docu, status, slope, intercept)
46 {
47 }
48 
49 
DiMono2Image(const DiDocument * docu,const EI_Status status,const DcmUnsignedShort & data,const DcmUnsignedShort & descriptor,const DcmLongString * explanation)50 DiMono2Image::DiMono2Image(const DiDocument *docu,
51                            const EI_Status status,
52                            const DcmUnsignedShort &data,
53                            const DcmUnsignedShort &descriptor,
54                            const DcmLongString *explanation)
55   : DiMonoImage(docu, status, data, descriptor, explanation)
56 {
57 }
58 
59 
DiMono2Image(const DiDocument * docu,const EI_Status status,const char dummy)60 DiMono2Image::DiMono2Image(const DiDocument *docu,
61                            const EI_Status status,
62                            const char dummy)
63   : DiMonoImage(docu, status, dummy)
64 {
65 }
66 
67 
DiMono2Image(const DiMonoImage * image,const unsigned long fstart,const unsigned long fcount)68 DiMono2Image::DiMono2Image(const DiMonoImage *image,
69                            const unsigned long fstart,
70                            const unsigned long fcount)
71   : DiMonoImage(image, fstart, fcount)
72 {
73 }
74 
75 
DiMono2Image(const DiColorImage * image,const double red,const double green,const double blue)76 DiMono2Image::DiMono2Image(const DiColorImage *image,
77                            const double red,
78                            const double green,
79                            const double blue)
80   : DiMonoImage(image, red, green, blue)
81 {
82 }
83 
84 
DiMono2Image(const DiMonoImage * image,const signed long left_pos,const signed long top_pos,const Uint16 src_cols,const Uint16 src_rows,const Uint16 dest_cols,const Uint16 dest_rows,const int interpolate,const int aspect,const Uint16 pvalue)85 DiMono2Image::DiMono2Image(const DiMonoImage *image,
86                            const signed long left_pos,
87                            const signed long top_pos,
88                            const Uint16 src_cols,
89                            const Uint16 src_rows,
90                            const Uint16 dest_cols,
91                            const Uint16 dest_rows,
92                            const int interpolate,
93                            const int aspect,
94                            const Uint16 pvalue)
95   : DiMonoImage(image, left_pos, top_pos, src_cols, src_rows, dest_cols, dest_rows, interpolate, aspect, pvalue)
96 {
97 }
98 
99 
DiMono2Image(const DiMonoImage * image,const int horz,const int vert)100 DiMono2Image::DiMono2Image(const DiMonoImage *image,
101                            const int horz,
102                            const int vert)
103   : DiMonoImage(image, horz, vert)
104 {
105 }
106 
107 
DiMono2Image(const DiMonoImage * image,const int degree)108 DiMono2Image::DiMono2Image(const DiMonoImage *image,
109                            const int degree)
110   : DiMonoImage(image, degree)
111 {
112 }
113 
114 
DiMono2Image(const DiMonoImage * image,DiMonoOutputPixel * pixel,const unsigned long frame,const int stored,const int alloc)115 DiMono2Image::DiMono2Image(const DiMonoImage *image,
116                            DiMonoOutputPixel *pixel,
117                            const unsigned long frame,
118                            const int stored,
119                            const int alloc)
120   : DiMonoImage(image, pixel, frame, stored, alloc)
121 {
122 }
123 
124 
125 /*--------------*
126  *  destructor  *
127  *--------------*/
128 
~DiMono2Image()129 DiMono2Image::~DiMono2Image()
130 {
131 }
132 
133 
134 /*********************************************************************/
135 
136 
getOutputData(const unsigned long frame,const int bits,const int planar)137 const void *DiMono2Image::getOutputData(const unsigned long frame,
138                                         const int bits,
139                                         const int planar)
140 {
141     return DiMonoImage::getData(NULL, 0, frame, bits, planar, 0);
142 }
143 
144 
getOutputData(void * buffer,const unsigned long size,const unsigned long frame,const int bits,const int planar)145 int DiMono2Image::getOutputData(void *buffer,
146                                 const unsigned long size,
147                                 const unsigned long frame,
148                                 const int bits,
149                                 const int planar)
150 {
151     return (DiMonoImage::getData(buffer, size, frame, bits, planar, 0) != NULL);
152 }
153 
154 
createImage(const unsigned long fstart,const unsigned long fcount) const155 DiImage *DiMono2Image::createImage(const unsigned long fstart,
156                                    const unsigned long fcount) const
157 {
158     DiImage *image = new DiMono2Image(this, fstart, fcount);
159     return image;
160 }
161 
162 
createScale(const signed long left_pos,const signed long top_pos,const unsigned long src_cols,const unsigned long src_rows,const unsigned long dest_cols,const unsigned long dest_rows,const int interpolate,const int aspect,const Uint16 pvalue) const163 DiImage *DiMono2Image::createScale(const signed long left_pos,
164                                    const signed long top_pos,
165                                    const unsigned long src_cols,
166                                    const unsigned long src_rows,
167                                    const unsigned long dest_cols,
168                                    const unsigned long dest_rows,
169                                    const int interpolate,
170                                    const int aspect,
171                                    const Uint16 pvalue) const
172 {
173     DiImage *image = new DiMono2Image(this, left_pos, top_pos, OFstatic_cast(Uint16, src_cols),
174         OFstatic_cast(Uint16, src_rows), OFstatic_cast(Uint16, dest_cols), OFstatic_cast(Uint16, dest_rows),
175         interpolate, aspect, pvalue);
176     return image;
177 }
178 
179 
createFlip(const int horz,const int vert) const180 DiImage *DiMono2Image::createFlip(const int horz,
181                                   const int vert) const
182 {
183     DiImage *image = new DiMono2Image(this, horz, vert);
184     return image;
185 }
186 
187 
createRotate(const int degree) const188 DiImage *DiMono2Image::createRotate(const int degree) const
189 {
190     DiImage *image = new DiMono2Image(this, degree);
191     return image;
192 }
193 
194 
createMono(const double,const double,const double) const195 DiImage *DiMono2Image::createMono(const double,
196                                   const double,
197                                   const double) const
198 {
199     return createImage(0, 0);
200 }
201