Mercurial > hg > orthanc-stone
annotate OrthancStone/Sources/Toolbox/ParsedDicomCache.h @ 1903:c7bc9e1776a6
fix rendering of RT sample
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 31 Jan 2022 18:00:10 +0100 |
parents | 7053b8a0aaec |
children | 07964689cb0b |
rev | line source |
---|---|
1116 | 1 /** |
2 * Stone of Orthanc | |
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics | |
4 * Department, University Hospital of Liege, Belgium | |
1871
7053b8a0aaec
upgrade to year 2022
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1870
diff
changeset
|
5 * Copyright (C) 2017-2022 Osimis S.A., Belgium |
7053b8a0aaec
upgrade to year 2022
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1870
diff
changeset
|
6 * Copyright (C) 2021-2022 Sebastien Jodogne, ICTEAM UCLouvain, Belgium |
1116 | 7 * |
8 * 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
|
9 * modify it under the terms of the GNU Lesser General Public License |
1116 | 10 * as published by the Free Software Foundation, either version 3 of |
11 * the License, or (at your option) any later version. | |
12 * | |
13 * This program is distributed in the hope that it will be useful, but | |
14 * 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
|
15 * 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
|
16 * Lesser General Public License for more details. |
1596
4fb8fdf03314
removed annoying whitespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1571
diff
changeset
|
17 * |
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
|
18 * 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
|
19 * 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
|
20 * <http://www.gnu.org/licenses/>. |
1116 | 21 **/ |
22 | |
23 | |
24 #pragma once | |
25 | |
1455
30deba7bc8e2
simplifying include_directories
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1271
diff
changeset
|
26 #include <Cache/MemoryObjectCache.h> |
30deba7bc8e2
simplifying include_directories
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1271
diff
changeset
|
27 #include <DicomParsing/ParsedDicomFile.h> |
1116 | 28 |
29 namespace OrthancStone | |
30 { | |
1149
2da8b4d6f8c1
renamed ParsedDicomFileCache as ParsedDicomCache
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1140
diff
changeset
|
31 class ParsedDicomCache : public boost::noncopyable |
1116 | 32 { |
33 private: | |
34 class Item; | |
1151
48befc2bf66d
ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1149
diff
changeset
|
35 |
48befc2bf66d
ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1149
diff
changeset
|
36 static std::string GetIndex(unsigned int bucket, |
48befc2bf66d
ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1149
diff
changeset
|
37 const std::string& bucketKey); |
1116 | 38 |
39 Orthanc::MemoryObjectCache cache_; | |
1714
a878e807cd96
configuration option "DicomCacheSize", warning if cache should be larger
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1598
diff
changeset
|
40 size_t lowCacheSizeWarning_; |
1116 | 41 |
42 public: | |
1714
a878e807cd96
configuration option "DicomCacheSize", warning if cache should be larger
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1598
diff
changeset
|
43 explicit ParsedDicomCache(size_t size) : |
a878e807cd96
configuration option "DicomCacheSize", warning if cache should be larger
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1598
diff
changeset
|
44 lowCacheSizeWarning_(0) |
1116 | 45 { |
46 cache_.SetMaximumSize(size); | |
47 } | |
1140 | 48 |
1151
48befc2bf66d
ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1149
diff
changeset
|
49 void Invalidate(unsigned int bucket, |
48befc2bf66d
ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1149
diff
changeset
|
50 const std::string& bucketKey) |
1140 | 51 { |
1151
48befc2bf66d
ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1149
diff
changeset
|
52 cache_.Invalidate(GetIndex(bucket, bucketKey)); |
1140 | 53 } |
1116 | 54 |
1151
48befc2bf66d
ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1149
diff
changeset
|
55 void Acquire(unsigned int bucket, |
48befc2bf66d
ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1149
diff
changeset
|
56 const std::string& bucketKey, |
1136
42581a6182c8
reactivation of the cache of parsed DICOM files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1124
diff
changeset
|
57 Orthanc::ParsedDicomFile* dicom, |
1124
a8bf81756839
unsuccessful attempt to cache ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1116
diff
changeset
|
58 size_t fileSize, |
a8bf81756839
unsuccessful attempt to cache ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1116
diff
changeset
|
59 bool hasPixelData); |
1116 | 60 |
61 class Reader : public boost::noncopyable | |
62 { | |
63 private: | |
1140 | 64 Orthanc::MemoryObjectCache::Accessor accessor_; |
65 Item* item_; | |
1116 | 66 |
67 public: | |
1149
2da8b4d6f8c1
renamed ParsedDicomFileCache as ParsedDicomCache
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1140
diff
changeset
|
68 Reader(ParsedDicomCache& cache, |
1151
48befc2bf66d
ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1149
diff
changeset
|
69 unsigned int bucket, |
48befc2bf66d
ParseDicomFromWadoCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1149
diff
changeset
|
70 const std::string& bucketKey); |
1116 | 71 |
72 bool IsValid() const | |
73 { | |
1124
a8bf81756839
unsuccessful attempt to cache ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1116
diff
changeset
|
74 return item_ != NULL; |
1116 | 75 } |
76 | |
1124
a8bf81756839
unsuccessful attempt to cache ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1116
diff
changeset
|
77 bool HasPixelData() const; |
a8bf81756839
unsuccessful attempt to cache ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1116
diff
changeset
|
78 |
1136
42581a6182c8
reactivation of the cache of parsed DICOM files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1124
diff
changeset
|
79 Orthanc::ParsedDicomFile& GetDicom() const; |
1124
a8bf81756839
unsuccessful attempt to cache ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1116
diff
changeset
|
80 |
a8bf81756839
unsuccessful attempt to cache ParseDicomFileCommand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1116
diff
changeset
|
81 size_t GetFileSize() const; |
1116 | 82 }; |
83 }; | |
84 } |