comparison Framework/Outputs/HierarchicalTiffWriter.h @ 0:4a7a53257c7d

initial commit
author Sebastien Jodogne <s.jodogne@gmail.com>
date Sat, 22 Oct 2016 21:48:33 +0200
parents
children ff0ef01c332c
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 "PyramidWriterBase.h"
24
25 #include <tiff.h>
26 #include <tiffio.h>
27 #include <deque>
28 #include <vector>
29 #include <boost/thread.hpp>
30
31 namespace OrthancWSI
32 {
33 class HierarchicalTiffWriter : public PyramidWriterBase
34 {
35 private:
36 class PendingTile;
37 struct Comparator;
38
39 TIFF* tiff_;
40
41 boost::mutex mutex_;
42 std::deque<PendingTile*> pending_;
43 std::vector<Level> levels_;
44 unsigned int currentLevel_;
45 unsigned int nextX_;
46 unsigned int nextY_;
47 bool isFirst_;
48
49 void Close()
50 {
51 TIFFClose(tiff_);
52 }
53
54 void StoreTile(const std::string& tile,
55 unsigned int tileX,
56 unsigned int tileY);
57
58 void ConfigureLevel(const Level& level,
59 bool createLevel);
60
61 void AdvanceToNextTile();
62
63 void ScanPending();
64
65
66 protected:
67 virtual void WriteRawTileInternal(const std::string& tile,
68 const Level& level,
69 unsigned int tileX,
70 unsigned int tileY);
71
72 virtual void AddLevelInternal(const Level& level);
73
74
75 public:
76 HierarchicalTiffWriter(const std::string& path,
77 Orthanc::PixelFormat pixelFormat,
78 ImageCompression compression,
79 unsigned int tileWidth,
80 unsigned int tileHeight);
81
82 virtual ~HierarchicalTiffWriter();
83
84 virtual void Flush();
85 };
86 }