libimage  0.25.4
 All Classes Namespaces Files Functions Variables Enumerations Macros Pages
Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
Rok4Image Class Reference

#include <Rok4Image.h>

Inheritance diagram for Rok4Image:
Inheritance graph
Collaboration diagram for Rok4Image:
Collaboration graph

Public Member Functions

 ~Rok4Image ()
 Default destructor.
void print ()
 ROK4 image description output.
int getRawTile (uint8_t *buf, int tile)
int getEncodedTile (uint8_t *buf, int tile)
int getline (uint8_t *buffer, int line)
int getline (uint16_t *buffer, int line)
int getline (float *buffer, int line)
int writeImage (Image *pIn)
int writeImage (Image *pIn, bool crop)
int writeImage (uint8_t *buffer)
int writeImage (uint16_t *buffer)
int writeImage (float *buffer)
int writeLine (uint8_t *buffer, int line)
int writeLine (uint16_t *buffer, int line)
int writeLine (float *buffer, int line)
- Public Member Functions inherited from FileImage
void unassociateAlpha (uint8_t *buffer)
char * getFilename ()
 Return the path to image file.
int getBitsPerSample ()
 Return number of bits per sample.
Photometric::ePhotometric getPhotometric ()
 Return data photometric (rgb, gray...)
ExtraSample::eExtraSample getExtraSample ()
 Return extra sample type.
void setExtraSample (ExtraSample::eExtraSample es)
 Modify extra sample type.
Compression::eCompression getCompression ()
 Return data compression.
SampleFormat::eSampleFormat getSampleFormat ()
 Return sample format (integer, float)
int getPixelSize ()
 Return the pixel's byte size.
 ~FileImage ()
 Default destructor.
- Public Member Functions inherited from Image
void makeMask ()
 Define the image as a mask.
int getWidth ()
 Return the image's width.
int getHeight ()
 Return the image's height.
void setBbox (BoundingBox< double > box)
 Define the image's bounding box and calculate resolutions.
bool setDimensions (int w, int h, BoundingBox< double > box, double rx, double ry)
 Define the image's bounding box and calculate resolutions.
BoundingBox< double > getBbox () const
 Return the image's bounding box.
void setCRS (CRS srs)
 Define the CRS of the image's bounding box.
CRS getCRS () const
 Return the image's bounding box's CRS.
double getXmin () const
 Return bounding box's xmin.
double getYmax () const
 Return bounding box's ymax.
double getXmax () const
 Return bounding box's xmax.
double getYmin () const
 Return bounding box's ymin.
double getResX () const
 Return the X wise resolution.
double getResY () const
 Return the Y wise resolution.
ImagegetMask ()
 Return the associated mask.
bool setMask (Image *newMask)
 Defined data mask and check consistency.
int x2c (double x)
 Conversion from terrain coordinate X to image column indice.
int y2l (double y)
 Conversion from terrain coordinate Y to image line indice.
