public class J2KImageWriteParamJava extends ImageWriteParam
ImageWriteParam
for writing images in
the JPEG 2000 format.
JPEG 2000 plugin supports to losslessly or lossy compress gray-scale, RGB, and RGBA images with byte, unsigned short or short data type. It also supports losslessly compress bilevel, and 8-bit indexed. The result data is in the format of JP2 (JPEG 2000 Part 1 or baseline format).
Many encoding parameters for JPEG 2000 can be tile-component specific.
These parameters are marked as Yes
in the column
TC_SPEC
in the following parameter table.
They must be provided according to the pattern:
[<tile-component idx>] <param> (repeated as many time as needed),
where <tile-component idx> respect the following policy according to
the degree of priority:
(1) t<idx> c<idx> : Tile-component specification. |
(2) t<idx> : Tile specification. |
(3) c<idx> : Component specification. |
(4) <void> : Default specification. |
Where the priorities of the specifications are: (1) > (2) > (3) > (4), (">" means "overrides") <idx>: "," separates indexes, "-" separates bounds of indexes list. (for example, 0,2-4 means indexes 0,2,3 and 4).
The parameters for encoding JPEG 2000 are listed in the following table: *
Parameter Name | Description | TC_SPEC |
---|---|---|
encodingRate | The bitrate in bits-per-pixel for encoding. Should be set when
lossy compression scheme is used. With the default value
Double.MAX_VALUE , a lossless compression will be done.
|
No |
lossless | Indicates using the loseless scheme or not. It is equivalent to
use reversible quantization and 5x3 integer wavelet filters. The
default is true .
|
No |
componentTransformation | Specifies to utilize the component transformation on some tiles. If the wavelet transform is reversible (w5x3 filter), the Reversible Component Transformation (RCT) is applied. If not reversible (w9x7 filter), the Irreversible Component Transformation (ICT) is used. | Yes, Tile_Specific |
filters | Specifies which wavelet filters to use for the specified tile-components. JPEG 2000 part I only supports w5x3 and w9x7 filters. | Yes |
decompositionLevel | Specifies the wavelet decomposition levels to apply to the image. If it is 0, no wavelet transform is performed, in which case the original image data will be sent to the encoder and an example is the binary data. All components and all tiles have the same number of decomposition levels. The default value is 5. | No |
guardBits | The number of bits used for each tile-component in the quantizer to avoid overflow. It takes values in the range 0 through 7. The default value is 2. | Yes |
quantizationStep | This parameter specifies the base normalized quantization step size for the tiles/components. It is normalized to a dynamic range of 1 in the image domain. This parameter is ignored in reversible coding. The default value is 0.0078125. | Yes |
quantizationType | Specifies which quantization type to use for specified tiles/components. Not specified for lossless compression. By default, the quantization step size is "expounded". Supported quantization types specification are : "reversible" (no quantization), "derived" (derived quantization step size) and "expounded". | Yes |
codeBlockSize | Specifies the maximum code-block size to use for tile-component. The maximum width and height is 1024, however the block size (i.e. width x height) must not exceed 4096. The minimum width and height is 4. The default values are (64, 64). | Yes |
progressionType | Specifies which type of progression should be used when generating
the codestream.
The format is [<tile index>] res|layer|res-pos|pos-comp|comp-pos [res_start comp_start layer_end res_end comp_end prog] [[res_start comp_start layer_end res_end comp_end prog]...] [[<tile-component idx]...]. The value "res" generates a resolution progressive codestream with the number of layers specified by "layers" parameter. The value "layer" generates a layer progressive codestream with multiple layers. In any case, the rate-allocation algorithm optimizes for best quality in each layer. The quality measure is mean squared error (MSE) or a weighted version of it (WMSE). If no progression type is specified or imposed by other parameters, the default value is "layer". It is also possible to describe progression order changes. In this case, "res_start" is the index (from 0) of the first resolution level, "comp_start" is the index (from 0) of the first component, "layer_end" is the index (from 0) of the first layer not included, "res_end" is the index (from 0) of the first resolution level not included, "comp_end" is index (from 0) of the first component not included and "prog" is the progression type to be used for the rest of the tile/image. Several progression order changes can be specified, one after the other. |
Yes |
packPacketHeaderInTile | Indicates that the packet headers are packed in the tiles' headers. The default is false. | No |
packPacketHeaderInMain | Indicates that the packet headers are packed in the main header. The default is false. | No |
packetPerTilePart | Specifies the maximum number of packets to be put into one tile-part. Zero means putting all packets in the first tile-part of each tile. | No |
ROIs | Specifies ROIs shape and location. The component index specifies
which components contain the ROI. If this parameter is used, the
codestream is layer progressive by default unless it is overridden by
the progressionType . A rectanglar or circular ROI can be
specified in the format: [<component idx>] R <left>
<top> <width> <height> or [<component idx>] C
<center x> <center y> <radius>. An arbitrary shape
can be assigned by [<component idx>] A <PGM file>
|
Yes, component-specified |
startLevelROI | This parameter defines the lowest resolution levels to belong to the ROI. By doing this, it is possible to avoid getting information for the ROI at an early stage of transmission. startLevelROI = 0 means the lowest resolution level belongs to the ROI, 1 means the second lowest etc. The default values, -1, deactivates this parameter. | No |
alignROI | By specifying this parameter, the ROI mask will be limited to covering only entire code-blocks. The ROI coding can then be performed without any actual scaling of the coefficients but by instead scaling the distortion estimates. | No |
bypass | Uses the lazy coding mode with the entropy coder. This will bypass
the MQ coder for some of the coding passes, where the distribution
is often close to uniform. Since the MQ codeword will be terminated
at least once per lazy pass, it is important to use an efficient
termination algorithm, methodForMQTermination .
true enables, and false disables it. The default value is false.
|
Yes |
resetMQ | If this is enabled the probability estimates of the MQ coder are reset after each arithmetically coded (i.e. non-lazy) coding pass. true enables, and false disables it. The default value is false. | Yes |
terminateOnByte | If this is enabled the codeword (raw or MQ) is terminated on a byte boundary after each coding pass. In this case it is important to use an efficient termination algorithm, "methodForMQTermination". true enables, and false disables it. The default value is false. | Yes |
causalCXInfo | Uses vertically stripe causal context formation. If this is enabled the context formation process in one stripe is independant of the next stripe (i.e. the one below it). true enables, and false disables it. The default value is false. | Yes |
codeSegSymbol | Inserts an error resilience segmentation symbol in the MQ codeword at the end of each bit-plane (cleanup pass). Decoders can use this information to detect and conceal errors. true enables, and false disables it. The default value is false. | Yes |
methodForMQTermination | Specifies the algorithm used to terminate the MQ codeword. The most efficient one is "near_opt", which delivers a codeword which in almost all cases is the shortest possible. The "easy" is a simpler algorithm that delivers a codeword length that is close to the previous one (in average 1 bit longer). The "predict" is almost the same as the "easy" but it leaves error resilient information on the spare least significant bits (in average 3.5 bits), which can be used by a decoder to detect errors. The "full" algorithm performs a full flush of the MQ coder and is highly inefficient. It is important to use a good termination policy since the MQ codeword can be terminated quite often, specially if the "bypass" or "terminateOnByte" parameters are enabled (in the normal case it would be terminated once per code-block, while "terminateOnByte" is specified it will be done almost 3 times per bit-plane in each code-block). The default value is "near_opt". | Yes |
methodForMQLengthCalc | Specifies the algorithm to use in calculating the necessary MQ length for each decoding pass. The best one is "near_opt", which performs a rather sophisticated calculation and provides the best results. The "lazy_good" and "lazy" are very simple algorithms that provide rather conservative results. "lazy_good" performs slightly better. Please use the default unless the experiments show the benefits of different length calculation algorithms. The default value is "near_opt". | Yes |
precinctPartition | Specifies precinct partition dimensions for tiles/components. They are stored from those applied to the highest resolution to those applied to the remaining resolutions in decreasing order. If less values than the number of decomposition levels are specified, then the last two values are used for the remaining resolutions. | Yes |
layers | Explicitly specifies the codestream layer formation parameters. The rate (double) parameter specifies the bitrate to which the first layer should be optimized. The layers (int) parameter, if present, specifies the number of extra layers that should be added for scalability. These extra layers are not optimized. Any extra rate and layers parameters add more layers, in the same way. An additional layer is always added at the end, which is optimized to the overall target bitrate of the bit stream. Any layers (optimized or not) whose target bitrate is higher that the overall target bitrate are silently ignored. The bitrates of the extra layers that are added through the layers parameter are approximately log-spaced between the other target bitrates. If several (rate, layers) constructs appear the rate parameters must appear in increasing order. The rate allocation algorithm ensures that all coded layers have a minimal reasonable size, if not these layers are silently ignored. Default: 0.015 +20 2.0 +10. | No |
SOP | Specifies whether start of packet (SOP) markers should be used. true enables, false disables it. The default value is false. | Yes |
EPH | Specifies whether end of packet header (EPH) markers should be used. true enables, false disables it. The default value is false. | Yes |
canOffsetTiles, canWriteCompressed, canWriteProgressive, canWriteTiles, compressionMode, compressionQuality, compressionType, compressionTypes, locale, MODE_COPY_FROM_METADATA, MODE_DEFAULT, MODE_DISABLED, MODE_EXPLICIT, preferredTileSizes, progressiveMode, tileGridXOffset, tileGridYOffset, tileHeight, tileWidth, tilingMode, tilingSet
controller, defaultController, destinationOffset, destinationType, sourceBands, sourceRegion, sourceXSubsampling, sourceYSubsampling, subsamplingXOffset, subsamplingYOffset
Constructor and Description |
---|
J2KImageWriteParamJava()
Constructs a
J2KImageWriteParamJava object with default
values for all parameters. |
J2KImageWriteParamJava(IIOImage image,
ImageWriteParam param)
Constructor to set locales.
|
J2KImageWriteParamJava(Raster raster)
Constructs a
J2KImageWriteParamJava object with default
values for all parameters. |
J2KImageWriteParamJava(RenderedImage imgsrc)
Constructs a
J2KImageWriteParamJava object with default
values for all parameters. |
J2KImageWriteParamJava(RenderedImage imgsrc,
Locale locale)
Constructor to set locales.
|
Modifier and Type | Method and Description |
---|---|
boolean |
getAlignROI()
Gets
alignROI |
StringSpec |
getBypass()
Gets
bypass |
StringSpec |
getCausalCXInfo()
Gets
causalCXInfo |
CBlkSizeSpec |
getCodeBlockSize()
Gets
codeBlockSize |
StringSpec |
getCodeSegSymbol()
Gets
codeSegSymbol |
ForwCompTransfSpec |
getComponentTransformation()
Gets
componentTransformation |
IntegerSpec |
getDecompositionLevel()
Gets
decompositionLevel |
double |
getEncodingRate()
Gets
encodingRate |
StringSpec |
getEPH()
Gets
EPH |
AnWTFilterSpec |
getFilters()
Gets
filters |
GuardBitsSpec |
getGuardBits()
Gets
guardBits |
String |
getLayers()
Gets
layers |
boolean |
getLossless()
Gets
encodingRate |
StringSpec |
getMethodForMQLengthCalc()
Gets
methodForMQLengthCalc |
StringSpec |
getMethodForMQTermination()
Gets
methodForMQTermination |
int |
getMinX()
Gets
minX |
int |
getMinY()
Gets
minY |
int |
getNumComponents()
Gets the number of components
|
int |
getNumTiles()
Gets the number of tiles
|
int |
getPacketPerTilePart()
Gets
packetPerTilePart |
boolean |
getPackPacketHeaderInMain()
Gets
packPacketHeaderInMain |
boolean |
getPackPacketHeaderInTile()
Gets
packPacketHeaderInTile |
PrecinctSizeSpec |
getPrecinctPartition()
Gets
precinctPartition |
String |
getProgressionName()
Gets
progressionType |
ProgressionSpec |
getProgressionType()
Gets
progressionType |
QuantStepSizeSpec |
getQuantizationStep()
Gets
quantizationStep |
QuantTypeSpec |
getQuantizationType()
Gets
quantizationType |
StringSpec |
getResetMQ()
Gets
resetMQ |
MaxShiftSpec |
getROIs()
Gets
ROIs |
StringSpec |
getSOP()
Gets
SOP |
int |
getStartLevelROI()
Gets
startLevel |
StringSpec |
getTerminateOnByte()
Gets
terminateOnByte |
void |
setAlignROI(boolean align)
Sets
alignROI |
void |
setBypass(String values)
Sets
bypass |
void |
setCausalCXInfo(String values)
Sets
causalCXInfo |
void |
setCodeBlockSize(String values)
Sets
codeBlockSize |
void |
setCodeSegSymbol(String values)
Sets
codeSegSymbol |
void |
setComponentTransformation(String values)
Sets
componentTransformation |
void |
setDecompositionLevel(String values)
Sets
decompositionLevel |
void |
setEncodingRate(double rate)
Sets
encodingRate |
void |
setEPH(String values)
Sets
EPH |
void |
setFilters(String values)
Sets
filters |
void |
setGuardBits(String values)
Sets
guardBits |
void |
setLayers(String value)
Sets the
layers |
void |
setLossless(boolean lossless)
Sets
lossless |
void |
setMethodForMQLengthCalc(String values)
Sets
methodForMQLengthCalc |
void |
setMethodForMQTermination(String values)
Sets
methodForMQTermination |
void |
setMinX(int minX)
Sets
minX |
void |
setMinY(int minY)
Sets
minY |
void |
setPacketPerTilePart(int packetPerTilePart)
Sets
packetPerTilePart |
void |
setPackPacketHeaderInMain(boolean packPacketHeaderInMain)
Sets
packPacketHeaderInMain |
void |
setPackPacketHeaderInTile(boolean packPacketHeaderInTile)
Sets
packPacketHeaderInTile |
void |
setPrecinctPartition(String values)
Sets
precinctPartition |
void |
setProgressionName(String values)
Sets
progressionName |
void |
setProgressionType(LayersInfo lyrs,
String values)
Sets
progressionType |
void |
setQuantizationStep(String values)
Sets
quantizationStep |
void |
setQuantizationType(String values)
Sets
quantizationType |
void |
setResetMQ(String values)
Sets
resetMQ |
void |
setROIs(String values)
Sets
ROIs |
void |
setSOP(String values)
Sets
SOP |
void |
setSourceBands(int[] bands)
Override the method setSourceBands in the super class.
|
void |
setSourceSubsampling(int sx,
int sy,
int xOff,
int yOff)
Override the method setSourceSubsampling in the super class.
|
void |
setStartLevelROI(int value)
Sets the
startLevelROI |
void |
setTerminateOnByte(String values)
Sets
terminateOnByte |
void |
setTiling(int tw,
int th,
int xOff,
int yOff)
Override the method setTiling in the super class.
|
canOffsetTiles, canWriteCompressed, canWriteProgressive, canWriteTiles, getBitRate, getCompressionMode, getCompressionQuality, getCompressionQualityDescriptions, getCompressionQualityValues, getCompressionType, getCompressionTypes, getLocale, getLocalizedCompressionTypeName, getPreferredTileSizes, getProgressiveMode, getTileGridXOffset, getTileGridYOffset, getTileHeight, getTileWidth, getTilingMode, isCompressionLossless, setCompressionMode, setCompressionQuality, setCompressionType, setProgressiveMode, setTilingMode, unsetCompression, unsetTiling
activateController, getController, getDefaultController, getDestinationOffset, getDestinationType, getSourceBands, getSourceRegion, getSourceXSubsampling, getSourceYSubsampling, getSubsamplingXOffset, getSubsamplingYOffset, hasController, setController, setDestinationOffset, setDestinationType, setSourceRegion
public J2KImageWriteParamJava(RenderedImage imgsrc, Locale locale)
public J2KImageWriteParamJava(IIOImage image, ImageWriteParam param)
public J2KImageWriteParamJava()
J2KImageWriteParamJava
object with default
values for all parameters.public J2KImageWriteParamJava(RenderedImage imgsrc)
J2KImageWriteParamJava
object with default
values for all parameters.public J2KImageWriteParamJava(Raster raster)
J2KImageWriteParamJava
object with default
values for all parameters.public void setEncodingRate(double rate)
encodingRate
public double getEncodingRate()
encodingRate
public void setLossless(boolean lossless)
lossless
public boolean getLossless()
encodingRate
public void setPacketPerTilePart(int packetPerTilePart)
packetPerTilePart
public int getPacketPerTilePart()
packetPerTilePart
public void setPackPacketHeaderInTile(boolean packPacketHeaderInTile)
packPacketHeaderInTile
public boolean getPackPacketHeaderInTile()
packPacketHeaderInTile
public void setPackPacketHeaderInMain(boolean packPacketHeaderInMain)
packPacketHeaderInMain
public boolean getPackPacketHeaderInMain()
packPacketHeaderInMain
public void setAlignROI(boolean align)
alignROI
public boolean getAlignROI()
alignROI
public MaxShiftSpec getROIs()
ROIs
public void setQuantizationType(String values)
quantizationType
public QuantTypeSpec getQuantizationType()
quantizationType
public void setQuantizationStep(String values)
quantizationStep
public QuantStepSizeSpec getQuantizationStep()
quantizationStep
public void setGuardBits(String values)
guardBits
public GuardBitsSpec getGuardBits()
guardBits
public void setFilters(String values)
filters
public AnWTFilterSpec getFilters()
filters
public void setDecompositionLevel(String values)
decompositionLevel
public IntegerSpec getDecompositionLevel()
decompositionLevel
public void setComponentTransformation(String values)
componentTransformation
public ForwCompTransfSpec getComponentTransformation()
componentTransformation
public void setMethodForMQLengthCalc(String values)
methodForMQLengthCalc
public StringSpec getMethodForMQLengthCalc()
methodForMQLengthCalc
public void setMethodForMQTermination(String values)
methodForMQTermination
public StringSpec getMethodForMQTermination()
methodForMQTermination
public void setCodeSegSymbol(String values)
codeSegSymbol
public StringSpec getCodeSegSymbol()
codeSegSymbol
public void setCausalCXInfo(String values)
causalCXInfo
public StringSpec getCausalCXInfo()
causalCXInfo
public void setTerminateOnByte(String values)
terminateOnByte
public StringSpec getTerminateOnByte()
terminateOnByte
public void setResetMQ(String values)
resetMQ
public StringSpec getResetMQ()
resetMQ
public StringSpec getBypass()
bypass
public void setCodeBlockSize(String values)
codeBlockSize
public CBlkSizeSpec getCodeBlockSize()
codeBlockSize
public void setPrecinctPartition(String values)
precinctPartition
public PrecinctSizeSpec getPrecinctPartition()
precinctPartition
public StringSpec getSOP()
SOP
public StringSpec getEPH()
EPH
public void setProgressionName(String values)
progressionName
public String getProgressionName()
progressionType
public void setProgressionType(LayersInfo lyrs, String values)
progressionType
public ProgressionSpec getProgressionType()
progressionType
public void setStartLevelROI(int value)
startLevelROI
public int getStartLevelROI()
startLevel
public void setMinX(int minX)
minX
public int getMinX()
minX
public void setMinY(int minY)
minY
public int getMinY()
minY
public int getNumTiles()
public int getNumComponents()
public void setSourceBands(int[] bands)
setSourceBands
in class IIOParam
public void setTiling(int tw, int th, int xOff, int yOff)
setTiling
in class ImageWriteParam
public void setSourceSubsampling(int sx, int sy, int xOff, int yOff)
setSourceSubsampling
in class IIOParam
Copyright © 2014. All rights reserved.