annotate Framework/Radiography/RadiographyDicomLayer.cpp @ 1145:4f99c7905f8d broker

mingw qt
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 12 Nov 2019 18:28:46 +0100
parents d7e06542304c
children 54cbffabdc45
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
430
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
1 /**
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
2 * Stone of Orthanc
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
4 * Department, University Hospital of Liege, Belgium
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
5 * Copyright (C) 2017-2018 Osimis S.A., Belgium
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
6 *
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
7 * This program is free software: you can redistribute it and/or
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
8 * modify it under the terms of the GNU Affero General Public License
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
9 * as published by the Free Software Foundation, either version 3 of
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
10 * the License, or (at your option) any later version.
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
11 *
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
12 * This program is distributed in the hope that it will be useful, but
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
15 * Affero General Public License for more details.
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
16 *
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
17 * You should have received a copy of the GNU Affero General Public License
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
19 **/
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
20
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
21
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
22 #include "RadiographyDicomLayer.h"
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
23
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
24 #include "RadiographyScene.h"
732
c35e98d22764 move Deprecated classes to a separate folder
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 714
diff changeset
25 #include "../Deprecated/Toolbox/DicomFrameConverter.h"
430
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
26
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
27 #include <Core/OrthancException.h>
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
28 #include <Core/Images/Image.h>
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
29 #include <Core/Images/ImageProcessing.h>
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
30 #include <Plugins/Samples/Common/DicomDatasetReader.h>
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
31
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
32 static OrthancPlugins::DicomTag ConvertTag(const Orthanc::DicomTag& tag)
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
33 {
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
34 return OrthancPlugins::DicomTag(tag.GetGroup(), tag.GetElement());
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
35 }
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
36
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
37 namespace OrthancStone
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
38 {
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
39
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
40 void RadiographyDicomLayer::ApplyConverter()
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
41 {
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
42 if (source_.get() != NULL &&
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
43 converter_.get() != NULL)
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
44 {
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
45 converted_.reset(converter_->ConvertFrame(*source_));
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
46 }
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
47 }
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
48
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
49
1066
b537002f83a9 removing broker from deprecated classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 739
diff changeset
50 RadiographyDicomLayer::RadiographyDicomLayer(const RadiographyScene& scene) :
b537002f83a9 removing broker from deprecated classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 739
diff changeset
51 RadiographyLayer(scene)
655
1e26bb5f2a02 Fixed truncating conversion warnings + fixed deletion of incomplete type
Benjamin Golinvaux <bgo@osimis.io>
parents: 649
diff changeset
52 {
1e26bb5f2a02 Fixed truncating conversion warnings + fixed deletion of incomplete type
Benjamin Golinvaux <bgo@osimis.io>
parents: 649
diff changeset
53
1e26bb5f2a02 Fixed truncating conversion warnings + fixed deletion of incomplete type
Benjamin Golinvaux <bgo@osimis.io>
parents: 649
diff changeset
54 }
1e26bb5f2a02 Fixed truncating conversion warnings + fixed deletion of incomplete type
Benjamin Golinvaux <bgo@osimis.io>
parents: 649
diff changeset
55
430
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
56 void RadiographyDicomLayer::SetDicomTags(const OrthancPlugins::FullOrthancDataset& dataset)
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
57 {
714
d2c0e347ddc2 deprecating DicomFrameConverter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 655
diff changeset
58 converter_.reset(new Deprecated::DicomFrameConverter);
430
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
59 converter_->ReadParameters(dataset);
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
60 ApplyConverter();
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
61
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
62 std::string tmp;
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
63 Vector pixelSpacing;
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
64
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
65 if (dataset.GetStringValue(tmp, ConvertTag(Orthanc::DICOM_TAG_PIXEL_SPACING)) &&
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
66 LinearAlgebra::ParseVector(pixelSpacing, tmp) &&
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
67 pixelSpacing.size() == 2)
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
68 {
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
69 SetPixelSpacing(pixelSpacing[0], pixelSpacing[1]);
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
70 }
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
71
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
72 OrthancPlugins::DicomDatasetReader reader(dataset);
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
73
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
74 unsigned int width, height;
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
75 if (!reader.GetUnsignedIntegerValue(width, ConvertTag(Orthanc::DICOM_TAG_COLUMNS)) ||
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
76 !reader.GetUnsignedIntegerValue(height, ConvertTag(Orthanc::DICOM_TAG_ROWS)))
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
77 {
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
78 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadFileFormat);
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
79 }
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
80 else
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
81 {
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
82 SetSize(width, height);
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
83 }
432
4eb96c6b4e96 improved handling of MONOCHROME1, background and invertion
am@osimis.io
parents: 430
diff changeset
84
4eb96c6b4e96 improved handling of MONOCHROME1, background and invertion
am@osimis.io
parents: 430
diff changeset
85 if (dataset.GetStringValue(tmp, ConvertTag(Orthanc::DICOM_TAG_PHOTOMETRIC_INTERPRETATION)))
4eb96c6b4e96 improved handling of MONOCHROME1, background and invertion
am@osimis.io
parents: 430
diff changeset
86 {
4eb96c6b4e96 improved handling of MONOCHROME1, background and invertion
am@osimis.io
parents: 430
diff changeset
87 if (tmp == "MONOCHROME1")
4eb96c6b4e96 improved handling of MONOCHROME1, background and invertion
am@osimis.io
parents: 430
diff changeset
88 {
739
be9c1530d40a deprecating enum SliceImageQuality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
89 SetPreferredPhotomotricDisplayMode(RadiographyPhotometricDisplayMode_Monochrome1);
432
4eb96c6b4e96 improved handling of MONOCHROME1, background and invertion
am@osimis.io
parents: 430
diff changeset
90 }
4eb96c6b4e96 improved handling of MONOCHROME1, background and invertion
am@osimis.io
parents: 430
diff changeset
91 else if (tmp == "MONOCHROME2")
4eb96c6b4e96 improved handling of MONOCHROME1, background and invertion
am@osimis.io
parents: 430
diff changeset
92 {
739
be9c1530d40a deprecating enum SliceImageQuality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 732
diff changeset
93 SetPreferredPhotomotricDisplayMode(RadiographyPhotometricDisplayMode_Monochrome2);
432
4eb96c6b4e96 improved handling of MONOCHROME1, background and invertion
am@osimis.io
parents: 430
diff changeset
94 }
4eb96c6b4e96 improved handling of MONOCHROME1, background and invertion
am@osimis.io
parents: 430
diff changeset
95 }
430
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
96 }
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
97
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
98 void RadiographyDicomLayer::SetSourceImage(Orthanc::ImageAccessor* image) // Takes ownership
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
99 {
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
100 std::auto_ptr<Orthanc::ImageAccessor> raii(image);
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
101
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
102 if (image == NULL)
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
103 {
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
104 throw Orthanc::OrthancException(Orthanc::ErrorCode_NullPointer);
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
105 }
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
106
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
107 SetSize(image->GetWidth(), image->GetHeight());
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
108
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
109 source_ = raii;
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
110 ApplyConverter();
503
77e0eb83ff63 layers are now Observable and emitting LayerEdited messages
amazy
parents: 432
diff changeset
111
623
42dadae61fa9 renamed IObservable::EmitMessage() as BroadcastMessage()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
112 BroadcastMessage(RadiographyLayer::LayerEditedMessage(*this));
430
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
113 }
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
114
1118
35e798b16b65 RadiographyDicomLayer: allow replacing low res image by high res image
Alain Mazy <alain@mazy.be>
parents: 739
diff changeset
115 void RadiographyDicomLayer::SetSourceImage(Orthanc::ImageAccessor* image, double newPixelSpacingX, double newPixelSpacingY) // Takes ownership
35e798b16b65 RadiographyDicomLayer: allow replacing low res image by high res image
Alain Mazy <alain@mazy.be>
parents: 739
diff changeset
116 {
35e798b16b65 RadiographyDicomLayer: allow replacing low res image by high res image
Alain Mazy <alain@mazy.be>
parents: 739
diff changeset
117 std::auto_ptr<Orthanc::ImageAccessor> raii(image);
35e798b16b65 RadiographyDicomLayer: allow replacing low res image by high res image
Alain Mazy <alain@mazy.be>
parents: 739
diff changeset
118
35e798b16b65 RadiographyDicomLayer: allow replacing low res image by high res image
Alain Mazy <alain@mazy.be>
parents: 739
diff changeset
119 if (image == NULL)
35e798b16b65 RadiographyDicomLayer: allow replacing low res image by high res image
Alain Mazy <alain@mazy.be>
parents: 739
diff changeset
120 {
35e798b16b65 RadiographyDicomLayer: allow replacing low res image by high res image
Alain Mazy <alain@mazy.be>
parents: 739
diff changeset
121 throw Orthanc::OrthancException(Orthanc::ErrorCode_NullPointer);
35e798b16b65 RadiographyDicomLayer: allow replacing low res image by high res image
Alain Mazy <alain@mazy.be>
parents: 739
diff changeset
122 }
35e798b16b65 RadiographyDicomLayer: allow replacing low res image by high res image
Alain Mazy <alain@mazy.be>
parents: 739
diff changeset
123
35e798b16b65 RadiographyDicomLayer: allow replacing low res image by high res image
Alain Mazy <alain@mazy.be>
parents: 739
diff changeset
124 SetSize(image->GetWidth(), image->GetHeight());
35e798b16b65 RadiographyDicomLayer: allow replacing low res image by high res image
Alain Mazy <alain@mazy.be>
parents: 739
diff changeset
125
35e798b16b65 RadiographyDicomLayer: allow replacing low res image by high res image
Alain Mazy <alain@mazy.be>
parents: 739
diff changeset
126 source_ = raii;
35e798b16b65 RadiographyDicomLayer: allow replacing low res image by high res image
Alain Mazy <alain@mazy.be>
parents: 739
diff changeset
127 ApplyConverter();
35e798b16b65 RadiographyDicomLayer: allow replacing low res image by high res image
Alain Mazy <alain@mazy.be>
parents: 739
diff changeset
128
35e798b16b65 RadiographyDicomLayer: allow replacing low res image by high res image
Alain Mazy <alain@mazy.be>
parents: 739
diff changeset
129 SetPixelSpacing(newPixelSpacingX, newPixelSpacingY, false);
35e798b16b65 RadiographyDicomLayer: allow replacing low res image by high res image
Alain Mazy <alain@mazy.be>
parents: 739
diff changeset
130
35e798b16b65 RadiographyDicomLayer: allow replacing low res image by high res image
Alain Mazy <alain@mazy.be>
parents: 739
diff changeset
131 BroadcastMessage(RadiographyLayer::LayerEditedMessage(*this));
35e798b16b65 RadiographyDicomLayer: allow replacing low res image by high res image
Alain Mazy <alain@mazy.be>
parents: 739
diff changeset
132 }
35e798b16b65 RadiographyDicomLayer: allow replacing low res image by high res image
Alain Mazy <alain@mazy.be>
parents: 739
diff changeset
133
649
f1bfe3d1759f Moved RadiographyDicomLayer::SetDicomFrameConverter to cpp file to prevent
Benjamin Golinvaux <bgo@osimis.io>
parents: 623
diff changeset
134
714
d2c0e347ddc2 deprecating DicomFrameConverter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 655
diff changeset
135 void RadiographyDicomLayer::SetDicomFrameConverter(Deprecated::DicomFrameConverter* converter)
649
f1bfe3d1759f Moved RadiographyDicomLayer::SetDicomFrameConverter to cpp file to prevent
Benjamin Golinvaux <bgo@osimis.io>
parents: 623
diff changeset
136 {
f1bfe3d1759f Moved RadiographyDicomLayer::SetDicomFrameConverter to cpp file to prevent
Benjamin Golinvaux <bgo@osimis.io>
parents: 623
diff changeset
137 converter_.reset(converter);
f1bfe3d1759f Moved RadiographyDicomLayer::SetDicomFrameConverter to cpp file to prevent
Benjamin Golinvaux <bgo@osimis.io>
parents: 623
diff changeset
138 }
f1bfe3d1759f Moved RadiographyDicomLayer::SetDicomFrameConverter to cpp file to prevent
Benjamin Golinvaux <bgo@osimis.io>
parents: 623
diff changeset
139
430
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
140 void RadiographyDicomLayer::Render(Orthanc::ImageAccessor& buffer,
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
141 const AffineTransform2D& viewTransform,
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
142 ImageInterpolation interpolation) const
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
143 {
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
144 if (converted_.get() != NULL)
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
145 {
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
146 if (converted_->GetFormat() != Orthanc::PixelFormat_Float32)
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
147 {
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
148 throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError);
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
149 }
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
150
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
151 unsigned int cropX, cropY, cropWidth, cropHeight;
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
152 GetCrop(cropX, cropY, cropWidth, cropHeight);
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
153
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
154 AffineTransform2D t = AffineTransform2D::Combine(
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
155 viewTransform, GetTransform(),
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
156 AffineTransform2D::CreateOffset(cropX, cropY));
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
157
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
158 Orthanc::ImageAccessor cropped;
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
159 converted_->GetRegion(cropped, cropX, cropY, cropWidth, cropHeight);
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
160
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
161 t.Apply(buffer, cropped, interpolation, false);
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
162 }
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
163 }
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
164
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
165
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
166 bool RadiographyDicomLayer::GetDefaultWindowing(float& center,
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
167 float& width) const
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
168 {
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
169 if (converter_.get() != NULL &&
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
170 converter_->HasDefaultWindow())
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
171 {
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
172 center = static_cast<float>(converter_->GetDefaultWindowCenter());
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
173 width = static_cast<float>(converter_->GetDefaultWindowWidth());
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
174 return true;
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
175 }
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
176 else
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
177 {
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
178 return false;
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
179 }
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
180 }
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
181
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
182
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
183 bool RadiographyDicomLayer::GetRange(float& minValue,
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
184 float& maxValue) const
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
185 {
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
186 if (converted_.get() != NULL)
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
187 {
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
188 if (converted_->GetFormat() != Orthanc::PixelFormat_Float32)
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
189 {
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
190 throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError);
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
191 }
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
192
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
193 Orthanc::ImageProcessing::GetMinMaxFloatValue(minValue, maxValue, *converted_);
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
194 return true;
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
195 }
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
196 else
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
197 {
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
198 return false;
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
199 }
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
200 }
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
201
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents:
diff changeset
202 }