|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object eap.fits.FitsData eap.fits.FitsImageData
Represents the data in the primary HDU of an image extension.
The philosophy of this package is to represent FITS data in ways that are
natural to Java. So for example, a table is represented as a Swing TableModel.
Although the representation of images in Java has evolved over the years, this
class follows the old ImageProducer/ImageConsumer paradigm of treating
images a data streams. The problem is that that paradigm only handled
integer pixel values. So I invented a similar set of interfaces:
RealImageProducer
and RealImageConsumer
, and an
ImageDigitizer
class which can convert from real to integer images.
Another issue is that displayable images are two-dimensional, while FITS image can have any number of dimensions. So we need a mechanism for making two dimensional slices through the FITS data array.
So you use the following proceedure to display an image:
RealImageProducer
with createView(int, int, int[])
or
createView()
ImageDigitizer
and register it as a consumer of
the producer you just created.
It made sense to treat images as data streams back when computers had less memory and connections to the internet had less bandwidth. However, Java has evolved to the simpler BufferedImage paradigm, where the pixel data are held in memory. So at some point I plan to modify this class to be more like a DataBuffer. It also might be nice to make an image implement the TableModel interface, to give tabular access to the pixels.
Field Summary |
Fields inherited from class eap.fits.FitsData |
data, interpreter, isComplete, PADDING, setter, valid_bytes |
Constructor Summary | |
FitsImageData()
make an empty image. |
|
FitsImageData(FitsHeader header)
Create an image as specified by the given HDU header |
|
FitsImageData(int bitpix,
boolean isReal,
int[] dimen)
Create an image from a set of image characteristics |
Method Summary | |
FitsHeader |
createHeader(String name)
create the minimum header needed for this image. |
RealImageProducer |
createView()
create a new view of this image which is the first plane of the first two axes. |
RealImageProducer |
createView(int x_axis,
int y_axis,
int[] plane)
create a new view of this image. |
double |
getNextPixel()
returns the scaled value of the pixel currently pointed to by the reader |
Number |
getNextRawPixel()
returns the unscaled value of the pixel currently pointed to by the reader |
void |
goToPixel()
set the internal pointer to the first pixel in the image |
void |
goToPixel(int[] coord)
set the internal pointer so the interpreter will read a given pixel next |
double |
max()
returns the maximum pixel value in the image. |
double |
min()
returns the minimum pixel value in the image. |
int |
pixelCount()
returns the total number of pixels in the image |
void |
removeView(eap.fits.FitsImageData.View view)
remove a view from the internal registry. |
void |
setValidBytes(int valid_bytes)
update the number of valid bytes. |
Methods inherited from class eap.fits.FitsData |
available, blockCount, createFrom, data, goToByte, incrementValidBytes, isComplete |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public FitsImageData(FitsHeader header) throws FitsException
header
- the HDU header which defined the image
FitsException
- if there is a problem with the FITS formatpublic FitsImageData(int bitpix, boolean isReal, int[] dimen) throws FitsException
bitpix
- the number of bits per pixel. Note this should always be positive
even though FITS uses a negative BITPIX to indicate real valued pixels.isReal
- true if the pixels should have floating point values.dimen
- an array of image dimensions
FitsException
- if invalid values are given. For example only certain
values of bitpix are allowed.public FitsImageData() throws FitsException
Method Detail |
public int pixelCount()
public double min() throws FitsException
FitsException
public double max() throws FitsException
FitsException
public void setValidBytes(int valid_bytes) throws FitsException
setValidBytes
in class FitsData
valid_bytes
- the new number of valid bytes in the raw data array
FitsException
- never, however subclasses may do so.FitsFile.getHDU(int, int)
public RealImageProducer createView(int x_axis, int y_axis, int[] plane) throws FitsException
x_axis
- the index of the horizontal axis in the slice.
This index counts from zero.y_axis
- the index of the vertical axis in the slice.
This index counts from zero.plane
- an array indicating the coordinates at which to slide the data
cube. For instance for a three dimensional image data array, if
x_axis=0 and Y_axis=1, then if plane = {0, 0, 10} then the slice
will be those pixels values with the third coordinates equals to 10.
In this case the first two elements of plane are ignored.
FitsException
public RealImageProducer createView() throws FitsException
FitsException
public void removeView(eap.fits.FitsImageData.View view)
public void goToPixel(int[] coord)
public void goToPixel()
public Number getNextRawPixel() throws FitsException
FitsException
public double getNextPixel() throws FitsException
FitsException
public FitsHeader createHeader(String name)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |