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: DicomMonochromeImage (Source, getData 16 bit)
19  *
20  */
21 
22 
23 #include "dcmtk/config/osconfig.h"
24 
25 #include "dcmtk/dcmimgle/dimoimg.h"
26 #include "dcmtk/dcmimgle/dimoipxt.h"
27 #include "dcmtk/dcmimgle/dimoopxt.h"
28 #include "dcmtk/dcmimgle/diutils.h"
29 
30 
getDataUint16(void * buffer,DiDisplayFunction * disp,const int samples,const unsigned long frame,const int bits,const Uint32 low,const Uint32 high)31 void DiMonoImage::getDataUint16(void *buffer,
32                                 DiDisplayFunction *disp,
33                                 const int samples,
34                                 const unsigned long frame,
35                                 const int bits,
36                                 const Uint32 low,
37                                 const Uint32 high)
38 {
39     if (InterData != NULL)
40     {
41         if (InterData->isPotentiallySigned())
42         {
43             if (bits <= 8)
44                 OutputData = new DiMonoOutputPixelTemplate<Uint16, Sint32, Uint8>(buffer, InterData, Overlays, VoiLutData, PresLutData,
45                     disp, VoiLutFunction, WindowCenter, WindowWidth, low, high, Columns, Rows, frame, NumberOfFrames, samples > 1);
46             else if (bits <= 16)
47                 OutputData = new DiMonoOutputPixelTemplate<Uint16, Sint32, Uint16>(buffer, InterData, Overlays, VoiLutData, PresLutData,
48                     disp, VoiLutFunction, WindowCenter, WindowWidth, low, high, Columns, Rows, frame, NumberOfFrames);
49             else
50                 OutputData = new DiMonoOutputPixelTemplate<Uint16, Sint32, Uint32>(buffer, InterData, Overlays, VoiLutData, PresLutData,
51                     disp, VoiLutFunction, WindowCenter, WindowWidth, low, high, Columns, Rows, frame, NumberOfFrames);
52         } else {
53             if (bits <= 8)
54                 OutputData = new DiMonoOutputPixelTemplate<Uint16, Uint32, Uint8>(buffer, InterData, Overlays, VoiLutData, PresLutData,
55                     disp, VoiLutFunction, WindowCenter, WindowWidth, low, high, Columns, Rows, frame, NumberOfFrames, samples > 1);
56             else if (bits <= 16)
57                 OutputData = new DiMonoOutputPixelTemplate<Uint16, Uint32, Uint16>(buffer, InterData, Overlays, VoiLutData, PresLutData,
58                     disp, VoiLutFunction, WindowCenter, WindowWidth, low, high, Columns, Rows, frame, NumberOfFrames);
59             else
60                 OutputData = new DiMonoOutputPixelTemplate<Uint16, Uint32, Uint32>(buffer, InterData, Overlays, VoiLutData, PresLutData,
61                     disp, VoiLutFunction, WindowCenter, WindowWidth, low, high, Columns, Rows, frame, NumberOfFrames);
62         }
63     }
64 }
65 
66 
getDataSint16(void * buffer,DiDisplayFunction * disp,const int samples,const unsigned long frame,const int bits,const Uint32 low,const Uint32 high)67 void DiMonoImage::getDataSint16(void *buffer,
68                                 DiDisplayFunction *disp,
69                                 const int samples,
70                                 const unsigned long frame,
71                                 const int bits,
72                                 const Uint32 low,
73                                 const Uint32 high)
74 {
75     if (bits <= 8)
76         OutputData = new DiMonoOutputPixelTemplate<Sint16, Sint32, Uint8>(buffer, InterData, Overlays, VoiLutData, PresLutData,
77             disp, VoiLutFunction, WindowCenter, WindowWidth, low, high, Columns, Rows, frame, NumberOfFrames, samples > 1);
78     else if (bits <= 16)
79         OutputData = new DiMonoOutputPixelTemplate<Sint16, Sint32, Uint16>(buffer, InterData, Overlays, VoiLutData, PresLutData,
80             disp, VoiLutFunction, WindowCenter, WindowWidth, low, high, Columns, Rows, frame, NumberOfFrames);
81     else
82         OutputData = new DiMonoOutputPixelTemplate<Sint16, Sint32, Uint32>(buffer, InterData, Overlays, VoiLutData, PresLutData,
83             disp, VoiLutFunction, WindowCenter, WindowWidth, low, high, Columns, Rows, frame, NumberOfFrames);
84 }
85