1 /**
2  * Orthanc - A Lightweight, RESTful DICOM Store
3  * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
4  * Department, University Hospital of Liege, Belgium
5  * Copyright (C) 2017-2021 Osimis S.A., Belgium
6  *
7  * This program is free software: you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public License
9  * as published by the Free Software Foundation, either version 3 of
10  * the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful, but
13  * WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this program. If not, see
19  * <http://www.gnu.org/licenses/>.
20  **/
21 
22 
23 #pragma once
24 
25 #include "DicomMap.h"
26 
27 #include "DicomImageInformation.h"
28 
29 #include <stdint.h>
30 
31 namespace Orthanc
32 {
33   class DicomIntegerPixelAccessor
34   {
35   private:
36     DicomImageInformation information_;
37 
38     uint32_t signMask_;
39     uint32_t mask_;
40 
41     const void* pixelData_;
42     size_t size_;
43     unsigned int frame_;
44     size_t frameOffset_;
45     size_t rowOffset_;
46 
47   public:
48     DicomIntegerPixelAccessor(const DicomMap& values,
49                               const void* pixelData,
50                               size_t size);
51 
GetInformation()52     const DicomImageInformation GetInformation() const
53     {
54       return information_;
55     }
56 
GetCurrentFrame()57     unsigned int GetCurrentFrame() const
58     {
59       return frame_;
60     }
61 
62     void SetCurrentFrame(unsigned int frame);
63 
64     void GetExtremeValues(int32_t& min,
65                           int32_t& max) const;
66 
67     int32_t GetValue(unsigned int x, unsigned int y, unsigned int channel = 0) const;
68 
GetPixelData()69     const void* GetPixelData() const
70     {
71       return pixelData_;
72     }
73 
GetSize()74     size_t GetSize() const
75     {
76       return size_;
77     }
78   };
79 }
80