annotate OrthancStone/UnitTestsSources/DicomTests.cpp @ 2012:637d6373127a

width of the vertical slider has doubled to ease user interactions
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 02 Dec 2022 18:49:06 +0100
parents a2955abe4c2e
children 990f396484b1
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
1871
7053b8a0aaec upgrade to year 2022
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1870
diff changeset
5 * Copyright (C) 2017-2022 Osimis S.A., Belgium
7053b8a0aaec upgrade to year 2022
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1870
diff changeset
6 * Copyright (C) 2021-2022 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
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());
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
57 ASSERT_TRUE(OrthancStone::LinearAlgebra::IsCloseToZero(p->GetSliceThickness()));
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
58 ASSERT_FLOAT_EQ(1, p->GetPixelSpacingX());
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
59 ASSERT_FLOAT_EQ(1, p->GetPixelSpacingY());
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
60 ASSERT_FALSE(p->GetGeometry().IsValid());
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
61 ASSERT_THROW(p->GetImageInformation(), Orthanc::OrthancException);
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
62 ASSERT_FALSE(p->GetFrameGeometry(0).IsValid());
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
63 ASSERT_THROW(p->IsColor(), Orthanc::OrthancException); // Accesses DicomImageInformation
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
64 ASSERT_FALSE(p->HasRescale());
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
65 ASSERT_THROW(p->GetRescaleIntercept(), Orthanc::OrthancException);
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
66 ASSERT_THROW(p->GetRescaleSlope(), Orthanc::OrthancException);
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
67 ASSERT_EQ(0u, p->GetWindowingPresetsCount());
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
68 ASSERT_THROW(p->GetWindowingPresetCenter(0), Orthanc::OrthancException);
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
69 ASSERT_THROW(p->GetWindowingPresetWidth(0), Orthanc::OrthancException);
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
70
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
71 float c, w;
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
72 p->GetWindowingPresetsUnion(c, w);
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
73 ASSERT_FLOAT_EQ(128.0f, c);
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
74 ASSERT_FLOAT_EQ(256.0f, w);
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
75
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
76 ASSERT_THROW(p->GetExpectedPixelFormat(), Orthanc::OrthancException);
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
77 ASSERT_FALSE(p->HasIndexInSeries());
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
78 ASSERT_THROW(p->GetIndexInSeries(), Orthanc::OrthancException);
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
79 ASSERT_TRUE(p->GetDoseUnits().empty());
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
80 ASSERT_DOUBLE_EQ(1.0, p->GetDoseGridScaling());
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
81 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
82
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
83 double s;
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
84 ASSERT_FALSE(p->ComputeRegularSpacing(s));
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
85 ASSERT_TRUE(p->GetFrameOfReferenceUid().empty());
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
86 }
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 TEST(DicomInstanceParameters, Windowing)
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
90 {
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
91 Orthanc::DicomMap m;
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
92 SetupUids(m);
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
93 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
94 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
95
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
96 OrthancStone::DicomInstanceParameters p(m);
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
97 ASSERT_EQ(3u, p.GetWindowingPresetsCount());
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
98 ASSERT_FLOAT_EQ(10, p.GetWindowingPresetCenter(0));
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
99 ASSERT_FLOAT_EQ(100, p.GetWindowingPresetCenter(1));
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
100 ASSERT_FLOAT_EQ(1000, p.GetWindowingPresetCenter(2));
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
101 ASSERT_FLOAT_EQ(50, p.GetWindowingPresetWidth(0));
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
102 ASSERT_FLOAT_EQ(60, p.GetWindowingPresetWidth(1));
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
103 ASSERT_FLOAT_EQ(70, p.GetWindowingPresetWidth(2));
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
104
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
105 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
106 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
107
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
108 float c, w;
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
109 p.GetWindowingPresetsUnion(c, w);
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
110 ASSERT_FLOAT_EQ((a + b) / 2.0f, c);
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
111 ASSERT_FLOAT_EQ(b - a, w);
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
112 }
1725
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
113
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 TEST(DicomSource, Equality)
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
116 {
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 OrthancStone::DicomSource s1;
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
119
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 OrthancStone::DicomSource s2;
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
122 ASSERT_TRUE(s1.IsSameSource(s2));
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
123
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
124 s2.SetDicomDirSource();
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
125 ASSERT_FALSE(s1.IsSameSource(s2));
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
126
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
127 s2.SetDicomWebSource("toto");
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
128 ASSERT_FALSE(s1.IsSameSource(s2));
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
129
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
130 s2.SetDicomWebThroughOrthancSource("toto");
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
131 ASSERT_FALSE(s1.IsSameSource(s2));
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
132
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
133 s2.SetOrthancSource();
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
134 ASSERT_TRUE(s1.IsSameSource(s2));
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
135 }
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 OrthancStone::DicomSource s1;
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
140
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 Orthanc::WebServiceParameters p;
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
143 p.SetUrl("http://localhost:8042/");
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
144
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
145 OrthancStone::DicomSource s2;
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
146 s2.SetOrthancSource(p);
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
147 ASSERT_TRUE(s1.IsSameSource(s2));
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
148
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
149 p.SetCredentials("toto", "tutu");
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
150 s2.SetOrthancSource(p);
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
151 ASSERT_FALSE(s1.IsSameSource(s2));
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
152
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
153 p.ClearCredentials();
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
154 s2.SetOrthancSource(p);
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
155 ASSERT_TRUE(s1.IsSameSource(s2));
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
156
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
157 p.SetUrl("http://localhost:8043/");
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
158 s2.SetOrthancSource(p);
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
159 ASSERT_FALSE(s1.IsSameSource(s2));
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
160 }
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 OrthancStone::DicomSource s1;
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
165 s1.SetDicomDirSource();
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
166
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 OrthancStone::DicomSource s2;
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
169 ASSERT_FALSE(s1.IsSameSource(s2));
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
170
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
171 s2.SetDicomDirSource();
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
172 ASSERT_TRUE(s1.IsSameSource(s2));
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
173
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
174 s2.SetDicomWebSource("toto");
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
175 ASSERT_FALSE(s1.IsSameSource(s2));
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
176
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
177 s2.SetDicomWebThroughOrthancSource("toto");
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
178 ASSERT_FALSE(s1.IsSameSource(s2));
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
179 }
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 OrthancStone::DicomSource s1;
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
184 s1.SetDicomWebSource("http");
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
185
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 OrthancStone::DicomSource s2;
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
188 ASSERT_FALSE(s1.IsSameSource(s2));
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
189
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
190 s2.SetDicomDirSource();
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
191 ASSERT_FALSE(s1.IsSameSource(s2));
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
192
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
193 s2.SetDicomWebSource("http");
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
194 ASSERT_TRUE(s1.IsSameSource(s2));
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
195
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
196 s2.SetDicomWebSource("http2");
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
197 ASSERT_FALSE(s1.IsSameSource(s2));
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
198
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
199 s2.SetDicomWebThroughOrthancSource("toto");
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
200 ASSERT_FALSE(s1.IsSameSource(s2));
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
201 }
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 OrthancStone::DicomSource s1;
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
206 s1.SetDicomWebThroughOrthancSource("server");
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
207
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 OrthancStone::DicomSource s2;
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
210 ASSERT_FALSE(s1.IsSameSource(s2));
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
211
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
212 s2.SetDicomDirSource();
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
213 ASSERT_FALSE(s1.IsSameSource(s2));
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
214
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
215 s2.SetDicomWebSource("http");
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
216 ASSERT_FALSE(s1.IsSameSource(s2));
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
217
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
218 s2.SetDicomWebThroughOrthancSource("server");
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
219 ASSERT_TRUE(s1.IsSameSource(s2));
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
220
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
221 s2.SetDicomWebThroughOrthancSource("server2");
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
222 ASSERT_FALSE(s1.IsSameSource(s2));
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
223 }
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 }