annotate Framework/Deprecated/Loaders/OrthancSeriesVolumeProgressiveLoader.cpp @ 1327:4f8db2d202c8 broker

OrthancSeriesProgressiveLoader now has two modes that can be selected at object creation : - progressive (will first load jpeg50, then jpeg90 then PAM) - non-progressive (will directly load PAM (uncompressed)) Please note that the slice loading order remains dynamic and depending upon the slice that the client code wishes to extract from the volume.
author Benjamin Golinvaux <bgo@osimis.io>
date Wed, 25 Mar 2020 14:34:27 +0100
parents 7702ad9b7011
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
814
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 /**
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2 * Stone of Orthanc
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4 * Department, University Hospital of Liege, Belgium
1271
0ca50d275b9a upgrade to year 2020
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1225
diff changeset
5 * Copyright (C) 2017-2020 Osimis S.A., Belgium
814
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6 *
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7 * This program is free software: you can redistribute it and/or
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8 * modify it under the terms of the GNU Affero General Public License
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9 * as published by the Free Software Foundation, either version 3 of
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
10 * the License, or (at your option) any later version.
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
11 *
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12 * This program is distributed in the hope that it will be useful, but
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
15 * Affero General Public License for more details.
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
16 *
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
17 * You should have received a copy of the GNU Affero General Public License
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
19 **/
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
20
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
21
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
22 #include "OrthancSeriesVolumeProgressiveLoader.h"
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
23
1327
4f8db2d202c8 OrthancSeriesProgressiveLoader now has two modes that
Benjamin Golinvaux <bgo@osimis.io>
parents: 1320
diff changeset
24 #include "../../StoneException.h"
1310
9bea7e15b519 - first pass at changes to cope with the refactoring of the loading system
Benjamin Golinvaux <bgo@osimis.io>
parents: 1300
diff changeset
25 #include "../../Loaders/ILoadersContext.h"
1225
16738485e457 deprecating DicomStructureSetLoader, OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1156
diff changeset
26 #include "../../Loaders/BasicFetchingItemsSorter.h"
16738485e457 deprecating DicomStructureSetLoader, OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1156
diff changeset
27 #include "../../Loaders/BasicFetchingStrategy.h"
16738485e457 deprecating DicomStructureSetLoader, OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1156
diff changeset
28 #include "../../Toolbox/GeometryToolbox.h"
16738485e457 deprecating DicomStructureSetLoader, OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1156
diff changeset
29 #include "../../Volumes/DicomVolumeImageMPRSlicer.h"
814
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
30
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
31 #include <Core/Images/ImageProcessing.h>
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
32 #include <Core/OrthancException.h>
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
33
1225
16738485e457 deprecating DicomStructureSetLoader, OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1156
diff changeset
34 namespace Deprecated
814
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
35 {
1310
9bea7e15b519 - first pass at changes to cope with the refactoring of the loading system
Benjamin Golinvaux <bgo@osimis.io>
parents: 1300
diff changeset
36 using OrthancStone::ILoadersContext;
9bea7e15b519 - first pass at changes to cope with the refactoring of the loading system
Benjamin Golinvaux <bgo@osimis.io>
parents: 1300
diff changeset
37
1225
16738485e457 deprecating DicomStructureSetLoader, OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1156
diff changeset
38 class OrthancSeriesVolumeProgressiveLoader::ExtractedSlice : public OrthancStone::DicomVolumeImageMPRSlicer::Slice
814
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
39 {
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
40 private:
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
41 const OrthancSeriesVolumeProgressiveLoader& that_;
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
42
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
43 public:
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
44 ExtractedSlice(const OrthancSeriesVolumeProgressiveLoader& that,
1225
16738485e457 deprecating DicomStructureSetLoader, OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1156
diff changeset
45 const OrthancStone::CoordinateSystem3D& plane) :
16738485e457 deprecating DicomStructureSetLoader, OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1156
diff changeset
46 OrthancStone::DicomVolumeImageMPRSlicer::Slice(*that.volume_, plane),
814
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
47 that_(that)
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
48 {
819
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 817
diff changeset
49 if (IsValid())
817
68f888812af4 simplification of DicomVolumeImageMPRSlicer::ExtractedSlice
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 814
diff changeset
50 {
1225
16738485e457 deprecating DicomStructureSetLoader, OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1156
diff changeset
51 if (GetProjection() == OrthancStone::VolumeProjection_Axial)
819
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 817
diff changeset
52 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 817
diff changeset
53 // For coronal and sagittal projections, we take the global
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 817
diff changeset
54 // revision of the volume because even if a single slice changes,
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 817
diff changeset
55 // this means the projection will yield a different result -->
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 817
diff changeset
56 // we must increase the revision as soon as any slice changes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 817
diff changeset
57 SetRevision(that_.seriesGeometry_.GetSliceRevision(GetSliceIndex()));
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 817
diff changeset
58 }
817
68f888812af4 simplification of DicomVolumeImageMPRSlicer::ExtractedSlice
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 814
diff changeset
59
819
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 817
diff changeset
60 if (that_.strategy_.get() != NULL &&
1225
16738485e457 deprecating DicomStructureSetLoader, OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1156
diff changeset
61 GetProjection() == OrthancStone::VolumeProjection_Axial)
819
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 817
diff changeset
62 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 817
diff changeset
63 that_.strategy_->SetCurrent(GetSliceIndex());
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 817
diff changeset
64 }
814
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
65 }
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
66 }
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
67 };
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
68
1327
4f8db2d202c8 OrthancSeriesProgressiveLoader now has two modes that
Benjamin Golinvaux <bgo@osimis.io>
parents: 1320
diff changeset
69 void OrthancSeriesVolumeProgressiveLoader::SeriesGeometry::CheckSlice(
4f8db2d202c8 OrthancSeriesProgressiveLoader now has two modes that
Benjamin Golinvaux <bgo@osimis.io>
parents: 1320
diff changeset
70 size_t index, const OrthancStone::DicomInstanceParameters& reference) const
814
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
71 {
1225
16738485e457 deprecating DicomStructureSetLoader, OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1156
diff changeset
72 const OrthancStone::DicomInstanceParameters& slice = *slices_[index];
814
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
73
1225
16738485e457 deprecating DicomStructureSetLoader, OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1156
diff changeset
74 if (!OrthancStone::GeometryToolbox::IsParallel(
814
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
75 reference.GetGeometry().GetNormal(),
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
76 slice.GetGeometry().GetNormal()))
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
77 {
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
78 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadGeometry,
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
79 "A slice in the volume image is not parallel to the others");
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
80 }
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
81
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
82 if (reference.GetExpectedPixelFormat() != slice.GetExpectedPixelFormat())
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
83 {
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
84 throw Orthanc::OrthancException(Orthanc::ErrorCode_IncompatibleImageFormat,
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
85 "The pixel format changes across the slices of the volume image");
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
86 }
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
87
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
88 if (reference.GetImageInformation().GetWidth() != slice.GetImageInformation().GetWidth() ||
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
89 reference.GetImageInformation().GetHeight() != slice.GetImageInformation().GetHeight())
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
90 {
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
91 throw Orthanc::OrthancException(Orthanc::ErrorCode_IncompatibleImageSize,
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
92 "The width/height of slices are not constant in the volume image");
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
93 }
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
94
1225
16738485e457 deprecating DicomStructureSetLoader, OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1156
diff changeset
95 if (!OrthancStone::LinearAlgebra::IsNear(reference.GetPixelSpacingX(), slice.GetPixelSpacingX()) ||
16738485e457 deprecating DicomStructureSetLoader, OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1156
diff changeset
96 !OrthancStone::LinearAlgebra::IsNear(reference.GetPixelSpacingY(), slice.GetPixelSpacingY()))
814
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
97 {
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
98 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadGeometry,
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
99 "The pixel spacing of the slices change across the volume image");
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
100 }
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
101 }
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
102
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
103
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
104 void OrthancSeriesVolumeProgressiveLoader::SeriesGeometry::CheckVolume() const
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
105 {
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
106 for (size_t i = 0; i < slices_.size(); i++)
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
107 {
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
108 assert(slices_[i] != NULL);
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
109 if (slices_[i]->GetImageInformation().GetNumberOfFrames() != 1)
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
110 {
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
111 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadGeometry,
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
112 "This class does not support multi-frame images");
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
113 }
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
114 }
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
115
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
116 if (slices_.size() != 0)
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
117 {
1225
16738485e457 deprecating DicomStructureSetLoader, OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1156
diff changeset
118 const OrthancStone::DicomInstanceParameters& reference = *slices_[0];
814
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
119
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
120 for (size_t i = 1; i < slices_.size(); i++)
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
121 {
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
122 CheckSlice(i, reference);
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
123 }
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
124 }
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
125 }
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
126
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
127
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
128 void OrthancSeriesVolumeProgressiveLoader::SeriesGeometry::Clear()
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
129 {
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
130 for (size_t i = 0; i < slices_.size(); i++)
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
131 {
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
132 assert(slices_[i] != NULL);
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
133 delete slices_[i];
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
134 }
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
135
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
136 slices_.clear();
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
137 slicesRevision_.clear();
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
138 }
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
139
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
140
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
141 void OrthancSeriesVolumeProgressiveLoader::SeriesGeometry::CheckSliceIndex(size_t index) const
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
142 {
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
143 if (!HasGeometry())
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
144 {
956
a7351ad54960 Made IsContextLost automatically set the flag by checking with the emscripten
Benjamin Golinvaux <bgo@osimis.io>
parents: 949
diff changeset
145 LOG(ERROR) << "OrthancSeriesVolumeProgressiveLoader::SeriesGeometry::CheckSliceIndex(size_t index): (!HasGeometry())";
814
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
146 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadSequenceOfCalls);
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
147 }
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
148 else if (index >= slices_.size())
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
149 {
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
150 throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange);
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
151 }
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
152 else
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
153 {
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
154 assert(slices_.size() == GetImageGeometry().GetDepth() &&
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
155 slices_.size() == slicesRevision_.size());
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
156 }
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
157 }
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
158
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
159
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
160 // WARNING: The payload of "slices" must be of class "DicomInstanceParameters"
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
161 // (called with the slices created in LoadGeometry)
1225
16738485e457 deprecating DicomStructureSetLoader, OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1156
diff changeset
162 void OrthancSeriesVolumeProgressiveLoader::SeriesGeometry::ComputeGeometry(OrthancStone::SlicesSorter& slices)
814
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
163 {
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
164 Clear();
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
165
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
166 if (!slices.Sort())
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
167 {
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
168 throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange,
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
169 "Cannot sort the 3D slices of a DICOM series");
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
170 }
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
171
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
172 if (slices.GetSlicesCount() == 0)
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
173 {
1225
16738485e457 deprecating DicomStructureSetLoader, OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1156
diff changeset
174 geometry_.reset(new OrthancStone::VolumeImageGeometry);
814
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
175 }
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
176 else
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
177 {
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
178 slices_.reserve(slices.GetSlicesCount());
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
179 slicesRevision_.resize(slices.GetSlicesCount(), 0);
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
180
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
181 for (size_t i = 0; i < slices.GetSlicesCount(); i++)
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
182 {
1225
16738485e457 deprecating DicomStructureSetLoader, OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1156
diff changeset
183 const OrthancStone::DicomInstanceParameters& slice =
16738485e457 deprecating DicomStructureSetLoader, OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1156
diff changeset
184 dynamic_cast<const OrthancStone::DicomInstanceParameters&>(slices.GetSlicePayload(i));
16738485e457 deprecating DicomStructureSetLoader, OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1156
diff changeset
185 slices_.push_back(new OrthancStone::DicomInstanceParameters(slice));
814
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
186 }
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
187
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
188 CheckVolume();
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
189
1156
34ee7204fde3 removing IGeometryProvider
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1135
diff changeset
190 double spacingZ;
34ee7204fde3 removing IGeometryProvider
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1135
diff changeset
191
34ee7204fde3 removing IGeometryProvider
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1135
diff changeset
192 if (slices.ComputeSpacingBetweenSlices(spacingZ))
34ee7204fde3 removing IGeometryProvider
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1135
diff changeset
193 {
1320
7702ad9b7011 OrthancSeriesVolumeProgressiveLoader : PNG quality only!
Benjamin Golinvaux <bgo@osimis.io>
parents: 1318
diff changeset
194 LOG(TRACE) << "Computed spacing between slices: " << spacingZ << "mm";
814
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
195
1225
16738485e457 deprecating DicomStructureSetLoader, OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1156
diff changeset
196 const OrthancStone::DicomInstanceParameters& parameters = *slices_[0];
814
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
197
1225
16738485e457 deprecating DicomStructureSetLoader, OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1156
diff changeset
198 geometry_.reset(new OrthancStone::VolumeImageGeometry);
1156
34ee7204fde3 removing IGeometryProvider
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1135
diff changeset
199 geometry_->SetSizeInVoxels(parameters.GetImageInformation().GetWidth(),
34ee7204fde3 removing IGeometryProvider
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1135
diff changeset
200 parameters.GetImageInformation().GetHeight(),
34ee7204fde3 removing IGeometryProvider
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1135
diff changeset
201 static_cast<unsigned int>(slices.GetSlicesCount()));
34ee7204fde3 removing IGeometryProvider
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1135
diff changeset
202 geometry_->SetAxialGeometry(slices.GetSliceGeometry(0));
34ee7204fde3 removing IGeometryProvider
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1135
diff changeset
203 geometry_->SetVoxelDimensions(parameters.GetPixelSpacingX(),
34ee7204fde3 removing IGeometryProvider
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1135
diff changeset
204 parameters.GetPixelSpacingY(), spacingZ);
34ee7204fde3 removing IGeometryProvider
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1135
diff changeset
205 }
34ee7204fde3 removing IGeometryProvider
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1135
diff changeset
206 else
34ee7204fde3 removing IGeometryProvider
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1135
diff changeset
207 {
34ee7204fde3 removing IGeometryProvider
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1135
diff changeset
208 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadGeometry,
34ee7204fde3 removing IGeometryProvider
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1135
diff changeset
209 "The origins of the slices of a volume image are not regularly spaced");
34ee7204fde3 removing IGeometryProvider
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1135
diff changeset
210 }
814
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
211 }
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
212 }
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
213
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
214
1225
16738485e457 deprecating DicomStructureSetLoader, OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1156
diff changeset
215 const OrthancStone::VolumeImageGeometry& OrthancSeriesVolumeProgressiveLoader::SeriesGeometry::GetImageGeometry() const
814
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
216 {
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
217 if (!HasGeometry())
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
218 {
956
a7351ad54960 Made IsContextLost automatically set the flag by checking with the emscripten
Benjamin Golinvaux <bgo@osimis.io>
parents: 949
diff changeset
219 LOG(ERROR) << "OrthancSeriesVolumeProgressiveLoader::SeriesGeometry::GetImageGeometry(): (!HasGeometry())";
814
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
220 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadSequenceOfCalls);
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
221 }
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
222 else
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
223 {
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
224 assert(slices_.size() == geometry_->GetDepth());
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
225 return *geometry_;
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
226 }
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
227 }
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
228
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
229
1225
16738485e457 deprecating DicomStructureSetLoader, OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1156
diff changeset
230 const OrthancStone::DicomInstanceParameters& OrthancSeriesVolumeProgressiveLoader::SeriesGeometry::GetSliceParameters(size_t index) const
814
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
231 {
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
232 CheckSliceIndex(index);
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
233 return *slices_[index];
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
234 }
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
235
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
236
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
237 uint64_t OrthancSeriesVolumeProgressiveLoader::SeriesGeometry::GetSliceRevision(size_t index) const
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
238 {
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
239 CheckSliceIndex(index);
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
240 return slicesRevision_[index];
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
241 }
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
242
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
243
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
244 void OrthancSeriesVolumeProgressiveLoader::SeriesGeometry::IncrementSliceRevision(size_t index)
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
245 {
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
246 CheckSliceIndex(index);
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
247 slicesRevision_[index] ++;
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
248 }
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
249
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
250
1225
16738485e457 deprecating DicomStructureSetLoader, OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1156
diff changeset
251 static unsigned int GetSliceIndexPayload(const OrthancStone::OracleCommandBase& command)
814
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
252 {
1135
a0a33e5ea5bb IOracleCommand::Clone()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1134
diff changeset
253 assert(command.HasPayload());
814
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
254 return dynamic_cast< const Orthanc::SingleValueObject<unsigned int>& >(command.GetPayload()).GetValue();
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
255 }
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
256
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
257
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
258 void OrthancSeriesVolumeProgressiveLoader::ScheduleNextSliceDownload()
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
259 {
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
260 assert(strategy_.get() != NULL);
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
261
1327
4f8db2d202c8 OrthancSeriesProgressiveLoader now has two modes that
Benjamin Golinvaux <bgo@osimis.io>
parents: 1320
diff changeset
262 unsigned int sliceIndex = 0, quality = 0;
814
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
263
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
264 if (strategy_->GetNext(sliceIndex, quality))
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
265 {
1327
4f8db2d202c8 OrthancSeriesProgressiveLoader now has two modes that
Benjamin Golinvaux <bgo@osimis.io>
parents: 1320
diff changeset
266 if (!progressiveQuality_)
4f8db2d202c8 OrthancSeriesProgressiveLoader now has two modes that
Benjamin Golinvaux <bgo@osimis.io>
parents: 1320
diff changeset
267 {
4f8db2d202c8 OrthancSeriesProgressiveLoader now has two modes that
Benjamin Golinvaux <bgo@osimis.io>
parents: 1320
diff changeset
268 ORTHANC_ASSERT(quality == QUALITY_00, "INTERNAL ERROR. quality != QUALITY_00 in "
4f8db2d202c8 OrthancSeriesProgressiveLoader now has two modes that
Benjamin Golinvaux <bgo@osimis.io>
parents: 1320
diff changeset
269 << "OrthancSeriesVolumeProgressiveLoader::ScheduleNextSliceDownload");
4f8db2d202c8 OrthancSeriesProgressiveLoader now has two modes that
Benjamin Golinvaux <bgo@osimis.io>
parents: 1320
diff changeset
270 }
814
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
271
1225
16738485e457 deprecating DicomStructureSetLoader, OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1156
diff changeset
272 const OrthancStone::DicomInstanceParameters& slice = seriesGeometry_.GetSliceParameters(sliceIndex);
814
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
273
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
274 const std::string& instance = slice.GetOrthancInstanceIdentifier();
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
275 if (instance.empty())
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
276 {
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
277 throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError);
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
278 }
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
279
1299
c38c89684d83 replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1279
diff changeset
280 std::unique_ptr<OrthancStone::OracleCommandBase> command;
814
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
281
1327
4f8db2d202c8 OrthancSeriesProgressiveLoader now has two modes that
Benjamin Golinvaux <bgo@osimis.io>
parents: 1320
diff changeset
282 if (!progressiveQuality_ || quality == QUALITY_02)
814
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
283 {
1299
c38c89684d83 replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1279
diff changeset
284 std::unique_ptr<OrthancStone::GetOrthancImageCommand> tmp(new OrthancStone::GetOrthancImageCommand);
937
86ac61a040c9 Added getters and notifications to allow clients of the loaders (DicomStructureSetLoader, OrthancSeriesVolumeProgressiveLoader and OrthancMultiframeVolumeLoader) to know when the loading is finished + added ability for SDL event loop to execute a callback repeatedly (used to check the view loading state)
Benjamin Golinvaux <bgo@osimis.io>
parents: 935
diff changeset
285 // TODO: review the following comment.
86ac61a040c9 Added getters and notifications to allow clients of the loaders (DicomStructureSetLoader, OrthancSeriesVolumeProgressiveLoader and OrthancMultiframeVolumeLoader) to know when the loading is finished + added ability for SDL event loop to execute a callback repeatedly (used to check the view loading state)
Benjamin Golinvaux <bgo@osimis.io>
parents: 935
diff changeset
286 // - Commented out by bgo on 2019-07-19 | reason: Alain has seen cases
86ac61a040c9 Added getters and notifications to allow clients of the loaders (DicomStructureSetLoader, OrthancSeriesVolumeProgressiveLoader and OrthancMultiframeVolumeLoader) to know when the loading is finished + added ability for SDL event loop to execute a callback repeatedly (used to check the view loading state)
Benjamin Golinvaux <bgo@osimis.io>
parents: 935
diff changeset
287 // where gzipping the uint16 image took 11 sec to produce 5mb.
86ac61a040c9 Added getters and notifications to allow clients of the loaders (DicomStructureSetLoader, OrthancSeriesVolumeProgressiveLoader and OrthancMultiframeVolumeLoader) to know when the loading is finished + added ability for SDL event loop to execute a callback repeatedly (used to check the view loading state)
Benjamin Golinvaux <bgo@osimis.io>
parents: 935
diff changeset
288 // The unzipped request was much much faster.
86ac61a040c9 Added getters and notifications to allow clients of the loaders (DicomStructureSetLoader, OrthancSeriesVolumeProgressiveLoader and OrthancMultiframeVolumeLoader) to know when the loading is finished + added ability for SDL event loop to execute a callback repeatedly (used to check the view loading state)
Benjamin Golinvaux <bgo@osimis.io>
parents: 935
diff changeset
289 // - Re-enabled on 2019-07-30. Reason: in Web Assembly, the browser
86ac61a040c9 Added getters and notifications to allow clients of the loaders (DicomStructureSetLoader, OrthancSeriesVolumeProgressiveLoader and OrthancMultiframeVolumeLoader) to know when the loading is finished + added ability for SDL event loop to execute a callback repeatedly (used to check the view loading state)
Benjamin Golinvaux <bgo@osimis.io>
parents: 935
diff changeset
290 // does not use the Accept-Encoding header and always requests
86ac61a040c9 Added getters and notifications to allow clients of the loaders (DicomStructureSetLoader, OrthancSeriesVolumeProgressiveLoader and OrthancMultiframeVolumeLoader) to know when the loading is finished + added ability for SDL event loop to execute a callback repeatedly (used to check the view loading state)
Benjamin Golinvaux <bgo@osimis.io>
parents: 935
diff changeset
291 // compression. Furthermore, NOT
86ac61a040c9 Added getters and notifications to allow clients of the loaders (DicomStructureSetLoader, OrthancSeriesVolumeProgressiveLoader and OrthancMultiframeVolumeLoader) to know when the loading is finished + added ability for SDL event loop to execute a callback repeatedly (used to check the view loading state)
Benjamin Golinvaux <bgo@osimis.io>
parents: 935
diff changeset
292 tmp->SetHttpHeader("Accept-Encoding", "gzip");
814
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
293 tmp->SetHttpHeader("Accept", std::string(Orthanc::EnumerationToString(Orthanc::MimeType_Pam)));
819
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 817
diff changeset
294 tmp->SetInstanceUri(instance, slice.GetExpectedPixelFormat());
814
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
295 tmp->SetExpectedPixelFormat(slice.GetExpectedPixelFormat());
1320
7702ad9b7011 OrthancSeriesVolumeProgressiveLoader : PNG quality only!
Benjamin Golinvaux <bgo@osimis.io>
parents: 1318
diff changeset
296 //LOG(INFO)
7702ad9b7011 OrthancSeriesVolumeProgressiveLoader : PNG quality only!
Benjamin Golinvaux <bgo@osimis.io>
parents: 1318
diff changeset
297 // << "OrthancSeriesVolumeProgressiveLoader.ScheduleNextSliceDownload()"
7702ad9b7011 OrthancSeriesVolumeProgressiveLoader : PNG quality only!
Benjamin Golinvaux <bgo@osimis.io>
parents: 1318
diff changeset
298 // << " sliceIndex = " << sliceIndex << " slice quality = " << quality
7702ad9b7011 OrthancSeriesVolumeProgressiveLoader : PNG quality only!
Benjamin Golinvaux <bgo@osimis.io>
parents: 1318
diff changeset
299 // << " URI = " << tmp->GetUri();
814
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
300 command.reset(tmp.release());
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
301 }
1327
4f8db2d202c8 OrthancSeriesProgressiveLoader now has two modes that
Benjamin Golinvaux <bgo@osimis.io>
parents: 1320
diff changeset
302 else // progressive mode is true AND quality is not final (different from QUALITY_02
814
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
303 {
1327
4f8db2d202c8 OrthancSeriesProgressiveLoader now has two modes that
Benjamin Golinvaux <bgo@osimis.io>
parents: 1320
diff changeset
304 std::unique_ptr<OrthancStone::GetOrthancWebViewerJpegCommand> tmp(
4f8db2d202c8 OrthancSeriesProgressiveLoader now has two modes that
Benjamin Golinvaux <bgo@osimis.io>
parents: 1320
diff changeset
305 new OrthancStone::GetOrthancWebViewerJpegCommand);
4f8db2d202c8 OrthancSeriesProgressiveLoader now has two modes that
Benjamin Golinvaux <bgo@osimis.io>
parents: 1320
diff changeset
306
913
2b4b6b86520a Re-enabled gl debug output in GuiAdapter +
Benjamin Golinvaux <bgo@osimis.io>
parents: 819
diff changeset
307 // TODO: review the following comment. Commented out by bgo on 2019-07-19
2b4b6b86520a Re-enabled gl debug output in GuiAdapter +
Benjamin Golinvaux <bgo@osimis.io>
parents: 819
diff changeset
308 // (gzip for jpeg seems overkill)
2b4b6b86520a Re-enabled gl debug output in GuiAdapter +
Benjamin Golinvaux <bgo@osimis.io>
parents: 819
diff changeset
309 //tmp->SetHttpHeader("Accept-Encoding", "gzip");
814
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
310 tmp->SetInstance(instance);
1327
4f8db2d202c8 OrthancSeriesProgressiveLoader now has two modes that
Benjamin Golinvaux <bgo@osimis.io>
parents: 1320
diff changeset
311 tmp->SetQuality((quality == 0 ? 50 : 90)); // QUALITY_00 is Jpeg50 while QUALITY_01 is Jpeg90
814
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
312 tmp->SetExpectedPixelFormat(slice.GetExpectedPixelFormat());
1320
7702ad9b7011 OrthancSeriesVolumeProgressiveLoader : PNG quality only!
Benjamin Golinvaux <bgo@osimis.io>
parents: 1318
diff changeset
313 LOG(TRACE)
7702ad9b7011 OrthancSeriesVolumeProgressiveLoader : PNG quality only!
Benjamin Golinvaux <bgo@osimis.io>
parents: 1318
diff changeset
314 << "OrthancSeriesVolumeProgressiveLoader.ScheduleNextSliceDownload()"
7702ad9b7011 OrthancSeriesVolumeProgressiveLoader : PNG quality only!
Benjamin Golinvaux <bgo@osimis.io>
parents: 1318
diff changeset
315 << " sliceIndex = " << sliceIndex << " slice quality = " << quality;
814
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
316 command.reset(tmp.release());
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
317 }
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
318
1128
8e3763d1736a removing CustomOracleCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1075
diff changeset
319 command->AcquirePayload(new Orthanc::SingleValueObject<unsigned int>(sliceIndex));
1310
9bea7e15b519 - first pass at changes to cope with the refactoring of the loading system
Benjamin Golinvaux <bgo@osimis.io>
parents: 1300
diff changeset
320
9bea7e15b519 - first pass at changes to cope with the refactoring of the loading system
Benjamin Golinvaux <bgo@osimis.io>
parents: 1300
diff changeset
321 {
9bea7e15b519 - first pass at changes to cope with the refactoring of the loading system
Benjamin Golinvaux <bgo@osimis.io>
parents: 1300
diff changeset
322 std::unique_ptr<OrthancStone::ILoadersContext::ILock> lock(loadersContext_.Lock());
9bea7e15b519 - first pass at changes to cope with the refactoring of the loading system
Benjamin Golinvaux <bgo@osimis.io>
parents: 1300
diff changeset
323 boost::shared_ptr<IObserver> observer(GetSharedObserver());
9bea7e15b519 - first pass at changes to cope with the refactoring of the loading system
Benjamin Golinvaux <bgo@osimis.io>
parents: 1300
diff changeset
324 lock->Schedule(observer, 0, command.release()); // TODO: priority!
9bea7e15b519 - first pass at changes to cope with the refactoring of the loading system
Benjamin Golinvaux <bgo@osimis.io>
parents: 1300
diff changeset
325 }
814
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
326 }
937
86ac61a040c9 Added getters and notifications to allow clients of the loaders (DicomStructureSetLoader, OrthancSeriesVolumeProgressiveLoader and OrthancMultiframeVolumeLoader) to know when the loading is finished + added ability for SDL event loop to execute a callback repeatedly (used to check the view loading state)
Benjamin Golinvaux <bgo@osimis.io>
parents: 935
diff changeset
327 else
86ac61a040c9 Added getters and notifications to allow clients of the loaders (DicomStructureSetLoader, OrthancSeriesVolumeProgressiveLoader and OrthancMultiframeVolumeLoader) to know when the loading is finished + added ability for SDL event loop to execute a callback repeatedly (used to check the view loading state)
Benjamin Golinvaux <bgo@osimis.io>
parents: 935
diff changeset
328 {
86ac61a040c9 Added getters and notifications to allow clients of the loaders (DicomStructureSetLoader, OrthancSeriesVolumeProgressiveLoader and OrthancMultiframeVolumeLoader) to know when the loading is finished + added ability for SDL event loop to execute a callback repeatedly (used to check the view loading state)
Benjamin Golinvaux <bgo@osimis.io>
parents: 935
diff changeset
329 // loading is finished!
86ac61a040c9 Added getters and notifications to allow clients of the loaders (DicomStructureSetLoader, OrthancSeriesVolumeProgressiveLoader and OrthancMultiframeVolumeLoader) to know when the loading is finished + added ability for SDL event loop to execute a callback repeatedly (used to check the view loading state)
Benjamin Golinvaux <bgo@osimis.io>
parents: 935
diff changeset
330 volumeImageReadyInHighQuality_ = true;
86ac61a040c9 Added getters and notifications to allow clients of the loaders (DicomStructureSetLoader, OrthancSeriesVolumeProgressiveLoader and OrthancMultiframeVolumeLoader) to know when the loading is finished + added ability for SDL event loop to execute a callback repeatedly (used to check the view loading state)
Benjamin Golinvaux <bgo@osimis.io>
parents: 935
diff changeset
331 BroadcastMessage(OrthancSeriesVolumeProgressiveLoader::VolumeImageReadyInHighQuality(*this));
86ac61a040c9 Added getters and notifications to allow clients of the loaders (DicomStructureSetLoader, OrthancSeriesVolumeProgressiveLoader and OrthancMultiframeVolumeLoader) to know when the loading is finished + added ability for SDL event loop to execute a callback repeatedly (used to check the view loading state)
Benjamin Golinvaux <bgo@osimis.io>
parents: 935
diff changeset
332 }
814
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
333 }
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
334
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
335 /**
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
336 This is called in response to GET "/series/XXXXXXXXXXXXX/instances-tags"
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
337 */
1225
16738485e457 deprecating DicomStructureSetLoader, OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1156
diff changeset
338 void OrthancSeriesVolumeProgressiveLoader::LoadGeometry(const OrthancStone::OrthancRestApiCommand::SuccessMessage& message)
814
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
339 {
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
340 Json::Value body;
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
341 message.ParseJsonBody(body);
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
342
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
343 if (body.type() != Json::objectValue)
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
344 {
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
345 throw Orthanc::OrthancException(Orthanc::ErrorCode_NetworkProtocol);
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
346 }
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
347
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
348 {
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
349 Json::Value::Members instances = body.getMemberNames();
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
350
1225
16738485e457 deprecating DicomStructureSetLoader, OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1156
diff changeset
351 OrthancStone::SlicesSorter slices;
814
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
352
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
353 for (size_t i = 0; i < instances.size(); i++)
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
354 {
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
355 Orthanc::DicomMap dicom;
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
356 dicom.FromDicomAsJson(body[instances[i]]);
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
357
1299
c38c89684d83 replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1279
diff changeset
358 std::unique_ptr<OrthancStone::DicomInstanceParameters> instance(new OrthancStone::DicomInstanceParameters(dicom));
814
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
359 instance->SetOrthancInstanceIdentifier(instances[i]);
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
360
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
361 // the 3D plane corresponding to the slice
1225
16738485e457 deprecating DicomStructureSetLoader, OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1156
diff changeset
362 OrthancStone::CoordinateSystem3D geometry = instance->GetGeometry();
814
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
363 slices.AddSlice(geometry, instance.release());
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
364 }
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
365
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
366 seriesGeometry_.ComputeGeometry(slices);
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
367 }
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
368
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
369 size_t slicesCount = seriesGeometry_.GetImageGeometry().GetDepth();
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
370
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
371 if (slicesCount == 0)
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
372 {
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
373 volume_->Initialize(seriesGeometry_.GetImageGeometry(), Orthanc::PixelFormat_Grayscale8);
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
374 }
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
375 else
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
376 {
1225
16738485e457 deprecating DicomStructureSetLoader, OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1156
diff changeset
377 const OrthancStone::DicomInstanceParameters& parameters = seriesGeometry_.GetSliceParameters(0);
814
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
378
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
379 volume_->Initialize(seriesGeometry_.GetImageGeometry(), parameters.GetExpectedPixelFormat());
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
380 volume_->SetDicomParameters(parameters);
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
381 volume_->GetPixelData().Clear();
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
382
1327
4f8db2d202c8 OrthancSeriesProgressiveLoader now has two modes that
Benjamin Golinvaux <bgo@osimis.io>
parents: 1320
diff changeset
383 // If we are in progressive mode, the Fetching strategy will first request QUALITY_00, then QUALITY_01, then
4f8db2d202c8 OrthancSeriesProgressiveLoader now has two modes that
Benjamin Golinvaux <bgo@osimis.io>
parents: 1320
diff changeset
384 // QUALITY_02... Otherwise, it's only QUALITY_00
4f8db2d202c8 OrthancSeriesProgressiveLoader now has two modes that
Benjamin Golinvaux <bgo@osimis.io>
parents: 1320
diff changeset
385 unsigned int maxQuality = QUALITY_00;
4f8db2d202c8 OrthancSeriesProgressiveLoader now has two modes that
Benjamin Golinvaux <bgo@osimis.io>
parents: 1320
diff changeset
386 if (progressiveQuality_)
4f8db2d202c8 OrthancSeriesProgressiveLoader now has two modes that
Benjamin Golinvaux <bgo@osimis.io>
parents: 1320
diff changeset
387 maxQuality = QUALITY_02;
4f8db2d202c8 OrthancSeriesProgressiveLoader now has two modes that
Benjamin Golinvaux <bgo@osimis.io>
parents: 1320
diff changeset
388
1320
7702ad9b7011 OrthancSeriesVolumeProgressiveLoader : PNG quality only!
Benjamin Golinvaux <bgo@osimis.io>
parents: 1318
diff changeset
389 strategy_.reset(new OrthancStone::BasicFetchingStrategy(
7702ad9b7011 OrthancSeriesVolumeProgressiveLoader : PNG quality only!
Benjamin Golinvaux <bgo@osimis.io>
parents: 1318
diff changeset
390 sorter_->CreateSorter(static_cast<unsigned int>(slicesCount)),
1327
4f8db2d202c8 OrthancSeriesProgressiveLoader now has two modes that
Benjamin Golinvaux <bgo@osimis.io>
parents: 1320
diff changeset
391 maxQuality));
1320
7702ad9b7011 OrthancSeriesVolumeProgressiveLoader : PNG quality only!
Benjamin Golinvaux <bgo@osimis.io>
parents: 1318
diff changeset
392
814
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
393 assert(simultaneousDownloads_ != 0);
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
394 for (unsigned int i = 0; i < simultaneousDownloads_; i++)
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
395 {
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
396 ScheduleNextSliceDownload();
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
397 }
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
398 }
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
399
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
400 slicesQuality_.resize(slicesCount, 0);
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
401
1225
16738485e457 deprecating DicomStructureSetLoader, OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1156
diff changeset
402 BroadcastMessage(OrthancStone::DicomVolumeImage::GeometryReadyMessage(*volume_));
814
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
403 }
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
404
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
405
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
406 void OrthancSeriesVolumeProgressiveLoader::SetSliceContent(unsigned int sliceIndex,
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
407 const Orthanc::ImageAccessor& image,
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
408 unsigned int quality)
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
409 {
1327
4f8db2d202c8 OrthancSeriesProgressiveLoader now has two modes that
Benjamin Golinvaux <bgo@osimis.io>
parents: 1320
diff changeset
410 ORTHANC_ASSERT(sliceIndex < slicesQuality_.size() &&
814
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
411 slicesQuality_.size() == volume_->GetPixelData().GetDepth());
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
412
1327
4f8db2d202c8 OrthancSeriesProgressiveLoader now has two modes that
Benjamin Golinvaux <bgo@osimis.io>
parents: 1320
diff changeset
413 if (!progressiveQuality_)
4f8db2d202c8 OrthancSeriesProgressiveLoader now has two modes that
Benjamin Golinvaux <bgo@osimis.io>
parents: 1320
diff changeset
414 {
4f8db2d202c8 OrthancSeriesProgressiveLoader now has two modes that
Benjamin Golinvaux <bgo@osimis.io>
parents: 1320
diff changeset
415 ORTHANC_ASSERT(quality == QUALITY_00);
4f8db2d202c8 OrthancSeriesProgressiveLoader now has two modes that
Benjamin Golinvaux <bgo@osimis.io>
parents: 1320
diff changeset
416 ORTHANC_ASSERT(slicesQuality_[sliceIndex] == QUALITY_00);
4f8db2d202c8 OrthancSeriesProgressiveLoader now has two modes that
Benjamin Golinvaux <bgo@osimis.io>
parents: 1320
diff changeset
417 }
4f8db2d202c8 OrthancSeriesProgressiveLoader now has two modes that
Benjamin Golinvaux <bgo@osimis.io>
parents: 1320
diff changeset
418
814
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
419 if (quality >= slicesQuality_[sliceIndex])
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
420 {
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
421 {
1327
4f8db2d202c8 OrthancSeriesProgressiveLoader now has two modes that
Benjamin Golinvaux <bgo@osimis.io>
parents: 1320
diff changeset
422 OrthancStone::ImageBuffer3D::SliceWriter writer(volume_->GetPixelData(),
4f8db2d202c8 OrthancSeriesProgressiveLoader now has two modes that
Benjamin Golinvaux <bgo@osimis.io>
parents: 1320
diff changeset
423 OrthancStone::VolumeProjection_Axial,
4f8db2d202c8 OrthancSeriesProgressiveLoader now has two modes that
Benjamin Golinvaux <bgo@osimis.io>
parents: 1320
diff changeset
424 sliceIndex);
4f8db2d202c8 OrthancSeriesProgressiveLoader now has two modes that
Benjamin Golinvaux <bgo@osimis.io>
parents: 1320
diff changeset
425
814
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
426 Orthanc::ImageProcessing::Copy(writer.GetAccessor(), image);
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
427 }
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
428
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
429 volume_->IncrementRevision();
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
430 seriesGeometry_.IncrementSliceRevision(sliceIndex);
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
431 slicesQuality_[sliceIndex] = quality;
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
432
1225
16738485e457 deprecating DicomStructureSetLoader, OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1156
diff changeset
433 BroadcastMessage(OrthancStone::DicomVolumeImage::ContentUpdatedMessage(*volume_));
814
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
434 }
1320
7702ad9b7011 OrthancSeriesVolumeProgressiveLoader : PNG quality only!
Benjamin Golinvaux <bgo@osimis.io>
parents: 1318
diff changeset
435 LOG(TRACE) << "SetSliceContent sliceIndex = " << sliceIndex << " -- will "
7702ad9b7011 OrthancSeriesVolumeProgressiveLoader : PNG quality only!
Benjamin Golinvaux <bgo@osimis.io>
parents: 1318
diff changeset
436 << " now call ScheduleNextSliceDownload()";
814
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
437 ScheduleNextSliceDownload();
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
438 }
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
439
1327
4f8db2d202c8 OrthancSeriesProgressiveLoader now has two modes that
Benjamin Golinvaux <bgo@osimis.io>
parents: 1320
diff changeset
440 void OrthancSeriesVolumeProgressiveLoader::LoadBestQualitySliceContent(
4f8db2d202c8 OrthancSeriesProgressiveLoader now has two modes that
Benjamin Golinvaux <bgo@osimis.io>
parents: 1320
diff changeset
441 const OrthancStone::GetOrthancImageCommand::SuccessMessage& message)
814
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
442 {
1327
4f8db2d202c8 OrthancSeriesProgressiveLoader now has two modes that
Benjamin Golinvaux <bgo@osimis.io>
parents: 1320
diff changeset
443 unsigned int quality = QUALITY_00;
4f8db2d202c8 OrthancSeriesProgressiveLoader now has two modes that
Benjamin Golinvaux <bgo@osimis.io>
parents: 1320
diff changeset
444 if (progressiveQuality_)
4f8db2d202c8 OrthancSeriesProgressiveLoader now has two modes that
Benjamin Golinvaux <bgo@osimis.io>
parents: 1320
diff changeset
445 quality = QUALITY_02;
4f8db2d202c8 OrthancSeriesProgressiveLoader now has two modes that
Benjamin Golinvaux <bgo@osimis.io>
parents: 1320
diff changeset
446
4f8db2d202c8 OrthancSeriesProgressiveLoader now has two modes that
Benjamin Golinvaux <bgo@osimis.io>
parents: 1320
diff changeset
447 SetSliceContent(GetSliceIndexPayload(message.GetOrigin()),
4f8db2d202c8 OrthancSeriesProgressiveLoader now has two modes that
Benjamin Golinvaux <bgo@osimis.io>
parents: 1320
diff changeset
448 message.GetImage(),
4f8db2d202c8 OrthancSeriesProgressiveLoader now has two modes that
Benjamin Golinvaux <bgo@osimis.io>
parents: 1320
diff changeset
449 quality);
814
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
450 }
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
451
1327
4f8db2d202c8 OrthancSeriesProgressiveLoader now has two modes that
Benjamin Golinvaux <bgo@osimis.io>
parents: 1320
diff changeset
452 void OrthancSeriesVolumeProgressiveLoader::LoadJpegSliceContent(
4f8db2d202c8 OrthancSeriesProgressiveLoader now has two modes that
Benjamin Golinvaux <bgo@osimis.io>
parents: 1320
diff changeset
453 const OrthancStone::GetOrthancWebViewerJpegCommand::SuccessMessage& message)
814
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
454 {
1327
4f8db2d202c8 OrthancSeriesProgressiveLoader now has two modes that
Benjamin Golinvaux <bgo@osimis.io>
parents: 1320
diff changeset
455 ORTHANC_ASSERT(progressiveQuality_, "INTERNAL ERROR: OrthancSeriesVolumeProgressiveLoader::LoadJpegSliceContent"
4f8db2d202c8 OrthancSeriesProgressiveLoader now has two modes that
Benjamin Golinvaux <bgo@osimis.io>
parents: 1320
diff changeset
456 << " called while progressiveQuality_ is false!");
4f8db2d202c8 OrthancSeriesProgressiveLoader now has two modes that
Benjamin Golinvaux <bgo@osimis.io>
parents: 1320
diff changeset
457
1320
7702ad9b7011 OrthancSeriesVolumeProgressiveLoader : PNG quality only!
Benjamin Golinvaux <bgo@osimis.io>
parents: 1318
diff changeset
458 LOG(TRACE) << "OrthancSeriesVolumeProgressiveLoader::LoadJpegSliceContent";
814
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
459 unsigned int quality;
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
460
1225
16738485e457 deprecating DicomStructureSetLoader, OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1156
diff changeset
461 switch (dynamic_cast<const OrthancStone::GetOrthancWebViewerJpegCommand&>(message.GetOrigin()).GetQuality())
814
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
462 {
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
463 case 50:
1327
4f8db2d202c8 OrthancSeriesProgressiveLoader now has two modes that
Benjamin Golinvaux <bgo@osimis.io>
parents: 1320
diff changeset
464 quality = QUALITY_00;
814
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
465 break;
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
466
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
467 case 90:
1327
4f8db2d202c8 OrthancSeriesProgressiveLoader now has two modes that
Benjamin Golinvaux <bgo@osimis.io>
parents: 1320
diff changeset
468 quality = QUALITY_01;
814
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
469 break;
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
470
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
471 default:
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
472 throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError);
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
473 }
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
474
1135
a0a33e5ea5bb IOracleCommand::Clone()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1134
diff changeset
475 SetSliceContent(GetSliceIndexPayload(message.GetOrigin()), message.GetImage(), quality);
814
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
476 }
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
477
1310
9bea7e15b519 - first pass at changes to cope with the refactoring of the loading system
Benjamin Golinvaux <bgo@osimis.io>
parents: 1300
diff changeset
478 OrthancSeriesVolumeProgressiveLoader::OrthancSeriesVolumeProgressiveLoader(
9bea7e15b519 - first pass at changes to cope with the refactoring of the loading system
Benjamin Golinvaux <bgo@osimis.io>
parents: 1300
diff changeset
479 OrthancStone::ILoadersContext& loadersContext,
1327
4f8db2d202c8 OrthancSeriesProgressiveLoader now has two modes that
Benjamin Golinvaux <bgo@osimis.io>
parents: 1320
diff changeset
480 boost::shared_ptr<OrthancStone::DicomVolumeImage> volume,
4f8db2d202c8 OrthancSeriesProgressiveLoader now has two modes that
Benjamin Golinvaux <bgo@osimis.io>
parents: 1320
diff changeset
481 bool progressiveQuality)
1310
9bea7e15b519 - first pass at changes to cope with the refactoring of the loading system
Benjamin Golinvaux <bgo@osimis.io>
parents: 1300
diff changeset
482 : loadersContext_(loadersContext)
9bea7e15b519 - first pass at changes to cope with the refactoring of the loading system
Benjamin Golinvaux <bgo@osimis.io>
parents: 1300
diff changeset
483 , active_(false)
1327
4f8db2d202c8 OrthancSeriesProgressiveLoader now has two modes that
Benjamin Golinvaux <bgo@osimis.io>
parents: 1320
diff changeset
484 , progressiveQuality_(progressiveQuality)
1310
9bea7e15b519 - first pass at changes to cope with the refactoring of the loading system
Benjamin Golinvaux <bgo@osimis.io>
parents: 1300
diff changeset
485 , simultaneousDownloads_(4)
9bea7e15b519 - first pass at changes to cope with the refactoring of the loading system
Benjamin Golinvaux <bgo@osimis.io>
parents: 1300
diff changeset
486 , volume_(volume)
9bea7e15b519 - first pass at changes to cope with the refactoring of the loading system
Benjamin Golinvaux <bgo@osimis.io>
parents: 1300
diff changeset
487 , sorter_(new OrthancStone::BasicFetchingItemsSorter::Factory)
9bea7e15b519 - first pass at changes to cope with the refactoring of the loading system
Benjamin Golinvaux <bgo@osimis.io>
parents: 1300
diff changeset
488 , volumeImageReadyInHighQuality_(false)
814
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
489 {
1314
9b126de2cde2 Since the observer system now uses shared_ptr and many registrations are
Benjamin Golinvaux <bgo@osimis.io>
parents: 1310
diff changeset
490 }
9b126de2cde2 Since the observer system now uses shared_ptr and many registrations are
Benjamin Golinvaux <bgo@osimis.io>
parents: 1310
diff changeset
491
9b126de2cde2 Since the observer system now uses shared_ptr and many registrations are
Benjamin Golinvaux <bgo@osimis.io>
parents: 1310
diff changeset
492 boost::shared_ptr<OrthancSeriesVolumeProgressiveLoader>
9b126de2cde2 Since the observer system now uses shared_ptr and many registrations are
Benjamin Golinvaux <bgo@osimis.io>
parents: 1310
diff changeset
493 OrthancSeriesVolumeProgressiveLoader::Create(
9b126de2cde2 Since the observer system now uses shared_ptr and many registrations are
Benjamin Golinvaux <bgo@osimis.io>
parents: 1310
diff changeset
494 OrthancStone::ILoadersContext& loadersContext,
1327
4f8db2d202c8 OrthancSeriesProgressiveLoader now has two modes that
Benjamin Golinvaux <bgo@osimis.io>
parents: 1320
diff changeset
495 boost::shared_ptr<OrthancStone::DicomVolumeImage> volume,
4f8db2d202c8 OrthancSeriesProgressiveLoader now has two modes that
Benjamin Golinvaux <bgo@osimis.io>
parents: 1320
diff changeset
496 bool progressiveQuality)
1314
9b126de2cde2 Since the observer system now uses shared_ptr and many registrations are
Benjamin Golinvaux <bgo@osimis.io>
parents: 1310
diff changeset
497 {
1310
9bea7e15b519 - first pass at changes to cope with the refactoring of the loading system
Benjamin Golinvaux <bgo@osimis.io>
parents: 1300
diff changeset
498 std::auto_ptr<OrthancStone::ILoadersContext::ILock> lock(loadersContext.Lock());
9bea7e15b519 - first pass at changes to cope with the refactoring of the loading system
Benjamin Golinvaux <bgo@osimis.io>
parents: 1300
diff changeset
499
1314
9b126de2cde2 Since the observer system now uses shared_ptr and many registrations are
Benjamin Golinvaux <bgo@osimis.io>
parents: 1310
diff changeset
500 boost::shared_ptr<OrthancSeriesVolumeProgressiveLoader> obj(
1327
4f8db2d202c8 OrthancSeriesProgressiveLoader now has two modes that
Benjamin Golinvaux <bgo@osimis.io>
parents: 1320
diff changeset
501 new OrthancSeriesVolumeProgressiveLoader(
4f8db2d202c8 OrthancSeriesProgressiveLoader now has two modes that
Benjamin Golinvaux <bgo@osimis.io>
parents: 1320
diff changeset
502 loadersContext, volume, progressiveQuality));
1314
9b126de2cde2 Since the observer system now uses shared_ptr and many registrations are
Benjamin Golinvaux <bgo@osimis.io>
parents: 1310
diff changeset
503
9b126de2cde2 Since the observer system now uses shared_ptr and many registrations are
Benjamin Golinvaux <bgo@osimis.io>
parents: 1310
diff changeset
504 obj->Register<OrthancStone::OrthancRestApiCommand::SuccessMessage>(
9b126de2cde2 Since the observer system now uses shared_ptr and many registrations are
Benjamin Golinvaux <bgo@osimis.io>
parents: 1310
diff changeset
505 lock->GetOracleObservable(),
1310
9bea7e15b519 - first pass at changes to cope with the refactoring of the loading system
Benjamin Golinvaux <bgo@osimis.io>
parents: 1300
diff changeset
506 &OrthancSeriesVolumeProgressiveLoader::LoadGeometry);
1065
9d42f89b8c3c improved readability
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1064
diff changeset
507
1314
9b126de2cde2 Since the observer system now uses shared_ptr and many registrations are
Benjamin Golinvaux <bgo@osimis.io>
parents: 1310
diff changeset
508 obj->Register<OrthancStone::GetOrthancImageCommand::SuccessMessage>(
1310
9bea7e15b519 - first pass at changes to cope with the refactoring of the loading system
Benjamin Golinvaux <bgo@osimis.io>
parents: 1300
diff changeset
509 lock->GetOracleObservable(),
9bea7e15b519 - first pass at changes to cope with the refactoring of the loading system
Benjamin Golinvaux <bgo@osimis.io>
parents: 1300
diff changeset
510 &OrthancSeriesVolumeProgressiveLoader::LoadBestQualitySliceContent);
1065
9d42f89b8c3c improved readability
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1064
diff changeset
511
1314
9b126de2cde2 Since the observer system now uses shared_ptr and many registrations are
Benjamin Golinvaux <bgo@osimis.io>
parents: 1310
diff changeset
512 obj->Register<OrthancStone::GetOrthancWebViewerJpegCommand::SuccessMessage>(
1310
9bea7e15b519 - first pass at changes to cope with the refactoring of the loading system
Benjamin Golinvaux <bgo@osimis.io>
parents: 1300
diff changeset
513 lock->GetOracleObservable(),
9bea7e15b519 - first pass at changes to cope with the refactoring of the loading system
Benjamin Golinvaux <bgo@osimis.io>
parents: 1300
diff changeset
514 &OrthancSeriesVolumeProgressiveLoader::LoadJpegSliceContent);
1327
4f8db2d202c8 OrthancSeriesProgressiveLoader now has two modes that
Benjamin Golinvaux <bgo@osimis.io>
parents: 1320
diff changeset
515
1314
9b126de2cde2 Since the observer system now uses shared_ptr and many registrations are
Benjamin Golinvaux <bgo@osimis.io>
parents: 1310
diff changeset
516 return obj;
814
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
517 }
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
518
1314
9b126de2cde2 Since the observer system now uses shared_ptr and many registrations are
Benjamin Golinvaux <bgo@osimis.io>
parents: 1310
diff changeset
519
935
401808e7ff2e Added traces in LoaderCache objects dtors + fuse to prevent dead weak ptrs to be calleds in VisitWdigets (in GuiAdapter.h)
Benjamin Golinvaux <bgo@osimis.io>
parents: 933
diff changeset
520 OrthancSeriesVolumeProgressiveLoader::~OrthancSeriesVolumeProgressiveLoader()
401808e7ff2e Added traces in LoaderCache objects dtors + fuse to prevent dead weak ptrs to be calleds in VisitWdigets (in GuiAdapter.h)
Benjamin Golinvaux <bgo@osimis.io>
parents: 933
diff changeset
521 {
401808e7ff2e Added traces in LoaderCache objects dtors + fuse to prevent dead weak ptrs to be calleds in VisitWdigets (in GuiAdapter.h)
Benjamin Golinvaux <bgo@osimis.io>
parents: 933
diff changeset
522 LOG(TRACE) << "OrthancSeriesVolumeProgressiveLoader::~OrthancSeriesVolumeProgressiveLoader()";
401808e7ff2e Added traces in LoaderCache objects dtors + fuse to prevent dead weak ptrs to be calleds in VisitWdigets (in GuiAdapter.h)
Benjamin Golinvaux <bgo@osimis.io>
parents: 933
diff changeset
523 }
814
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
524
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
525 void OrthancSeriesVolumeProgressiveLoader::SetSimultaneousDownloads(unsigned int count)
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
526 {
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
527 if (active_)
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
528 {
956
a7351ad54960 Made IsContextLost automatically set the flag by checking with the emscripten
Benjamin Golinvaux <bgo@osimis.io>
parents: 949
diff changeset
529 LOG(ERROR) << "OrthancSeriesVolumeProgressiveLoader::SetSimultaneousDownloads(): (active_)";
814
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
530 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadSequenceOfCalls);
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
531 }
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
532 else if (count == 0)
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
533 {
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
534 throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange);
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
535 }
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
536 else
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
537 {
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
538 simultaneousDownloads_ = count;
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
539 }
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
540 }
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
541
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
542
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
543 void OrthancSeriesVolumeProgressiveLoader::LoadSeries(const std::string& seriesId)
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
544 {
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
545 if (active_)
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
546 {
956
a7351ad54960 Made IsContextLost automatically set the flag by checking with the emscripten
Benjamin Golinvaux <bgo@osimis.io>
parents: 949
diff changeset
547 LOG(ERROR) << "OrthancSeriesVolumeProgressiveLoader::LoadSeries(const std::string& seriesId): (active_)";
814
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
548 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadSequenceOfCalls);
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
549 }
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
550 else
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
551 {
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
552 active_ = true;
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
553
1299
c38c89684d83 replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1279
diff changeset
554 std::unique_ptr<OrthancStone::OrthancRestApiCommand> command(new OrthancStone::OrthancRestApiCommand);
814
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
555 command->SetUri("/series/" + seriesId + "/instances-tags");
1310
9bea7e15b519 - first pass at changes to cope with the refactoring of the loading system
Benjamin Golinvaux <bgo@osimis.io>
parents: 1300
diff changeset
556 {
9bea7e15b519 - first pass at changes to cope with the refactoring of the loading system
Benjamin Golinvaux <bgo@osimis.io>
parents: 1300
diff changeset
557 std::unique_ptr<OrthancStone::ILoadersContext::ILock> lock(loadersContext_.Lock());
9bea7e15b519 - first pass at changes to cope with the refactoring of the loading system
Benjamin Golinvaux <bgo@osimis.io>
parents: 1300
diff changeset
558 boost::shared_ptr<IObserver> observer(GetSharedObserver());
9bea7e15b519 - first pass at changes to cope with the refactoring of the loading system
Benjamin Golinvaux <bgo@osimis.io>
parents: 1300
diff changeset
559 lock->Schedule(observer, 0, command.release()); //TODO: priority!
9bea7e15b519 - first pass at changes to cope with the refactoring of the loading system
Benjamin Golinvaux <bgo@osimis.io>
parents: 1300
diff changeset
560 }
814
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
561 }
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
562 }
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
563
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
564
1225
16738485e457 deprecating DicomStructureSetLoader, OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1156
diff changeset
565 OrthancStone::IVolumeSlicer::IExtractedSlice*
16738485e457 deprecating DicomStructureSetLoader, OrthancMultiframeVolumeLoader and OrthancSeriesVolumeProgressiveLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1156
diff changeset
566 OrthancSeriesVolumeProgressiveLoader::ExtractSlice(const OrthancStone::CoordinateSystem3D& cuttingPlane)
814
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
567 {
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
568 if (volume_->HasGeometry())
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
569 {
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
570 return new ExtractedSlice(*this, cuttingPlane);
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
571 }
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
572 else
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
573 {
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
574 return new IVolumeSlicer::InvalidSlice;
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
575 }
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
576 }
aead999345e0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
577 }