annotate UnitTestsSources/DicomTests.cpp @ 1762:604fc328dc10

typo
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 10 May 2021 11:56:47 +0200
parents 9ac2a65d4172
children 3889ae96d2e9
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
1739
9ac2a65d4172 upgrade to year 2021
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1725
diff changeset
5 * Copyright (C) 2017-2021 Osimis S.A., Belgium
1679
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6 *
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7 * This program is free software: you can redistribute it and/or
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8 * modify it under the terms of the GNU Affero General Public License
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9 * 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
10 * 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
11 *
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12 * 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
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
15 * Affero General Public License for more details.
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
16 *
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
17 * You should have received a copy of the GNU Affero General Public License
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
19 **/
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
20
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 #include <gtest/gtest.h>
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 "../OrthancStone/Sources/Toolbox/DicomInstanceParameters.h"
1725
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
25 #include "../OrthancStone/Sources/Loaders/DicomSource.h"
1679
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
26
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
27 #include <OrthancException.h>
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
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
30 static void SetupUids(Orthanc::DicomMap& m)
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 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
33 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
34 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
35 }
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
36
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 TEST(DicomInstanceParameters, Basic)
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 Orthanc::DicomMap m;
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
41 SetupUids(m);
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
42
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
43 std::unique_ptr<OrthancStone::DicomInstanceParameters> p;
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
44 p.reset(OrthancStone::DicomInstanceParameters(m).Clone());
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
45
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
46 ASSERT_TRUE(p->GetOrthancInstanceIdentifier().empty());
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
47 ASSERT_EQ(3u, p->GetTags().GetSize());
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
48 ASSERT_EQ("my_study", p->GetStudyInstanceUid());
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
49 ASSERT_EQ("my_series", p->GetSeriesInstanceUid());
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
50 ASSERT_EQ("my_sop", p->GetSopInstanceUid());
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
51 ASSERT_EQ(OrthancStone::SopClassUid_Other, p->GetSopClassUid());
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
52 ASSERT_EQ(1u, p->GetNumberOfFrames());
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
53 ASSERT_EQ(0u, p->GetWidth());
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
54 ASSERT_EQ(0u, p->GetHeight());
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
55 ASSERT_TRUE(OrthancStone::LinearAlgebra::IsCloseToZero(p->GetSliceThickness()));
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
56 ASSERT_FLOAT_EQ(1, p->GetPixelSpacingX());
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
57 ASSERT_FLOAT_EQ(1, p->GetPixelSpacingY());
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
58 ASSERT_FALSE(p->GetGeometry().IsValid());
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
59 ASSERT_THROW(p->GetImageInformation(), Orthanc::OrthancException);
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
60 ASSERT_FALSE(p->GetFrameGeometry(0).IsValid());
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
61 ASSERT_THROW(p->IsColor(), Orthanc::OrthancException); // Accesses DicomImageInformation
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
62 ASSERT_FALSE(p->HasRescale());
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
63 ASSERT_THROW(p->GetRescaleIntercept(), Orthanc::OrthancException);
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
64 ASSERT_THROW(p->GetRescaleSlope(), Orthanc::OrthancException);
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
65 ASSERT_EQ(0u, p->GetWindowingPresetsCount());
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
66 ASSERT_THROW(p->GetWindowingPresetCenter(0), Orthanc::OrthancException);
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
67 ASSERT_THROW(p->GetWindowingPresetWidth(0), Orthanc::OrthancException);
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
68
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
69 float c, w;
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
70 p->GetWindowingPresetsUnion(c, w);
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
71 ASSERT_FLOAT_EQ(128.0f, c);
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
72 ASSERT_FLOAT_EQ(256.0f, w);
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
73
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
74 ASSERT_THROW(p->GetExpectedPixelFormat(), Orthanc::OrthancException);
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
75 ASSERT_FALSE(p->HasIndexInSeries());
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
76 ASSERT_THROW(p->GetIndexInSeries(), Orthanc::OrthancException);
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
77 ASSERT_TRUE(p->GetDoseUnits().empty());
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
78 ASSERT_DOUBLE_EQ(1.0, p->GetDoseGridScaling());
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
79 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
80
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
81 double s;
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
82 ASSERT_FALSE(p->ComputeRegularSpacing(s));
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
83 ASSERT_TRUE(p->GetFrameOfReferenceUid().empty());
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
84 }
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
85
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 TEST(DicomInstanceParameters, Windowing)
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 Orthanc::DicomMap m;
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
90 SetupUids(m);
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
91 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
92 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
93
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
94 OrthancStone::DicomInstanceParameters p(m);
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
95 ASSERT_EQ(3u, p.GetWindowingPresetsCount());
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
96 ASSERT_FLOAT_EQ(10, p.GetWindowingPresetCenter(0));
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
97 ASSERT_FLOAT_EQ(100, p.GetWindowingPresetCenter(1));
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
98 ASSERT_FLOAT_EQ(1000, p.GetWindowingPresetCenter(2));
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
99 ASSERT_FLOAT_EQ(50, p.GetWindowingPresetWidth(0));
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
100 ASSERT_FLOAT_EQ(60, p.GetWindowingPresetWidth(1));
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
101 ASSERT_FLOAT_EQ(70, p.GetWindowingPresetWidth(2));
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
102
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
103 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
104 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
105
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
106 float c, w;
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
107 p.GetWindowingPresetsUnion(c, w);
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
108 ASSERT_FLOAT_EQ((a + b) / 2.0f, c);
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
109 ASSERT_FLOAT_EQ(b - a, w);
5b8b88e5bfd6 successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
110 }
1725
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
111
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
112
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
113 TEST(DicomSource, Equality)
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 OrthancStone::DicomSource s1;
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 s2;
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
120 ASSERT_TRUE(s1.IsSameSource(s2));
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 s2.SetDicomDirSource();
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
123 ASSERT_FALSE(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.SetDicomWebSource("toto");
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.SetDicomWebThroughOrthancSource("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.SetOrthancSource();
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
132 ASSERT_TRUE(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 }
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 OrthancStone::DicomSource s1;
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 Orthanc::WebServiceParameters p;
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
141 p.SetUrl("http://localhost:8042/");
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 OrthancStone::DicomSource s2;
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
144 s2.SetOrthancSource(p);
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
145 ASSERT_TRUE(s1.IsSameSource(s2));
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
146
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
147 p.SetCredentials("toto", "tutu");
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
148 s2.SetOrthancSource(p);
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
149 ASSERT_FALSE(s1.IsSameSource(s2));
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
150
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
151 p.ClearCredentials();
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
152 s2.SetOrthancSource(p);
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
153 ASSERT_TRUE(s1.IsSameSource(s2));
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
154
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
155 p.SetUrl("http://localhost:8043/");
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
156 s2.SetOrthancSource(p);
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
157 ASSERT_FALSE(s1.IsSameSource(s2));
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
158 }
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
159 }
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 OrthancStone::DicomSource s1;
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
163 s1.SetDicomDirSource();
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 {
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
166 OrthancStone::DicomSource s2;
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
167 ASSERT_FALSE(s1.IsSameSource(s2));
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 s2.SetDicomDirSource();
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
170 ASSERT_TRUE(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.SetDicomWebSource("toto");
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
173 ASSERT_FALSE(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.SetDicomWebThroughOrthancSource("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 }
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 OrthancStone::DicomSource s1;
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
182 s1.SetDicomWebSource("http");
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 {
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
185 OrthancStone::DicomSource s2;
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
186 ASSERT_FALSE(s1.IsSameSource(s2));
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 s2.SetDicomDirSource();
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.SetDicomWebSource("http");
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
192 ASSERT_TRUE(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("http2");
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
195 ASSERT_FALSE(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.SetDicomWebThroughOrthancSource("toto");
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 }
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 OrthancStone::DicomSource s1;
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
204 s1.SetDicomWebThroughOrthancSource("server");
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 {
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
207 OrthancStone::DicomSource s2;
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
208 ASSERT_FALSE(s1.IsSameSource(s2));
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 s2.SetDicomDirSource();
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.SetDicomWebSource("http");
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.SetDicomWebThroughOrthancSource("server");
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
217 ASSERT_TRUE(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("server2");
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
220 ASSERT_FALSE(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 }
c8d0ffb3047d DicomSource::IsSameSource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1679
diff changeset
223 }