com.c3d.image.hips
Class HipsShortImage

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

public class HipsShortImage
extends HipsImage

Read in a short format 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 shorts are swapped.


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
HipsShortImage(HipsByteImage image)
          Create a HipsShortImage from a HipsByteImage.
HipsShortImage(java.io.InputStream in)
          Load from a DataInput stream.
HipsShortImage(int w, int h, int nImages, int nFramesPerImage)
           
HipsShortImage(java.lang.String fileName)
          Load from a file.
 
Method Summary
 short[] getFrame(int i)
           
 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.
 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)
           
 HipsByteImage toHipsByteImage(int topBit)
          Convert a short image to a byte image, with the top bit being topBit.
 HipsFloatImage toHipsFloatImage()
          Convert a short image to a float image.
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, main, 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

HipsShortImage

public HipsShortImage(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

HipsShortImage

public HipsShortImage(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

HipsShortImage

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

HipsShortImage

public HipsShortImage(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

toHipsByteImage

public HipsByteImage toHipsByteImage(int topBit)
Convert a short image to a byte image, with the top bit being topBit. If topBit is 8 for example we take the bottom 8 bits of the image, if 16 the top bits. For 12-bit cameras topBit will be 12.

toHipsFloatImage

public HipsFloatImage toHipsFloatImage()
Convert a short image to a float image. The integral value goes straight to float

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 short[] getFrame(int i)

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