Mercurial > hg > orthanc-wsi
comparison Framework/Outputs/InMemoryTiledImage.h @ 0:4a7a53257c7d
initial commit
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Sat, 22 Oct 2016 21:48:33 +0200 |
parents | |
children | 91fc9583b2de |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:4a7a53257c7d |
---|---|
1 /** | |
2 * Orthanc - A Lightweight, RESTful DICOM Store | |
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics | |
4 * Department, University Hospital of Liege, Belgium | |
5 * | |
6 * This program is free software: you can redistribute it and/or | |
7 * modify it under the terms of the GNU Affero General Public License | |
8 * as published by the Free Software Foundation, either version 3 of | |
9 * the License, or (at your option) any later version. | |
10 * | |
11 * This program is distributed in the hope that it will be useful, but | |
12 * WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
14 * Affero General Public License for more details. | |
15 * | |
16 * You should have received a copy of the GNU Affero General Public License | |
17 * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
18 **/ | |
19 | |
20 | |
21 #pragma once | |
22 | |
23 #include "../Inputs/ITiledPyramid.h" | |
24 #include "../Outputs/IPyramidWriter.h" | |
25 | |
26 #include <map> | |
27 #include <boost/thread.hpp> | |
28 | |
29 namespace OrthancWSI | |
30 { | |
31 class InMemoryTiledImage : | |
32 public ITiledPyramid, | |
33 public IPyramidWriter | |
34 { | |
35 private: | |
36 typedef std::pair<unsigned int, unsigned int> Location; | |
37 typedef std::map<Location, Orthanc::ImageAccessor*> Tiles; | |
38 | |
39 boost::mutex mutex_; | |
40 Orthanc::PixelFormat format_; | |
41 unsigned int countTilesX_; | |
42 unsigned int countTilesY_; | |
43 unsigned int tileWidth_; | |
44 unsigned int tileHeight_; | |
45 Tiles tiles_; | |
46 | |
47 public: | |
48 InMemoryTiledImage(Orthanc::PixelFormat format, | |
49 unsigned int countTilesX, | |
50 unsigned int countTilesY, | |
51 unsigned int tileWidth, | |
52 unsigned int tileHeight); | |
53 | |
54 virtual ~InMemoryTiledImage(); | |
55 | |
56 virtual unsigned int GetLevelCount() const | |
57 { | |
58 return 1; | |
59 } | |
60 | |
61 virtual unsigned int GetCountTilesX(unsigned int level) const; | |
62 | |
63 virtual unsigned int GetCountTilesY(unsigned int level) const; | |
64 | |
65 virtual unsigned int GetLevelWidth(unsigned int level) const; | |
66 | |
67 virtual unsigned int GetLevelHeight(unsigned int level) const; | |
68 | |
69 virtual unsigned int GetTileWidth() const | |
70 { | |
71 return tileWidth_; | |
72 } | |
73 | |
74 virtual unsigned int GetTileHeight() const | |
75 { | |
76 return tileHeight_; | |
77 } | |
78 | |
79 virtual bool ReadRawTile(std::string& tile, | |
80 unsigned int level, | |
81 unsigned int tileX, | |
82 unsigned int tileY); | |
83 | |
84 virtual Orthanc::ImageAccessor* DecodeTile(unsigned int level, | |
85 unsigned int tileX, | |
86 unsigned int tileY); | |
87 | |
88 virtual ImageCompression GetImageCompression() const | |
89 { | |
90 return ImageCompression_None; | |
91 } | |
92 | |
93 virtual Orthanc::PixelFormat GetPixelFormat() const | |
94 { | |
95 return format_; | |
96 } | |
97 | |
98 virtual void WriteRawTile(const std::string& raw, | |
99 ImageCompression compression, | |
100 unsigned int level, | |
101 unsigned int tileX, | |
102 unsigned int tileY); | |
103 | |
104 virtual void EncodeTile(const Orthanc::ImageAccessor& tile, | |
105 unsigned int level, | |
106 unsigned int tileX, | |
107 unsigned int tileY); | |
108 }; | |
109 } |