Mercurial > hg > orthanc-stone
annotate Framework/Layers/ColorFrameRenderer.cpp @ 438:237160cbb44f am-vsol-upgrade
allow derivation of RadiographyScene
author | am@osimis.io |
---|---|
date | Thu, 20 Dec 2018 18:24:52 +0100 |
parents | 17d54c028805 |
children | b70e9be013e4 |
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 | |
134
4cff7b1ed31d
upgrade to year 2018
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
47
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 #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 |
28 namespace OrthancStone | |
29 { | |
30 CairoSurface* ColorFrameRenderer::GenerateDisplay(const RenderStyle& style) | |
31 { | |
32 std::auto_ptr<CairoSurface> display(new CairoSurface(frame_->GetWidth(), frame_->GetHeight())); | |
33 | |
316
ce48c3b3b0e9
fix for new ImageAccessor API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
212
diff
changeset
|
34 Orthanc::ImageAccessor target; |
ce48c3b3b0e9
fix for new ImageAccessor API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
212
diff
changeset
|
35 display->GetWriteableAccessor(target); |
ce48c3b3b0e9
fix for new ImageAccessor API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
212
diff
changeset
|
36 |
0 | 37 Orthanc::ImageProcessing::Convert(target, *frame_); |
38 | |
39 return display.release(); | |
40 } | |
41 | |
42 | |
378 | 43 ColorFrameRenderer::ColorFrameRenderer(const Orthanc::ImageAccessor& frame, |
394
17d54c028805
rename ILayerRenderer::GetLayerSlice() to GetLayerPlane()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
378
diff
changeset
|
44 const CoordinateSystem3D& framePlane, |
0 | 45 double pixelSpacingX, |
46 double pixelSpacingY, | |
47 bool isFullQuality) : | |
394
17d54c028805
rename ILayerRenderer::GetLayerSlice() to GetLayerPlane()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
378
diff
changeset
|
48 FrameRenderer(framePlane, pixelSpacingX, pixelSpacingY, isFullQuality), |
378 | 49 frame_(Orthanc::Image::Clone(frame)) |
0 | 50 { |
378 | 51 if (frame_.get() == NULL) |
0 | 52 { |
53 throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange); | |
54 } | |
55 | |
56 if (frame_->GetFormat() != Orthanc::PixelFormat_RGB24) | |
57 { | |
58 throw Orthanc::OrthancException(Orthanc::ErrorCode_IncompatibleImageFormat); | |
59 } | |
60 } | |
61 } |