public class ROIScaler extends ImgDataAdapter implements CBlkQuantDataSrcEnc
The ROI method is the Maxshift method. The ROIScaler works by scaling the quantized wavelet coefficients that do not affect the ROI (i.e background coefficients) so that these samples get a lower significance than the ROI ones. By scaling the coefficients sufficiently, the ROI coefficients can be recognized by their amplitude alone and no ROI mask needs to be generated at the decoder side.
The source module must be a quantizer and code-block's data is exchange with thanks to CBlkWTData instances.
Quantizer
,
CBlkWTData
Modifier and Type | Field and Description |
---|---|
static char |
OPT_PREFIX
The prefix for ROI Scaler options: 'R'
|
imgdatasrc, tIdx
Constructor and Description |
---|
ROIScaler(Quantizer src,
ROIMaskGenerator mg,
boolean roi,
int sLev,
boolean uba,
J2KImageWriteParamJava wp)
Constructor of the ROI scaler, takes a Quantizer as source of data to
scale.
|
Modifier and Type | Method and Description |
---|---|
static ROIScaler |
createInstance(Quantizer src,
J2KImageWriteParamJava wp)
Creates a ROIScaler object.
|
SubbandAn |
getAnSubbandTree(int t,
int c)
Returns a reference to the subband tree structure representing the
subband decomposition for the specified tile-component.
|
boolean |
getBlockAligned()
This function returns the blockAligned flag
|
int |
getCbULX()
Returns the horizontal offset of the code-block partition.
|
int |
getCbULY()
Returns the vertical offset of the code-block partition.
|
CBlkWTData |
getNextCodeBlock(int n,
CBlkWTData cblk)
This function gets a datablk from the entropy coder.
|
CBlkWTData |
getNextInternCodeBlock(int c,
CBlkWTData cblk)
This function gets a datablk from the entropy coder.
|
static String[][] |
getParameterInfo()
Returns the parameters that are used in this class and
implementing classes.
|
ROIMaskGenerator |
getROIMaskGenerator()
This function returns the ROI mask generator.
|
boolean |
isReversible(int t,
int c)
Since ROI scaling is always a reversible operation, it calls
isReversible() method of it source (the quantizer module).
|
void |
nextTile()
Advances to the next tile, in standard scan-line order (by rows then
columns).
|
protected static Vector |
parseROIs(String roiopt,
int nc,
Vector roiVector)
This function parses the values given for the ROIs with the argument
-Rroi.
|
void |
setTile(int x,
int y)
Changes the current tile, given the new indexes.
|
boolean |
useRoi()
This function returns the flag indicating if any ROI functionality used
|
getCompImgHeight, getCompImgWidth, getCompSubsX, getCompSubsY, getCompULX, getCompULY, getImgHeight, getImgULX, getImgULY, getImgWidth, getNomRangeBits, getNomTileHeight, getNomTileWidth, getNumComps, getNumTiles, getNumTiles, getTile, getTileCompHeight, getTileCompWidth, getTileHeight, getTileIdx, getTilePartULX, getTilePartULY, getTileWidth
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getCompImgHeight, getCompImgWidth, getCompSubsX, getCompSubsY, getCompULX, getCompULY, getImgHeight, getImgULX, getImgULY, getImgWidth, getNomRangeBits, getNomTileHeight, getNomTileWidth, getNumComps, getNumTiles, getNumTiles, getTile, getTileCompHeight, getTileCompWidth, getTileHeight, getTileIdx, getTilePartULX, getTilePartULY, getTileWidth
public static final char OPT_PREFIX
public ROIScaler(Quantizer src, ROIMaskGenerator mg, boolean roi, int sLev, boolean uba, J2KImageWriteParamJava wp)
src
- The quantizer that is the source of data.mg
- The mask generator that will be used for all componentsroi
- Flag indicating whether there are rois specified.sLev
- The resolution levels that belong entirely to ROIuba
- Flag indicating whether block aligning is used.encSpec
- The encoder specifications for addition of roi specspublic boolean isReversible(int t, int c)
isReversible
in interface ForwWTDataProps
t
- The tile to test for reversibilityc
- The component to test for reversibilitypublic SubbandAn getAnSubbandTree(int t, int c)
getAnSubbandTree
in interface ForwWTDataProps
t
- The index of the tile.c
- The index of the component.SubbandAn
,
Subband
public int getCbULX()
getCbULX
in interface ForwWTDataProps
public int getCbULY()
getCbULY
in interface ForwWTDataProps
public static ROIScaler createInstance(Quantizer src, J2KImageWriteParamJava wp)
The ROI Scaler creates a ROIMaskGenerator depending on what ROI information is in the J2KImageWriteParamJava. If only rectangular ROI are used, the fast mask generator for rectangular ROI can be used.
src
- The source of data to scalepl
- The parameter list (or options).encSpec
- The encoder specifications for addition of roi specsIllegalArgumentException
- If an error occurs while parsing
the options in 'pl'protected static Vector parseROIs(String roiopt, int nc, Vector roiVector)
A rectangular ROI is indicated by a 'R' followed the coordinates for the upper left corner of the ROI and then its width and height.
A circular ROI is indicated by a 'C' followed by the coordinates of the circle center and then the radius.
Before the R and C values, the component that are affected by the ROI are indicated.
roiopt
- The info on the ROIsnc
- number of componentsroiVector
- The vcector containing the ROI parsed from the cmd linepublic CBlkWTData getNextCodeBlock(int n, CBlkWTData cblk)
The function calls on a ROIMaskGenerator to get the mask for scaling the coefficients in the current block.
The data returned by this method is a copy of the orignal data. Therfore it can be modified "in place" without any problems after being returned. The 'offset' of the returned data is 0, and the 'scanw' is the same as the code-block width. See the 'CBlkWTData' class.
getNextCodeBlock
in interface CBlkQuantDataSrcEnc
n
- The component for which to return the next code-block.cblk
- If non-null this object will be used to return the new
code-block. If null a new one will be allocated and returned. If the
"data" array of the object is non-null it will be reused, if possible,
to return the data.CBlkWTData
public CBlkWTData getNextInternCodeBlock(int c, CBlkWTData cblk)
The function calls on a ROIMaskGenerator to get the mask for scaling the coefficients in the current block.
getNextInternCodeBlock
in interface CBlkQuantDataSrcEnc
c
- The component for which to return the next code-block.cblk
- If non-null this object will be used to return the new
code-block. If null a new one will be allocated and returned. If the
"data" array of the object is non-null it will be reused, if possible,
to return the data.CBlkWTData
public ROIMaskGenerator getROIMaskGenerator()
public boolean getBlockAligned()
public boolean useRoi()
public static String[][] getParameterInfo()
public void setTile(int x, int y)
setTile
in interface ImgData
setTile
in class ImgDataAdapter
x
- The horizontal index of the tile.y
- The vertical index of the new tile.public void nextTile()
nextTile
in interface ImgData
nextTile
in class ImgDataAdapter
Copyright © 2015–2022 SCIFIO. All rights reserved.