double c2x (int c)
 Conversion from image column indice to terrain coordinate X (pixel's center)
double l2y (int l)
 Conversion from image line indice to terrain coordinate X (pixel's center)
double getPhaseX ()
 Phasis calculation, X wise.
double getPhaseY ()
 Phasis calculation, Y wise.
bool isCompatibleWith (Image *pImage)
 Determine compatibility with another image, comparing CRS, phasis and resolutions.
 Image (int width, int height, int channels, double resx, double resy, BoundingBox< double > bbox)
 Create an Image object, from all attributes.
 Image (int width, int height, int channels)
 Create an Image without providing georeferencement, neither resolutions nor bounding box.
 Image (int width, int height, int channels, BoundingBox< double > bbox)
 Create an Image without providing resolutions.
 Image (int width, int height, int channels, double resx, double resy)
 Create an Image object without providing bbox.
virtual ~Image ()
 Default destructor.
virtual void printTFW ()
 Image TFW output.

Static Public Member Functions

static bool canRead (int bps, SampleFormat::eSampleFormat sf)
static bool canWrite (int bps, SampleFormat::eSampleFormat sf)

Protected Member Functions

 Rok4Image (int width, int height, double resx, double resy, int channels, BoundingBox< double > bbox, char *name, SampleFormat::eSampleFormat sampleformat, int bitspersample, Photometric::ePhotometric photometric, Compression::eCompression compression, ExtraSample::eExtraSample es, int tileWidth, int tileHeight)
 Create a Rok4Image object, from all attributes.
- Protected Member Functions inherited from FileImage
 FileImage (int width, int height, double resx, double resy, int channels, BoundingBox< double > bbox, char *name, SampleFormat::eSampleFormat sampleformat, int bitspersample, Photometric::ePhotometric photometric, Compression::eCompression compression, ExtraSample::eExtraSample esType=ExtraSample::ALPHA_UNASSOC)
 Create a FileImage object, from all attributes.
- Protected Member Functions inherited from Image
void computeResolutions ()
 Resolutions calculation, from pixel size and bounding box.

Private Member Functions

uint8_t * memorizeRawTile (size_t &size, int tile)
 Buffer precising for each memorized tile's indice.
bool prepare ()
 Write the ROK4 image's TIFF header.
bool writeTile (int tileInd, uint8_t *data, bool crop=false)
 Write a ROK4 image's tile.
bool close ()
 End the ROK4 image's writting.
size_t computeRawTile (uint8_t *buffer, uint8_t *data)
 Compress raw data into RAW compression.
size_t computeJpegTile (uint8_t *buffer, uint8_t *data, bool crop)
 Compress raw data into JPEG compression.
void emptyWhiteBlock (uint8_t *buffer, int l)
 Fill blocs, which contains a white pixel, with white.
size_t computeLzwTile (uint8_t *buffer, uint8_t *data)
 Compress raw data into LZW compression.
size_t computePackbitsTile (uint8_t *buffer, uint8_t *data)
 Compress raw data into PACKBITS compression.
size_t computePngTile (uint8_t *buffer, uint8_t *data)
 Compress raw data into PNG compression.
size_t computeDeflateTile (uint8_t *buffer, uint8_t *data)
 Compress raw data into DEFLATE compression.
template<typename T >
int _getline (T *buffer, int line)

Private Attributes

int tileWidth
 Image's tile width, in pixel.
int tileHeight
 Image's tile height, in pixel.
int tileWidthwise
 Number of tiles, widthwise.
int tileHeightwise
 Number of tiles, heightwise.
int tilesNumber
 Number of tiles.
int rawTileLineSize
 Raw byte size of a tile's line.
int rawTileSize
 Raw byte size of a tile.
int memorySize
 Number of memorized tiles.
uint8_t ** memorizedTiles
 Buffer containing memorized tiles.
int * memorizedIndex
 Buffer precising for each memorized tile's indice.
uint32_t position
 Pointer position in opened written file.
uint32_t * tilesOffset
 Tile's start address, in the file.
uint32_t * tilesByteCounts
 Tile's size, in the file.
std::ofstream output
 Stream used to write the ROK4 image.
size_t BufferSize
 Temporary buffer Buffer size, containing the compressed tile to write.
uint8_t * Buffer
 Buffer size, containing the compressed tile to write.
uint8_t * zip_buffer
 Buffer used by zlib.
z_stream zstream
 Stream used by zlib.
struct jpeg_compress_struct cinfo
 Informations structure used by libjpeg.
struct jpeg_error_mgr jerr
 Error structure used by libjpeg.

Friends

class Rok4ImageFactory

Additional Inherited Members

- Public Attributes inherited from Image
const int channels
 Number of samples per pixel.
- Protected Attributes inherited from FileImage
char * filename
 Path to the image file.
Photometric::ePhotometric photometric
 Data photometric (rgb, gray...)
ExtraSample::eExtraSample esType
 extra sample type (if exists)
Compression::eCompression compression
 Data compression (jpeg, packbits...)
SampleFormat::eSampleFormat sampleformat
 Sample format.
int bitspersample
 Number of bits per sample.
int pixelSize
 Byte pixel's size.

Detailed Description

Author
Institut national de l'information géographique et forestière

Constructor & Destructor Documentation

Rok4Image::Rok4Image ( int  width,
int  height,
double  resx,
double  resy,
int  channels,
BoundingBox< double >  bbox,
char *  name,
SampleFormat::eSampleFormat  sampleformat,
int  bitspersample,
Photometric::ePhotometric  photometric,
Compression::eCompression  compression,
ExtraSample::eExtraSample  es,
int  tileWidth,
int  tileHeight 
)
protected

Create a Rok4Image object, from all attributes.

Parameters
[in]widthimage width, in pixel
[in]heightimage height, in pixel
[in]resxX wise resolution
[in]resyY wise resolution
[in]channelnumber of samples per pixel
[in]bboxbounding box
[in]namepath to image file
[in]sampleformatsamples' format
[in]bitspersamplenumber of bits per sample
[in]photometricdata photometric
[in]compressiondata compression
[in]esTypeextra sample type
[in]tileWidthtile's pixel width
[in]tileHeighttile's pixel height
Rok4Image::~Rok4Image ( )
inline

Default destructor.

We remove read buffer and TIFF interface

Member Function Documentation

bool Rok4Image::close ( )
private

End the ROK4 image's writting.

Returns
TRUE if success, FALSE otherwise

Here is the caller graph for this function:

size_t Rok4Image::computeDeflateTile ( uint8_t *  buffer,
uint8_t *  data 
)
private

Compress raw data into DEFLATE compression.

Use zlib.

Parameters
[out]bufferStorage buffer for compressed data. Have to be allocated.
[in]dataraw data (no compression) to write
Returns
data' size in buffer, 0 if failure

Here is the caller graph for this function:

size_t Rok4Image::computeJpegTile ( uint8_t *  buffer,
uint8_t *  data,
bool  crop 
)
private

Compress raw data into JPEG compression.

Use libjpeg

Parameters
[out]bufferStorage buffer for compressed data. Have to be allocated.
[in]dataraw data (no compression) to write
[in]cropjpeg option (see #writeImage)
Returns
data' size in buffer, 0 if failure

Here is the call graph for this function:

Here is the caller graph for this function:

size_t Rok4Image::computeLzwTile ( uint8_t *  buffer,
uint8_t *  data 
)
private

Compress raw data into LZW compression.

Use liblzw.

Parameters
[out]bufferStorage buffer for compressed data. Have to be allocated.
[in]dataraw data (no compression) to write
Returns
data' size in buffer, 0 if failure

Here is the caller graph for this function:

size_t Rok4Image::computePackbitsTile ( uint8_t *  buffer,
uint8_t *  data 
)
private

Compress raw data into PACKBITS compression.

Use libpkb.

Parameters
[out]bufferStorage buffer for compressed data. Have to be allocated.
[in]dataraw data (no compression) to write
Returns
data' size in buffer, 0 if failure

Here is the caller graph for this function:

size_t Rok4Image::computePngTile ( uint8_t *  buffer,
uint8_t *  data 
)
private

Compress raw data into PNG compression.

Use zlib. Returned data contains PNG header.

Parameters
[out]bufferStorage buffer for compressed data. Have to be allocated.
[in]dataraw data (no compression) to write
Returns
data' size in buffer, 0 if failure

Here is the caller graph for this function:

size_t Rok4Image::computeRawTile ( uint8_t *  buffer,
uint8_t *  data 
)
private

Compress raw data into RAW compression.

A simple copy

Parameters
[out]bufferStorage buffer for compressed data. Have to be allocated.
[in]dataraw data (no compression) to write
Returns
data' size in buffer, 0 if failure

Here is the caller graph for this function:

void Rok4Image::emptyWhiteBlock ( uint8_t *  buffer,
int  l 
)
private

Fill blocs, which contains a white pixel, with white.

Parameters
[in,out]bufferraw data to crop
[in]lnumber of tile's line (in buffer) to consider (16 or less when tile's bottom is reached)

Here is the caller graph for this function:

uint8_t * Rok4Image::memorizeRawTile ( size_t &  size,
int  tile 
)
private

Buffer precising for each memorized tile's indice.

Returns
pointer to array containing the wanted tile

Here is the call graph for this function:

bool Rok4Image::prepare ( )
private

Write the ROK4 image's TIFF header.

Returns
TRUE if success, FALSE otherwise

Here is the caller graph for this function:

int Rok4Image::writeImage ( Image pIn,
bool  crop 
)
Todo:
Écriture d'images ROK4 en JPEG gris

Here is the call graph for this function:

bool Rok4Image::writeTile ( int  tileInd,
uint8_t *  data,
bool  crop = false 
)
private

Write a ROK4 image's tile.

Parameters
[in]tileIndtile indice
[in]dataraw data (no compression) to write
[in]cropjpeg option (see emptyWhiteBlock)
Returns
TRUE if success, FALSE otherwise

Here is the call graph for this function:

Here is the caller graph for this function:

Member Data Documentation

int* Rok4Image::memorizedIndex
private

Buffer precising for each memorized tile's indice.

-1 if no tile is memorized into this place in memorizedTiles Size : memorySize

uint8_t** Rok4Image::memorizedTiles
private

Buffer containing memorized tiles.

We memorize uncompressed tiles Size : memorySize


The documentation for this class was generated from the following files: