iipsrv 1.1
iipsrv is an advanced high-performance feature-rich image server for web-based streamed viewing and zooming of ultra high-resolution images
OpenJPEGImage.h
1/* IIP Server: OpenJPEG JPEG2000 handler
2
3 Copyright (C) 2019 Ruven Pillay.
4
5 This program is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18*/
19
20#ifndef _OPENJPEGIMAGE_H
21#define _OPENJPEGIMAGE_H
22
23#include "IIPImage.h"
24#include <openjpeg.h>
25
26
27#define TILESIZE 256
28
29extern std::ofstream logfile;
30
33class OpenJPEGImage : public IIPImage {
34
35 private:
36
37 opj_stream_t* _stream;
38 opj_codec_t* _codec;
39 opj_image_t* _image;
40
41
43
51 void process( unsigned int r, int l, int x, int y, unsigned int w, unsigned int h, void* d );
52
53
54
55 public:
56
59 _stream = NULL; _codec = NULL; _image = NULL;
60 tile_width = TILESIZE; tile_height = TILESIZE; virtual_levels = 0;
61 };
62
63
65
67 OpenJPEGImage( const std::string& path) : IIPImage(path){
68 _stream = NULL; _codec = NULL; _image = NULL;
69 tile_width = TILESIZE; tile_height = TILESIZE; virtual_levels = 0;
70 };
71
72
74
76 OpenJPEGImage( const OpenJPEGImage& image ): IIPImage( image ) {};
77
78
80
82 OpenJPEGImage( const IIPImage& image ) : IIPImage(image){
83 _stream = NULL; _codec = NULL; _image = NULL;
84 tile_width = TILESIZE; tile_height = TILESIZE; virtual_levels = 0;
85 };
86
87
90
91
93 void openImage();
94
95
97
100 void loadImageInfo( int x, int y );
101
102
105
106
108 bool regionDecoding(){ return true; };
109
110
112
118 RawTile getTile( int x, int y, unsigned int r, int l, unsigned int t );
119
120
122
133 RawTile getRegion( int ha, int va, unsigned int res, int layers, int x, int y, unsigned int w, unsigned int h );
134
135};
136
137#endif
Main class to handle the pyramidal image source.
Definition IIPImage.h:62
unsigned int virtual_levels
Number of resolution levels that don't physically exist in file.
Definition IIPImage.h:103
unsigned int tile_width
The base tile pixel dimensions.
Definition IIPImage.h:115
Definition OpenJPEGImage.h:33
void loadImageInfo(int x, int y)
Overloaded function for loading JP2 image information.
bool regionDecoding()
Return whether this image type directly handles region decoding.
Definition OpenJPEGImage.h:108
RawTile getTile(int x, int y, unsigned int r, int l, unsigned int t)
Overloaded function for getting a particular tile.
OpenJPEGImage(const std::string &path)
Constructor.
Definition OpenJPEGImage.h:67
void closeImage()
Overloaded function for closing a JP2 image.
RawTile getRegion(int ha, int va, unsigned int res, int layers, int x, int y, unsigned int w, unsigned int h)
Overloaded function for returning a region from image.
void openImage()
Overloaded function for opening a TIFF image.
OpenJPEGImage()
Constructor.
Definition OpenJPEGImage.h:58
~OpenJPEGImage()
Destructor.
Definition OpenJPEGImage.h:89
OpenJPEGImage(const OpenJPEGImage &image)
Copy Constructor.
Definition OpenJPEGImage.h:76
OpenJPEGImage(const IIPImage &image)
Copy Constructor.
Definition OpenJPEGImage.h:82
Class to represent a single image tile.
Definition RawTile.h:45