|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectuk.ac.starlink.jaiutil.SimpleRenderedImage
uk.ac.starlink.jaiutil.HDXImage
public class HDXImage
This is the core class for JAI HDX/NDX support. It handles the conversion between the HDX->NDX->NDArrays and the display data. The data array is displayed by default.
This class defines a number of properties that can be accessed by applications via the getProperty method.
The value of the property "#hdx_image" returns the HDXImage object managing the image data.
The value of the property "#num_pages" returns an Integer with the number of NDXs in the HDX structure (always 1 at present).
The "#preview_image" property returns a preshrunk preview image suitable for use in a pan window. The size of the preview image may be set by calling the static method HDXImage.setPreviewSize(int).
Field Summary | |
---|---|
protected long[] |
axes
The axes. |
protected int |
dataType
The type of the data buffer (DataBuffer.TYPE_BYTE, ...) |
protected static int |
defaultTileHeight
Default tile height |
protected static int |
defaultTileWidth
Default tile width |
protected boolean |
empty
True if the image is empty? |
protected NDArray |
ndArray
Current NDArray, this is either the data, variance or quality of an NDX. |
protected NDArrayData |
ndArrayData
Object used to manage data type specific operations |
protected int |
ndxIndex
Index of the current NDX. |
protected List |
ndxs
List of the NDXs (current one). |
protected HDXDecodeParam |
param
Contains caller parameters (TODO: could specify component?). |
protected static int |
previewSize
Requested size of the preview image (width, height - actual size will vary) |
protected javax.media.jai.TileCache |
tileCache
Object used to cache tiles |
Fields inherited from class uk.ac.starlink.jaiutil.SimpleRenderedImage |
---|
colorModel, height, minX, minY, properties, sampleModel, sources, tileGridXOffset, tileGridYOffset, tileHeight, tileWidth, width |
Constructor Summary | |
---|---|
HDXImage(Document document,
HDXDecodeParam param,
int page)
Create a HDXImage from a w3c Document. |
|
HDXImage(Element element,
int page)
Create a HDXImage from a w3c Element |
|
HDXImage(Ndx ndx)
Construct a HDXImage from a NDX. |
|
HDXImage(com.sun.media.jai.codec.SeekableStream input,
HDXDecodeParam param,
int page)
Construct a HDXImage. |
|
HDXImage(Source source)
Construct a HDXImage. |
|
HDXImage(String fileOrUrl)
Construct a HDXImage from a file or URL. |
Method Summary | |
---|---|
void |
clearTileCache()
Try to save memory by clearing out the tile cache for this image. |
void |
close()
Close the current "HDX". |
protected Raster |
fillTile(Raster tile)
This method fills the given tile with the appropriate image data. |
double |
getBadValue()
Return the Bad pixel value for the current NDArray. |
Ndx |
getCurrentNDX()
Get a reference to the current NDX. |
int |
getCurrentNDXIndex()
Return the index of the current NDX |
static int |
getDefaultTileHeight()
|
static int |
getDefaultTileWidth()
|
int |
getNumNDXs()
Return the number of NDXs in the HDX structure. |
protected javax.media.jai.TiledImage |
getPreviewImage(int size)
Return a prescaled PlanarImage that fits entirely in a window of the given size, or null if there are any errors. |
static int |
getPreviewSize()
Return the requested size for the preview image |
Object |
getProperty(String name)
Gets a property from the property set of this HDX structure. |
String[] |
getPropertyNames()
Returns a list of property names that are recognized by this image. |
int |
getRealHeight()
Returns the real height of the image. |
int |
getRealWidth()
Returns the real width of the image. |
float |
getScale()
Return the current scale factor (zooming out is handled here for performance reasons). |
protected BufferedInputStream |
getStream(String fileOrUrl)
Return a BufferedInputStream for the given file or URL. |
int |
getSubsample()
Return the increment to use when accessing the image data if scale is less than 1. |
Raster |
getTile(int tileX,
int tileY)
Generate and return the given tile (required by the RenderedImage interface). |
protected URL |
getURL(String fileOrUrl)
Return a URL for the given file or URL string. |
ColorModel |
initColorModel()
Set the colormodel to use to display FITS images. |
void |
initData()
Create an object to manage the data based on the type and set the value of the dataType member variable to the correct DataBuffer constant to use for the sample model. |
SampleModel |
initSampleModel(int tileWidth,
int tileHeight)
Return a SampleModel for this image with the given tile width and height. |
static void |
setDefaultTileHeight(int h)
|
static void |
setDefaultTileWidth(int w)
|
void |
setNDX(int num)
Set the current NDX from those available. |
static void |
setPreviewSize(int i)
Set the requested size for the preview image |
boolean |
setScale(float scale)
Set the scale (zoom factor) for the image and return true if a new image was generated. |
Methods inherited from class uk.ac.starlink.jaiutil.SimpleRenderedImage |
---|
copyData, getBounds, getColorModel, getData, getData, getHeight, getMaxTileX, getMaxTileY, getMaxX, getMaxY, getMinTileX, getMinTileY, getMinX, getMinY, getNumXTiles, getNumYTiles, getPropertyNames, getSampleModel, getSources, getTileGridXOffset, getTileGridYOffset, getTileHeight, getTileWidth, getWidth, tileXToX, tileXToX, tileYToY, tileYToY, XToTileX, XToTileX, YToTileY, YToTileY |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected List ndxs
protected NDArray ndArray
protected NDArrayData ndArrayData
protected long[] axes
protected int ndxIndex
protected int dataType
protected static int defaultTileWidth
protected static int defaultTileHeight
protected javax.media.jai.TileCache tileCache
protected HDXDecodeParam param
protected static int previewSize
protected boolean empty
Constructor Detail |
---|
public HDXImage(com.sun.media.jai.codec.SeekableStream input, HDXDecodeParam param, int page) throws IOException
input
- the SeekableStream for the HDX XML description.param
- the parameter passed to the JAI create methodpage
- specifies the desired NDX, these are just
discovered in their natural order starting at 0.
IOException
public HDXImage(Source source) throws IOException
source
- a Source containing an HDX document.
IOException
public HDXImage(String fileOrUrl) throws IOException
fileOrURL
- the file name or URL
IOException
public HDXImage(Ndx ndx) throws IOException
ndx
- the Ndx reference.
IOException
public HDXImage(Document document, HDXDecodeParam param, int page) throws IOException
Document
- HDX structureparam
- the parameter passed to the JAI create methodpage
- specifies the desired NDX (default: 0)
IOException
public HDXImage(Element element, int page) throws IOException
Document
- HDX DOM structure containing an NDX.page
- specifies the desired NDX (default: 0)
IOException
Method Detail |
---|
public int getCurrentNDXIndex()
protected BufferedInputStream getStream(String fileOrUrl) throws IOException
IOException
protected URL getURL(String fileOrUrl) throws MalformedURLException
MalformedURLException
public int getNumNDXs()
public void setNDX(int num) throws IOException
num
- The NDX number (starts at 0).
IOException
public void close() throws IOException
IOException
public double getBadValue()
public static void setDefaultTileWidth(int w)
public static int getDefaultTileWidth()
public static void setDefaultTileHeight(int h)
public static int getDefaultTileHeight()
public void clearTileCache()
public Object getProperty(String name)
getProperty
in interface RenderedImage
getProperty
in class SimpleRenderedImage
name
- the name of the property to get, as a String.
public String[] getPropertyNames()
getPropertyNames
in interface RenderedImage
getPropertyNames
in class SimpleRenderedImage
protected javax.media.jai.TiledImage getPreviewImage(int size)
public ColorModel initColorModel()
public SampleModel initSampleModel(int tileWidth, int tileHeight)
public void initData() throws IOException
IOException
public Raster getTile(int tileX, int tileY)
tileX
- the X index of the requested tile in the tile array.tileY
- the Y index of the requested tile in the tile array.
protected Raster fillTile(Raster tile)
public static void setPreviewSize(int i)
public static int getPreviewSize()
public Ndx getCurrentNDX()
public int getRealWidth()
public int getRealHeight()
public boolean setScale(float scale) throws IOException
Note that zooming out is handled here for performance reasons, to avoid having to read in whole tiles, only to discard most of the data later. Zooming in should be handled in the image viewer widget at the end of the image processing chain.
scale
- the scale factor (a value of less than 1.0 means
the image is zoomed out and is handled specially here)
IOException
public float getScale()
public int getSubsample()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |