annotate OrthancStone/UnitTestsSources/DicomTests.cpp @ 2123:538c7b7c6e46 deep-learning

integration mainline->deep-learning
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 22 Mar 2024 16:11:42 +0100
parents c23eef785569
children 16c01cc201e7
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1679
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 /**
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2 * Stone of Orthanc
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4 * Department, University Hospital of Liege, Belgium
2114
c23eef785569 update year to 2024
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2077
diff changeset
5 * Copyright (C) 2017-2024 Osimis S.A., Belgium
c23eef785569 update year to 2024
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2077
diff changeset
6 * Copyright (C) 2021-2024 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
1679
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7 *
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8 * This program is free software: you can redistribute it and/or
1877
a2955abe4c2e skeleton for the RenderingPlugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1871
diff changeset
9 * modify it under the terms of the GNU Lesser General Public License
1679
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
10 * as published by the Free Software Foundation, either version 3 of
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
11 * the License, or (at your option) any later version.
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12 *
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 * This program is distributed in the hope that it will be useful, but
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
1877
a2955abe4c2e skeleton for the RenderingPlugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1871
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
a2955abe4c2e skeleton for the RenderingPlugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1871
diff changeset
16 * Lesser General Public License for more details.
1679
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
17 *
1877
a2955abe4c2e skeleton for the RenderingPlugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1871
diff changeset
18 * You should have received a copy of the GNU Lesser General Public
a2955abe4c2e skeleton for the RenderingPlugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1871
diff changeset
19 * License along with this program. If not, see
a2955abe4c2e skeleton for the RenderingPlugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1871
diff changeset
20 * <http://www.gnu.org/licenses/>.
1679
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
21 **/
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
22
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
23
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
24 #include <gtest/gtest.h>
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
25
1877
a2955abe4c2e skeleton for the RenderingPlugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1871
diff changeset
26 #include "../Sources/Toolbox/DicomInstanceParameters.h"
a2955abe4c2e skeleton for the RenderingPlugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1871
diff changeset
27 #include "../Sources/Loaders/DicomSource.h"
1679
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
28
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
29 #include <OrthancException.h>
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
30
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
31
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
32 static void SetupUids(Orthanc::DicomMap& m)
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
33 {
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
34 m.SetValue(Orthanc::DICOM_TAG_STUDY_INSTANCE_UID, "my_study", false);
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
35 m.SetValue(Orthanc::DICOM_TAG_SERIES_INSTANCE_UID, "my_series", false);
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
36 m.SetValue(Orthanc::DICOM_TAG_SOP_INSTANCE_UID, "my_sop", false);
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
37 }
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
38
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
39
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
40 TEST(DicomInstanceParameters, Basic)
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
41 {
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
42 Orthanc::DicomMap m;
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
43 SetupUids(m);
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
44
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
45 std::unique_ptr<OrthancStone::DicomInstanceParameters> p;
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
46 p.reset(OrthancStone::DicomInstanceParameters(m).Clone());
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
47
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
48 ASSERT_TRUE(p->GetOrthancInstanceIdentifier().empty());
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
49 ASSERT_EQ(3u, p->GetTags().GetSize());
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
50 ASSERT_EQ("my_study", p->GetStudyInstanceUid());
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
51 ASSERT_EQ("my_series", p->GetSeriesInstanceUid());
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
52 ASSERT_EQ("my_sop", p->GetSopInstanceUid());
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
53 ASSERT_EQ(OrthancStone::SopClassUid_Other, p->GetSopClassUid());
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
54 ASSERT_EQ(1u, p->GetNumberOfFrames());
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
55 ASSERT_EQ(0u, p->GetWidth());
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
56 ASSERT_EQ(0u, p->GetHeight());
2076
990f396484b1 fix rendering of RT-DOSE with negative GridFrameOffsetVector
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1877
diff changeset
57 ASSERT_FALSE(p->HasSliceThickness());
990f396484b1 fix rendering of RT-DOSE with negative GridFrameOffsetVector
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1877
diff changeset
58 ASSERT_THROW(p->GetSliceThickness(), Orthanc::OrthancException);
1679
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
59 ASSERT_FLOAT_EQ(1, p->GetPixelSpacingX());
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
60 ASSERT_FLOAT_EQ(1, p->GetPixelSpacingY());
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
61 ASSERT_FALSE(p->GetGeometry().IsValid());
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
62 ASSERT_THROW(p->GetImageInformation(), Orthanc::OrthancException);
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
63 ASSERT_FALSE(p->GetFrameGeometry(0).IsValid());
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
64 ASSERT_THROW(p->IsColor(), Orthanc::OrthancException); // Accesses DicomImageInformation
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
65 ASSERT_FALSE(p->HasRescale());
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
66 ASSERT_THROW(p->GetRescaleIntercept(), Orthanc::OrthancException);
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
67 ASSERT_THROW(p->GetRescaleSlope(), Orthanc::OrthancException);
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
68 ASSERT_EQ(0u, p->GetWindowingPresetsCount());
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
69 ASSERT_THROW(p->GetWindowingPresetCenter(0), Orthanc::OrthancException);
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
70 ASSERT_THROW(p->GetWindowingPresetWidth(0), Orthanc::OrthancException);
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
71
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
72 float c, w;
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
73 p->GetWindowingPresetsUnion(c, w);
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
74 ASSERT_FLOAT_EQ(128.0f, c);
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
75 ASSERT_FLOAT_EQ(256.0f, w);
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
76
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
77 ASSERT_THROW(p->GetExpectedPixelFormat(), Orthanc::OrthancException);
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
78 ASSERT_FALSE(p->HasIndexInSeries());
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
79 ASSERT_THROW(p->GetIndexInSeries(), Orthanc::OrthancException);
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
80 ASSERT_TRUE(p->GetDoseUnits().empty());
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
81 ASSERT_DOUBLE_EQ(1.0, p->GetDoseGridScaling());
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
82 ASSERT_DOUBLE_EQ(1.0, p->ApplyRescale(1.0));
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
83
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
84 double s;
2076
990f396484b1 fix rendering of RT-DOSE with negative GridFrameOffsetVector
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1877
diff changeset
85 ASSERT_FALSE(p->ComputeFrameOffsetsSpacing(s));
1679
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
86 ASSERT_TRUE(p->GetFrameOfReferenceUid().empty());
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
87 }
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
88
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
89
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
90 TEST(DicomInstanceParameters, Windowing)
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
91 {
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
92 Orthanc::DicomMap m;
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
93 SetupUids(m);
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
94 m.SetValue(Orthanc::DICOM_TAG_WINDOW_CENTER, "10\\100\\1000", false);
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
95 m.SetValue(Orthanc::DICOM_TAG_WINDOW_WIDTH, "50\\60\\70", false);
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
96
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
97 OrthancStone::DicomInstanceParameters p(m);
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
98 ASSERT_EQ(3u, p.GetWindowingPresetsCount());
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
99 ASSERT_FLOAT_EQ(10, p.GetWindowingPresetCenter(0));
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
100 ASSERT_FLOAT_EQ(100, p.GetWindowingPresetCenter(1));
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
101 ASSERT_FLOAT_EQ(1000, p.GetWindowingPresetCenter(2));
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
102 ASSERT_FLOAT_EQ(50, p.GetWindowingPresetWidth(0));
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
103 ASSERT_FLOAT_EQ(60, p.GetWindowingPresetWidth(1));
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
104 ASSERT_FLOAT_EQ(70, p.GetWindowingPresetWidth(2));
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
105
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
106 const float a = 10.0f - 50.0f / 2.0f;
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
107 const float b = 1000.0f + 70.0f / 2.0f;
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
108
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
109 float c, w;
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
110 p.GetWindowingPresetsUnion(c, w);
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
111 ASSERT_FLOAT_EQ((a + b) / 2.0f, c);
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
112 ASSERT_FLOAT_EQ(b - a, w);
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
113 }
1725
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
114
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
115
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
116 TEST(DicomSource, Equality)
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
117 {
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
118 {
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
119 OrthancStone::DicomSource s1;
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
120
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
121 {
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
122 OrthancStone::DicomSource s2;
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
123 ASSERT_TRUE(s1.IsSameSource(s2));
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
124
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
125 s2.SetDicomDirSource();
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
126 ASSERT_FALSE(s1.IsSameSource(s2));
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
127
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
128 s2.SetDicomWebSource("toto");
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
129 ASSERT_FALSE(s1.IsSameSource(s2));
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
130
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
131 s2.SetDicomWebThroughOrthancSource("toto");
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
132 ASSERT_FALSE(s1.IsSameSource(s2));
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
133
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
134 s2.SetOrthancSource();
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
135 ASSERT_TRUE(s1.IsSameSource(s2));
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
136 }
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
137 }
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
138
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
139 {
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
140 OrthancStone::DicomSource s1;
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
141
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
142 {
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
143 Orthanc::WebServiceParameters p;
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
144 p.SetUrl("http://localhost:8042/");
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
145
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
146 OrthancStone::DicomSource s2;
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
147 s2.SetOrthancSource(p);
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
148 ASSERT_TRUE(s1.IsSameSource(s2));
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
149
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
150 p.SetCredentials("toto", "tutu");
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
151 s2.SetOrthancSource(p);
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
152 ASSERT_FALSE(s1.IsSameSource(s2));
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
153
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
154 p.ClearCredentials();
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
155 s2.SetOrthancSource(p);
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
156 ASSERT_TRUE(s1.IsSameSource(s2));
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
157
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
158 p.SetUrl("http://localhost:8043/");
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
159 s2.SetOrthancSource(p);
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
160 ASSERT_FALSE(s1.IsSameSource(s2));
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
161 }
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
162 }
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
163
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
164 {
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
165 OrthancStone::DicomSource s1;
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
166 s1.SetDicomDirSource();
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
167
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
168 {
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
169 OrthancStone::DicomSource s2;
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
170 ASSERT_FALSE(s1.IsSameSource(s2));
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
171
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
172 s2.SetDicomDirSource();
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
173 ASSERT_TRUE(s1.IsSameSource(s2));
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
174
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
175 s2.SetDicomWebSource("toto");
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
176 ASSERT_FALSE(s1.IsSameSource(s2));
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
177
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
178 s2.SetDicomWebThroughOrthancSource("toto");
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
179 ASSERT_FALSE(s1.IsSameSource(s2));
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
180 }
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
181 }
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
182
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
183 {
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
184 OrthancStone::DicomSource s1;
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
185 s1.SetDicomWebSource("http");
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
186
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
187 {
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
188 OrthancStone::DicomSource s2;
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
189 ASSERT_FALSE(s1.IsSameSource(s2));
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
190
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
191 s2.SetDicomDirSource();
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
192 ASSERT_FALSE(s1.IsSameSource(s2));
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
193
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
194 s2.SetDicomWebSource("http");
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
195 ASSERT_TRUE(s1.IsSameSource(s2));
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
196
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
197 s2.SetDicomWebSource("http2");
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
198 ASSERT_FALSE(s1.IsSameSource(s2));
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
199
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
200 s2.SetDicomWebThroughOrthancSource("toto");
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
201 ASSERT_FALSE(s1.IsSameSource(s2));
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
202 }
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
203 }
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
204
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
205 {
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
206 OrthancStone::DicomSource s1;
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
207 s1.SetDicomWebThroughOrthancSource("server");
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
208
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
209 {
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
210 OrthancStone::DicomSource s2;
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
211 ASSERT_FALSE(s1.IsSameSource(s2));
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
212
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
213 s2.SetDicomDirSource();
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
214 ASSERT_FALSE(s1.IsSameSource(s2));
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
215
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
216 s2.SetDicomWebSource("http");
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
217 ASSERT_FALSE(s1.IsSameSource(s2));
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
218
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
219 s2.SetDicomWebThroughOrthancSource("server");
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
220 ASSERT_TRUE(s1.IsSameSource(s2));
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
221
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
222 s2.SetDicomWebThroughOrthancSource("server2");
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
223 ASSERT_FALSE(s1.IsSameSource(s2));
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
224 }
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
225 }
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
226 }
2076
990f396484b1 fix rendering of RT-DOSE with negative GridFrameOffsetVector
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1877
diff changeset
227
990f396484b1 fix rendering of RT-DOSE with negative GridFrameOffsetVector
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1877
diff changeset
228
990f396484b1 fix rendering of RT-DOSE with negative GridFrameOffsetVector
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1877
diff changeset
229 TEST(DicomInstanceParameters, ReverseFrameOffsetsGrid)
990f396484b1 fix rendering of RT-DOSE with negative GridFrameOffsetVector
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1877
diff changeset
230 {
990f396484b1 fix rendering of RT-DOSE with negative GridFrameOffsetVector
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1877
diff changeset
231 Orthanc::DicomMap m;
990f396484b1 fix rendering of RT-DOSE with negative GridFrameOffsetVector
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1877
diff changeset
232 SetupUids(m);
990f396484b1 fix rendering of RT-DOSE with negative GridFrameOffsetVector
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1877
diff changeset
233
990f396484b1 fix rendering of RT-DOSE with negative GridFrameOffsetVector
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1877
diff changeset
234 m.SetValue(Orthanc::DICOM_TAG_IMAGE_POSITION_PATIENT, "-276.611\\-274.463\\100", false);
990f396484b1 fix rendering of RT-DOSE with negative GridFrameOffsetVector
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1877
diff changeset
235 m.SetValue(Orthanc::DICOM_TAG_IMAGE_ORIENTATION_PATIENT, "1\\0\\0\\0\\1\\0", false);
990f396484b1 fix rendering of RT-DOSE with negative GridFrameOffsetVector
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1877
diff changeset
236 m.SetValue(Orthanc::DICOM_TAG_NUMBER_OF_FRAMES, "126", false);
990f396484b1 fix rendering of RT-DOSE with negative GridFrameOffsetVector
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1877
diff changeset
237 m.SetValue(Orthanc::DICOM_TAG_GRID_FRAME_OFFSET_VECTOR, "0\\-2\\-4\\-6\\-8\\-10\\-12\\-14\\-16\\-18\\-20\\-22\\-24\\-26\\-28\\-30\\-32\\-34\\-36\\-38\\-40\\-42\\-44\\-46\\-48\\-50\\-52\\-54\\-56\\-58\\-60\\-62\\-64\\-66\\-68\\-70\\-72\\-74\\-76\\-78\\-80\\-82\\-84\\-86\\-88\\-90\\-92\\-94\\-96\\-98\\-100\\-102\\-104\\-106\\-108\\-110\\-112\\-114\\-116\\-118\\-120\\-122\\-124\\-126\\-128\\-130\\-132\\-134\\-136\\-138\\-140\\-142\\-144\\-146\\-148\\-150\\-152\\-154\\-156\\-158\\-160\\-162\\-164\\-166\\-168\\-170\\-172\\-174\\-176\\-178\\-180\\-182\\-184\\-186\\-188\\-190\\-192\\-194\\-196\\-198\\-200\\-202\\-204\\-206\\-208\\-210\\-212\\-214\\-216\\-218\\-220\\-222\\-224\\-226\\-228\\-230\\-232\\-234\\-236\\-238\\-240\\-242\\-244\\-246\\-248\\-250", false);
990f396484b1 fix rendering of RT-DOSE with negative GridFrameOffsetVector
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1877
diff changeset
238
990f396484b1 fix rendering of RT-DOSE with negative GridFrameOffsetVector
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1877
diff changeset
239 std::unique_ptr<OrthancStone::DicomInstanceParameters> p;
990f396484b1 fix rendering of RT-DOSE with negative GridFrameOffsetVector
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1877
diff changeset
240 p.reset(OrthancStone::DicomInstanceParameters(m).Clone());
990f396484b1 fix rendering of RT-DOSE with negative GridFrameOffsetVector
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1877
diff changeset
241
990f396484b1 fix rendering of RT-DOSE with negative GridFrameOffsetVector
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1877
diff changeset
242 ASSERT_FALSE(p->HasSliceThickness());
990f396484b1 fix rendering of RT-DOSE with negative GridFrameOffsetVector
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1877
diff changeset
243 ASSERT_THROW(p->GetSliceThickness(), Orthanc::OrthancException);
990f396484b1 fix rendering of RT-DOSE with negative GridFrameOffsetVector
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1877
diff changeset
244
990f396484b1 fix rendering of RT-DOSE with negative GridFrameOffsetVector
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1877
diff changeset
245 double s;
990f396484b1 fix rendering of RT-DOSE with negative GridFrameOffsetVector
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1877
diff changeset
246 ASSERT_TRUE(p->ComputeFrameOffsetsSpacing(s));
990f396484b1 fix rendering of RT-DOSE with negative GridFrameOffsetVector
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1877
diff changeset
247 ASSERT_DOUBLE_EQ(s, 2.0);
990f396484b1 fix rendering of RT-DOSE with negative GridFrameOffsetVector
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1877
diff changeset
248 ASSERT_TRUE(p->IsReversedFrameOffsets());
990f396484b1 fix rendering of RT-DOSE with negative GridFrameOffsetVector
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1877
diff changeset
249
990f396484b1 fix rendering of RT-DOSE with negative GridFrameOffsetVector
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1877
diff changeset
250 ASSERT_DOUBLE_EQ(1, p->GetMultiFrameGeometry().GetAxisX() [0]);
990f396484b1 fix rendering of RT-DOSE with negative GridFrameOffsetVector
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1877
diff changeset
251 ASSERT_DOUBLE_EQ(0, p->GetMultiFrameGeometry().GetAxisX() [1]);
990f396484b1 fix rendering of RT-DOSE with negative GridFrameOffsetVector
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1877
diff changeset
252 ASSERT_DOUBLE_EQ(0, p->GetMultiFrameGeometry().GetAxisX() [2]);
990f396484b1 fix rendering of RT-DOSE with negative GridFrameOffsetVector
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1877
diff changeset
253
990f396484b1 fix rendering of RT-DOSE with negative GridFrameOffsetVector
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1877
diff changeset
254 ASSERT_DOUBLE_EQ(0, p->GetMultiFrameGeometry().GetAxisY() [0]);
990f396484b1 fix rendering of RT-DOSE with negative GridFrameOffsetVector
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1877
diff changeset
255 ASSERT_DOUBLE_EQ(1, p->GetMultiFrameGeometry().GetAxisY() [1]);
990f396484b1 fix rendering of RT-DOSE with negative GridFrameOffsetVector
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1877
diff changeset
256 ASSERT_DOUBLE_EQ(0, p->GetMultiFrameGeometry().GetAxisY() [2]);
990f396484b1 fix rendering of RT-DOSE with negative GridFrameOffsetVector
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1877
diff changeset
257
990f396484b1 fix rendering of RT-DOSE with negative GridFrameOffsetVector
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1877
diff changeset
258 ASSERT_DOUBLE_EQ(0, p->GetMultiFrameGeometry().GetNormal() [0]);
990f396484b1 fix rendering of RT-DOSE with negative GridFrameOffsetVector
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1877
diff changeset
259 ASSERT_DOUBLE_EQ(0, p->GetMultiFrameGeometry().GetNormal() [1]);
990f396484b1 fix rendering of RT-DOSE with negative GridFrameOffsetVector
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1877
diff changeset
260 ASSERT_DOUBLE_EQ(1, p->GetMultiFrameGeometry().GetNormal() [2]);
990f396484b1 fix rendering of RT-DOSE with negative GridFrameOffsetVector
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1877
diff changeset
261
990f396484b1 fix rendering of RT-DOSE with negative GridFrameOffsetVector
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1877
diff changeset
262 ASSERT_DOUBLE_EQ(-276.611, p->GetMultiFrameGeometry().GetOrigin() [0]);
990f396484b1 fix rendering of RT-DOSE with negative GridFrameOffsetVector
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1877
diff changeset
263 ASSERT_DOUBLE_EQ(-274.463, p->GetMultiFrameGeometry().GetOrigin() [1]);
990f396484b1 fix rendering of RT-DOSE with negative GridFrameOffsetVector
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1877
diff changeset
264 ASSERT_DOUBLE_EQ(100.0 - 250.0, p->GetMultiFrameGeometry().GetOrigin() [2]);
990f396484b1 fix rendering of RT-DOSE with negative GridFrameOffsetVector
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1877
diff changeset
265 }
990f396484b1 fix rendering of RT-DOSE with negative GridFrameOffsetVector
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1877
diff changeset
266
990f396484b1 fix rendering of RT-DOSE with negative GridFrameOffsetVector
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1877
diff changeset
267
990f396484b1 fix rendering of RT-DOSE with negative GridFrameOffsetVector
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1877
diff changeset
268 TEST(DicomInstanceParameters, StandardFrameOffsetsGrid)
990f396484b1 fix rendering of RT-DOSE with negative GridFrameOffsetVector
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1877
diff changeset
269 {
990f396484b1 fix rendering of RT-DOSE with negative GridFrameOffsetVector
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1877
diff changeset
270 Orthanc::DicomMap m;
990f396484b1 fix rendering of RT-DOSE with negative GridFrameOffsetVector
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1877
diff changeset
271 SetupUids(m);
990f396484b1 fix rendering of RT-DOSE with negative GridFrameOffsetVector
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1877
diff changeset
272
990f396484b1 fix rendering of RT-DOSE with negative GridFrameOffsetVector
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1877
diff changeset
273 m.SetValue(Orthanc::DICOM_TAG_SLICE_THICKNESS, "2", false);
990f396484b1 fix rendering of RT-DOSE with negative GridFrameOffsetVector
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1877
diff changeset
274 m.SetValue(Orthanc::DICOM_TAG_IMAGE_POSITION_PATIENT, "-205.2157\\-388.4679\\-120", false);
990f396484b1 fix rendering of RT-DOSE with negative GridFrameOffsetVector
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1877
diff changeset
275 m.SetValue(Orthanc::DICOM_TAG_IMAGE_ORIENTATION_PATIENT, "1\\0\\0\\0\\1\\0", false);
990f396484b1 fix rendering of RT-DOSE with negative GridFrameOffsetVector
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1877
diff changeset
276 m.SetValue(Orthanc::DICOM_TAG_NUMBER_OF_FRAMES, "155", false);
990f396484b1 fix rendering of RT-DOSE with negative GridFrameOffsetVector
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1877
diff changeset
277 m.SetValue(Orthanc::DICOM_TAG_GRID_FRAME_OFFSET_VECTOR, "0\\2\\4\\6\\8\\10\\12\\14\\16\\18\\20\\22\\24\\26\\28\\30\\32\\34\\36\\38\\40\\42\\44\\46\\48\\50\\52\\54\\56\\58\\60\\62\\64\\66\\68\\70\\72\\74\\76\\78\\80\\82\\84\\86\\88\\90\\92\\94\\96\\98\\100\\102\\104\\106\\108\\110\\112\\114\\116\\118\\120\\122\\124\\126\\128\\130\\132\\134\\136\\138\\140\\142\\144\\146\\148\\150\\152\\154\\156\\158\\160\\162\\164\\166\\168\\170\\172\\174\\176\\178\\180\\182\\184\\186\\188\\190\\192\\194\\196\\198\\200\\202\\204\\206\\208\\210\\212\\214\\216\\218\\220\\222\\224\\226\\228\\230\\232\\234\\236\\238\\240\\242\\244\\246\\248\\250\\252\\254\\256\\258\\260\\262\\264\\266\\268\\270\\272\\274\\276\\278\\280\\282\\284\\286\\288\\290\\292\\294\\296\\298\\300\\302\\304\\306\\308", false);
990f396484b1 fix rendering of RT-DOSE with negative GridFrameOffsetVector
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1877
diff changeset
278
990f396484b1 fix rendering of RT-DOSE with negative GridFrameOffsetVector
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1877
diff changeset
279 std::unique_ptr<OrthancStone::DicomInstanceParameters> p;
990f396484b1 fix rendering of RT-DOSE with negative GridFrameOffsetVector
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1877
diff changeset
280 p.reset(OrthancStone::DicomInstanceParameters(m).Clone());
990f396484b1 fix rendering of RT-DOSE with negative GridFrameOffsetVector
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1877
diff changeset
281
990f396484b1 fix rendering of RT-DOSE with negative GridFrameOffsetVector
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1877
diff changeset
282 ASSERT_TRUE(p->HasSliceThickness());
990f396484b1 fix rendering of RT-DOSE with negative GridFrameOffsetVector
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1877
diff changeset
283 ASSERT_DOUBLE_EQ(2.0, p->GetSliceThickness());
990f396484b1 fix rendering of RT-DOSE with negative GridFrameOffsetVector
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1877
diff changeset
284
990f396484b1 fix rendering of RT-DOSE with negative GridFrameOffsetVector
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1877
diff changeset
285 double s;
990f396484b1 fix rendering of RT-DOSE with negative GridFrameOffsetVector
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1877
diff changeset
286 ASSERT_TRUE(p->ComputeFrameOffsetsSpacing(s));
990f396484b1 fix rendering of RT-DOSE with negative GridFrameOffsetVector
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1877
diff changeset
287 ASSERT_DOUBLE_EQ(s, 2.0);
990f396484b1 fix rendering of RT-DOSE with negative GridFrameOffsetVector
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1877
diff changeset
288 ASSERT_FALSE(p->IsReversedFrameOffsets());
990f396484b1 fix rendering of RT-DOSE with negative GridFrameOffsetVector
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1877
diff changeset
289
990f396484b1 fix rendering of RT-DOSE with negative GridFrameOffsetVector
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1877
diff changeset
290 ASSERT_DOUBLE_EQ(1, p->GetMultiFrameGeometry().GetAxisX() [0]);
990f396484b1 fix rendering of RT-DOSE with negative GridFrameOffsetVector
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1877
diff changeset
291 ASSERT_DOUBLE_EQ(0, p->GetMultiFrameGeometry().GetAxisX() [1]);
990f396484b1 fix rendering of RT-DOSE with negative GridFrameOffsetVector
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1877
diff changeset
292 ASSERT_DOUBLE_EQ(0, p->GetMultiFrameGeometry().GetAxisX() [2]);
990f396484b1 fix rendering of RT-DOSE with negative GridFrameOffsetVector
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1877
diff changeset
293
990f396484b1 fix rendering of RT-DOSE with negative GridFrameOffsetVector
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1877
diff changeset
294 ASSERT_DOUBLE_EQ(0, p->GetMultiFrameGeometry().GetAxisY() [0]);
990f396484b1 fix rendering of RT-DOSE with negative GridFrameOffsetVector
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1877
diff changeset
295 ASSERT_DOUBLE_EQ(1, p->GetMultiFrameGeometry().GetAxisY() [1]);
990f396484b1 fix rendering of RT-DOSE with negative GridFrameOffsetVector
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1877
diff changeset
296 ASSERT_DOUBLE_EQ(0, p->GetMultiFrameGeometry().GetAxisY() [2]);
990f396484b1 fix rendering of RT-DOSE with negative GridFrameOffsetVector
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1877
diff changeset
297
990f396484b1 fix rendering of RT-DOSE with negative GridFrameOffsetVector
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1877
diff changeset
298 ASSERT_DOUBLE_EQ(0, p->GetMultiFrameGeometry().GetNormal() [0]);
990f396484b1 fix rendering of RT-DOSE with negative GridFrameOffsetVector
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1877
diff changeset
299 ASSERT_DOUBLE_EQ(0, p->GetMultiFrameGeometry().GetNormal() [1]);
990f396484b1 fix rendering of RT-DOSE with negative GridFrameOffsetVector
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1877
diff changeset
300 ASSERT_DOUBLE_EQ(1, p->GetMultiFrameGeometry().GetNormal() [2]);
990f396484b1 fix rendering of RT-DOSE with negative GridFrameOffsetVector
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1877
diff changeset
301
990f396484b1 fix rendering of RT-DOSE with negative GridFrameOffsetVector
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1877
diff changeset
302 ASSERT_DOUBLE_EQ(-205.2157, p->GetMultiFrameGeometry().GetOrigin() [0]);
990f396484b1 fix rendering of RT-DOSE with negative GridFrameOffsetVector
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1877
diff changeset
303 ASSERT_DOUBLE_EQ(-388.4679, p->GetMultiFrameGeometry().GetOrigin() [1]);
990f396484b1 fix rendering of RT-DOSE with negative GridFrameOffsetVector
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1877
diff changeset
304 ASSERT_DOUBLE_EQ(-120.0, p->GetMultiFrameGeometry().GetOrigin() [2]);
990f396484b1 fix rendering of RT-DOSE with negative GridFrameOffsetVector
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1877
diff changeset
305 }