iipsrv 1.2
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-2023 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
29
32class OpenJPEGImage : public IIPImage {
33
34 private:
35
36 opj_stream_t* _stream;
37 opj_codec_t* _codec;
38 opj_image_t* _image;
39
40
42
50 void process( unsigned int r, int l, int x, int y, unsigned int w, unsigned int h, void* d );
51
52
53
54 public:
55
58 _stream = NULL; _codec = NULL; _image = NULL;
59 tile_widths.push_back(TILESIZE); tile_heights.push_back(TILESIZE);
60 };
61
62
64
66 OpenJPEGImage( const std::string& path) : IIPImage(path){
67 _stream = NULL; _codec = NULL; _image = NULL;
68 tile_widths.push_back(TILESIZE); tile_heights.push_back(TILESIZE);
69 };
70
71
73
75 OpenJPEGImage( const OpenJPEGImage& image ): IIPImage( image ) {};
76
77
79
81 OpenJPEGImage( const IIPImage& image ) : IIPImage(image){
82 _stream = NULL; _codec = NULL; _image = NULL;
83 tile_widths.push_back(TILESIZE); tile_heights.push_back(TILESIZE);
84 };
85
86
89
90
92 void openImage();
93
94
96
99 void loadImageInfo( int x, int y );
100
101
104
105
107 bool regionDecoding(){ return true; };
108
109
111
117 RawTile getTile( int x, int y, unsigned int r, int l, unsigned int t );
118
119
121
132 RawTile getRegion( int ha, int va, unsigned int res, int layers, int x, int y, unsigned int w, unsigned int h );
133
134};
135
136#endif
Main class to handle the pyramidal image source.
Definition: IIPImage.h:76
std::vector< unsigned int > tile_widths
The tile dimensions for each resolution.
Definition: IIPImage.h:139
Definition: OpenJPEGImage.h:32
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:107
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:66
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:57
~OpenJPEGImage()
Destructor.
Definition: OpenJPEGImage.h:88
OpenJPEGImage(const OpenJPEGImage &image)
Copy Constructor.
Definition: OpenJPEGImage.h:75
OpenJPEGImage(const IIPImage &image)
Copy Constructor.
Definition: OpenJPEGImage.h:81
Class to represent a single image tile.
Definition: RawTile.h:47