Mercurial > hg > orthanc-stone
annotate Framework/Toolbox/DicomFrameConverter.h @ 182:2cbfb08f3a95 wasm
ImageGeometry.cpp
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 15 Mar 2018 12:12:01 +0100 |
parents | c6a464c266dd |
children | fccffbf99ba1 |
rev | line source |
---|---|
0 | 1 /** |
2 * Stone of Orthanc | |
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics | |
4 * Department, University Hospital of Liege, Belgium | |
135
e2fe9352f240
upgrade to year 2018
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
119
diff
changeset
|
5 * Copyright (C) 2017-2018 Osimis S.A., Belgium |
0 | 6 * |
7 * This program is free software: you can redistribute it and/or | |
47 | 8 * modify it under the terms of the GNU Affero 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. | |
0 | 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 | |
47 | 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
15 * Affero General Public License for more details. | |
16 * | |
17 * You should have received a copy of the GNU Affero General Public License | |
0 | 18 * along with this program. If not, see <http://www.gnu.org/licenses/>. |
19 **/ | |
20 | |
21 | |
22 #pragma once | |
23 | |
118
a4d0b6c82b29
using Orthanc::DicomMap instead of OrthancPlugins::DicomDatasetReader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
113
diff
changeset
|
24 #include <Core/DicomFormat/DicomMap.h> |
113
2eca030792aa
using the Orthanc Framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
47
diff
changeset
|
25 #include <Core/Images/ImageAccessor.h> |
0 | 26 |
32 | 27 #include <memory> |
0 | 28 |
29 namespace OrthancStone | |
30 { | |
31 /** | |
32 * This class is responsible for converting the pixel format of a | |
33 * DICOM frame coming from Orthanc, into a pixel format that is | |
34 * suitable for Stone, given the relevant DICOM tags: | |
35 * - Color frames will stay in the RGB24 format. | |
36 * - Grayscale frames will be converted to the Float32 format. | |
37 **/ | |
38 class DicomFrameConverter | |
39 { | |
40 private: | |
41 bool isSigned_; | |
42 bool isColor_; | |
43 bool hasRescale_; | |
119
ba83e38cf3ff
rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
118
diff
changeset
|
44 double rescaleIntercept_; |
ba83e38cf3ff
rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
118
diff
changeset
|
45 double rescaleSlope_; |
ba83e38cf3ff
rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
118
diff
changeset
|
46 double defaultWindowCenter_; |
ba83e38cf3ff
rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
118
diff
changeset
|
47 double defaultWindowWidth_; |
ba83e38cf3ff
rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
118
diff
changeset
|
48 |
ba83e38cf3ff
rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
118
diff
changeset
|
49 Orthanc::PixelFormat expectedPixelFormat_; |
0 | 50 |
51 void SetDefaultParameters(); | |
52 | |
53 public: | |
54 DicomFrameConverter() | |
55 { | |
56 SetDefaultParameters(); | |
57 } | |
58 | |
119
ba83e38cf3ff
rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
118
diff
changeset
|
59 Orthanc::PixelFormat GetExpectedPixelFormat() const |
ba83e38cf3ff
rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
118
diff
changeset
|
60 { |
ba83e38cf3ff
rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
118
diff
changeset
|
61 return expectedPixelFormat_; |
ba83e38cf3ff
rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
118
diff
changeset
|
62 } |
0 | 63 |
118
a4d0b6c82b29
using Orthanc::DicomMap instead of OrthancPlugins::DicomDatasetReader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
113
diff
changeset
|
64 void ReadParameters(const Orthanc::DicomMap& dicom); |
0 | 65 |
119
ba83e38cf3ff
rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
118
diff
changeset
|
66 double GetDefaultWindowCenter() const |
0 | 67 { |
68 return defaultWindowCenter_; | |
69 } | |
70 | |
119
ba83e38cf3ff
rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
118
diff
changeset
|
71 double GetDefaultWindowWidth() const |
0 | 72 { |
73 return defaultWindowWidth_; | |
74 } | |
75 | |
148 | 76 double GetRescaleIntercept() const |
77 { | |
78 return rescaleIntercept_; | |
79 } | |
80 | |
81 double GetRescaleSlope() const | |
82 { | |
83 return rescaleSlope_; | |
84 } | |
85 | |
119
ba83e38cf3ff
rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
118
diff
changeset
|
86 void ConvertFrame(std::auto_ptr<Orthanc::ImageAccessor>& source) const; |
ba83e38cf3ff
rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
118
diff
changeset
|
87 |
ba83e38cf3ff
rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
118
diff
changeset
|
88 void ApplyRescale(Orthanc::ImageAccessor& image, |
ba83e38cf3ff
rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
118
diff
changeset
|
89 bool useDouble) const; |
ba83e38cf3ff
rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
118
diff
changeset
|
90 |
ba83e38cf3ff
rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
118
diff
changeset
|
91 double Apply(double x) const; |
0 | 92 }; |
93 } |