Mercurial > hg > orthanc-stone
annotate Framework/Deprecated/Layers/ColorFrameRenderer.cpp @ 988:4c9b4c4de814 toa2019090901
Fixed bug in DicomStructureSet that prevented points from being added to polygons
author | Benjamin Golinvaux <bgo@osimis.io> |
---|---|
date | Mon, 09 Sep 2019 16:15:28 +0200 |
parents | c35e98d22764 |
children | 2d8ab34c8c91 |
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 | |
439 | 5 * Copyright (C) 2017-2019 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 #include "ColorFrameRenderer.h" | |
23 | |
212
5412adf19980
resort to OrthancFramework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
201
diff
changeset
|
24 #include <Core/OrthancException.h> |
378 | 25 #include <Core/Images/Image.h> |
212
5412adf19980
resort to OrthancFramework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
201
diff
changeset
|
26 #include <Core/Images/ImageProcessing.h> |
0 | 27 |
726
4f2416d519b4
moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
560
diff
changeset
|
28 namespace Deprecated |
0 | 29 { |
726
4f2416d519b4
moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
560
diff
changeset
|
30 OrthancStone::CairoSurface* ColorFrameRenderer::GenerateDisplay(const RenderStyle& style) |
0 | 31 { |
726
4f2416d519b4
moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
560
diff
changeset
|
32 std::auto_ptr<OrthancStone::CairoSurface> display |
4f2416d519b4
moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
560
diff
changeset
|
33 (new OrthancStone::CairoSurface(frame_->GetWidth(), frame_->GetHeight(), false /* no alpha */)); |
0 | 34 |
316
ce48c3b3b0e9
fix for new ImageAccessor API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
212
diff
changeset
|
35 Orthanc::ImageAccessor target; |
ce48c3b3b0e9
fix for new ImageAccessor API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
212
diff
changeset
|
36 display->GetWriteableAccessor(target); |
ce48c3b3b0e9
fix for new ImageAccessor API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
212
diff
changeset
|
37 |
0 | 38 Orthanc::ImageProcessing::Convert(target, *frame_); |
39 | |
40 return display.release(); | |
41 } | |
42 | |
43 | |
378 | 44 ColorFrameRenderer::ColorFrameRenderer(const Orthanc::ImageAccessor& frame, |
726
4f2416d519b4
moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
560
diff
changeset
|
45 const OrthancStone::CoordinateSystem3D& framePlane, |
0 | 46 double pixelSpacingX, |
47 double pixelSpacingY, | |
48 bool isFullQuality) : | |
394
17d54c028805
rename ILayerRenderer::GetLayerSlice() to GetLayerPlane()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
378
diff
changeset
|
49 FrameRenderer(framePlane, pixelSpacingX, pixelSpacingY, isFullQuality), |
378 | 50 frame_(Orthanc::Image::Clone(frame)) |
0 | 51 { |
378 | 52 if (frame_.get() == NULL) |
0 | 53 { |
54 throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange); | |
55 } | |
56 | |
57 if (frame_->GetFormat() != Orthanc::PixelFormat_RGB24) | |
58 { | |
59 throw Orthanc::OrthancException(Orthanc::ErrorCode_IncompatibleImageFormat); | |
60 } | |
61 } | |
62 } |