OpenJPEGImage.h
/* IIP Server: OpenJPEG JPEG2000 handler
Copyright (C) 2019 Ruven Pillay.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _OPENJPEGIMAGE_H
#define _OPENJPEGIMAGE_H
#include "IIPImage.h"
#include <openjpeg.h>
#define TILESIZE 256
extern std::ofstream logfile;
class OpenJPEGImage : public IIPImage {
private:
opj_stream_t* _stream;
opj_codec_t* _codec;
opj_image_t* _image;
void process( unsigned int r, int l, int x, int y, unsigned int w, unsigned int h, void* d );
public:
OpenJPEGImage() : IIPImage(){
_stream = NULL; _codec = NULL; _image = NULL;
tile_width = TILESIZE; tile_height = TILESIZE; virtual_levels = 0;
};
OpenJPEGImage( const std::string& path) : IIPImage(path){
_stream = NULL; _codec = NULL; _image = NULL;
tile_width = TILESIZE; tile_height = TILESIZE; virtual_levels = 0;
};
OpenJPEGImage( const OpenJPEGImage& image ): IIPImage( image ) {};
OpenJPEGImage( const IIPImage& image ) : IIPImage(image){
_stream = NULL; _codec = NULL; _image = NULL;
tile_width = TILESIZE; tile_height = TILESIZE; virtual_levels = 0;
};
~OpenJPEGImage(){ closeImage(); };
void openImage();
void loadImageInfo( int x, int y );
void closeImage();
bool regionDecoding(){ return true; };
RawTile getTile( int x, int y, unsigned int r, int l, unsigned int t );
RawTile getRegion( int ha, int va, unsigned int res, int layers, int x, int y, unsigned int w, unsigned int h );
};
#endif
IIPImage::virtual_levels
unsigned int virtual_levels
Number of resolution levels that don't physically exist in file.
Definition IIPImage.h:103
IIPImage::IIPImage
IIPImage()
Default Constructor.
Definition IIPImage.h:157
IIPImage::tile_width
unsigned int tile_width
The base tile pixel dimensions.
Definition IIPImage.h:115
OpenJPEGImage::loadImageInfo
void loadImageInfo(int x, int y)
Overloaded function for loading JP2 image information.
OpenJPEGImage::regionDecoding
bool regionDecoding()
Return whether this image type directly handles region decoding.
Definition OpenJPEGImage.h:108
OpenJPEGImage::getTile
RawTile getTile(int x, int y, unsigned int r, int l, unsigned int t)
Overloaded function for getting a particular tile.
OpenJPEGImage::OpenJPEGImage
OpenJPEGImage(const std::string &path)
Constructor.
Definition OpenJPEGImage.h:67
OpenJPEGImage::closeImage
void closeImage()
Overloaded function for closing a JP2 image.
OpenJPEGImage::getRegion
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.
OpenJPEGImage::openImage
void openImage()
Overloaded function for opening a TIFF image.
OpenJPEGImage::OpenJPEGImage
OpenJPEGImage()
Constructor.
Definition OpenJPEGImage.h:58
OpenJPEGImage::~OpenJPEGImage
~OpenJPEGImage()
Destructor.
Definition OpenJPEGImage.h:89
OpenJPEGImage::OpenJPEGImage
OpenJPEGImage(const OpenJPEGImage &image)
Copy Constructor.
Definition OpenJPEGImage.h:76
OpenJPEGImage::OpenJPEGImage
OpenJPEGImage(const IIPImage &image)
Copy Constructor.
Definition OpenJPEGImage.h:82
RawTile
Class to represent a single image tile.
Definition RawTile.h:45