1 /*
2  *
3  *  Copyright (C) 1996-2001, OFFIS
4  *
5  *  This software and supporting documentation were developed by
6  *
7  *    Kuratorium OFFIS e.V.
8  *    Healthcare Information and Communication Systems
9  *    Escherweg 2
10  *    D-26121 Oldenburg, Germany
11  *
12  *  THIS SOFTWARE IS MADE AVAILABLE,  AS IS,  AND OFFIS MAKES NO  WARRANTY
13  *  REGARDING  THE  SOFTWARE,  ITS  PERFORMANCE,  ITS  MERCHANTABILITY  OR
14  *  FITNESS FOR ANY PARTICULAR USE, FREEDOM FROM ANY COMPUTER DISEASES  OR
15  *  ITS CONFORMITY TO ANY SPECIFICATION. THE ENTIRE RISK AS TO QUALITY AND
16  *  PERFORMANCE OF THE SOFTWARE IS WITH THE USER.
17  *
18  *  Module:  dcmimgle
19  *
20  *  Author:  Joerg Riesmeier
21  *
22  *  Purpose: DicomMonochromeImage (Source, getData 16 bit)
23  *
24  */
25 
26 
27 #include "osconfig.h"
28 
29 #include "dimoimg.h"
30 #include "dimoipxt.h"
31 #include "dimoopxt.h"
32 #include "diutils.h"
33 
34 
getDataUint16(void * buffer,DiDisplayFunction * disp,const int samples,const unsigned long frame,const int bits,const Uint32 low,const Uint32 high)35 void DiMonoImage::getDataUint16(void *buffer,
36                                 DiDisplayFunction *disp,
37                                 const int samples,
38                                 const unsigned long frame,
39                                 const int bits,
40                                 const Uint32 low,
41                                 const Uint32 high)
42 {
43     if (InterData != NULL)
44     {
45         if (InterData->isPotentiallySigned())
46         {
47             if (bits <= 8)
48                 OutputData = new DiMonoOutputPixelTemplate<Uint16, Sint32, Uint8>(buffer, InterData, Overlays, VoiLutData,
49                     PresLutData, disp, WindowCenter, WindowWidth, low, high, Columns, Rows, frame, NumberOfFrames, samples > 1);
50             else if (bits <= 16)
51                 OutputData = new DiMonoOutputPixelTemplate<Uint16, Sint32, Uint16>(buffer, InterData, Overlays, VoiLutData,
52                     PresLutData, disp, WindowCenter, WindowWidth, low, high, Columns, Rows, frame, NumberOfFrames);
53             else
54                 OutputData = new DiMonoOutputPixelTemplate<Uint16, Sint32, Uint32>(buffer, InterData, Overlays, VoiLutData,
55                     PresLutData, disp, WindowCenter, WindowWidth, low, high, Columns, Rows, frame, NumberOfFrames);
56         } else {
57             if (bits <= 8)
58                 OutputData = new DiMonoOutputPixelTemplate<Uint16, Uint32, Uint8>(buffer, InterData, Overlays, VoiLutData,
59                     PresLutData, disp, WindowCenter, WindowWidth, low, high, Columns, Rows, frame, NumberOfFrames, samples > 1);
60             else if (bits <= 16)
61                 OutputData = new DiMonoOutputPixelTemplate<Uint16, Uint32, Uint16>(buffer, InterData, Overlays, VoiLutData,
62                     PresLutData, disp, WindowCenter, WindowWidth, low, high, Columns, Rows, frame, NumberOfFrames);
63             else
64                 OutputData = new DiMonoOutputPixelTemplate<Uint16, Uint32, Uint32>(buffer, InterData, Overlays, VoiLutData,
65                     PresLutData, disp, WindowCenter, WindowWidth, low, high, Columns, Rows, frame, NumberOfFrames);
66         }
67     }
68 }
69 
70 
getDataSint16(void * buffer,DiDisplayFunction * disp,const int samples,const unsigned long frame,const int bits,const Uint32 low,const Uint32 high)71 void DiMonoImage::getDataSint16(void *buffer,
72                                 DiDisplayFunction *disp,
73                                 const int samples,
74                                 const unsigned long frame,
75                                 const int bits,
76                                 const Uint32 low,
77                                 const Uint32 high)
78 {
79     if (bits <= 8)
80         OutputData = new DiMonoOutputPixelTemplate<Sint16, Sint32, Uint8>(buffer, InterData, Overlays, VoiLutData,
81             PresLutData, disp, WindowCenter, WindowWidth, low, high, Columns, Rows, frame, NumberOfFrames, samples > 1);
82     else if (bits <= 16)
83         OutputData = new DiMonoOutputPixelTemplate<Sint16, Sint32, Uint16>(buffer, InterData, Overlays, VoiLutData,
84             PresLutData, disp, WindowCenter, WindowWidth, low, high, Columns, Rows, frame, NumberOfFrames);
85     else
86         OutputData = new DiMonoOutputPixelTemplate<Sint16, Sint32, Uint32>(buffer, InterData, Overlays, VoiLutData,
87             PresLutData, disp, WindowCenter, WindowWidth, low, high, Columns, Rows, frame, NumberOfFrames);
88 }
89