annotate OrthancStone/Sources/Toolbox/ParsedDicomCache.cpp @ 1772:6c246f862b00

unit test VolumeRendering.Basic
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 12 May 2021 17:24:24 +0200
parents 9ac2a65d4172
children 3889ae96d2e9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1116
a08699daf78b ParsedDicomFileCache
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 /**
a08699daf78b ParsedDicomFileCache
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2 * Stone of Orthanc
a08699daf78b ParsedDicomFileCache
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
a08699daf78b ParsedDicomFileCache
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4 * Department, University Hospital of Liege, Belgium
1739
9ac2a65d4172 upgrade to year 2021
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1714
diff changeset
5 * Copyright (C) 2017-2021 Osimis S.A., Belgium
1116
a08699daf78b ParsedDicomFileCache
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6 *
a08699daf78b ParsedDicomFileCache
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7 * This program is free software: you can redistribute it and/or
1598
8563ea5d8ae4 relicensing some files, cf. osimis bm26 and chu agreement on 2020-05-20
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
8 * modify it under the terms of the GNU Lesser General Public License
1116
a08699daf78b ParsedDicomFileCache
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9 * as published by the Free Software Foundation, either version 3 of
a08699daf78b ParsedDicomFileCache
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
10 * the License, or (at your option) any later version.
a08699daf78b ParsedDicomFileCache
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
11 *
a08699daf78b ParsedDicomFileCache
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12 * This program is distributed in the hope that it will be useful, but
a08699daf78b ParsedDicomFileCache
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
1598
8563ea5d8ae4 relicensing some files, cf. osimis bm26 and chu agreement on 2020-05-20
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
8563ea5d8ae4 relicensing some files, cf. osimis bm26 and chu agreement on 2020-05-20
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
15 * Lesser General Public License for more details.
1596
4fb8fdf03314 removed annoying whitespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1571
diff changeset
16 *
1598
8563ea5d8ae4 relicensing some files, cf. osimis bm26 and chu agreement on 2020-05-20
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
17 * You should have received a copy of the GNU Lesser General Public
8563ea5d8ae4 relicensing some files, cf. osimis bm26 and chu agreement on 2020-05-20
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
18 * License along with this program. If not, see
8563ea5d8ae4 relicensing some files, cf. osimis bm26 and chu agreement on 2020-05-20
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
19 * <http://www.gnu.org/licenses/>.
1116
a08699daf78b ParsedDicomFileCache
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
20 **/
a08699daf78b ParsedDicomFileCache
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
21
a08699daf78b ParsedDicomFileCache
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
22
1149
2da8b4d6f8c1 renamed ParsedDicomFileCache as ParsedDicomCache
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1140
diff changeset
23 #include "ParsedDicomCache.h"
1116
a08699daf78b ParsedDicomFileCache
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
24
1624
59f95b9ea858 fix build
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1598
diff changeset
25 #include <Logging.h>
59f95b9ea858 fix build
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1598
diff changeset
26
59f95b9ea858 fix build
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1598
diff changeset
27 #include <cassert>
59f95b9ea858 fix build
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1598
diff changeset
28
59f95b9ea858 fix build
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1598
diff changeset
29
1116
a08699daf78b ParsedDicomFileCache
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
30 namespace OrthancStone
a08699daf78b ParsedDicomFileCache
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
31 {
1149
2da8b4d6f8c1 renamed ParsedDicomFileCache as ParsedDicomCache
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1140
diff changeset
32 class ParsedDicomCache::Item : public Orthanc::ICacheable
1116
a08699daf78b ParsedDicomFileCache
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
33 {
a08699daf78b ParsedDicomFileCache
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
34 private:
1299
c38c89684d83 replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1271
diff changeset
35 std::unique_ptr<Orthanc::ParsedDicomFile> dicom_;
1571
85e117739eca cppcheck
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1512
diff changeset
36 size_t fileSize_;
85e117739eca cppcheck
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1512
diff changeset
37 bool hasPixelData_;
1124
a8bf81756839 unsuccessful attempt to cache ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1116
diff changeset
38
1116
a08699daf78b ParsedDicomFileCache
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
39 public:
1136
42581a6182c8 reactivation of the cache of parsed DICOM files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1124
diff changeset
40 Item(Orthanc::ParsedDicomFile* dicom,
1124
a8bf81756839 unsuccessful attempt to cache ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1116
diff changeset
41 size_t fileSize,
a8bf81756839 unsuccessful attempt to cache ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1116
diff changeset
42 bool hasPixelData) :
1116
a08699daf78b ParsedDicomFileCache
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
43 dicom_(dicom),
1124
a8bf81756839 unsuccessful attempt to cache ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1116
diff changeset
44 fileSize_(fileSize),
a8bf81756839 unsuccessful attempt to cache ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1116
diff changeset
45 hasPixelData_(hasPixelData)
1116
a08699daf78b ParsedDicomFileCache
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
46 {
a08699daf78b ParsedDicomFileCache
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
47 if (dicom == NULL)
a08699daf78b ParsedDicomFileCache
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
48 {
a08699daf78b ParsedDicomFileCache
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
49 throw Orthanc::OrthancException(Orthanc::ErrorCode_NullPointer);
a08699daf78b ParsedDicomFileCache
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
50 }
1124
a8bf81756839 unsuccessful attempt to cache ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1116
diff changeset
51 }
1116
a08699daf78b ParsedDicomFileCache
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
52
1571
85e117739eca cppcheck
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1512
diff changeset
53 virtual size_t GetMemoryUsage() const ORTHANC_OVERRIDE
1116
a08699daf78b ParsedDicomFileCache
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
54 {
a08699daf78b ParsedDicomFileCache
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
55 return fileSize_;
a08699daf78b ParsedDicomFileCache
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
56 }
a08699daf78b ParsedDicomFileCache
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
57
1136
42581a6182c8 reactivation of the cache of parsed DICOM files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1124
diff changeset
58 Orthanc::ParsedDicomFile& GetDicom() const
1116
a08699daf78b ParsedDicomFileCache
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
59 {
a08699daf78b ParsedDicomFileCache
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
60 assert(dicom_.get() != NULL);
1136
42581a6182c8 reactivation of the cache of parsed DICOM files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1124
diff changeset
61 return *dicom_;
1124
a8bf81756839 unsuccessful attempt to cache ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1116
diff changeset
62 }
a8bf81756839 unsuccessful attempt to cache ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1116
diff changeset
63
a8bf81756839 unsuccessful attempt to cache ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1116
diff changeset
64 bool HasPixelData() const
a8bf81756839 unsuccessful attempt to cache ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1116
diff changeset
65 {
a8bf81756839 unsuccessful attempt to cache ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1116
diff changeset
66 return hasPixelData_;
1116
a08699daf78b ParsedDicomFileCache
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
67 }
a08699daf78b ParsedDicomFileCache
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
68 };
a08699daf78b ParsedDicomFileCache
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
69
a08699daf78b ParsedDicomFileCache
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
70
1151
48befc2bf66d ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1149
diff changeset
71 std::string ParsedDicomCache::GetIndex(unsigned int bucket,
48befc2bf66d ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1149
diff changeset
72 const std::string& bucketKey)
48befc2bf66d ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1149
diff changeset
73 {
48befc2bf66d ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1149
diff changeset
74 return boost::lexical_cast<std::string>(bucket) + "|" + bucketKey;
48befc2bf66d ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1149
diff changeset
75 }
48befc2bf66d ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1149
diff changeset
76
48befc2bf66d ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1149
diff changeset
77
48befc2bf66d ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1149
diff changeset
78 void ParsedDicomCache::Acquire(unsigned int bucket,
48befc2bf66d ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1149
diff changeset
79 const std::string& bucketKey,
1149
2da8b4d6f8c1 renamed ParsedDicomFileCache as ParsedDicomCache
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1140
diff changeset
80 Orthanc::ParsedDicomFile* dicom,
2da8b4d6f8c1 renamed ParsedDicomFileCache as ParsedDicomCache
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1140
diff changeset
81 size_t fileSize,
2da8b4d6f8c1 renamed ParsedDicomFileCache as ParsedDicomCache
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1140
diff changeset
82 bool hasPixelData)
1116
a08699daf78b ParsedDicomFileCache
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
83 {
1151
48befc2bf66d ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1149
diff changeset
84 LOG(TRACE) << "new item stored in cache: bucket " << bucket << ", key " << bucketKey;
1714
a878e807cd96 configuration option "DicomCacheSize", warning if cache should be larger
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1624
diff changeset
85
a878e807cd96 configuration option "DicomCacheSize", warning if cache should be larger
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1624
diff changeset
86 if (lowCacheSizeWarning_ < fileSize &&
a878e807cd96 configuration option "DicomCacheSize", warning if cache should be larger
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1624
diff changeset
87 cache_.GetMaximumSize() > 0 &&
a878e807cd96 configuration option "DicomCacheSize", warning if cache should be larger
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1624
diff changeset
88 fileSize >= cache_.GetMaximumSize())
a878e807cd96 configuration option "DicomCacheSize", warning if cache should be larger
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1624
diff changeset
89 {
a878e807cd96 configuration option "DicomCacheSize", warning if cache should be larger
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1624
diff changeset
90 lowCacheSizeWarning_ = fileSize;
a878e807cd96 configuration option "DicomCacheSize", warning if cache should be larger
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1624
diff changeset
91 LOG(WARNING) << "The DICOM cache size should be larger: Storing a DICOM instance of "
a878e807cd96 configuration option "DicomCacheSize", warning if cache should be larger
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1624
diff changeset
92 << (fileSize / (1024 * 1024)) << "MB, whereas the cache size is only "
a878e807cd96 configuration option "DicomCacheSize", warning if cache should be larger
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1624
diff changeset
93 << (cache_.GetMaximumSize() / (1024 * 1024)) << "MB wide";
a878e807cd96 configuration option "DicomCacheSize", warning if cache should be larger
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1624
diff changeset
94 }
a878e807cd96 configuration option "DicomCacheSize", warning if cache should be larger
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1624
diff changeset
95
1151
48befc2bf66d ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1149
diff changeset
96 cache_.Acquire(GetIndex(bucket, bucketKey), new Item(dicom, fileSize, hasPixelData));
1116
a08699daf78b ParsedDicomFileCache
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
97 }
a08699daf78b ParsedDicomFileCache
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
98
a08699daf78b ParsedDicomFileCache
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
99
1149
2da8b4d6f8c1 renamed ParsedDicomFileCache as ParsedDicomCache
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1140
diff changeset
100 ParsedDicomCache::Reader::Reader(ParsedDicomCache& cache,
1151
48befc2bf66d ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1149
diff changeset
101 unsigned int bucket,
48befc2bf66d ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1149
diff changeset
102 const std::string& bucketKey) :
1140
6333e6f7248e fix cache
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1136
diff changeset
103 /**
6333e6f7248e fix cache
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1136
diff changeset
104 * The "DcmFileFormat" object cannot be accessed from multiple
6333e6f7248e fix cache
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1136
diff changeset
105 * threads, even if using only getters. An unique lock (mutex) is
6333e6f7248e fix cache
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1136
diff changeset
106 * mandatory.
6333e6f7248e fix cache
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1136
diff changeset
107 **/
1151
48befc2bf66d ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1149
diff changeset
108 accessor_(cache.cache_, GetIndex(bucket, bucketKey), true /* unique */)
1124
a8bf81756839 unsuccessful attempt to cache ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1116
diff changeset
109 {
1140
6333e6f7248e fix cache
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1136
diff changeset
110 if (accessor_.IsValid())
1124
a8bf81756839 unsuccessful attempt to cache ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1116
diff changeset
111 {
1151
48befc2bf66d ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1149
diff changeset
112 LOG(TRACE) << "accessing item within cache: bucket " << bucket << ", key " << bucketKey;
1140
6333e6f7248e fix cache
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1136
diff changeset
113 item_ = &dynamic_cast<Item&>(accessor_.GetValue());
1124
a8bf81756839 unsuccessful attempt to cache ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1116
diff changeset
114 }
a8bf81756839 unsuccessful attempt to cache ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1116
diff changeset
115 else
a8bf81756839 unsuccessful attempt to cache ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1116
diff changeset
116 {
1151
48befc2bf66d ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1149
diff changeset
117 LOG(TRACE) << "missing item within cache: bucket " << bucket << ", key " << bucketKey;
1124
a8bf81756839 unsuccessful attempt to cache ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1116
diff changeset
118 item_ = NULL;
a8bf81756839 unsuccessful attempt to cache ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1116
diff changeset
119 }
a8bf81756839 unsuccessful attempt to cache ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1116
diff changeset
120 }
a8bf81756839 unsuccessful attempt to cache ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1116
diff changeset
121
a8bf81756839 unsuccessful attempt to cache ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1116
diff changeset
122
1149
2da8b4d6f8c1 renamed ParsedDicomFileCache as ParsedDicomCache
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1140
diff changeset
123 bool ParsedDicomCache::Reader::HasPixelData() const
1116
a08699daf78b ParsedDicomFileCache
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
124 {
1124
a8bf81756839 unsuccessful attempt to cache ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1116
diff changeset
125 if (item_ == NULL)
a8bf81756839 unsuccessful attempt to cache ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1116
diff changeset
126 {
a8bf81756839 unsuccessful attempt to cache ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1116
diff changeset
127 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadSequenceOfCalls);
a8bf81756839 unsuccessful attempt to cache ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1116
diff changeset
128 }
a8bf81756839 unsuccessful attempt to cache ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1116
diff changeset
129 else
a8bf81756839 unsuccessful attempt to cache ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1116
diff changeset
130 {
a8bf81756839 unsuccessful attempt to cache ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1116
diff changeset
131 return item_->HasPixelData();
a8bf81756839 unsuccessful attempt to cache ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1116
diff changeset
132 }
a8bf81756839 unsuccessful attempt to cache ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1116
diff changeset
133 }
a8bf81756839 unsuccessful attempt to cache ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1116
diff changeset
134
a8bf81756839 unsuccessful attempt to cache ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1116
diff changeset
135
1149
2da8b4d6f8c1 renamed ParsedDicomFileCache as ParsedDicomCache
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1140
diff changeset
136 Orthanc::ParsedDicomFile& ParsedDicomCache::Reader::GetDicom() const
1124
a8bf81756839 unsuccessful attempt to cache ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1116
diff changeset
137 {
a8bf81756839 unsuccessful attempt to cache ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1116
diff changeset
138 if (item_ == NULL)
a8bf81756839 unsuccessful attempt to cache ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1116
diff changeset
139 {
a8bf81756839 unsuccessful attempt to cache ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1116
diff changeset
140 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadSequenceOfCalls);
a8bf81756839 unsuccessful attempt to cache ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1116
diff changeset
141 }
a8bf81756839 unsuccessful attempt to cache ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1116
diff changeset
142 else
a8bf81756839 unsuccessful attempt to cache ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1116
diff changeset
143 {
a8bf81756839 unsuccessful attempt to cache ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1116
diff changeset
144 return item_->GetDicom();
a8bf81756839 unsuccessful attempt to cache ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1116
diff changeset
145 }
a8bf81756839 unsuccessful attempt to cache ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1116
diff changeset
146 }
a8bf81756839 unsuccessful attempt to cache ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1116
diff changeset
147
a8bf81756839 unsuccessful attempt to cache ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1116
diff changeset
148
1149
2da8b4d6f8c1 renamed ParsedDicomFileCache as ParsedDicomCache
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1140
diff changeset
149 size_t ParsedDicomCache::Reader::GetFileSize() const
1124
a8bf81756839 unsuccessful attempt to cache ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1116
diff changeset
150 {
a8bf81756839 unsuccessful attempt to cache ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1116
diff changeset
151 if (item_ == NULL)
a8bf81756839 unsuccessful attempt to cache ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1116
diff changeset
152 {
a8bf81756839 unsuccessful attempt to cache ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1116
diff changeset
153 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadSequenceOfCalls);
a8bf81756839 unsuccessful attempt to cache ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1116
diff changeset
154 }
a8bf81756839 unsuccessful attempt to cache ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1116
diff changeset
155 else
a8bf81756839 unsuccessful attempt to cache ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1116
diff changeset
156 {
a8bf81756839 unsuccessful attempt to cache ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1116
diff changeset
157 return item_->GetMemoryUsage();
a8bf81756839 unsuccessful attempt to cache ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1116
diff changeset
158 }
1116
a08699daf78b ParsedDicomFileCache
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
159 }
a08699daf78b ParsedDicomFileCache
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
160 }