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