comparison Framework/Toolbox/OrthancSlicesLoader.h @ 318:3a4ca166fafa am-2

ImageAccessor refactoring + implemented Image Cache in SmartLoader
author am@osimis.io
date Mon, 08 Oct 2018 17:10:08 +0200
parents b4abaeb783b1
children 814fa32e2fcc
comparison
equal deleted inserted replaced
317:b66d13708f40 318:3a4ca166fafa
11 * 11 *
12 * This program is distributed in the hope that it will be useful, but 12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of 13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Affero General Public License for more details. 15 * Affero General Public License for more details.
16 * 16 *
17 * You should have received a copy of the GNU Affero General Public License 17 * You should have received a copy of the GNU Affero General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>. 18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 **/ 19 **/
20 20
21 21
25 #include "SlicesSorter.h" 25 #include "SlicesSorter.h"
26 #include "../StoneEnumerations.h" 26 #include "../StoneEnumerations.h"
27 #include "../Messages/IObservable.h" 27 #include "../Messages/IObservable.h"
28 #include <boost/shared_ptr.hpp> 28 #include <boost/shared_ptr.hpp>
29 #include "OrthancApiClient.h" 29 #include "OrthancApiClient.h"
30 #include "Core/Images/Image.h"
31
30 32
31 namespace OrthancStone 33 namespace OrthancStone
32 { 34 {
33 class OrthancSlicesLoader : public IObservable, public IObserver 35 class OrthancSlicesLoader : public IObservable, public IObserver
34 { 36 {
39 41
40 struct SliceImageReadyMessage : public BaseMessage<MessageType_SliceLoader_ImageReady> 42 struct SliceImageReadyMessage : public BaseMessage<MessageType_SliceLoader_ImageReady>
41 { 43 {
42 unsigned int sliceIndex_; 44 unsigned int sliceIndex_;
43 const Slice& slice_; 45 const Slice& slice_;
44 std::auto_ptr<Orthanc::ImageAccessor>& image_; 46 boost::shared_ptr<Orthanc::ImageAccessor> image_;
45 SliceImageQuality effectiveQuality_; 47 SliceImageQuality effectiveQuality_;
46 48
47 SliceImageReadyMessage(unsigned int sliceIndex, 49 SliceImageReadyMessage(unsigned int sliceIndex,
48 const Slice& slice, 50 const Slice& slice,
49 std::auto_ptr<Orthanc::ImageAccessor>& image, 51 boost::shared_ptr<Orthanc::ImageAccessor> image,
50 SliceImageQuality effectiveQuality) 52 SliceImageQuality effectiveQuality)
51 : BaseMessage(), 53 : BaseMessage(),
52 sliceIndex_(sliceIndex), 54 sliceIndex_(sliceIndex),
53 slice_(slice), 55 slice_(slice),
54 image_(image), 56 image_(image),
55 effectiveQuality_(effectiveQuality) 57 effectiveQuality_(effectiveQuality)
62 const Slice& slice_; 64 const Slice& slice_;
63 unsigned int sliceIndex_; 65 unsigned int sliceIndex_;
64 SliceImageQuality effectiveQuality_; 66 SliceImageQuality effectiveQuality_;
65 67
66 SliceImageErrorMessage(unsigned int sliceIndex, 68 SliceImageErrorMessage(unsigned int sliceIndex,
67 const Slice& slice, 69 const Slice& slice,
68 SliceImageQuality effectiveQuality) 70 SliceImageQuality effectiveQuality)
69 : BaseMessage(), 71 : BaseMessage(),
70 slice_(slice), 72 slice_(slice),
71 sliceIndex_(sliceIndex), 73 sliceIndex_(sliceIndex),
72 effectiveQuality_(effectiveQuality) 74 effectiveQuality_(effectiveQuality)
73 { 75 {
98 OrthancApiClient& orthanc_; 100 OrthancApiClient& orthanc_;
99 State state_; 101 State state_;
100 SlicesSorter slices_; 102 SlicesSorter slices_;
101 103
102 void NotifySliceImageSuccess(const Operation& operation, 104 void NotifySliceImageSuccess(const Operation& operation,
103 std::auto_ptr<Orthanc::ImageAccessor>& image); 105 boost::shared_ptr<Orthanc::ImageAccessor> image);
104 106
105 void NotifySliceImageError(const Operation& operation); 107 void NotifySliceImageError(const Operation& operation);
106 108
107 void OnGeometryError(const OrthancApiClient::HttpErrorMessage& message); 109 void OnGeometryError(const OrthancApiClient::HttpErrorMessage& message);
108 void OnSliceImageError(const OrthancApiClient::HttpErrorMessage& message); 110 void OnSliceImageError(const OrthancApiClient::HttpErrorMessage& message);
109 111