com.c3d.image.hips
Class HipsFloatImage

java.lang.Object
  |
  +--com.c3d.image.hips.HipsImage
        |
        +--com.c3d.image.hips.HipsFloatImage

public class HipsFloatImage
extends HipsImage

Read in a floating point HIPS image, with all its frames into memory. It is assumed that the raw data is in Windows format, so the bytes on all the floats are swapped. This is a bug and a test should be made to determine the byte order before trying to read the data.


Fields inherited from class com.c3d.image.hips.HipsImage
BUFSIZ, cols_, fcol_, frow_, isDataLoaded_, num_frame_, numcolor_, ocols_, orig_date_, orig_name_, orows_, params_, PFAHC, PFAHC3, PFASCII, PFBQ, PFBT, PFBYTE, PFCHAIN, PFCOLVEC, PFCOMPLEX, PFDBLCOM, PFDOUBLE, PFDVFFT2D, PFDVFFT3D, PFDVVFFT3D, PFFLOAT, PFFLOATPYR, PFGEN, PFGRLE, PFHIST, PFINT, PFINTPYR, PFLSBF, PFLUT, PFMIXED, PFMSBF, PFOCT, PFPOLAR, PFPOLYLINE, PFQUAD, PFQUAD1, PFRGB, PFRGBZ, PFRGISPLINE, PFRGPLINE, PFRLEB, PFRLED, PFRLEW, PFSBYTE, PFSHORT, PFSPAN, PFSRLE, PFSTEREO, PFUINT, PFUKOOA, PFUSHORT, PFVFFT2D, PFVFFT3D, PFVVFFT3D, pixel_format_, PLOT3D, rows_, seq_desc_, seq_history_, seq_name_, sizedesc_, sizehist_
 
Constructor Summary
HipsFloatImage(HipsByteImage image)
          Create a HipsFloatImage from a HipsByteImage.
HipsFloatImage(HipsPoint3fImage image)
          Used in the conversion of Point3f image, not for public consumption
HipsFloatImage(java.io.InputStream in)
          Load from a DataInput stream.
HipsFloatImage(int w, int h, int nImages, int nFramesPerImage)
           
HipsFloatImage(java.lang.String fileName)
          Load from a file.
 
Method Summary
 float[] getFrame(int i)
           
 float[][] getFrames()
          Return all frames
 float[] getPixel(float x, float y, int imageIndex)
          Return the pixel at the specified location and in the specified image in the sequence.
 float[] getPixel(int xi, int yi, int imageIndex)
          Return the pixel at the specified location and in the specified image in the sequence.
 float getPixelFrame(float x, float y, int frame)
          Return the pixel at the specified location and in the specified frame in the sequence.
static void main(java.lang.String[] args)
           
 int[] rgbPixels(int imageIndex)
          Output an image in the direct colour model of java.
 HipsImage scale(double xScale, double yScale)
           
 HipsImage subImage(int srcX, int srcY, int width, int height)
           
protected  void writeData(java.io.OutputStream out)
           
 
Methods inherited from class com.c3d.image.hips.HipsImage
b2i, bilinearInterp, byte2pixels, byte2pixels, cols, copyFrom, fcol, finishLine, frow, getHeight, getParam, getWidth, i2b, int2pixels, int2pixels, isDataLoaded, isMSB, num_frame, numcolor, numImage, numparam, numpix, orig_date, orig_name, params, pixel_format, readFrame, readFromStream, readLine, rows, seq_desc, seq_history, seq_name, setMSB, setParam, sizedesc, sizehist, sizeimage, sizepix, swab, swab2, writeBytes, writeFrame, writeLine, writeToFile, writeToStream
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HipsFloatImage

public HipsFloatImage(java.io.InputStream in)
               throws HipsException,
                      java.io.IOException
Load from a DataInput stream. The stream is left open
Parameters:
in - Input stream from which image is read

HipsFloatImage

public HipsFloatImage(java.lang.String fileName)
               throws HipsException,
                      java.io.FileNotFoundException,
                      java.io.IOException
Load from a file.
Parameters:
The - filename in the conventions fo the local file system

HipsFloatImage

public HipsFloatImage(HipsPoint3fImage image)
Used in the conversion of Point3f image, not for public consumption

HipsFloatImage

public HipsFloatImage(HipsByteImage image)
Create a HipsFloatImage from a HipsByteImage. The pixel values are copied across directy, assuming that they are unsigned bytes

HipsFloatImage

public HipsFloatImage(int w,
                      int h,
                      int nImages,
                      int nFramesPerImage)
Method Detail

writeData

protected void writeData(java.io.OutputStream out)
                  throws java.io.IOException
Overrides:
writeData in class HipsImage

subImage

public HipsImage subImage(int srcX,
                          int srcY,
                          int width,
                          int height)
Overrides:
subImage in class HipsImage

getPixel

public float[] getPixel(int xi,
                        int yi,
                        int imageIndex)
Return the pixel at the specified location and in the specified image in the sequence. All images (even mono ones) return three values. When the image is mono all three values are the same.
Parameters:
xi - The x-location (column) of the pixel
yi - The y-location (row) of the pixel
imageIndex - The index of the image in the sequence (starting at 0) for which the pixel value is required.
Returns:
Three floating point numbers.
Overrides:
getPixel in class HipsImage

getPixel

public float[] getPixel(float x,
                        float y,
                        int imageIndex)
Return the pixel at the specified location and in the specified image in the sequence. All images (even mono ones) return three values. When the image is mono all three values are the same.

Bilinear interpolation is used to obtain the value of pixels at non-integral locations.

Parameters:
x - The x-location (column) of the pixel
y - The y-location (row) of the pixel
imageIndex - The index of the image in the sequence (starting at 0) for which the pixel value is required.
Returns:
Three floating point numbers.
Overrides:
getPixel in class HipsImage

getPixelFrame

public float getPixelFrame(float x,
                           float y,
                           int frame)
Return the pixel at the specified location and in the specified frame in the sequence.

Bilinear interpolation is used to obtain the value of pixels at non-integral locations.

Parameters:
x - The x-location (column) of the pixel
y - The y-location (row) of the pixel
frame - The index of the frame in the sequence (starting at 0) for which the pixel value is required.
Returns:
A float indiicating the interpolated value

getFrame

public float[] getFrame(int i)

getFrames

public float[][] getFrames()
Return all frames
Returns:
The image data

rgbPixels

public int[] rgbPixels(int imageIndex)
                throws HipsException
Output an image in the direct colour model of java. Convert each frame to the range 0-255 first before converting to pixels, coded in the normal way. from the signed form of pixels to an unsigned representation before packing into an integer.
Parameters:
x - the x-location (column) of the pixel
y - the y-location (row) of the pixel
frame - The image being indexex
Returns:
a Java direct color pixel
Overrides:
rgbPixels in class HipsImage

scale

public HipsImage scale(double xScale,
                       double yScale)
Overrides:
scale in class HipsImage

main

public static void main(java.lang.String[] args)