28#if defined _MSC_VER && _MSC_VER<1900
29#define snprintf _snprintf
30#define vsnprintf _vsnprintf
47 file_error(
const std::string& s) : std::runtime_error(s) { }
52enum ImageFormat { TIF, JPEG2000, UNSUPPORTED };
56enum PyramidType { NORMAL, SUBIFD };
64 Stack() : scale(1) {};
81 std::string imagePath;
84 std::string fileSystemPrefix;
87 std::string fileSystemSuffix;
90 std::string fileNamePattern;
102 void measureHorizontalAngles();
105 void measureVerticalAngles();
131 std::vector <uint32_t> resolution_ids;
164 std::vector <float>
min, max;
179 std::map <const std::string, std::string>
metadata;
237 imagePath( image.imagePath ),
238 fileSystemPrefix( image.fileSystemPrefix ),
239 fileSystemSuffix( image.fileSystemSuffix ),
240 fileNamePattern( image.fileNamePattern ),
241 isFile( image.isFile ),
242 suffix( image.suffix ),
250 resolution_ids( image.resolution_ids ),
252 image_heights( image.image_heights ),
254 tile_heights( image.tile_heights ),
257 dpi_y( image.dpi_y ),
268 currentY( image.currentY ),
376 if( tile_heights.size() < (
size_t) n+1 ) n = 0;
377 return tile_heights[n];
385 if(
stack.size() > 0 )
return true;
411 virtual void Load(
const std::string& module ) {};
414 virtual std::string
getDescription()
const {
return std::string(
"IIPImage Base Class" ); };
452 virtual RawTile getRegion(
int ha,
int va,
unsigned int r,
int layers,
int x,
int y,
unsigned int w,
unsigned int h ){
return RawTile(); };
458 swap( *
this, image );
Main class to handle the pyramidal image source.
Definition: IIPImage.h:76
std::vector< float > min
The min and max sample value for each channel.
Definition: IIPImage.h:164
unsigned int virtual_levels
Number of resolution levels that don't physically exist in file.
Definition: IIPImage.h:120
const std::string getTimestamp()
Get a HTTP RFC 1123 formatted timestamp.
IIPImage()
Default Constructor.
Definition: IIPImage.h:191
unsigned int getNumChannels() const
Return the number of channels for this image.
Definition: IIPImage.h:335
bool set() const
Check whether this object has been initialised.
Definition: IIPImage.h:312
IIPImage(const std::string &s)
Constructer taking the image path as parameter.
Definition: IIPImage.h:213
ColourSpaces getColourSpace() const
Return the colour space for this image.
Definition: IIPImage.h:381
ImageFormat getImageFormat() const
Get the image format.
Definition: IIPImage.h:301
std::vector< int > lut
LUT.
Definition: IIPImage.h:117
void swap(IIPImage &a, IIPImage &b)
Swap function.
const std::string getFileName(int x, int y)
Return the full file path for a particular horizontal and vertical angle.
bool isSet
Indicate whether we have opened and initialised some parameters for this image.
Definition: IIPImage.h:170
float dpi_x
Native physical resolution in both X and Y.
Definition: IIPImage.h:145
ImageFormat format
Return the image format e.g. tif.
Definition: IIPImage.h:123
float getVerticalDPI() const
Return physical resolution (DPI) in pixels/meter vertically.
Definition: IIPImage.h:402
std::list< int > horizontalAnglesList
The list of available horizontal angles (for image sequences)
Definition: IIPImage.h:111
IIPImage & operator=(IIPImage image)
Assignment operator.
Definition: IIPImage.h:457
IIPImage(const IIPImage &image)
Copy Constructor taking reference to another IIPImage object.
Definition: IIPImage.h:236
friend int operator!=(const IIPImage &, const IIPImage &)
Comparison non-equality operator.
float getMinValue(int n=0) const
Return the minimum sample value for each channel.
Definition: IIPImage.h:340
void updateTimestamp(const std::string &s)
Get the image timestamp.
virtual ~IIPImage()
Virtual Destructor.
Definition: IIPImage.h:274
std::vector< unsigned int > image_widths
The image pixel dimensions.
Definition: IIPImage.h:136
std::list< int > verticalAnglesList
The list of available vertical angles (for image sequences)
Definition: IIPImage.h:114
unsigned int getImageHeight(int n=0) const
Return the image height in pixels for a given resolution.
Definition: IIPImage.h:358
virtual RawTile getRegion(int ha, int va, unsigned int r, int layers, int x, int y, unsigned int w, unsigned int h)
Return a region for a given angle and resolution.
Definition: IIPImage.h:452
int getNativeResolution(const int res) const
Return index of the resolution within the image file.
Definition: IIPImage.h:329
time_t timestamp
Image modification timestamp.
Definition: IIPImage.h:182
unsigned int getTileHeight(int n=-1) const
Return the tile height in pixels for a given resolution.
Definition: IIPImage.h:373
static void setupLogging()
Setup logging for codec library errors and warnings.
Definition: IIPImage.h:464
virtual std::string getDescription() const
Return codec description: Overloaded by child class.
Definition: IIPImage.h:414
virtual void loadImageInfo(int x, int y)
Load information about the image eg. number of channels, tile size etc.
Definition: IIPImage.h:423
std::vector< unsigned int > tile_widths
The tile dimensions for each resolution.
Definition: IIPImage.h:139
virtual bool regionDecoding()
Return whether this image type directly handles region decoding.
Definition: IIPImage.h:405
SampleType sampleType
The sample format type (fixed or floating point)
Definition: IIPImage.h:161
unsigned int getNumBitsPerPixel() const
Return the number of bits per pixel for this image.
Definition: IIPImage.h:332
std::map< const std::string, std::string > metadata
STL map to hold string metadata.
Definition: IIPImage.h:179
unsigned int numResolutions
The number of available resolutions in this image.
Definition: IIPImage.h:152
unsigned int getTileWidth(int n=-1) const
Return the tile width in pixels for a given resolution.
Definition: IIPImage.h:363
const std::string & getMetadata(const std::string &index)
Return image metadata.
Definition: IIPImage.h:394
unsigned int getImageWidth(int n=0) const
Return the image width in pixels for a given resolution.
Definition: IIPImage.h:353
unsigned int getNumResolutions() const
Return the number of available resolutions in the image.
Definition: IIPImage.h:324
void setFileSystemSuffix(const std::string &s)
Set a file system suffix.
Definition: IIPImage.h:318
std::list< int > getHorizontalViewsList() const
Return a list of horizontal angles.
Definition: IIPImage.h:289
bool isStack() const
Return whether image is a single-file image stack.
Definition: IIPImage.h:384
PyramidType pyramid
Define how pyramid is structured.
Definition: IIPImage.h:126
const std::string & getImagePath() const
Return the image path.
Definition: IIPImage.h:292
virtual void closeImage()
Close the image: Overloaded by child class.
Definition: IIPImage.h:426
virtual void Load(const std::string &module)
Load the appropriate codec module for this image type.
Definition: IIPImage.h:411
unsigned int quality_layers
Quality layers.
Definition: IIPImage.h:167
int currentX
If we have an image sequence, the current X and Y position.
Definition: IIPImage.h:173
SampleType getSampleType() const
Return the sample format type.
Definition: IIPImage.h:348
static bool logging
Our logging stream - declared statically.
Definition: IIPImage.h:185
friend int operator==(const IIPImage &, const IIPImage &)
Comparison equality operator.
virtual void openImage()
Open the image: Overloaded by child class.
Definition: IIPImage.h:417
ColourSpaces colourspace
The colour space of the image.
Definition: IIPImage.h:142
std::vector< unsigned int > histogram
Image histogram.
Definition: IIPImage.h:176
void Initialise()
Test the image and initialise some parameters.
float getMaxValue(int n=0) const
Return the minimum sample value for each channel.
Definition: IIPImage.h:345
void setFileSystemPrefix(const std::string &prefix)
Set a file system prefix for added security.
Definition: IIPImage.h:315
std::list< Stack > stack
Whether we have an image stack consisting of multiple images within a single file.
Definition: IIPImage.h:129
float getHorizontalDPI() const
Return physical resolution (DPI) in pixels/meter horizontally.
Definition: IIPImage.h:399
std::list< int > getVerticalViewsList() const
Return a list of available vertical angles.
Definition: IIPImage.h:286
int dpi_units
Units for native physical resolution.
Definition: IIPImage.h:149
virtual RawTile getTile(int h, int v, unsigned int r, int l, unsigned int t)
Return an individual tile for a given angle and resolution.
Definition: IIPImage.h:437
std::list< Stack > getStack() const
Load stack info.
Definition: IIPImage.h:390
void setFileNamePattern(const std::string &pattern)
Set the file name pattern used in image sequences.
Definition: IIPImage.h:321
unsigned int channels
The number of channels for this image.
Definition: IIPImage.h:158
unsigned int bpc
The bits per channel for this image.
Definition: IIPImage.h:155
Class to represent a single image tile.
Definition: RawTile.h:47
Define our own derived exception class for file errors.
Definition: IIPImage.h:44
file_error(const std::string &s)
Definition: IIPImage.h:47
Definition: IIPImage.h:61