Mercurial > hg > orthanc-stone
annotate OrthancStone/UnitTestsSources/VolumeRenderingTests.cpp @ 1922:b64a58e35f90
removed todo about ipad air 4
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 22 Mar 2022 14:55:52 +0100 |
parents | a2955abe4c2e |
children | 07964689cb0b |
rev | line source |
---|---|
1771
f302bbddf94d
sync, trying to fix DicomVolumeImageReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1 /** |
f302bbddf94d
sync, trying to fix DicomVolumeImageReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2 * Stone of Orthanc |
f302bbddf94d
sync, trying to fix DicomVolumeImageReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics |
f302bbddf94d
sync, trying to fix DicomVolumeImageReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4 * Department, University Hospital of Liege, Belgium |
1871
7053b8a0aaec
upgrade to year 2022
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1870
diff
changeset
|
5 * Copyright (C) 2017-2022 Osimis S.A., Belgium |
7053b8a0aaec
upgrade to year 2022
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1870
diff
changeset
|
6 * Copyright (C) 2021-2022 Sebastien Jodogne, ICTEAM UCLouvain, Belgium |
1771
f302bbddf94d
sync, trying to fix DicomVolumeImageReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
7 * |
f302bbddf94d
sync, trying to fix DicomVolumeImageReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
8 * This program is free software: you can redistribute it and/or |
1877
a2955abe4c2e
skeleton for the RenderingPlugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1871
diff
changeset
|
9 * modify it under the terms of the GNU Lesser General Public License |
1771
f302bbddf94d
sync, trying to fix DicomVolumeImageReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
10 * as published by the Free Software Foundation, either version 3 of |
f302bbddf94d
sync, trying to fix DicomVolumeImageReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
11 * the License, or (at your option) any later version. |
f302bbddf94d
sync, trying to fix DicomVolumeImageReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
12 * |
f302bbddf94d
sync, trying to fix DicomVolumeImageReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
13 * This program is distributed in the hope that it will be useful, but |
f302bbddf94d
sync, trying to fix DicomVolumeImageReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
14 * WITHOUT ANY WARRANTY; without even the implied warranty of |
1877
a2955abe4c2e
skeleton for the RenderingPlugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1871
diff
changeset
|
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
a2955abe4c2e
skeleton for the RenderingPlugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1871
diff
changeset
|
16 * Lesser General Public License for more details. |
1771
f302bbddf94d
sync, trying to fix DicomVolumeImageReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
17 * |
1877
a2955abe4c2e
skeleton for the RenderingPlugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1871
diff
changeset
|
18 * You should have received a copy of the GNU Lesser General Public |
a2955abe4c2e
skeleton for the RenderingPlugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1871
diff
changeset
|
19 * License along with this program. If not, see |
a2955abe4c2e
skeleton for the RenderingPlugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1871
diff
changeset
|
20 * <http://www.gnu.org/licenses/>. |
1771
f302bbddf94d
sync, trying to fix DicomVolumeImageReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
21 **/ |
f302bbddf94d
sync, trying to fix DicomVolumeImageReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
22 |
f302bbddf94d
sync, trying to fix DicomVolumeImageReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
23 |
1877
a2955abe4c2e
skeleton for the RenderingPlugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1871
diff
changeset
|
24 #include "../Sources/Scene2D/CairoCompositor.h" |
a2955abe4c2e
skeleton for the RenderingPlugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1871
diff
changeset
|
25 #include "../Sources/Scene2D/ColorTextureSceneLayer.h" |
a2955abe4c2e
skeleton for the RenderingPlugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1871
diff
changeset
|
26 #include "../Sources/Scene2D/CopyStyleConfigurator.h" |
a2955abe4c2e
skeleton for the RenderingPlugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1871
diff
changeset
|
27 #include "../Sources/Scene2D/MacroSceneLayer.h" |
a2955abe4c2e
skeleton for the RenderingPlugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1871
diff
changeset
|
28 #include "../Sources/Scene2D/PolylineSceneLayer.h" |
a2955abe4c2e
skeleton for the RenderingPlugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1871
diff
changeset
|
29 #include "../Sources/Toolbox/SubvoxelReader.h" |
a2955abe4c2e
skeleton for the RenderingPlugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1871
diff
changeset
|
30 #include "../Sources/Volumes/DicomVolumeImageMPRSlicer.h" |
a2955abe4c2e
skeleton for the RenderingPlugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1871
diff
changeset
|
31 #include "../Sources/Volumes/DicomVolumeImageReslicer.h" |
1772
6c246f862b00
unit test VolumeRendering.Basic
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1771
diff
changeset
|
32 |
1779
9ab251c03eda
unit test VolumeRendering.TextureCorners
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1778
diff
changeset
|
33 #include <Images/ImageProcessing.h> |
1772
6c246f862b00
unit test VolumeRendering.Basic
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1771
diff
changeset
|
34 #include <Images/ImageTraits.h> |
1778
de5c965f0697
simplifying test VolumeRendering.Axial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1775
diff
changeset
|
35 #include <OrthancException.h> |
1772
6c246f862b00
unit test VolumeRendering.Basic
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1771
diff
changeset
|
36 |
1771
f302bbddf94d
sync, trying to fix DicomVolumeImageReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
37 #include <gtest/gtest.h> |
f302bbddf94d
sync, trying to fix DicomVolumeImageReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
38 |
1778
de5c965f0697
simplifying test VolumeRendering.Axial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1775
diff
changeset
|
39 |
1783
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
40 |
1778
de5c965f0697
simplifying test VolumeRendering.Axial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1775
diff
changeset
|
41 static float GetPixelValue(const Orthanc::ImageAccessor& image, |
de5c965f0697
simplifying test VolumeRendering.Axial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1775
diff
changeset
|
42 unsigned int x, |
de5c965f0697
simplifying test VolumeRendering.Axial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1775
diff
changeset
|
43 unsigned int y) |
de5c965f0697
simplifying test VolumeRendering.Axial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1775
diff
changeset
|
44 { |
de5c965f0697
simplifying test VolumeRendering.Axial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1775
diff
changeset
|
45 switch (image.GetFormat()) |
de5c965f0697
simplifying test VolumeRendering.Axial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1775
diff
changeset
|
46 { |
de5c965f0697
simplifying test VolumeRendering.Axial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1775
diff
changeset
|
47 case Orthanc::PixelFormat_Grayscale8: |
de5c965f0697
simplifying test VolumeRendering.Axial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1775
diff
changeset
|
48 return Orthanc::ImageTraits<Orthanc::PixelFormat_Grayscale8>::GetFloatPixel(image, x, y); |
de5c965f0697
simplifying test VolumeRendering.Axial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1775
diff
changeset
|
49 |
de5c965f0697
simplifying test VolumeRendering.Axial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1775
diff
changeset
|
50 case Orthanc::PixelFormat_Float32: |
de5c965f0697
simplifying test VolumeRendering.Axial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1775
diff
changeset
|
51 return Orthanc::ImageTraits<Orthanc::PixelFormat_Float32>::GetFloatPixel(image, x, y); |
de5c965f0697
simplifying test VolumeRendering.Axial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1775
diff
changeset
|
52 |
de5c965f0697
simplifying test VolumeRendering.Axial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1775
diff
changeset
|
53 case Orthanc::PixelFormat_RGB24: |
de5c965f0697
simplifying test VolumeRendering.Axial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1775
diff
changeset
|
54 { |
de5c965f0697
simplifying test VolumeRendering.Axial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1775
diff
changeset
|
55 Orthanc::PixelTraits<Orthanc::PixelFormat_RGB24>::PixelType pixel; |
de5c965f0697
simplifying test VolumeRendering.Axial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1775
diff
changeset
|
56 Orthanc::ImageTraits<Orthanc::PixelFormat_RGB24>::GetPixel(pixel, image, x, y); |
de5c965f0697
simplifying test VolumeRendering.Axial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1775
diff
changeset
|
57 return pixel.red_; |
de5c965f0697
simplifying test VolumeRendering.Axial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1775
diff
changeset
|
58 } |
de5c965f0697
simplifying test VolumeRendering.Axial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1775
diff
changeset
|
59 |
de5c965f0697
simplifying test VolumeRendering.Axial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1775
diff
changeset
|
60 case Orthanc::PixelFormat_BGRA32: |
de5c965f0697
simplifying test VolumeRendering.Axial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1775
diff
changeset
|
61 { |
de5c965f0697
simplifying test VolumeRendering.Axial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1775
diff
changeset
|
62 Orthanc::PixelTraits<Orthanc::PixelFormat_BGRA32>::PixelType pixel; |
de5c965f0697
simplifying test VolumeRendering.Axial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1775
diff
changeset
|
63 Orthanc::ImageTraits<Orthanc::PixelFormat_BGRA32>::GetPixel(pixel, image, x, y); |
de5c965f0697
simplifying test VolumeRendering.Axial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1775
diff
changeset
|
64 return pixel.red_; |
de5c965f0697
simplifying test VolumeRendering.Axial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1775
diff
changeset
|
65 } |
de5c965f0697
simplifying test VolumeRendering.Axial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1775
diff
changeset
|
66 |
de5c965f0697
simplifying test VolumeRendering.Axial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1775
diff
changeset
|
67 default: |
de5c965f0697
simplifying test VolumeRendering.Axial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1775
diff
changeset
|
68 throw Orthanc::OrthancException(Orthanc::ErrorCode_NotImplemented); |
de5c965f0697
simplifying test VolumeRendering.Axial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1775
diff
changeset
|
69 } |
de5c965f0697
simplifying test VolumeRendering.Axial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1775
diff
changeset
|
70 } |
de5c965f0697
simplifying test VolumeRendering.Axial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1775
diff
changeset
|
71 |
de5c965f0697
simplifying test VolumeRendering.Axial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1775
diff
changeset
|
72 |
de5c965f0697
simplifying test VolumeRendering.Axial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1775
diff
changeset
|
73 static bool IsConstImage(float value, |
de5c965f0697
simplifying test VolumeRendering.Axial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1775
diff
changeset
|
74 const Orthanc::ImageAccessor& image) |
de5c965f0697
simplifying test VolumeRendering.Axial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1775
diff
changeset
|
75 { |
de5c965f0697
simplifying test VolumeRendering.Axial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1775
diff
changeset
|
76 for (unsigned int y = 0; y < image.GetHeight(); y++) |
de5c965f0697
simplifying test VolumeRendering.Axial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1775
diff
changeset
|
77 { |
de5c965f0697
simplifying test VolumeRendering.Axial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1775
diff
changeset
|
78 for (unsigned int x = 0; x < image.GetWidth(); x++) |
de5c965f0697
simplifying test VolumeRendering.Axial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1775
diff
changeset
|
79 { |
de5c965f0697
simplifying test VolumeRendering.Axial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1775
diff
changeset
|
80 if (!OrthancStone::LinearAlgebra::IsNear(value, GetPixelValue(image, x, y))) |
de5c965f0697
simplifying test VolumeRendering.Axial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1775
diff
changeset
|
81 { |
de5c965f0697
simplifying test VolumeRendering.Axial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1775
diff
changeset
|
82 return false; |
de5c965f0697
simplifying test VolumeRendering.Axial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1775
diff
changeset
|
83 } |
de5c965f0697
simplifying test VolumeRendering.Axial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1775
diff
changeset
|
84 } |
de5c965f0697
simplifying test VolumeRendering.Axial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1775
diff
changeset
|
85 } |
de5c965f0697
simplifying test VolumeRendering.Axial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1775
diff
changeset
|
86 |
de5c965f0697
simplifying test VolumeRendering.Axial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1775
diff
changeset
|
87 return true; |
de5c965f0697
simplifying test VolumeRendering.Axial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1775
diff
changeset
|
88 } |
de5c965f0697
simplifying test VolumeRendering.Axial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1775
diff
changeset
|
89 |
de5c965f0697
simplifying test VolumeRendering.Axial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1775
diff
changeset
|
90 |
de5c965f0697
simplifying test VolumeRendering.Axial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1775
diff
changeset
|
91 static bool IsConstRegion(float value, |
de5c965f0697
simplifying test VolumeRendering.Axial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1775
diff
changeset
|
92 const Orthanc::ImageAccessor& image, |
de5c965f0697
simplifying test VolumeRendering.Axial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1775
diff
changeset
|
93 unsigned int x, |
de5c965f0697
simplifying test VolumeRendering.Axial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1775
diff
changeset
|
94 unsigned int y, |
de5c965f0697
simplifying test VolumeRendering.Axial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1775
diff
changeset
|
95 unsigned int width, |
de5c965f0697
simplifying test VolumeRendering.Axial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1775
diff
changeset
|
96 unsigned int height) |
de5c965f0697
simplifying test VolumeRendering.Axial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1775
diff
changeset
|
97 { |
de5c965f0697
simplifying test VolumeRendering.Axial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1775
diff
changeset
|
98 Orthanc::ImageAccessor region; |
de5c965f0697
simplifying test VolumeRendering.Axial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1775
diff
changeset
|
99 image.GetRegion(region, x, y, width, height); |
de5c965f0697
simplifying test VolumeRendering.Axial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1775
diff
changeset
|
100 return IsConstImage(value, region); |
de5c965f0697
simplifying test VolumeRendering.Axial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1775
diff
changeset
|
101 } |
1779
9ab251c03eda
unit test VolumeRendering.TextureCorners
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1778
diff
changeset
|
102 |
9ab251c03eda
unit test VolumeRendering.TextureCorners
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1778
diff
changeset
|
103 |
1781
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
104 static bool IsConstImageWithExclusion(float value, |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
105 const Orthanc::ImageAccessor& image, |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
106 unsigned int exclusionX, |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
107 unsigned int exclusionY, |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
108 unsigned int exclusionWidth, |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
109 unsigned int exclusionHeight) |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
110 { |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
111 for (unsigned int y = 0; y < image.GetHeight(); y++) |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
112 { |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
113 for (unsigned int x = 0; x < image.GetWidth(); x++) |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
114 { |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
115 if ((x < exclusionX || |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
116 y < exclusionY || |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
117 x >= exclusionX + exclusionWidth || |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
118 y >= exclusionY + exclusionHeight) && |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
119 !OrthancStone::LinearAlgebra::IsNear(value, GetPixelValue(image, x, y))) |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
120 { |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
121 return false; |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
122 } |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
123 } |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
124 } |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
125 |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
126 return true; |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
127 } |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
128 |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
129 |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
130 static bool AreSameImages(const Orthanc::ImageAccessor& image1, |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
131 const Orthanc::ImageAccessor& image2) |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
132 { |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
133 if (image1.GetWidth() != image2.GetWidth() || |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
134 image1.GetHeight() != image2.GetHeight()) |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
135 { |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
136 return false; |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
137 } |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
138 |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
139 for (unsigned int y = 0; y < image1.GetHeight(); y++) |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
140 { |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
141 for (unsigned int x = 0; x < image1.GetWidth(); x++) |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
142 { |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
143 if (!OrthancStone::LinearAlgebra::IsNear(GetPixelValue(image1, x, y), |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
144 GetPixelValue(image2, x, y))) |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
145 { |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
146 return false; |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
147 } |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
148 } |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
149 } |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
150 |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
151 return true; |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
152 } |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
153 |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
154 |
1779
9ab251c03eda
unit test VolumeRendering.TextureCorners
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1778
diff
changeset
|
155 static void Assign3x3Pattern(Orthanc::ImageAccessor& image) |
9ab251c03eda
unit test VolumeRendering.TextureCorners
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1778
diff
changeset
|
156 { |
9ab251c03eda
unit test VolumeRendering.TextureCorners
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1778
diff
changeset
|
157 if (image.GetFormat() == Orthanc::PixelFormat_Grayscale8 && |
9ab251c03eda
unit test VolumeRendering.TextureCorners
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1778
diff
changeset
|
158 image.GetWidth() == 3 && |
9ab251c03eda
unit test VolumeRendering.TextureCorners
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1778
diff
changeset
|
159 image.GetHeight() == 3) |
9ab251c03eda
unit test VolumeRendering.TextureCorners
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1778
diff
changeset
|
160 { |
9ab251c03eda
unit test VolumeRendering.TextureCorners
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1778
diff
changeset
|
161 unsigned int v = 0; |
9ab251c03eda
unit test VolumeRendering.TextureCorners
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1778
diff
changeset
|
162 for (unsigned int y = 0; y < image.GetHeight(); y++) |
9ab251c03eda
unit test VolumeRendering.TextureCorners
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1778
diff
changeset
|
163 { |
9ab251c03eda
unit test VolumeRendering.TextureCorners
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1778
diff
changeset
|
164 uint8_t *p = reinterpret_cast<uint8_t*>(image.GetRow(y)); |
9ab251c03eda
unit test VolumeRendering.TextureCorners
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1778
diff
changeset
|
165 for (unsigned int x = 0; x < image.GetWidth(); x++, p++) |
9ab251c03eda
unit test VolumeRendering.TextureCorners
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1778
diff
changeset
|
166 { |
9ab251c03eda
unit test VolumeRendering.TextureCorners
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1778
diff
changeset
|
167 *p = v; |
9ab251c03eda
unit test VolumeRendering.TextureCorners
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1778
diff
changeset
|
168 v += 25; |
9ab251c03eda
unit test VolumeRendering.TextureCorners
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1778
diff
changeset
|
169 } |
9ab251c03eda
unit test VolumeRendering.TextureCorners
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1778
diff
changeset
|
170 } |
9ab251c03eda
unit test VolumeRendering.TextureCorners
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1778
diff
changeset
|
171 } |
9ab251c03eda
unit test VolumeRendering.TextureCorners
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1778
diff
changeset
|
172 else |
9ab251c03eda
unit test VolumeRendering.TextureCorners
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1778
diff
changeset
|
173 { |
9ab251c03eda
unit test VolumeRendering.TextureCorners
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1778
diff
changeset
|
174 throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError); |
9ab251c03eda
unit test VolumeRendering.TextureCorners
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1778
diff
changeset
|
175 } |
9ab251c03eda
unit test VolumeRendering.TextureCorners
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1778
diff
changeset
|
176 } |
1780
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
177 |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
178 |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
179 static Orthanc::ImageAccessor* Render(const OrthancStone::Scene2D& scene, |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
180 unsigned int width, |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
181 unsigned int height) |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
182 { |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
183 OrthancStone::CairoCompositor compositor(width, height); |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
184 compositor.Refresh(scene); |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
185 |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
186 Orthanc::ImageAccessor rendered; |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
187 compositor.GetCanvas().GetReadOnlyAccessor(rendered); |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
188 |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
189 return Orthanc::Image::Clone(rendered); |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
190 } |
1778
de5c965f0697
simplifying test VolumeRendering.Axial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1775
diff
changeset
|
191 |
de5c965f0697
simplifying test VolumeRendering.Axial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1775
diff
changeset
|
192 |
1780
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
193 |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
194 // Render the scene using the identity viewpoint (default) |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
195 static Orthanc::ImageAccessor* Render(OrthancStone::ISceneLayer* layer, |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
196 unsigned int width, |
1782
f053c80ea411
ImageBuffer3D::CommitSagittalSlice()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1781
diff
changeset
|
197 unsigned int height, |
f053c80ea411
ImageBuffer3D::CommitSagittalSlice()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1781
diff
changeset
|
198 bool fitScene) |
1780
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
199 { |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
200 OrthancStone::Scene2D scene; |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
201 scene.SetLayer(0, layer); |
1782
f053c80ea411
ImageBuffer3D::CommitSagittalSlice()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1781
diff
changeset
|
202 |
f053c80ea411
ImageBuffer3D::CommitSagittalSlice()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1781
diff
changeset
|
203 if (fitScene) |
f053c80ea411
ImageBuffer3D::CommitSagittalSlice()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1781
diff
changeset
|
204 { |
f053c80ea411
ImageBuffer3D::CommitSagittalSlice()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1781
diff
changeset
|
205 scene.FitContent(width, height); |
f053c80ea411
ImageBuffer3D::CommitSagittalSlice()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1781
diff
changeset
|
206 } |
f053c80ea411
ImageBuffer3D::CommitSagittalSlice()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1781
diff
changeset
|
207 |
1780
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
208 return Render(scene, width, height); |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
209 } |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
210 |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
211 |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
212 enum SlicerType |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
213 { |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
214 SlicerType_MPR = 0, |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
215 SlicerType_Reslicer = 1 |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
216 }; |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
217 |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
218 |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
219 static OrthancStone::TextureBaseSceneLayer* SliceVolume(boost::shared_ptr<OrthancStone::DicomVolumeImage> volume, |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
220 const OrthancStone::CoordinateSystem3D& volumeCoordinates, |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
221 const OrthancStone::CoordinateSystem3D& cuttingPlane, |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
222 SlicerType type) |
1771
f302bbddf94d
sync, trying to fix DicomVolumeImageReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
223 { |
1772
6c246f862b00
unit test VolumeRendering.Basic
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1771
diff
changeset
|
224 Orthanc::DicomMap dicom; |
6c246f862b00
unit test VolumeRendering.Basic
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1771
diff
changeset
|
225 dicom.SetValue(Orthanc::DICOM_TAG_STUDY_INSTANCE_UID, "study", false); |
6c246f862b00
unit test VolumeRendering.Basic
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1771
diff
changeset
|
226 dicom.SetValue(Orthanc::DICOM_TAG_SERIES_INSTANCE_UID, "series", false); |
6c246f862b00
unit test VolumeRendering.Basic
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1771
diff
changeset
|
227 dicom.SetValue(Orthanc::DICOM_TAG_SOP_INSTANCE_UID, "sop", false); |
6c246f862b00
unit test VolumeRendering.Basic
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1771
diff
changeset
|
228 |
1780
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
229 volume->SetDicomParameters(OrthancStone::DicomInstanceParameters(dicom)); |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
230 |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
231 std::unique_ptr<OrthancStone::IVolumeSlicer> slicer; |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
232 |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
233 switch (type) |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
234 { |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
235 case SlicerType_MPR: |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
236 slicer.reset(new OrthancStone::DicomVolumeImageMPRSlicer(volume)); |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
237 break; |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
238 |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
239 case SlicerType_Reslicer: |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
240 slicer.reset(new OrthancStone::DicomVolumeImageReslicer(volume)); |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
241 break; |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
242 |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
243 default: |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
244 throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange); |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
245 } |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
246 |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
247 std::unique_ptr<OrthancStone::IVolumeSlicer::IExtractedSlice> slice(slicer->ExtractSlice(cuttingPlane)); |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
248 if (slice->IsValid()) |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
249 { |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
250 OrthancStone::CopyStyleConfigurator configurator; |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
251 return dynamic_cast<OrthancStone::TextureBaseSceneLayer*>(slice->CreateSceneLayer(&configurator, cuttingPlane)); |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
252 } |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
253 else |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
254 { |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
255 return NULL; |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
256 } |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
257 } |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
258 |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
259 |
1782
f053c80ea411
ImageBuffer3D::CommitSagittalSlice()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1781
diff
changeset
|
260 static OrthancStone::TextureBaseSceneLayer* Slice3x3x1Pattern(OrthancStone::VolumeProjection projection, |
f053c80ea411
ImageBuffer3D::CommitSagittalSlice()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1781
diff
changeset
|
261 const OrthancStone::CoordinateSystem3D& volumeCoordinates, |
1780
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
262 const OrthancStone::CoordinateSystem3D& cuttingPlane, |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
263 SlicerType type) |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
264 { |
1772
6c246f862b00
unit test VolumeRendering.Basic
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1771
diff
changeset
|
265 OrthancStone::VolumeImageGeometry geometry; |
1782
f053c80ea411
ImageBuffer3D::CommitSagittalSlice()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1781
diff
changeset
|
266 |
f053c80ea411
ImageBuffer3D::CommitSagittalSlice()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1781
diff
changeset
|
267 switch (projection) |
f053c80ea411
ImageBuffer3D::CommitSagittalSlice()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1781
diff
changeset
|
268 { |
f053c80ea411
ImageBuffer3D::CommitSagittalSlice()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1781
diff
changeset
|
269 case OrthancStone::VolumeProjection_Axial: |
f053c80ea411
ImageBuffer3D::CommitSagittalSlice()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1781
diff
changeset
|
270 geometry.SetSizeInVoxels(3, 3, 1); |
f053c80ea411
ImageBuffer3D::CommitSagittalSlice()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1781
diff
changeset
|
271 break; |
f053c80ea411
ImageBuffer3D::CommitSagittalSlice()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1781
diff
changeset
|
272 |
f053c80ea411
ImageBuffer3D::CommitSagittalSlice()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1781
diff
changeset
|
273 case OrthancStone::VolumeProjection_Sagittal: |
f053c80ea411
ImageBuffer3D::CommitSagittalSlice()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1781
diff
changeset
|
274 geometry.SetSizeInVoxels(1, 3, 3); |
f053c80ea411
ImageBuffer3D::CommitSagittalSlice()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1781
diff
changeset
|
275 break; |
f053c80ea411
ImageBuffer3D::CommitSagittalSlice()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1781
diff
changeset
|
276 |
f053c80ea411
ImageBuffer3D::CommitSagittalSlice()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1781
diff
changeset
|
277 case OrthancStone::VolumeProjection_Coronal: |
f053c80ea411
ImageBuffer3D::CommitSagittalSlice()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1781
diff
changeset
|
278 geometry.SetSizeInVoxels(3, 1, 3); |
f053c80ea411
ImageBuffer3D::CommitSagittalSlice()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1781
diff
changeset
|
279 break; |
f053c80ea411
ImageBuffer3D::CommitSagittalSlice()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1781
diff
changeset
|
280 |
f053c80ea411
ImageBuffer3D::CommitSagittalSlice()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1781
diff
changeset
|
281 default: |
f053c80ea411
ImageBuffer3D::CommitSagittalSlice()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1781
diff
changeset
|
282 throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError); |
f053c80ea411
ImageBuffer3D::CommitSagittalSlice()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1781
diff
changeset
|
283 } |
f053c80ea411
ImageBuffer3D::CommitSagittalSlice()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1781
diff
changeset
|
284 |
1780
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
285 geometry.SetAxialGeometry(volumeCoordinates); |
1775
fca942f4b4a7
fix conversion from voxel centers to texture borders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1774
diff
changeset
|
286 |
1772
6c246f862b00
unit test VolumeRendering.Basic
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1771
diff
changeset
|
287 boost::shared_ptr<OrthancStone::DicomVolumeImage> volume(new OrthancStone::DicomVolumeImage); |
6c246f862b00
unit test VolumeRendering.Basic
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1771
diff
changeset
|
288 volume->Initialize(geometry, Orthanc::PixelFormat_Grayscale8, false); |
6c246f862b00
unit test VolumeRendering.Basic
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1771
diff
changeset
|
289 |
6c246f862b00
unit test VolumeRendering.Basic
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1771
diff
changeset
|
290 { |
1782
f053c80ea411
ImageBuffer3D::CommitSagittalSlice()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1781
diff
changeset
|
291 OrthancStone::ImageBuffer3D::SliceWriter writer(volume->GetPixelData(), projection, 0); |
1779
9ab251c03eda
unit test VolumeRendering.TextureCorners
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1778
diff
changeset
|
292 Assign3x3Pattern(writer.GetAccessor()); |
1772
6c246f862b00
unit test VolumeRendering.Basic
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1771
diff
changeset
|
293 } |
6c246f862b00
unit test VolumeRendering.Basic
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1771
diff
changeset
|
294 |
1775
fca942f4b4a7
fix conversion from voxel centers to texture borders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1774
diff
changeset
|
295 OrthancStone::Vector v = volume->GetGeometry().GetVoxelDimensions(OrthancStone::VolumeProjection_Axial); |
1780
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
296 if (!OrthancStone::LinearAlgebra::IsNear(1, v[0]) || |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
297 !OrthancStone::LinearAlgebra::IsNear(1, v[1]) || |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
298 !OrthancStone::LinearAlgebra::IsNear(1, v[2])) |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
299 { |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
300 throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError); |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
301 } |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
302 |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
303 return SliceVolume(volume, volumeCoordinates, cuttingPlane, type); |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
304 } |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
305 |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
306 |
1783
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
307 TEST(VolumeRendering, Pattern) |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
308 { |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
309 { |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
310 // Axial |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
311 OrthancStone::ImageBuffer3D image(Orthanc::PixelFormat_Grayscale8, 3, 3, 1, true); |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
312 |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
313 { |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
314 OrthancStone::ImageBuffer3D::SliceWriter writer(image, OrthancStone::VolumeProjection_Axial, 0); |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
315 Assign3x3Pattern(writer.GetAccessor()); |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
316 } |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
317 |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
318 float a, b; |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
319 ASSERT_TRUE(image.GetRange(a, b)); |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
320 ASSERT_FLOAT_EQ(0, a); |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
321 ASSERT_FLOAT_EQ(200, b); |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
322 |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
323 ASSERT_EQ(0, image.GetVoxelGrayscale8(0, 0, 0)); |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
324 ASSERT_EQ(25, image.GetVoxelGrayscale8(1, 0, 0)); |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
325 ASSERT_EQ(50, image.GetVoxelGrayscale8(2, 0, 0)); |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
326 ASSERT_EQ(75, image.GetVoxelGrayscale8(0, 1, 0)); |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
327 ASSERT_EQ(100, image.GetVoxelGrayscale8(1, 1, 0)); |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
328 ASSERT_EQ(125, image.GetVoxelGrayscale8(2, 1, 0)); |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
329 ASSERT_EQ(150, image.GetVoxelGrayscale8(0, 2, 0)); |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
330 ASSERT_EQ(175, image.GetVoxelGrayscale8(1, 2, 0)); |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
331 ASSERT_EQ(200, image.GetVoxelGrayscale8(2, 2, 0)); |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
332 |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
333 float v; |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
334 OrthancStone::SubvoxelReader<Orthanc::PixelFormat_Grayscale8, |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
335 OrthancStone::ImageInterpolation_Nearest> reader(image); |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
336 |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
337 ASSERT_TRUE(reader.GetFloatValue(v, 0.01, 0.01, 0.01)); ASSERT_FLOAT_EQ(0, v); |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
338 ASSERT_TRUE(reader.GetFloatValue(v, 1.01, 0.01, 0.01)); ASSERT_FLOAT_EQ(25, v); |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
339 ASSERT_TRUE(reader.GetFloatValue(v, 2.01, 0.01, 0.01)); ASSERT_FLOAT_EQ(50, v); |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
340 ASSERT_TRUE(reader.GetFloatValue(v, 0.01, 1.01, 0.01)); ASSERT_FLOAT_EQ(75, v); |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
341 ASSERT_TRUE(reader.GetFloatValue(v, 1.01, 1.01, 0.01)); ASSERT_FLOAT_EQ(100, v); |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
342 ASSERT_TRUE(reader.GetFloatValue(v, 2.01, 1.01, 0.01)); ASSERT_FLOAT_EQ(125, v); |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
343 ASSERT_TRUE(reader.GetFloatValue(v, 0.01, 2.01, 0.01)); ASSERT_FLOAT_EQ(150, v); |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
344 ASSERT_TRUE(reader.GetFloatValue(v, 1.01, 2.01, 0.01)); ASSERT_FLOAT_EQ(175, v); |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
345 ASSERT_TRUE(reader.GetFloatValue(v, 2.01, 2.01, 0.01)); ASSERT_FLOAT_EQ(200, v); |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
346 |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
347 ASSERT_TRUE(reader.GetFloatValue(v, 0.99, 0.99, 0.99)); ASSERT_FLOAT_EQ(0, v); |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
348 ASSERT_TRUE(reader.GetFloatValue(v, 1.99, 0.99, 0.99)); ASSERT_FLOAT_EQ(25, v); |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
349 ASSERT_TRUE(reader.GetFloatValue(v, 2.99, 0.99, 0.99)); ASSERT_FLOAT_EQ(50, v); |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
350 ASSERT_TRUE(reader.GetFloatValue(v, 0.99, 1.99, 0.99)); ASSERT_FLOAT_EQ(75, v); |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
351 ASSERT_TRUE(reader.GetFloatValue(v, 1.99, 1.99, 0.99)); ASSERT_FLOAT_EQ(100, v); |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
352 ASSERT_TRUE(reader.GetFloatValue(v, 2.99, 1.99, 0.99)); ASSERT_FLOAT_EQ(125, v); |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
353 ASSERT_TRUE(reader.GetFloatValue(v, 0.99, 2.99, 0.99)); ASSERT_FLOAT_EQ(150, v); |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
354 ASSERT_TRUE(reader.GetFloatValue(v, 1.99, 2.99, 0.99)); ASSERT_FLOAT_EQ(175, v); |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
355 ASSERT_TRUE(reader.GetFloatValue(v, 2.99, 2.99, 0.99)); ASSERT_FLOAT_EQ(200, v); |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
356 } |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
357 |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
358 { |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
359 // Coronal |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
360 OrthancStone::ImageBuffer3D image(Orthanc::PixelFormat_Grayscale8, 3, 1, 3, true); |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
361 |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
362 { |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
363 OrthancStone::ImageBuffer3D::SliceWriter writer(image, OrthancStone::VolumeProjection_Coronal, 0); |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
364 Assign3x3Pattern(writer.GetAccessor()); |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
365 } |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
366 |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
367 float a, b; |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
368 ASSERT_TRUE(image.GetRange(a, b)); |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
369 ASSERT_FLOAT_EQ(0, a); |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
370 ASSERT_FLOAT_EQ(200, b); |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
371 |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
372 // "Z" is in reverse order in "Assign3x3Pattern()", because important note in "ImageBuffer3D" |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
373 ASSERT_EQ(0, image.GetVoxelGrayscale8(0, 0, 2)); |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
374 ASSERT_EQ(25, image.GetVoxelGrayscale8(1, 0, 2)); |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
375 ASSERT_EQ(50, image.GetVoxelGrayscale8(2, 0, 2)); |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
376 ASSERT_EQ(75, image.GetVoxelGrayscale8(0, 0, 1)); |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
377 ASSERT_EQ(100, image.GetVoxelGrayscale8(1, 0, 1)); |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
378 ASSERT_EQ(125, image.GetVoxelGrayscale8(2, 0, 1)); |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
379 ASSERT_EQ(150, image.GetVoxelGrayscale8(0, 0, 0)); |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
380 ASSERT_EQ(175, image.GetVoxelGrayscale8(1, 0, 0)); |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
381 ASSERT_EQ(200, image.GetVoxelGrayscale8(2, 0, 0)); |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
382 |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
383 // Ensure that "SubvoxelReader" is consistent with "image.GetVoxelGrayscale8()" |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
384 float v; |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
385 OrthancStone::SubvoxelReader<Orthanc::PixelFormat_Grayscale8, |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
386 OrthancStone::ImageInterpolation_Nearest> reader(image); |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
387 |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
388 ASSERT_TRUE(reader.GetFloatValue(v, 0.01, 0.01, 2.01)); ASSERT_FLOAT_EQ(0, v); |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
389 ASSERT_TRUE(reader.GetFloatValue(v, 1.01, 0.01, 2.01)); ASSERT_FLOAT_EQ(25, v); |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
390 ASSERT_TRUE(reader.GetFloatValue(v, 2.01, 0.01, 2.01)); ASSERT_FLOAT_EQ(50, v); |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
391 ASSERT_TRUE(reader.GetFloatValue(v, 0.01, 0.01, 1.01)); ASSERT_FLOAT_EQ(75, v); |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
392 ASSERT_TRUE(reader.GetFloatValue(v, 1.01, 0.01, 1.01)); ASSERT_FLOAT_EQ(100, v); |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
393 ASSERT_TRUE(reader.GetFloatValue(v, 2.01, 0.01, 1.01)); ASSERT_FLOAT_EQ(125, v); |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
394 ASSERT_TRUE(reader.GetFloatValue(v, 0.01, 0.01, 0.01)); ASSERT_FLOAT_EQ(150, v); |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
395 ASSERT_TRUE(reader.GetFloatValue(v, 1.01, 0.01, 0.01)); ASSERT_FLOAT_EQ(175, v); |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
396 ASSERT_TRUE(reader.GetFloatValue(v, 2.01, 0.01, 0.01)); ASSERT_FLOAT_EQ(200, v); |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
397 |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
398 ASSERT_TRUE(reader.GetFloatValue(v, 0.99, 0.99, 2.99)); ASSERT_FLOAT_EQ(0, v); |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
399 ASSERT_TRUE(reader.GetFloatValue(v, 1.99, 0.99, 2.99)); ASSERT_FLOAT_EQ(25, v); |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
400 ASSERT_TRUE(reader.GetFloatValue(v, 2.99, 0.99, 2.99)); ASSERT_FLOAT_EQ(50, v); |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
401 ASSERT_TRUE(reader.GetFloatValue(v, 0.99, 0.99, 1.99)); ASSERT_FLOAT_EQ(75, v); |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
402 ASSERT_TRUE(reader.GetFloatValue(v, 1.99, 0.99, 1.99)); ASSERT_FLOAT_EQ(100, v); |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
403 ASSERT_TRUE(reader.GetFloatValue(v, 2.99, 0.99, 1.99)); ASSERT_FLOAT_EQ(125, v); |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
404 ASSERT_TRUE(reader.GetFloatValue(v, 0.99, 0.99, 0.99)); ASSERT_FLOAT_EQ(150, v); |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
405 ASSERT_TRUE(reader.GetFloatValue(v, 1.99, 0.99, 0.99)); ASSERT_FLOAT_EQ(175, v); |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
406 ASSERT_TRUE(reader.GetFloatValue(v, 2.99, 0.99, 0.99)); ASSERT_FLOAT_EQ(200, v); |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
407 } |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
408 |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
409 { |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
410 // Sagittal |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
411 OrthancStone::ImageBuffer3D image(Orthanc::PixelFormat_Grayscale8, 1, 3, 3, true); |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
412 |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
413 { |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
414 OrthancStone::ImageBuffer3D::SliceWriter writer(image, OrthancStone::VolumeProjection_Sagittal, 0); |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
415 Assign3x3Pattern(writer.GetAccessor()); |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
416 } |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
417 |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
418 float a, b; |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
419 ASSERT_TRUE(image.GetRange(a, b)); |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
420 ASSERT_FLOAT_EQ(0, a); |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
421 ASSERT_FLOAT_EQ(200, b); |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
422 |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
423 // "Z" is in reverse order in "Assign3x3Pattern()", because important note in "ImageBuffer3D" |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
424 ASSERT_EQ(0, image.GetVoxelGrayscale8(0, 0, 2)); |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
425 ASSERT_EQ(25, image.GetVoxelGrayscale8(0, 1, 2)); |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
426 ASSERT_EQ(50, image.GetVoxelGrayscale8(0, 2, 2)); |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
427 ASSERT_EQ(75, image.GetVoxelGrayscale8(0, 0, 1)); |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
428 ASSERT_EQ(100, image.GetVoxelGrayscale8(0, 1, 1)); |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
429 ASSERT_EQ(125, image.GetVoxelGrayscale8(0, 2, 1)); |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
430 ASSERT_EQ(150, image.GetVoxelGrayscale8(0, 0, 0)); |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
431 ASSERT_EQ(175, image.GetVoxelGrayscale8(0, 1, 0)); |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
432 ASSERT_EQ(200, image.GetVoxelGrayscale8(0, 2, 0)); |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
433 |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
434 // Ensure that "SubvoxelReader" is consistent with "image.GetVoxelGrayscale8()" |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
435 float v; |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
436 OrthancStone::SubvoxelReader<Orthanc::PixelFormat_Grayscale8, |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
437 OrthancStone::ImageInterpolation_Nearest> reader(image); |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
438 |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
439 ASSERT_TRUE(reader.GetFloatValue(v, 0.1, 0.01, 2.01)); ASSERT_FLOAT_EQ(0, v); |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
440 ASSERT_TRUE(reader.GetFloatValue(v, 0.1, 1.01, 2.01)); ASSERT_FLOAT_EQ(25, v); |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
441 ASSERT_TRUE(reader.GetFloatValue(v, 0.1, 2.01, 2.01)); ASSERT_FLOAT_EQ(50, v); |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
442 ASSERT_TRUE(reader.GetFloatValue(v, 0.1, 0.01, 1.01)); ASSERT_FLOAT_EQ(75, v); |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
443 ASSERT_TRUE(reader.GetFloatValue(v, 0.1, 1.01, 1.01)); ASSERT_FLOAT_EQ(100, v); |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
444 ASSERT_TRUE(reader.GetFloatValue(v, 0.1, 2.01, 1.01)); ASSERT_FLOAT_EQ(125, v); |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
445 ASSERT_TRUE(reader.GetFloatValue(v, 0.1, 0.01, 0.01)); ASSERT_FLOAT_EQ(150, v); |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
446 ASSERT_TRUE(reader.GetFloatValue(v, 0.1, 1.01, 0.01)); ASSERT_FLOAT_EQ(175, v); |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
447 ASSERT_TRUE(reader.GetFloatValue(v, 0.1, 2.01, 0.01)); ASSERT_FLOAT_EQ(200, v); |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
448 |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
449 ASSERT_TRUE(reader.GetFloatValue(v, 0.99, 0.99, 2.99)); ASSERT_FLOAT_EQ(0, v); |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
450 ASSERT_TRUE(reader.GetFloatValue(v, 0.99, 1.99, 2.99)); ASSERT_FLOAT_EQ(25, v); |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
451 ASSERT_TRUE(reader.GetFloatValue(v, 0.99, 2.99, 2.99)); ASSERT_FLOAT_EQ(50, v); |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
452 ASSERT_TRUE(reader.GetFloatValue(v, 0.99, 0.99, 1.99)); ASSERT_FLOAT_EQ(75, v); |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
453 ASSERT_TRUE(reader.GetFloatValue(v, 0.99, 1.99, 1.99)); ASSERT_FLOAT_EQ(100, v); |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
454 ASSERT_TRUE(reader.GetFloatValue(v, 0.99, 2.99, 1.99)); ASSERT_FLOAT_EQ(125, v); |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
455 ASSERT_TRUE(reader.GetFloatValue(v, 0.99, 0.99, 0.99)); ASSERT_FLOAT_EQ(150, v); |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
456 ASSERT_TRUE(reader.GetFloatValue(v, 0.99, 1.99, 0.99)); ASSERT_FLOAT_EQ(175, v); |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
457 ASSERT_TRUE(reader.GetFloatValue(v, 0.99, 2.99, 0.99)); ASSERT_FLOAT_EQ(200, v); |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
458 } |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
459 } |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
460 |
75d3e2ab1fe1
BREAKING: SubvoxelReader using the same Z-axis ordering as ImageBuffer3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1782
diff
changeset
|
461 |
1780
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
462 TEST(VolumeRendering, Axial) |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
463 { |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
464 OrthancStone::CoordinateSystem3D axial(OrthancStone::LinearAlgebra::CreateVector(-0.5, -0.5, 0), |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
465 OrthancStone::LinearAlgebra::CreateVector(1, 0, 0), |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
466 OrthancStone::LinearAlgebra::CreateVector(0, 1, 0)); |
1775
fca942f4b4a7
fix conversion from voxel centers to texture borders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1774
diff
changeset
|
467 |
1774
95ece40bb298
DicomVolumeImageReslicer and DicomVolumeImageMPRSlicer behave identically on axial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1772
diff
changeset
|
468 for (unsigned int mode = 0; mode < 2; mode++) |
95ece40bb298
DicomVolumeImageReslicer and DicomVolumeImageMPRSlicer behave identically on axial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1772
diff
changeset
|
469 { |
1780
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
470 OrthancStone::CoordinateSystem3D cuttingPlane; |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
471 |
1782
f053c80ea411
ImageBuffer3D::CommitSagittalSlice()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1781
diff
changeset
|
472 std::unique_ptr<OrthancStone::TextureBaseSceneLayer> layer( |
f053c80ea411
ImageBuffer3D::CommitSagittalSlice()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1781
diff
changeset
|
473 Slice3x3x1Pattern(OrthancStone::VolumeProjection_Axial, axial, cuttingPlane, static_cast<SlicerType>(mode))); |
1772
6c246f862b00
unit test VolumeRendering.Basic
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1771
diff
changeset
|
474 |
1780
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
475 ASSERT_TRUE(layer.get() != NULL); |
1775
fca942f4b4a7
fix conversion from voxel centers to texture borders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1774
diff
changeset
|
476 ASSERT_EQ(OrthancStone::ISceneLayer::Type_FloatTexture, layer->GetType()); |
fca942f4b4a7
fix conversion from voxel centers to texture borders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1774
diff
changeset
|
477 |
fca942f4b4a7
fix conversion from voxel centers to texture borders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1774
diff
changeset
|
478 OrthancStone::Extent2D box; |
fca942f4b4a7
fix conversion from voxel centers to texture borders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1774
diff
changeset
|
479 layer->GetBoundingBox(box); |
fca942f4b4a7
fix conversion from voxel centers to texture borders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1774
diff
changeset
|
480 ASSERT_FLOAT_EQ(-1.0f, box.GetX1()); |
fca942f4b4a7
fix conversion from voxel centers to texture borders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1774
diff
changeset
|
481 ASSERT_FLOAT_EQ(-1.0f, box.GetY1()); |
fca942f4b4a7
fix conversion from voxel centers to texture borders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1774
diff
changeset
|
482 ASSERT_FLOAT_EQ(2.0f, box.GetX2()); |
fca942f4b4a7
fix conversion from voxel centers to texture borders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1774
diff
changeset
|
483 ASSERT_FLOAT_EQ(2.0f, box.GetY2()); |
fca942f4b4a7
fix conversion from voxel centers to texture borders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1774
diff
changeset
|
484 |
1774
95ece40bb298
DicomVolumeImageReslicer and DicomVolumeImageMPRSlicer behave identically on axial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1772
diff
changeset
|
485 { |
1778
de5c965f0697
simplifying test VolumeRendering.Axial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1775
diff
changeset
|
486 const Orthanc::ImageAccessor& texture = dynamic_cast<OrthancStone::TextureBaseSceneLayer&>(*layer).GetTexture(); |
de5c965f0697
simplifying test VolumeRendering.Axial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1775
diff
changeset
|
487 ASSERT_EQ(3u, texture.GetWidth()); |
de5c965f0697
simplifying test VolumeRendering.Axial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1775
diff
changeset
|
488 ASSERT_EQ(3u, texture.GetHeight()); |
de5c965f0697
simplifying test VolumeRendering.Axial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1775
diff
changeset
|
489 ASSERT_FLOAT_EQ(0, GetPixelValue(texture, 0, 0)); |
de5c965f0697
simplifying test VolumeRendering.Axial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1775
diff
changeset
|
490 ASSERT_FLOAT_EQ(25, GetPixelValue(texture, 1, 0)); |
de5c965f0697
simplifying test VolumeRendering.Axial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1775
diff
changeset
|
491 ASSERT_FLOAT_EQ(50, GetPixelValue(texture, 2, 0)); |
de5c965f0697
simplifying test VolumeRendering.Axial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1775
diff
changeset
|
492 ASSERT_FLOAT_EQ(75, GetPixelValue(texture, 0, 1)); |
de5c965f0697
simplifying test VolumeRendering.Axial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1775
diff
changeset
|
493 ASSERT_FLOAT_EQ(100, GetPixelValue(texture, 1, 1)); |
de5c965f0697
simplifying test VolumeRendering.Axial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1775
diff
changeset
|
494 ASSERT_FLOAT_EQ(125, GetPixelValue(texture, 2, 1)); |
de5c965f0697
simplifying test VolumeRendering.Axial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1775
diff
changeset
|
495 ASSERT_FLOAT_EQ(150, GetPixelValue(texture, 0, 2)); |
de5c965f0697
simplifying test VolumeRendering.Axial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1775
diff
changeset
|
496 ASSERT_FLOAT_EQ(175, GetPixelValue(texture, 1, 2)); |
de5c965f0697
simplifying test VolumeRendering.Axial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1775
diff
changeset
|
497 ASSERT_FLOAT_EQ(200, GetPixelValue(texture, 2, 2)); |
1774
95ece40bb298
DicomVolumeImageReslicer and DicomVolumeImageMPRSlicer behave identically on axial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1772
diff
changeset
|
498 } |
1772
6c246f862b00
unit test VolumeRendering.Basic
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1771
diff
changeset
|
499 |
1782
f053c80ea411
ImageBuffer3D::CommitSagittalSlice()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1781
diff
changeset
|
500 std::unique_ptr<Orthanc::ImageAccessor> rendered(Render(layer.release(), 5, 5, false)); |
1780
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
501 ASSERT_EQ(5u, rendered->GetWidth()); |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
502 ASSERT_EQ(5u, rendered->GetHeight()); |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
503 ASSERT_FLOAT_EQ(0, GetPixelValue(*rendered, 0, 0)); |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
504 ASSERT_FLOAT_EQ(0, GetPixelValue(*rendered, 1, 0)); |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
505 ASSERT_FLOAT_EQ(0, GetPixelValue(*rendered, 2, 0)); |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
506 ASSERT_FLOAT_EQ(0, GetPixelValue(*rendered, 3, 0)); |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
507 ASSERT_FLOAT_EQ(0, GetPixelValue(*rendered, 4, 0)); |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
508 ASSERT_FLOAT_EQ(0, GetPixelValue(*rendered, 0, 1)); |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
509 ASSERT_FLOAT_EQ(0, GetPixelValue(*rendered, 1, 1)); |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
510 ASSERT_FLOAT_EQ(0, GetPixelValue(*rendered, 2, 1)); |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
511 ASSERT_FLOAT_EQ(0, GetPixelValue(*rendered, 3, 1)); |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
512 ASSERT_FLOAT_EQ(0, GetPixelValue(*rendered, 4, 1)); |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
513 ASSERT_FLOAT_EQ(0, GetPixelValue(*rendered, 0, 2)); |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
514 ASSERT_FLOAT_EQ(0, GetPixelValue(*rendered, 1, 2)); |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
515 ASSERT_FLOAT_EQ(0, GetPixelValue(*rendered, 2, 2)); |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
516 ASSERT_FLOAT_EQ(25, GetPixelValue(*rendered, 3, 2)); |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
517 ASSERT_FLOAT_EQ(50, GetPixelValue(*rendered, 4, 2)); |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
518 ASSERT_FLOAT_EQ(0, GetPixelValue(*rendered, 0, 3)); |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
519 ASSERT_FLOAT_EQ(0, GetPixelValue(*rendered, 1, 3)); |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
520 ASSERT_FLOAT_EQ(75, GetPixelValue(*rendered, 2, 3)); |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
521 ASSERT_FLOAT_EQ(100, GetPixelValue(*rendered, 3, 3)); |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
522 ASSERT_FLOAT_EQ(125, GetPixelValue(*rendered, 4, 3)); |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
523 ASSERT_FLOAT_EQ(0, GetPixelValue(*rendered, 0, 4)); |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
524 ASSERT_FLOAT_EQ(0, GetPixelValue(*rendered, 1, 4)); |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
525 ASSERT_FLOAT_EQ(150, GetPixelValue(*rendered, 2, 4)); |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
526 ASSERT_FLOAT_EQ(175, GetPixelValue(*rendered, 3, 4)); |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
527 ASSERT_FLOAT_EQ(200, GetPixelValue(*rendered, 4, 4)); |
1774
95ece40bb298
DicomVolumeImageReslicer and DicomVolumeImageMPRSlicer behave identically on axial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1772
diff
changeset
|
528 } |
1771
f302bbddf94d
sync, trying to fix DicomVolumeImageReslicer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
529 } |
1779
9ab251c03eda
unit test VolumeRendering.TextureCorners
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1778
diff
changeset
|
530 |
9ab251c03eda
unit test VolumeRendering.TextureCorners
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1778
diff
changeset
|
531 |
9ab251c03eda
unit test VolumeRendering.TextureCorners
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1778
diff
changeset
|
532 TEST(VolumeRendering, TextureCorners) |
9ab251c03eda
unit test VolumeRendering.TextureCorners
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1778
diff
changeset
|
533 { |
9ab251c03eda
unit test VolumeRendering.TextureCorners
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1778
diff
changeset
|
534 // The origin of a 2D texture is the coordinate of the BORDER of the |
9ab251c03eda
unit test VolumeRendering.TextureCorners
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1778
diff
changeset
|
535 // top-left pixel, *not* the center of the top-left pixel (as in |
9ab251c03eda
unit test VolumeRendering.TextureCorners
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1778
diff
changeset
|
536 // DICOM 3D convention) |
9ab251c03eda
unit test VolumeRendering.TextureCorners
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1778
diff
changeset
|
537 |
9ab251c03eda
unit test VolumeRendering.TextureCorners
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1778
diff
changeset
|
538 Orthanc::Image pixel(Orthanc::PixelFormat_RGB24, 1, 1, false); |
9ab251c03eda
unit test VolumeRendering.TextureCorners
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1778
diff
changeset
|
539 Orthanc::ImageProcessing::Set(pixel, 255, 0, 0, 255); |
9ab251c03eda
unit test VolumeRendering.TextureCorners
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1778
diff
changeset
|
540 |
9ab251c03eda
unit test VolumeRendering.TextureCorners
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1778
diff
changeset
|
541 { |
9ab251c03eda
unit test VolumeRendering.TextureCorners
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1778
diff
changeset
|
542 std::unique_ptr<OrthancStone::ColorTextureSceneLayer> layer(new OrthancStone::ColorTextureSceneLayer(pixel)); |
9ab251c03eda
unit test VolumeRendering.TextureCorners
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1778
diff
changeset
|
543 layer->SetOrigin(0, 0); |
9ab251c03eda
unit test VolumeRendering.TextureCorners
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1778
diff
changeset
|
544 |
1782
f053c80ea411
ImageBuffer3D::CommitSagittalSlice()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1781
diff
changeset
|
545 std::unique_ptr<Orthanc::ImageAccessor> rendered(Render(layer.release(), 2, 2, false)); |
1780
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
546 ASSERT_EQ(2u, rendered->GetWidth()); |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
547 ASSERT_EQ(2u, rendered->GetHeight()); |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
548 ASSERT_FLOAT_EQ(0, GetPixelValue(*rendered, 0, 0)); |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
549 ASSERT_FLOAT_EQ(0, GetPixelValue(*rendered, 1, 0)); |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
550 ASSERT_FLOAT_EQ(0, GetPixelValue(*rendered, 0, 1)); |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
551 ASSERT_FLOAT_EQ(255, GetPixelValue(*rendered, 1, 1)); |
1779
9ab251c03eda
unit test VolumeRendering.TextureCorners
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1778
diff
changeset
|
552 } |
9ab251c03eda
unit test VolumeRendering.TextureCorners
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1778
diff
changeset
|
553 |
9ab251c03eda
unit test VolumeRendering.TextureCorners
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1778
diff
changeset
|
554 { |
9ab251c03eda
unit test VolumeRendering.TextureCorners
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1778
diff
changeset
|
555 std::unique_ptr<OrthancStone::ColorTextureSceneLayer> layer(new OrthancStone::ColorTextureSceneLayer(pixel)); |
9ab251c03eda
unit test VolumeRendering.TextureCorners
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1778
diff
changeset
|
556 layer->SetOrigin(-0.01, 0); |
9ab251c03eda
unit test VolumeRendering.TextureCorners
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1778
diff
changeset
|
557 |
1782
f053c80ea411
ImageBuffer3D::CommitSagittalSlice()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1781
diff
changeset
|
558 std::unique_ptr<Orthanc::ImageAccessor> rendered(Render(layer.release(), 2, 2, false)); |
1780
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
559 ASSERT_FLOAT_EQ(0, GetPixelValue(*rendered, 0, 0)); |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
560 ASSERT_FLOAT_EQ(0, GetPixelValue(*rendered, 1, 0)); |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
561 ASSERT_FLOAT_EQ(255, GetPixelValue(*rendered, 0, 1)); |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
562 ASSERT_FLOAT_EQ(0, GetPixelValue(*rendered, 1, 1)); |
1779
9ab251c03eda
unit test VolumeRendering.TextureCorners
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1778
diff
changeset
|
563 } |
9ab251c03eda
unit test VolumeRendering.TextureCorners
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1778
diff
changeset
|
564 |
9ab251c03eda
unit test VolumeRendering.TextureCorners
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1778
diff
changeset
|
565 { |
9ab251c03eda
unit test VolumeRendering.TextureCorners
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1778
diff
changeset
|
566 std::unique_ptr<OrthancStone::ColorTextureSceneLayer> layer(new OrthancStone::ColorTextureSceneLayer(pixel)); |
9ab251c03eda
unit test VolumeRendering.TextureCorners
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1778
diff
changeset
|
567 layer->SetOrigin(-0.01, -0.01); |
9ab251c03eda
unit test VolumeRendering.TextureCorners
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1778
diff
changeset
|
568 |
1782
f053c80ea411
ImageBuffer3D::CommitSagittalSlice()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1781
diff
changeset
|
569 std::unique_ptr<Orthanc::ImageAccessor> rendered(Render(layer.release(), 2, 2, false)); |
1780
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
570 ASSERT_FLOAT_EQ(255, GetPixelValue(*rendered, 0, 0)); |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
571 ASSERT_FLOAT_EQ(0, GetPixelValue(*rendered, 1, 0)); |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
572 ASSERT_FLOAT_EQ(0, GetPixelValue(*rendered, 0, 1)); |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
573 ASSERT_FLOAT_EQ(0, GetPixelValue(*rendered, 1, 1)); |
1779
9ab251c03eda
unit test VolumeRendering.TextureCorners
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1778
diff
changeset
|
574 } |
9ab251c03eda
unit test VolumeRendering.TextureCorners
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1778
diff
changeset
|
575 |
9ab251c03eda
unit test VolumeRendering.TextureCorners
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1778
diff
changeset
|
576 { |
9ab251c03eda
unit test VolumeRendering.TextureCorners
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1778
diff
changeset
|
577 std::unique_ptr<OrthancStone::ColorTextureSceneLayer> layer(new OrthancStone::ColorTextureSceneLayer(pixel)); |
9ab251c03eda
unit test VolumeRendering.TextureCorners
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1778
diff
changeset
|
578 layer->SetOrigin(0, -0.01); |
9ab251c03eda
unit test VolumeRendering.TextureCorners
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1778
diff
changeset
|
579 |
1782
f053c80ea411
ImageBuffer3D::CommitSagittalSlice()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1781
diff
changeset
|
580 std::unique_ptr<Orthanc::ImageAccessor> rendered(Render(layer.release(), 2, 2, false)); |
1780
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
581 ASSERT_FLOAT_EQ(0, GetPixelValue(*rendered, 0, 0)); |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
582 ASSERT_FLOAT_EQ(255, GetPixelValue(*rendered, 1, 0)); |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
583 ASSERT_FLOAT_EQ(0, GetPixelValue(*rendered, 0, 1)); |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
584 ASSERT_FLOAT_EQ(0, GetPixelValue(*rendered, 1, 1)); |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
585 } |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
586 } |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
587 |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
588 |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
589 |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
590 TEST(VolumeRendering, FitTexture) |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
591 { |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
592 Orthanc::Image pixel(Orthanc::PixelFormat_RGB24, 1, 1, false); |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
593 Orthanc::ImageProcessing::Set(pixel, 255, 0, 0, 255); |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
594 |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
595 { |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
596 std::unique_ptr<OrthancStone::ColorTextureSceneLayer> layer(new OrthancStone::ColorTextureSceneLayer(pixel)); |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
597 layer->SetOrigin(-42.0f, 35.0f); |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
598 layer->SetPixelSpacing(2, 3); |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
599 |
1779
9ab251c03eda
unit test VolumeRendering.TextureCorners
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1778
diff
changeset
|
600 OrthancStone::Scene2D scene; |
9ab251c03eda
unit test VolumeRendering.TextureCorners
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1778
diff
changeset
|
601 scene.SetLayer(0, layer.release()); |
1780
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
602 scene.FitContent(30, 30); |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
603 |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
604 std::unique_ptr<Orthanc::ImageAccessor> rendered(Render(scene, 30, 30)); |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
605 ASSERT_TRUE(IsConstRegion(0.0f, *rendered, 0, 0, 5, 30)); |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
606 ASSERT_TRUE(IsConstRegion(255.0f, *rendered, 5, 0, 20, 30)); |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
607 ASSERT_TRUE(IsConstRegion(0.0f, *rendered, 25, 0, 5, 30)); |
1779
9ab251c03eda
unit test VolumeRendering.TextureCorners
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1778
diff
changeset
|
608 |
1780
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
609 rendered.reset(Render(scene, 40, 30)); |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
610 ASSERT_TRUE(IsConstRegion(0.0f, *rendered, 0, 0, 10, 30)); |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
611 ASSERT_TRUE(IsConstRegion(255.0f, *rendered, 10, 0, 20, 30)); |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
612 ASSERT_TRUE(IsConstRegion(0.0f, *rendered, 30, 0, 5, 30)); |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
613 |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
614 scene.FitContent(40, 30); |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
615 ASSERT_TRUE(IsConstRegion(0.0f, *rendered, 0, 0, 10, 30)); |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
616 ASSERT_TRUE(IsConstRegion(255.0f, *rendered, 10, 0, 20, 30)); |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
617 ASSERT_TRUE(IsConstRegion(0.0f, *rendered, 30, 0, 5, 30)); |
1779
9ab251c03eda
unit test VolumeRendering.TextureCorners
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1778
diff
changeset
|
618 |
1780
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
619 rendered.reset(Render(scene, 30, 36)); // The scene has not been fitted |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
620 ASSERT_TRUE(IsConstRegion(0.0f, *rendered, 0, 0, 30, 3)); |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
621 ASSERT_TRUE(IsConstRegion(0.0f, *rendered, 0, 0, 3, 36)); |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
622 ASSERT_TRUE(IsConstRegion(255.0f, *rendered, 5, 3, 20, 30)); |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
623 ASSERT_TRUE(IsConstRegion(0.0f, *rendered, 25, 0, 5, 36)); |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
624 ASSERT_TRUE(IsConstRegion(0.0f, *rendered, 0, 33, 30, 3)); |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
625 |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
626 scene.FitContent(30, 36); // Refit |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
627 rendered.reset(Render(scene, 30, 36)); |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
628 ASSERT_TRUE(IsConstRegion(0.0f, *rendered, 0, 0, 3, 36)); |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
629 ASSERT_TRUE(IsConstRegion(255.0f, *rendered, 3, 0, 24, 36)); |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
630 ASSERT_TRUE(IsConstRegion(0.0f, *rendered, 27, 0, 3, 36)); |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
631 } |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
632 |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
633 { |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
634 std::unique_ptr<OrthancStone::ColorTextureSceneLayer> layer(new OrthancStone::ColorTextureSceneLayer(pixel)); |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
635 layer->SetOrigin(42.0f, -35.0f); |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
636 layer->SetPixelSpacing(3, 2); |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
637 |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
638 OrthancStone::Scene2D scene; |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
639 scene.SetLayer(0, layer.release()); |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
640 scene.FitContent(30, 30); |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
641 |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
642 std::unique_ptr<Orthanc::ImageAccessor> rendered(Render(scene, 30, 30)); |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
643 ASSERT_TRUE(IsConstRegion(0.0f, *rendered, 0, 0, 30, 5)); |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
644 ASSERT_TRUE(IsConstRegion(255.0f, *rendered, 0, 5, 30, 20)); |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
645 ASSERT_TRUE(IsConstRegion(0.0f, *rendered, 0, 25, 30, 5)); |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
646 |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
647 rendered.reset(Render(scene, 30, 40)); |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
648 ASSERT_TRUE(IsConstRegion(0.0f, *rendered, 0, 0, 30, 10)); |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
649 ASSERT_TRUE(IsConstRegion(255.0f, *rendered, 0, 10, 30, 20)); |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
650 ASSERT_TRUE(IsConstRegion(0.0f, *rendered, 0, 30, 30, 5)); |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
651 |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
652 scene.FitContent(30, 40); |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
653 ASSERT_TRUE(IsConstRegion(0.0f, *rendered, 0, 0, 30, 10)); |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
654 ASSERT_TRUE(IsConstRegion(255.0f, *rendered, 0, 10, 30, 20)); |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
655 ASSERT_TRUE(IsConstRegion(0.0f, *rendered, 0, 30, 30, 5)); |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
656 |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
657 rendered.reset(Render(scene, 36, 30)); // The scene has not been fitted |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
658 ASSERT_TRUE(IsConstRegion(0.0f, *rendered, 0, 0, 3, 30)); |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
659 ASSERT_TRUE(IsConstRegion(0.0f, *rendered, 0, 0, 36, 3)); |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
660 ASSERT_TRUE(IsConstRegion(255.0f, *rendered, 3, 5, 30, 20)); |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
661 ASSERT_TRUE(IsConstRegion(0.0f, *rendered, 0, 25, 36, 5)); |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
662 ASSERT_TRUE(IsConstRegion(0.0f, *rendered, 33, 0, 3, 30)); |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
663 |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
664 scene.FitContent(36, 30); // Refit |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
665 rendered.reset(Render(scene, 36, 30)); |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
666 ASSERT_TRUE(IsConstRegion(0.0f, *rendered, 0, 0, 36, 3)); |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
667 ASSERT_TRUE(IsConstRegion(255.0f, *rendered, 0, 3, 36, 24)); |
b7c9fd1e9fb0
unit test VolumeRendering.FitTexture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1779
diff
changeset
|
668 ASSERT_TRUE(IsConstRegion(0.0f, *rendered, 0, 27, 36, 3)); |
1779
9ab251c03eda
unit test VolumeRendering.TextureCorners
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1778
diff
changeset
|
669 } |
9ab251c03eda
unit test VolumeRendering.TextureCorners
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1778
diff
changeset
|
670 } |
1781
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
671 |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
672 |
1782
f053c80ea411
ImageBuffer3D::CommitSagittalSlice()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1781
diff
changeset
|
673 |
1784
42a2880d690f
unit tests for MPR slicing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1783
diff
changeset
|
674 TEST(VolumeRendering, MPR) |
1781
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
675 { |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
676 double x = 2; |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
677 double y = 1; |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
678 OrthancStone::CoordinateSystem3D axial(OrthancStone::LinearAlgebra::CreateVector(x, y, 0), |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
679 OrthancStone::LinearAlgebra::CreateVector(1, 0, 0), |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
680 OrthancStone::LinearAlgebra::CreateVector(0, 1, 0)); |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
681 |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
682 Orthanc::Image pattern(Orthanc::PixelFormat_Grayscale8, 3, 3, false); |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
683 Assign3x3Pattern(pattern); |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
684 |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
685 Orthanc::Image patternX(Orthanc::PixelFormat_Grayscale8, 3, 3, false); |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
686 Assign3x3Pattern(patternX); |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
687 Orthanc::ImageProcessing::FlipX(patternX); |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
688 |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
689 Orthanc::Image patternY(Orthanc::PixelFormat_Grayscale8, 3, 3, false); |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
690 Assign3x3Pattern(patternY); |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
691 Orthanc::ImageProcessing::FlipY(patternY); |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
692 |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
693 Orthanc::Image patternXY(Orthanc::PixelFormat_Grayscale8, 3, 3, false); |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
694 Assign3x3Pattern(patternXY); |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
695 Orthanc::ImageProcessing::FlipX(patternXY); |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
696 Orthanc::ImageProcessing::FlipY(patternXY); |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
697 |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
698 for (unsigned int mode = 0; mode < 2; mode++) |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
699 { |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
700 { |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
701 OrthancStone::CoordinateSystem3D cuttingPlane(OrthancStone::LinearAlgebra::CreateVector(0, 0, 0), |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
702 OrthancStone::LinearAlgebra::CreateVector(1, 0, 0), |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
703 OrthancStone::LinearAlgebra::CreateVector(0, 1, 0)); |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
704 |
1782
f053c80ea411
ImageBuffer3D::CommitSagittalSlice()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1781
diff
changeset
|
705 std::unique_ptr<OrthancStone::TextureBaseSceneLayer> layer( |
f053c80ea411
ImageBuffer3D::CommitSagittalSlice()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1781
diff
changeset
|
706 Slice3x3x1Pattern(OrthancStone::VolumeProjection_Axial, axial, cuttingPlane, static_cast<SlicerType>(mode))); |
1781
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
707 ASSERT_TRUE(AreSameImages(layer->GetTexture(), pattern)); |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
708 |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
709 OrthancStone::Extent2D extent; |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
710 layer->GetBoundingBox(extent); |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
711 ASSERT_FLOAT_EQ(x - 0.5, extent.GetX1()); |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
712 ASSERT_FLOAT_EQ(y - 0.5, extent.GetY1()); |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
713 ASSERT_FLOAT_EQ(x + 2.5, extent.GetX2()); |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
714 ASSERT_FLOAT_EQ(y + 2.5, extent.GetY2()); |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
715 |
1782
f053c80ea411
ImageBuffer3D::CommitSagittalSlice()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1781
diff
changeset
|
716 std::unique_ptr<Orthanc::ImageAccessor> rendered(Render(layer.release(), 15, 15, false)); |
1781
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
717 ASSERT_TRUE(IsConstImageWithExclusion(0.0f, *rendered, 9, 8, 3, 3)); |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
718 |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
719 Orthanc::ImageAccessor p; |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
720 rendered->GetRegion(p, 9, 8, 3, 3); |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
721 ASSERT_TRUE(AreSameImages(p, pattern)); |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
722 } |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
723 |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
724 { |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
725 OrthancStone::CoordinateSystem3D cuttingPlane(OrthancStone::LinearAlgebra::CreateVector(0, 0, 0), |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
726 OrthancStone::LinearAlgebra::CreateVector(-1, 0, 0), |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
727 OrthancStone::LinearAlgebra::CreateVector(0, 1, 0)); |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
728 |
1782
f053c80ea411
ImageBuffer3D::CommitSagittalSlice()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1781
diff
changeset
|
729 std::unique_ptr<OrthancStone::TextureBaseSceneLayer> layer( |
f053c80ea411
ImageBuffer3D::CommitSagittalSlice()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1781
diff
changeset
|
730 Slice3x3x1Pattern(OrthancStone::VolumeProjection_Axial, axial, cuttingPlane, static_cast<SlicerType>(mode))); |
1781
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
731 if (mode == 1) |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
732 { |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
733 // Reslicer directly flips the pixels of the texture |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
734 ASSERT_TRUE(AreSameImages(layer->GetTexture(), patternX)); |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
735 } |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
736 else |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
737 { |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
738 // MPR slicer uses "TextureBaseSceneLayer::SetTransform()" to flip |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
739 ASSERT_TRUE(AreSameImages(layer->GetTexture(), pattern)); |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
740 } |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
741 |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
742 OrthancStone::Extent2D extent; |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
743 layer->GetBoundingBox(extent); |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
744 ASSERT_FLOAT_EQ(-(x + 2.5), extent.GetX1()); |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
745 ASSERT_FLOAT_EQ(y - 0.5, extent.GetY1()); |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
746 ASSERT_FLOAT_EQ(-(x - 0.5), extent.GetX2()); |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
747 ASSERT_FLOAT_EQ(y + 2.5, extent.GetY2()); |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
748 |
1782
f053c80ea411
ImageBuffer3D::CommitSagittalSlice()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1781
diff
changeset
|
749 std::unique_ptr<Orthanc::ImageAccessor> rendered(Render(layer.release(), 15, 15, false)); |
1781
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
750 ASSERT_TRUE(IsConstImageWithExclusion(0.0f, *rendered, 3, 8, 3, 3)); |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
751 |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
752 Orthanc::ImageAccessor p; |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
753 rendered->GetRegion(p, 3, 8, 3, 3); |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
754 ASSERT_TRUE(AreSameImages(p, patternX)); |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
755 } |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
756 |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
757 { |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
758 OrthancStone::CoordinateSystem3D cuttingPlane(OrthancStone::LinearAlgebra::CreateVector(0, 0, 0), |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
759 OrthancStone::LinearAlgebra::CreateVector(1, 0, 0), |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
760 OrthancStone::LinearAlgebra::CreateVector(0, -1, 0)); |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
761 |
1782
f053c80ea411
ImageBuffer3D::CommitSagittalSlice()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1781
diff
changeset
|
762 std::unique_ptr<OrthancStone::TextureBaseSceneLayer> layer( |
f053c80ea411
ImageBuffer3D::CommitSagittalSlice()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1781
diff
changeset
|
763 Slice3x3x1Pattern(OrthancStone::VolumeProjection_Axial, axial, cuttingPlane, static_cast<SlicerType>(mode))); |
1781
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
764 if (mode == 1) |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
765 { |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
766 ASSERT_TRUE(AreSameImages(layer->GetTexture(), patternY)); |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
767 } |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
768 else |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
769 { |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
770 ASSERT_TRUE(AreSameImages(layer->GetTexture(), pattern)); |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
771 } |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
772 |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
773 OrthancStone::Extent2D extent; |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
774 layer->GetBoundingBox(extent); |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
775 ASSERT_FLOAT_EQ(x - 0.5, extent.GetX1()); |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
776 ASSERT_FLOAT_EQ(-(y + 2.5), extent.GetY1()); |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
777 ASSERT_FLOAT_EQ(x + 2.5, extent.GetX2()); |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
778 ASSERT_FLOAT_EQ(-(y - 0.5), extent.GetY2()); |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
779 |
1782
f053c80ea411
ImageBuffer3D::CommitSagittalSlice()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1781
diff
changeset
|
780 std::unique_ptr<Orthanc::ImageAccessor> rendered(Render(layer.release(), 15, 15, false)); |
1781
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
781 ASSERT_TRUE(IsConstImageWithExclusion(0.0f, *rendered, 9, 4, 3, 3)); |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
782 |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
783 Orthanc::ImageAccessor p; |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
784 rendered->GetRegion(p, 9, 4, 3, 3); |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
785 ASSERT_TRUE(AreSameImages(p, patternY)); |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
786 } |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
787 |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
788 { |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
789 OrthancStone::CoordinateSystem3D cuttingPlane(OrthancStone::LinearAlgebra::CreateVector(0, 0, 0), |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
790 OrthancStone::LinearAlgebra::CreateVector(-1, 0, 0), |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
791 OrthancStone::LinearAlgebra::CreateVector(0, -1, 0)); |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
792 |
1782
f053c80ea411
ImageBuffer3D::CommitSagittalSlice()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1781
diff
changeset
|
793 std::unique_ptr<OrthancStone::TextureBaseSceneLayer> layer( |
f053c80ea411
ImageBuffer3D::CommitSagittalSlice()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1781
diff
changeset
|
794 Slice3x3x1Pattern(OrthancStone::VolumeProjection_Axial, axial, cuttingPlane, static_cast<SlicerType>(mode))); |
1781
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
795 if (mode == 1) |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
796 { |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
797 ASSERT_TRUE(AreSameImages(layer->GetTexture(), patternXY)); |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
798 } |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
799 else |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
800 { |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
801 ASSERT_TRUE(AreSameImages(layer->GetTexture(), pattern)); |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
802 } |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
803 |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
804 OrthancStone::Extent2D extent; |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
805 layer->GetBoundingBox(extent); |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
806 ASSERT_FLOAT_EQ(-(x + 2.5), extent.GetX1()); |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
807 ASSERT_FLOAT_EQ(-(y + 2.5), extent.GetY1()); |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
808 ASSERT_FLOAT_EQ(-(x - 0.5), extent.GetX2()); |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
809 ASSERT_FLOAT_EQ(-(y - 0.5), extent.GetY2()); |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
810 |
1782
f053c80ea411
ImageBuffer3D::CommitSagittalSlice()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1781
diff
changeset
|
811 std::unique_ptr<Orthanc::ImageAccessor> rendered(Render(layer.release(), 15, 15, false)); |
1781
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
812 ASSERT_TRUE(IsConstImageWithExclusion(0.0f, *rendered, 3, 4, 3, 3)); |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
813 |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
814 Orthanc::ImageAccessor p; |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
815 rendered->GetRegion(p, 3, 4, 3, 3); |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
816 ASSERT_TRUE(AreSameImages(p, patternXY)); |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
817 } |
1784
42a2880d690f
unit tests for MPR slicing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1783
diff
changeset
|
818 |
42a2880d690f
unit tests for MPR slicing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1783
diff
changeset
|
819 // Tests along the sagittal and coronal axis: cf. |
42a2880d690f
unit tests for MPR slicing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1783
diff
changeset
|
820 // "TEST(VolumeRendering, Pattern)" to understand why Z is flipped |
42a2880d690f
unit tests for MPR slicing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1783
diff
changeset
|
821 |
42a2880d690f
unit tests for MPR slicing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1783
diff
changeset
|
822 { |
42a2880d690f
unit tests for MPR slicing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1783
diff
changeset
|
823 OrthancStone::CoordinateSystem3D cuttingPlane(OrthancStone::LinearAlgebra::CreateVector(0, 0, 0), |
42a2880d690f
unit tests for MPR slicing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1783
diff
changeset
|
824 OrthancStone::LinearAlgebra::CreateVector(1, 0, 0), |
42a2880d690f
unit tests for MPR slicing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1783
diff
changeset
|
825 OrthancStone::LinearAlgebra::CreateVector(0, 1, 0)); |
42a2880d690f
unit tests for MPR slicing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1783
diff
changeset
|
826 |
42a2880d690f
unit tests for MPR slicing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1783
diff
changeset
|
827 std::unique_ptr<OrthancStone::TextureBaseSceneLayer> layer( |
42a2880d690f
unit tests for MPR slicing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1783
diff
changeset
|
828 Slice3x3x1Pattern(OrthancStone::VolumeProjection_Sagittal, axial, cuttingPlane, static_cast<SlicerType>(mode))); |
42a2880d690f
unit tests for MPR slicing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1783
diff
changeset
|
829 |
42a2880d690f
unit tests for MPR slicing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1783
diff
changeset
|
830 std::unique_ptr<Orthanc::ImageAccessor> rendered(Render(layer.release(), 1, 3, true)); |
42a2880d690f
unit tests for MPR slicing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1783
diff
changeset
|
831 ASSERT_FLOAT_EQ(150, GetPixelValue(*rendered, 0, 0)); |
42a2880d690f
unit tests for MPR slicing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1783
diff
changeset
|
832 ASSERT_FLOAT_EQ(175, GetPixelValue(*rendered, 0, 1)); |
42a2880d690f
unit tests for MPR slicing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1783
diff
changeset
|
833 ASSERT_FLOAT_EQ(200, GetPixelValue(*rendered, 0, 2)); |
42a2880d690f
unit tests for MPR slicing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1783
diff
changeset
|
834 } |
42a2880d690f
unit tests for MPR slicing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1783
diff
changeset
|
835 |
42a2880d690f
unit tests for MPR slicing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1783
diff
changeset
|
836 { |
42a2880d690f
unit tests for MPR slicing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1783
diff
changeset
|
837 OrthancStone::CoordinateSystem3D cuttingPlane(OrthancStone::LinearAlgebra::CreateVector(0, 0, 1), |
42a2880d690f
unit tests for MPR slicing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1783
diff
changeset
|
838 OrthancStone::LinearAlgebra::CreateVector(1, 0, 0), |
42a2880d690f
unit tests for MPR slicing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1783
diff
changeset
|
839 OrthancStone::LinearAlgebra::CreateVector(0, 1, 0)); |
42a2880d690f
unit tests for MPR slicing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1783
diff
changeset
|
840 |
42a2880d690f
unit tests for MPR slicing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1783
diff
changeset
|
841 std::unique_ptr<OrthancStone::TextureBaseSceneLayer> layer( |
42a2880d690f
unit tests for MPR slicing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1783
diff
changeset
|
842 Slice3x3x1Pattern(OrthancStone::VolumeProjection_Sagittal, axial, cuttingPlane, static_cast<SlicerType>(mode))); |
42a2880d690f
unit tests for MPR slicing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1783
diff
changeset
|
843 |
42a2880d690f
unit tests for MPR slicing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1783
diff
changeset
|
844 std::unique_ptr<Orthanc::ImageAccessor> rendered(Render(layer.release(), 1, 3, true)); |
42a2880d690f
unit tests for MPR slicing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1783
diff
changeset
|
845 ASSERT_FLOAT_EQ(75, GetPixelValue(*rendered, 0, 0)); |
42a2880d690f
unit tests for MPR slicing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1783
diff
changeset
|
846 ASSERT_FLOAT_EQ(100, GetPixelValue(*rendered, 0, 1)); |
42a2880d690f
unit tests for MPR slicing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1783
diff
changeset
|
847 ASSERT_FLOAT_EQ(125, GetPixelValue(*rendered, 0, 2)); |
42a2880d690f
unit tests for MPR slicing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1783
diff
changeset
|
848 } |
42a2880d690f
unit tests for MPR slicing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1783
diff
changeset
|
849 |
42a2880d690f
unit tests for MPR slicing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1783
diff
changeset
|
850 { |
42a2880d690f
unit tests for MPR slicing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1783
diff
changeset
|
851 OrthancStone::CoordinateSystem3D cuttingPlane(OrthancStone::LinearAlgebra::CreateVector(0, 0, 2), |
42a2880d690f
unit tests for MPR slicing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1783
diff
changeset
|
852 OrthancStone::LinearAlgebra::CreateVector(1, 0, 0), |
42a2880d690f
unit tests for MPR slicing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1783
diff
changeset
|
853 OrthancStone::LinearAlgebra::CreateVector(0, 1, 0)); |
42a2880d690f
unit tests for MPR slicing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1783
diff
changeset
|
854 |
42a2880d690f
unit tests for MPR slicing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1783
diff
changeset
|
855 std::unique_ptr<OrthancStone::TextureBaseSceneLayer> layer( |
42a2880d690f
unit tests for MPR slicing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1783
diff
changeset
|
856 Slice3x3x1Pattern(OrthancStone::VolumeProjection_Sagittal, axial, cuttingPlane, static_cast<SlicerType>(mode))); |
42a2880d690f
unit tests for MPR slicing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1783
diff
changeset
|
857 |
42a2880d690f
unit tests for MPR slicing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1783
diff
changeset
|
858 std::unique_ptr<Orthanc::ImageAccessor> rendered(Render(layer.release(), 1, 3, true)); |
42a2880d690f
unit tests for MPR slicing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1783
diff
changeset
|
859 ASSERT_FLOAT_EQ(0, GetPixelValue(*rendered, 0, 0)); |
42a2880d690f
unit tests for MPR slicing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1783
diff
changeset
|
860 ASSERT_FLOAT_EQ(25, GetPixelValue(*rendered, 0, 1)); |
42a2880d690f
unit tests for MPR slicing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1783
diff
changeset
|
861 ASSERT_FLOAT_EQ(50, GetPixelValue(*rendered, 0, 2)); |
42a2880d690f
unit tests for MPR slicing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1783
diff
changeset
|
862 } |
42a2880d690f
unit tests for MPR slicing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1783
diff
changeset
|
863 |
1788
4fd065ad1fc0
more mpr rendering tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1784
diff
changeset
|
864 { |
4fd065ad1fc0
more mpr rendering tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1784
diff
changeset
|
865 OrthancStone::CoordinateSystem3D cuttingPlane(OrthancStone::LinearAlgebra::CreateVector(0, 0, 2), |
4fd065ad1fc0
more mpr rendering tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1784
diff
changeset
|
866 OrthancStone::LinearAlgebra::CreateVector(-1, 0, 0), |
4fd065ad1fc0
more mpr rendering tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1784
diff
changeset
|
867 OrthancStone::LinearAlgebra::CreateVector(0, 1, 0)); |
4fd065ad1fc0
more mpr rendering tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1784
diff
changeset
|
868 |
4fd065ad1fc0
more mpr rendering tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1784
diff
changeset
|
869 std::unique_ptr<OrthancStone::TextureBaseSceneLayer> layer( |
4fd065ad1fc0
more mpr rendering tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1784
diff
changeset
|
870 Slice3x3x1Pattern(OrthancStone::VolumeProjection_Sagittal, axial, cuttingPlane, static_cast<SlicerType>(mode))); |
4fd065ad1fc0
more mpr rendering tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1784
diff
changeset
|
871 |
4fd065ad1fc0
more mpr rendering tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1784
diff
changeset
|
872 std::unique_ptr<Orthanc::ImageAccessor> rendered(Render(layer.release(), 1, 3, true)); |
4fd065ad1fc0
more mpr rendering tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1784
diff
changeset
|
873 ASSERT_FLOAT_EQ(0, GetPixelValue(*rendered, 0, 0)); |
4fd065ad1fc0
more mpr rendering tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1784
diff
changeset
|
874 ASSERT_FLOAT_EQ(25, GetPixelValue(*rendered, 0, 1)); |
4fd065ad1fc0
more mpr rendering tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1784
diff
changeset
|
875 ASSERT_FLOAT_EQ(50, GetPixelValue(*rendered, 0, 2)); |
4fd065ad1fc0
more mpr rendering tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1784
diff
changeset
|
876 } |
4fd065ad1fc0
more mpr rendering tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1784
diff
changeset
|
877 |
4fd065ad1fc0
more mpr rendering tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1784
diff
changeset
|
878 { |
4fd065ad1fc0
more mpr rendering tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1784
diff
changeset
|
879 OrthancStone::CoordinateSystem3D cuttingPlane(OrthancStone::LinearAlgebra::CreateVector(0, 0, 2), |
4fd065ad1fc0
more mpr rendering tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1784
diff
changeset
|
880 OrthancStone::LinearAlgebra::CreateVector(1, 0, 0), |
4fd065ad1fc0
more mpr rendering tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1784
diff
changeset
|
881 OrthancStone::LinearAlgebra::CreateVector(0, -1, 0)); |
4fd065ad1fc0
more mpr rendering tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1784
diff
changeset
|
882 |
4fd065ad1fc0
more mpr rendering tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1784
diff
changeset
|
883 std::unique_ptr<OrthancStone::TextureBaseSceneLayer> layer( |
4fd065ad1fc0
more mpr rendering tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1784
diff
changeset
|
884 Slice3x3x1Pattern(OrthancStone::VolumeProjection_Sagittal, axial, cuttingPlane, static_cast<SlicerType>(mode))); |
4fd065ad1fc0
more mpr rendering tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1784
diff
changeset
|
885 |
4fd065ad1fc0
more mpr rendering tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1784
diff
changeset
|
886 std::unique_ptr<Orthanc::ImageAccessor> rendered(Render(layer.release(), 1, 3, true)); |
4fd065ad1fc0
more mpr rendering tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1784
diff
changeset
|
887 ASSERT_FLOAT_EQ(50, GetPixelValue(*rendered, 0, 0)); |
4fd065ad1fc0
more mpr rendering tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1784
diff
changeset
|
888 ASSERT_FLOAT_EQ(25, GetPixelValue(*rendered, 0, 1)); |
4fd065ad1fc0
more mpr rendering tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1784
diff
changeset
|
889 ASSERT_FLOAT_EQ(0, GetPixelValue(*rendered, 0, 2)); |
4fd065ad1fc0
more mpr rendering tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1784
diff
changeset
|
890 } |
4fd065ad1fc0
more mpr rendering tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1784
diff
changeset
|
891 |
4fd065ad1fc0
more mpr rendering tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1784
diff
changeset
|
892 { |
4fd065ad1fc0
more mpr rendering tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1784
diff
changeset
|
893 OrthancStone::CoordinateSystem3D cuttingPlane(OrthancStone::LinearAlgebra::CreateVector(0, 0, 2), |
4fd065ad1fc0
more mpr rendering tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1784
diff
changeset
|
894 OrthancStone::LinearAlgebra::CreateVector(-1, 0, 0), |
4fd065ad1fc0
more mpr rendering tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1784
diff
changeset
|
895 OrthancStone::LinearAlgebra::CreateVector(0, -1, 0)); |
4fd065ad1fc0
more mpr rendering tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1784
diff
changeset
|
896 |
4fd065ad1fc0
more mpr rendering tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1784
diff
changeset
|
897 std::unique_ptr<OrthancStone::TextureBaseSceneLayer> layer( |
4fd065ad1fc0
more mpr rendering tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1784
diff
changeset
|
898 Slice3x3x1Pattern(OrthancStone::VolumeProjection_Sagittal, axial, cuttingPlane, static_cast<SlicerType>(mode))); |
4fd065ad1fc0
more mpr rendering tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1784
diff
changeset
|
899 |
4fd065ad1fc0
more mpr rendering tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1784
diff
changeset
|
900 std::unique_ptr<Orthanc::ImageAccessor> rendered(Render(layer.release(), 1, 3, true)); |
4fd065ad1fc0
more mpr rendering tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1784
diff
changeset
|
901 ASSERT_FLOAT_EQ(50, GetPixelValue(*rendered, 0, 0)); |
4fd065ad1fc0
more mpr rendering tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1784
diff
changeset
|
902 ASSERT_FLOAT_EQ(25, GetPixelValue(*rendered, 0, 1)); |
4fd065ad1fc0
more mpr rendering tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1784
diff
changeset
|
903 ASSERT_FLOAT_EQ(0, GetPixelValue(*rendered, 0, 2)); |
4fd065ad1fc0
more mpr rendering tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1784
diff
changeset
|
904 } |
4fd065ad1fc0
more mpr rendering tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1784
diff
changeset
|
905 |
1784
42a2880d690f
unit tests for MPR slicing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1783
diff
changeset
|
906 for (double z = -1; z < 4; z += 4) // z in { -1, 3 }, out of volume |
42a2880d690f
unit tests for MPR slicing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1783
diff
changeset
|
907 { |
42a2880d690f
unit tests for MPR slicing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1783
diff
changeset
|
908 OrthancStone::CoordinateSystem3D cuttingPlane(OrthancStone::LinearAlgebra::CreateVector(0, 0, z), |
42a2880d690f
unit tests for MPR slicing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1783
diff
changeset
|
909 OrthancStone::LinearAlgebra::CreateVector(1, 0, 0), |
42a2880d690f
unit tests for MPR slicing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1783
diff
changeset
|
910 OrthancStone::LinearAlgebra::CreateVector(0, 1, 0)); |
42a2880d690f
unit tests for MPR slicing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1783
diff
changeset
|
911 |
42a2880d690f
unit tests for MPR slicing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1783
diff
changeset
|
912 std::unique_ptr<OrthancStone::TextureBaseSceneLayer> layer( |
42a2880d690f
unit tests for MPR slicing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1783
diff
changeset
|
913 Slice3x3x1Pattern(OrthancStone::VolumeProjection_Sagittal, axial, cuttingPlane, static_cast<SlicerType>(mode))); |
42a2880d690f
unit tests for MPR slicing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1783
diff
changeset
|
914 |
42a2880d690f
unit tests for MPR slicing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1783
diff
changeset
|
915 ASSERT_TRUE(layer.get() == NULL || // This is for DicomVolumeImageMPRSlicer |
42a2880d690f
unit tests for MPR slicing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1783
diff
changeset
|
916 (layer->GetTexture().GetWidth() == 0 && // This is for DicomVolumeImageReslicer |
42a2880d690f
unit tests for MPR slicing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1783
diff
changeset
|
917 layer->GetTexture().GetHeight() == 0)); |
42a2880d690f
unit tests for MPR slicing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1783
diff
changeset
|
918 } |
42a2880d690f
unit tests for MPR slicing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1783
diff
changeset
|
919 |
42a2880d690f
unit tests for MPR slicing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1783
diff
changeset
|
920 { |
42a2880d690f
unit tests for MPR slicing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1783
diff
changeset
|
921 OrthancStone::CoordinateSystem3D cuttingPlane(OrthancStone::LinearAlgebra::CreateVector(0, 0, 0), |
42a2880d690f
unit tests for MPR slicing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1783
diff
changeset
|
922 OrthancStone::LinearAlgebra::CreateVector(1, 0, 0), |
42a2880d690f
unit tests for MPR slicing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1783
diff
changeset
|
923 OrthancStone::LinearAlgebra::CreateVector(0, 1, 0)); |
42a2880d690f
unit tests for MPR slicing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1783
diff
changeset
|
924 |
42a2880d690f
unit tests for MPR slicing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1783
diff
changeset
|
925 std::unique_ptr<OrthancStone::TextureBaseSceneLayer> layer( |
42a2880d690f
unit tests for MPR slicing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1783
diff
changeset
|
926 Slice3x3x1Pattern(OrthancStone::VolumeProjection_Coronal, axial, cuttingPlane, static_cast<SlicerType>(mode))); |
42a2880d690f
unit tests for MPR slicing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1783
diff
changeset
|
927 |
42a2880d690f
unit tests for MPR slicing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1783
diff
changeset
|
928 std::unique_ptr<Orthanc::ImageAccessor> rendered(Render(layer.release(), 3, 1, true)); |
42a2880d690f
unit tests for MPR slicing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1783
diff
changeset
|
929 ASSERT_FLOAT_EQ(150, GetPixelValue(*rendered, 0, 0)); |
42a2880d690f
unit tests for MPR slicing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1783
diff
changeset
|
930 ASSERT_FLOAT_EQ(175, GetPixelValue(*rendered, 1, 0)); |
42a2880d690f
unit tests for MPR slicing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1783
diff
changeset
|
931 ASSERT_FLOAT_EQ(200, GetPixelValue(*rendered, 2, 0)); |
42a2880d690f
unit tests for MPR slicing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1783
diff
changeset
|
932 } |
42a2880d690f
unit tests for MPR slicing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1783
diff
changeset
|
933 |
42a2880d690f
unit tests for MPR slicing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1783
diff
changeset
|
934 { |
42a2880d690f
unit tests for MPR slicing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1783
diff
changeset
|
935 OrthancStone::CoordinateSystem3D cuttingPlane(OrthancStone::LinearAlgebra::CreateVector(0, 0, 1), |
42a2880d690f
unit tests for MPR slicing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1783
diff
changeset
|
936 OrthancStone::LinearAlgebra::CreateVector(1, 0, 0), |
42a2880d690f
unit tests for MPR slicing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1783
diff
changeset
|
937 OrthancStone::LinearAlgebra::CreateVector(0, 1, 0)); |
42a2880d690f
unit tests for MPR slicing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1783
diff
changeset
|
938 |
42a2880d690f
unit tests for MPR slicing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1783
diff
changeset
|
939 std::unique_ptr<OrthancStone::TextureBaseSceneLayer> layer( |
42a2880d690f
unit tests for MPR slicing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1783
diff
changeset
|
940 Slice3x3x1Pattern(OrthancStone::VolumeProjection_Coronal, axial, cuttingPlane, static_cast<SlicerType>(mode))); |
42a2880d690f
unit tests for MPR slicing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1783
diff
changeset
|
941 |
42a2880d690f
unit tests for MPR slicing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1783
diff
changeset
|
942 std::unique_ptr<Orthanc::ImageAccessor> rendered(Render(layer.release(), 3, 1, true)); |
42a2880d690f
unit tests for MPR slicing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1783
diff
changeset
|
943 ASSERT_FLOAT_EQ(75, GetPixelValue(*rendered, 0, 0)); |
42a2880d690f
unit tests for MPR slicing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1783
diff
changeset
|
944 ASSERT_FLOAT_EQ(100, GetPixelValue(*rendered, 1, 0)); |
42a2880d690f
unit tests for MPR slicing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1783
diff
changeset
|
945 ASSERT_FLOAT_EQ(125, GetPixelValue(*rendered, 2, 0)); |
42a2880d690f
unit tests for MPR slicing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1783
diff
changeset
|
946 } |
42a2880d690f
unit tests for MPR slicing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1783
diff
changeset
|
947 |
42a2880d690f
unit tests for MPR slicing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1783
diff
changeset
|
948 { |
42a2880d690f
unit tests for MPR slicing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1783
diff
changeset
|
949 OrthancStone::CoordinateSystem3D cuttingPlane(OrthancStone::LinearAlgebra::CreateVector(0, 0, 2), |
42a2880d690f
unit tests for MPR slicing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1783
diff
changeset
|
950 OrthancStone::LinearAlgebra::CreateVector(1, 0, 0), |
42a2880d690f
unit tests for MPR slicing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1783
diff
changeset
|
951 OrthancStone::LinearAlgebra::CreateVector(0, 1, 0)); |
42a2880d690f
unit tests for MPR slicing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1783
diff
changeset
|
952 |
42a2880d690f
unit tests for MPR slicing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1783
diff
changeset
|
953 std::unique_ptr<OrthancStone::TextureBaseSceneLayer> layer( |
42a2880d690f
unit tests for MPR slicing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1783
diff
changeset
|
954 Slice3x3x1Pattern(OrthancStone::VolumeProjection_Coronal, axial, cuttingPlane, static_cast<SlicerType>(mode))); |
42a2880d690f
unit tests for MPR slicing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1783
diff
changeset
|
955 |
42a2880d690f
unit tests for MPR slicing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1783
diff
changeset
|
956 std::unique_ptr<Orthanc::ImageAccessor> rendered(Render(layer.release(), 3, 1, true)); |
42a2880d690f
unit tests for MPR slicing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1783
diff
changeset
|
957 ASSERT_FLOAT_EQ(0, GetPixelValue(*rendered, 0, 0)); |
42a2880d690f
unit tests for MPR slicing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1783
diff
changeset
|
958 ASSERT_FLOAT_EQ(25, GetPixelValue(*rendered, 1, 0)); |
42a2880d690f
unit tests for MPR slicing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1783
diff
changeset
|
959 ASSERT_FLOAT_EQ(50, GetPixelValue(*rendered, 2, 0)); |
42a2880d690f
unit tests for MPR slicing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1783
diff
changeset
|
960 } |
42a2880d690f
unit tests for MPR slicing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1783
diff
changeset
|
961 |
1788
4fd065ad1fc0
more mpr rendering tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1784
diff
changeset
|
962 { |
4fd065ad1fc0
more mpr rendering tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1784
diff
changeset
|
963 OrthancStone::CoordinateSystem3D cuttingPlane(OrthancStone::LinearAlgebra::CreateVector(0, 0, 2), |
4fd065ad1fc0
more mpr rendering tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1784
diff
changeset
|
964 OrthancStone::LinearAlgebra::CreateVector(1, 0, 0), |
4fd065ad1fc0
more mpr rendering tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1784
diff
changeset
|
965 OrthancStone::LinearAlgebra::CreateVector(0, -1, 0)); |
4fd065ad1fc0
more mpr rendering tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1784
diff
changeset
|
966 |
4fd065ad1fc0
more mpr rendering tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1784
diff
changeset
|
967 std::unique_ptr<OrthancStone::TextureBaseSceneLayer> layer( |
4fd065ad1fc0
more mpr rendering tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1784
diff
changeset
|
968 Slice3x3x1Pattern(OrthancStone::VolumeProjection_Coronal, axial, cuttingPlane, static_cast<SlicerType>(mode))); |
4fd065ad1fc0
more mpr rendering tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1784
diff
changeset
|
969 |
4fd065ad1fc0
more mpr rendering tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1784
diff
changeset
|
970 std::unique_ptr<Orthanc::ImageAccessor> rendered(Render(layer.release(), 3, 1, true)); |
4fd065ad1fc0
more mpr rendering tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1784
diff
changeset
|
971 ASSERT_FLOAT_EQ(0, GetPixelValue(*rendered, 0, 0)); |
4fd065ad1fc0
more mpr rendering tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1784
diff
changeset
|
972 ASSERT_FLOAT_EQ(25, GetPixelValue(*rendered, 1, 0)); |
4fd065ad1fc0
more mpr rendering tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1784
diff
changeset
|
973 ASSERT_FLOAT_EQ(50, GetPixelValue(*rendered, 2, 0)); |
4fd065ad1fc0
more mpr rendering tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1784
diff
changeset
|
974 } |
4fd065ad1fc0
more mpr rendering tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1784
diff
changeset
|
975 |
4fd065ad1fc0
more mpr rendering tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1784
diff
changeset
|
976 { |
4fd065ad1fc0
more mpr rendering tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1784
diff
changeset
|
977 OrthancStone::CoordinateSystem3D cuttingPlane(OrthancStone::LinearAlgebra::CreateVector(0, 0, 2), |
4fd065ad1fc0
more mpr rendering tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1784
diff
changeset
|
978 OrthancStone::LinearAlgebra::CreateVector(-1, 0, 0), |
4fd065ad1fc0
more mpr rendering tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1784
diff
changeset
|
979 OrthancStone::LinearAlgebra::CreateVector(0, 1, 0)); |
4fd065ad1fc0
more mpr rendering tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1784
diff
changeset
|
980 |
4fd065ad1fc0
more mpr rendering tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1784
diff
changeset
|
981 std::unique_ptr<OrthancStone::TextureBaseSceneLayer> layer( |
4fd065ad1fc0
more mpr rendering tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1784
diff
changeset
|
982 Slice3x3x1Pattern(OrthancStone::VolumeProjection_Coronal, axial, cuttingPlane, static_cast<SlicerType>(mode))); |
4fd065ad1fc0
more mpr rendering tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1784
diff
changeset
|
983 |
4fd065ad1fc0
more mpr rendering tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1784
diff
changeset
|
984 std::unique_ptr<Orthanc::ImageAccessor> rendered(Render(layer.release(), 3, 1, true)); |
4fd065ad1fc0
more mpr rendering tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1784
diff
changeset
|
985 ASSERT_FLOAT_EQ(50, GetPixelValue(*rendered, 0, 0)); |
4fd065ad1fc0
more mpr rendering tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1784
diff
changeset
|
986 ASSERT_FLOAT_EQ(25, GetPixelValue(*rendered, 1, 0)); |
4fd065ad1fc0
more mpr rendering tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1784
diff
changeset
|
987 ASSERT_FLOAT_EQ(0, GetPixelValue(*rendered, 2, 0)); |
4fd065ad1fc0
more mpr rendering tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1784
diff
changeset
|
988 } |
4fd065ad1fc0
more mpr rendering tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1784
diff
changeset
|
989 |
4fd065ad1fc0
more mpr rendering tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1784
diff
changeset
|
990 { |
4fd065ad1fc0
more mpr rendering tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1784
diff
changeset
|
991 OrthancStone::CoordinateSystem3D cuttingPlane(OrthancStone::LinearAlgebra::CreateVector(0, 0, 2), |
4fd065ad1fc0
more mpr rendering tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1784
diff
changeset
|
992 OrthancStone::LinearAlgebra::CreateVector(-1, 0, 0), |
4fd065ad1fc0
more mpr rendering tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1784
diff
changeset
|
993 OrthancStone::LinearAlgebra::CreateVector(0, -1, 0)); |
4fd065ad1fc0
more mpr rendering tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1784
diff
changeset
|
994 |
4fd065ad1fc0
more mpr rendering tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1784
diff
changeset
|
995 std::unique_ptr<OrthancStone::TextureBaseSceneLayer> layer( |
4fd065ad1fc0
more mpr rendering tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1784
diff
changeset
|
996 Slice3x3x1Pattern(OrthancStone::VolumeProjection_Coronal, axial, cuttingPlane, static_cast<SlicerType>(mode))); |
4fd065ad1fc0
more mpr rendering tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1784
diff
changeset
|
997 |
4fd065ad1fc0
more mpr rendering tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1784
diff
changeset
|
998 std::unique_ptr<Orthanc::ImageAccessor> rendered(Render(layer.release(), 3, 1, true)); |
4fd065ad1fc0
more mpr rendering tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1784
diff
changeset
|
999 ASSERT_FLOAT_EQ(50, GetPixelValue(*rendered, 0, 0)); |
4fd065ad1fc0
more mpr rendering tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1784
diff
changeset
|
1000 ASSERT_FLOAT_EQ(25, GetPixelValue(*rendered, 1, 0)); |
4fd065ad1fc0
more mpr rendering tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1784
diff
changeset
|
1001 ASSERT_FLOAT_EQ(0, GetPixelValue(*rendered, 2, 0)); |
4fd065ad1fc0
more mpr rendering tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1784
diff
changeset
|
1002 } |
4fd065ad1fc0
more mpr rendering tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1784
diff
changeset
|
1003 |
1784
42a2880d690f
unit tests for MPR slicing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1783
diff
changeset
|
1004 for (double z = -1; z < 4; z += 4) // z in { -1, 3 }, out of volume |
42a2880d690f
unit tests for MPR slicing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1783
diff
changeset
|
1005 { |
42a2880d690f
unit tests for MPR slicing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1783
diff
changeset
|
1006 OrthancStone::CoordinateSystem3D cuttingPlane(OrthancStone::LinearAlgebra::CreateVector(0, 0, z), |
42a2880d690f
unit tests for MPR slicing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1783
diff
changeset
|
1007 OrthancStone::LinearAlgebra::CreateVector(1, 0, 0), |
42a2880d690f
unit tests for MPR slicing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1783
diff
changeset
|
1008 OrthancStone::LinearAlgebra::CreateVector(0, 1, 0)); |
42a2880d690f
unit tests for MPR slicing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1783
diff
changeset
|
1009 |
42a2880d690f
unit tests for MPR slicing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1783
diff
changeset
|
1010 std::unique_ptr<OrthancStone::TextureBaseSceneLayer> layer( |
42a2880d690f
unit tests for MPR slicing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1783
diff
changeset
|
1011 Slice3x3x1Pattern(OrthancStone::VolumeProjection_Coronal, axial, cuttingPlane, static_cast<SlicerType>(mode))); |
42a2880d690f
unit tests for MPR slicing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1783
diff
changeset
|
1012 |
42a2880d690f
unit tests for MPR slicing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1783
diff
changeset
|
1013 ASSERT_TRUE(layer.get() == NULL || // This is for DicomVolumeImageMPRSlicer |
42a2880d690f
unit tests for MPR slicing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1783
diff
changeset
|
1014 (layer->GetTexture().GetWidth() == 0 && // This is for DicomVolumeImageReslicer |
42a2880d690f
unit tests for MPR slicing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1783
diff
changeset
|
1015 layer->GetTexture().GetHeight() == 0)); |
42a2880d690f
unit tests for MPR slicing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1783
diff
changeset
|
1016 } |
1781
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
1017 } |
bf4b15b059ea
unit test VolumeRendering.FlipAxial
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1780
diff
changeset
|
1018 } |
1802
757987cb5a68
recycling of layers in MacroSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1788
diff
changeset
|
1019 |
757987cb5a68
recycling of layers in MacroSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1788
diff
changeset
|
1020 |
757987cb5a68
recycling of layers in MacroSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1788
diff
changeset
|
1021 TEST(VolumeRendering, MacroLayer) |
757987cb5a68
recycling of layers in MacroSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1788
diff
changeset
|
1022 { |
757987cb5a68
recycling of layers in MacroSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1788
diff
changeset
|
1023 OrthancStone::MacroSceneLayer layer; |
757987cb5a68
recycling of layers in MacroSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1788
diff
changeset
|
1024 ASSERT_THROW(layer.AddLayer(NULL), Orthanc::OrthancException); |
757987cb5a68
recycling of layers in MacroSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1788
diff
changeset
|
1025 |
757987cb5a68
recycling of layers in MacroSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1788
diff
changeset
|
1026 ASSERT_EQ(0u, layer.AddLayer(new OrthancStone::PolylineSceneLayer)); |
757987cb5a68
recycling of layers in MacroSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1788
diff
changeset
|
1027 ASSERT_EQ(1u, layer.AddLayer(new OrthancStone::PolylineSceneLayer)); |
757987cb5a68
recycling of layers in MacroSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1788
diff
changeset
|
1028 ASSERT_EQ(2u, layer.AddLayer(new OrthancStone::PolylineSceneLayer)); |
757987cb5a68
recycling of layers in MacroSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1788
diff
changeset
|
1029 ASSERT_EQ(3u, layer.GetSize()); |
757987cb5a68
recycling of layers in MacroSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1788
diff
changeset
|
1030 ASSERT_TRUE(layer.HasLayer(0)); |
757987cb5a68
recycling of layers in MacroSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1788
diff
changeset
|
1031 ASSERT_TRUE(layer.HasLayer(1)); |
757987cb5a68
recycling of layers in MacroSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1788
diff
changeset
|
1032 ASSERT_TRUE(layer.HasLayer(2)); |
757987cb5a68
recycling of layers in MacroSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1788
diff
changeset
|
1033 |
757987cb5a68
recycling of layers in MacroSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1788
diff
changeset
|
1034 layer.DeleteLayer(1); |
757987cb5a68
recycling of layers in MacroSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1788
diff
changeset
|
1035 ASSERT_EQ(3u, layer.GetSize()); |
757987cb5a68
recycling of layers in MacroSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1788
diff
changeset
|
1036 ASSERT_TRUE(layer.HasLayer(0)); |
757987cb5a68
recycling of layers in MacroSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1788
diff
changeset
|
1037 ASSERT_FALSE(layer.HasLayer(1)); |
757987cb5a68
recycling of layers in MacroSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1788
diff
changeset
|
1038 ASSERT_TRUE(layer.HasLayer(2)); |
757987cb5a68
recycling of layers in MacroSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1788
diff
changeset
|
1039 |
757987cb5a68
recycling of layers in MacroSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1788
diff
changeset
|
1040 ASSERT_THROW(layer.UpdateLayer(1, NULL), Orthanc::OrthancException); |
757987cb5a68
recycling of layers in MacroSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1788
diff
changeset
|
1041 layer.UpdateLayer(1, new OrthancStone::PolylineSceneLayer); |
757987cb5a68
recycling of layers in MacroSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1788
diff
changeset
|
1042 ASSERT_TRUE(layer.HasLayer(1)); |
757987cb5a68
recycling of layers in MacroSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1788
diff
changeset
|
1043 |
757987cb5a68
recycling of layers in MacroSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1788
diff
changeset
|
1044 ASSERT_EQ(3u, layer.AddLayer(new OrthancStone::PolylineSceneLayer)); |
757987cb5a68
recycling of layers in MacroSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1788
diff
changeset
|
1045 ASSERT_EQ(4u, layer.GetSize()); |
757987cb5a68
recycling of layers in MacroSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1788
diff
changeset
|
1046 |
757987cb5a68
recycling of layers in MacroSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1788
diff
changeset
|
1047 layer.DeleteLayer(1); |
757987cb5a68
recycling of layers in MacroSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1788
diff
changeset
|
1048 layer.DeleteLayer(2); |
757987cb5a68
recycling of layers in MacroSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1788
diff
changeset
|
1049 ASSERT_EQ(1u, layer.AddLayer(new OrthancStone::PolylineSceneLayer)); |
757987cb5a68
recycling of layers in MacroSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1788
diff
changeset
|
1050 |
757987cb5a68
recycling of layers in MacroSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1788
diff
changeset
|
1051 std::unique_ptr<OrthancStone::MacroSceneLayer> clone(dynamic_cast<OrthancStone::MacroSceneLayer*>(layer.Clone())); |
757987cb5a68
recycling of layers in MacroSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1788
diff
changeset
|
1052 |
757987cb5a68
recycling of layers in MacroSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1788
diff
changeset
|
1053 layer.UpdateLayer(2, new OrthancStone::PolylineSceneLayer); |
757987cb5a68
recycling of layers in MacroSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1788
diff
changeset
|
1054 ASSERT_EQ(4u, layer.AddLayer(new OrthancStone::PolylineSceneLayer)); |
757987cb5a68
recycling of layers in MacroSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1788
diff
changeset
|
1055 ASSERT_EQ(5u, layer.GetSize()); |
757987cb5a68
recycling of layers in MacroSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1788
diff
changeset
|
1056 ASSERT_TRUE(layer.HasLayer(0)); |
757987cb5a68
recycling of layers in MacroSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1788
diff
changeset
|
1057 ASSERT_TRUE(layer.HasLayer(1)); |
757987cb5a68
recycling of layers in MacroSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1788
diff
changeset
|
1058 ASSERT_TRUE(layer.HasLayer(2)); |
757987cb5a68
recycling of layers in MacroSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1788
diff
changeset
|
1059 ASSERT_TRUE(layer.HasLayer(3)); |
757987cb5a68
recycling of layers in MacroSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1788
diff
changeset
|
1060 ASSERT_TRUE(layer.HasLayer(4)); |
757987cb5a68
recycling of layers in MacroSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1788
diff
changeset
|
1061 |
757987cb5a68
recycling of layers in MacroSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1788
diff
changeset
|
1062 ASSERT_EQ(2u, clone->AddLayer(new OrthancStone::PolylineSceneLayer)); |
757987cb5a68
recycling of layers in MacroSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1788
diff
changeset
|
1063 ASSERT_EQ(4u, clone->GetSize()); |
757987cb5a68
recycling of layers in MacroSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1788
diff
changeset
|
1064 ASSERT_TRUE(clone->HasLayer(0)); |
757987cb5a68
recycling of layers in MacroSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1788
diff
changeset
|
1065 ASSERT_TRUE(clone->HasLayer(1)); |
757987cb5a68
recycling of layers in MacroSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1788
diff
changeset
|
1066 ASSERT_TRUE(clone->HasLayer(2)); |
757987cb5a68
recycling of layers in MacroSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1788
diff
changeset
|
1067 ASSERT_TRUE(clone->HasLayer(3)); |
757987cb5a68
recycling of layers in MacroSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1788
diff
changeset
|
1068 ASSERT_THROW(clone->HasLayer(4), Orthanc::OrthancException); |
757987cb5a68
recycling of layers in MacroSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1788
diff
changeset
|
1069 } |