comparison Framework/Algorithms/PyramidReader.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 "../DicomizerParameters.h"
25
26 #include <map>
27 #include <memory>
28
29 namespace OrthancWSI
30 {
31 // This class is not thread-safe
32 class PyramidReader : public boost::noncopyable
33 {
34 private:
35 class SourceTile;
36
37 typedef std::pair<unsigned int, unsigned int> Location;
38 typedef std::map<Location, SourceTile*> Cache;
39
40 ITiledPyramid& source_;
41 unsigned int level_;
42 unsigned int levelWidth_;
43 unsigned int levelHeight_;
44 unsigned int sourceTileWidth_;
45 unsigned int sourceTileHeight_;
46 unsigned int targetTileWidth_;
47 unsigned int targetTileHeight_;
48 const DicomizerParameters& parameters_;
49
50 Cache cache_;
51
52 std::auto_ptr<Orthanc::ImageAccessor> outside_;
53
54
55 Orthanc::ImageAccessor& GetOutsideTile();
56
57 void CheckTileSize(const Orthanc::ImageAccessor& tile) const;
58
59 void CheckTileSize(const std::string& tile) const;
60
61 SourceTile& AccessSourceTile(const Location& location);
62
63 Location MapTargetToSourceLocation(unsigned int tileX,
64 unsigned int tileY);
65
66 public:
67 PyramidReader(ITiledPyramid& source,
68 unsigned int level,
69 unsigned int targetTileWidth,
70 unsigned int targetTileHeight,
71 const DicomizerParameters& parameters);
72
73 ~PyramidReader();
74
75 const DicomizerParameters& GetParameters() const
76 {
77 return parameters_;
78 }
79
80 ImageCompression GetImageCompression() const
81 {
82 return source_.GetImageCompression();
83 }
84
85 Orthanc::PixelFormat GetPixelFormat() const
86 {
87 return source_.GetPixelFormat();
88 }
89
90 const std::string* GetRawTile(unsigned int tileX,
91 unsigned int tileY);
92
93 Orthanc::ImageAccessor GetDecodedTile(unsigned int tileX,
94 unsigned int tileY);
95 };
96 }