J2K-Codec ™

News
Overview
Download
Order
F.A.Q.
More info
Support
Links

Welcome
QuickStart

ActiveX Control

C++ Wrapper
J2K_Image
open
easyDecode
selectTiles
getMetaData
decode
close
J2K_Frames
open
getFrames
getFrame
operators
close

API Reference
General
getVersion
getLastError
getErrorStr
getLastErrorStr
Unlock
Open / Close
Open
Close
Info
GetInfo
GetInfoEx
GetResolutions
GetResDimensions
GetMetaData
Decoding
EasyDecode
SelectTiles
Decode
Cancel
Debug
StartLogging
StopLogging


J2K_SelectTiles


You need to use this function only if you want to decode a particular tile (or a tile range) from the image.

int J2K_SelectTiles(void *image, int start_tile, int end_tile, int action);


Parameters

image
A pointer, obtained from J2K_Open().

start_tile
Start tile number of selection range.

end_tile
End tile number of selection range (inclusive).

action
Action to do: 1 - select, 0 - unselect (remove from processing).

Return value

Returns J2KERR_SUCCESS or an error code if the function has failed. See the list of error codes here.

Notes

1. By default (if this function is not used) all tiles are selected.

2. After you have selected some of the tiles, the following functions will use them as a base for their operation:
J2K_GetResolutions() will return the number of resolution levels available in the selected tile-set.

J2K_GetResolutionDimensions() will return the dimensions of a bounding box, which includes all selected tiles at the specified resolution level.

J2K_Decode() will allocate (or expect) a buffer with such dimensions and decode only selected tiles into it.
3. Tiles are numbered starting from 0 in the raster order (i.e. first - by X axis and then by Y).

4. If end_tile == -1 then the max tile number will be used instead.

5. If end_tile < start_tile they will be swapped.

6. If no tiles were selected then J2K_GetResolutions() and J2K_GetResolutionDimensions() will assume 1 resolution level available with the dimensions of the whole image, and no decoding will be done by J2K_Decode().

Example

void *image = J2K_Open("test.j2k");

if(!image) printf("\n J2K-Codec error: %s.", J2K_getLastErrorStr());
else
{
   J2K_SelectTiles(image, 0, -1, 0); // Unselect all tiles

   J2K_SelectTiles(image, 2, 2, 1); // Select the third tile only

   // Work with selected tiles
   ...
}

See also

J2K_Open()

J2K_GetInfoEx()
2004-2008 © Alex Saveliev