cds.aladin
Class AladinData

java.lang.Object
  extended by cds.aladin.AladinData

public class AladinData
extends java.lang.Object

Aladin stack plane access for plugins.

This class allows Aladin compatible plugins to access the stack plane data. An Aladin compatible plugin must extend the AladinPlugin class. In a plugin, the current usage is to get an AladinData object from one of these Aladin methods.
  1. AladinData ad = aladin.getAladinData(String planeLabel)
    => return the AladinData object corresponding to the plane called planeLabel
  2. AladinData ad = aladin.getAladinData()
    => return the AladinData object corresponding to the first selected plane in the stack
  3. AladinData ad = aladin.getAladinImage()
    => return the AladinData object corresponding to current image stack plane (the background image)
  4. AladinData ad = aladin.createAladinData(String planeLabel)
    => create a new (image) stack plane and return its corresponding AladinData object.

Version:
1.2 : january 2009 - isOn(), isReady(), 1.1 : november 2006 - calibration manipulation adds, 1.0 : october 2006 - creation
Author:
Pierre Fernique [CDS]

Constructor Summary
AladinData(Aladin aladin)
          Aladin plane data for the first selected plane in the stack (from the top)
AladinData(Aladin aladin, int planeHashCode)
          Aladin plane data for the specified plane
AladinData(Aladin aladin, int mode, java.lang.String name)
          Aladin plane data creation and/or simple access.
AladinData(Aladin aladin, java.lang.String name)
          Aladin plane data for the specified plane
 
Method Summary
 Obj addSource(java.lang.String id, double ra, double dec, java.lang.String[] value)
          FOR ADVANCED DEVELOPERS ONLY !
 void bytePixelsModified()
          FOR ADVANCED DEVELOPERS ONLY !
 void codedPixelsModified()
          FOR ADVANCED DEVELOPERS ONLY !
static double CodedPixelsToDouble(byte[] codedPixels, int bitpix, int pos)
          FOR ADVANCED DEVELOPERS ONLY !
static void DoubleToCodedPixels(double val, byte[] codedPixels, int bitpix, int pos)
          FOR ADVANCED DEVELOPERS ONLY !
 void fitsKeysModified()
          FOR ADVANCED DEVELOPERS ONLY !
 double[] getCoord(double x, double y)
          Return the J2000 coordinates for a x,y position according to the image astrometrical calibration This method is dedicated to the image planes
 double[][][] getCube()
          Return the cube pixels.
 double[][][] getCube(int x, int y, int z, int width, int height, int depth)
          Extract a sub-cube.
 int getDepth()
          Return the cube depth This method is dedicated to the blink or cube planes
 java.lang.String getError()
          Return the last error message associated to the plane
 int getFitsBitPix()
          Return the image coding in FITS standard.
 double getFitsBscale()
          Return the BSCALE value of the original pixels.
 double getFitsBzero()
          Return the BZERO value of the original pixels.
 java.lang.String getFitsHeader()
          Return the Fits header as a String.
 int getHeight()
          Return the image height This method is dedicated to the image planes
 java.lang.String getLabel()
          Return the plane label
 int getNbObj()
          FOR ADVANCED DEVELOPERS ONLY !
 java.lang.String getOrigin()
          Return the origin of the plane
 double getPixel(int x, int y)
          Return the full pixel value convert in double for a dedicated position.
 double getPixel(int x, int y, int z)
          Return the full pixel value from a cube convert in double for a dedicated position.
 double[][] getPixels()
          Return a copy of the image pixels in doubles This method is dedicated to the image planes
 int getPlaneHashCode()
          return the plane internal hashCode (never modified during the Aladin session)
 java.lang.String getPlaneType()
          Return the plane type.
 java.net.URL getUrl()
          Return the url from where the plane has been built
 int getWidth()
          Return the image width This method is dedicated to the image planes
 double[] getXY(double ra, double dec)
          Return the x,y pixel coordinates for a ra,dec J2000 postion according to the image astrometrical calibration.
 boolean isOn()
          Return true if the plane is activated
 boolean isReady()
          Return true if the plane is ready
 boolean isSelected()
          Return true if the plane is selected
 void objModified()
          FOR ADVANCED DEVELOPERS ONLY !
 void rmObj(Obj obj)
          FOR ADVANCED DEVELOPERS ONLY !
 byte[] seeBytePixels()
          FOR ADVANCED DEVELOPERS ONLY !
 byte[] seeBytePixels(int z)
          FOR ADVANCED DEVELOPERS ONLY !
 byte[] seeCodedPixels()
          FOR ADVANCED DEVELOPERS ONLY !
 java.util.Hashtable seeFitsKeys()
          FOR ADVANCED DEVELOPERS ONLY !
 Obj[] seeObj()
          FOR ADVANCED DEVELOPERS ONLY !
 void setDatatype(java.lang.String[] datatype)
          FOR ADVANCED DEVELOPERS ONLY !
 void setFitsHeader(java.lang.String header)
          Replace original Fits header, and modify the astrometrical projection according to the WCS keys in this new Fits header.
 void setName(java.lang.String[] name)
          FOR ADVANCED DEVELOPERS ONLY !
 void setPixels(double[][] pixels)
          Replace the original image pixel values.
 void setPixels(double[][] pixels, int bitpix)
          Replace the original image and possibly modify its internal coding (byte,integer,float..)
 void setUCD(java.lang.String[] ucd)
          FOR ADVANCED DEVELOPERS ONLY !
 void setUnit(java.lang.String[] unit)
          FOR ADVANCED DEVELOPERS ONLY !
 void setWidth(java.lang.String[] width)
          This method is dedicated to the overlay planes and specifically source planes For providing a fast and direct way for creating overlay source plane.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AladinData

public AladinData(Aladin aladin)
           throws AladinException
Aladin plane data for the first selected plane in the stack (from the top)

Parameters:
aladin - Aladin object reference
Throws:
AladinException

AladinData

public AladinData(Aladin aladin,
                  java.lang.String name)
           throws AladinException
Aladin plane data for the specified plane

Parameters:
aladin - Aladin object reference
name - plane label as displayed in the Aladin stack or plane number (The bottom one is 1)
Throws:
AladinException

AladinData

public AladinData(Aladin aladin,
                  int planeHashCode)
           throws AladinException
Aladin plane data for the specified plane

Parameters:
aladin - Aladin object reference
planeHashCode - plane hashCode (see getPlaneHashCode())
Throws:
AladinException

AladinData

public AladinData(Aladin aladin,
                  int mode,
                  java.lang.String name)
           throws AladinException
Aladin plane data creation and/or simple access.

Parameters:
aladin - aladin object reference
mode - Plan mode: 0-get a plane, 1-create a new image, 2-create a new catalog
name - plane name for mode 0 (as displayed in the Aladin stack)
Throws:
AladinException
Method Detail

getPlaneHashCode

public int getPlaneHashCode()
return the plane internal hashCode (never modified during the Aladin session)

Returns:
the unique plane hashCode

getLabel

public java.lang.String getLabel()
Return the plane label

Returns:
the plane label

getOrigin

public java.lang.String getOrigin()
Return the origin of the plane

Parameters:
the - origin of the plane

getUrl

public java.net.URL getUrl()
Return the url from where the plane has been built

Returns:
the url of the plane

getError

public java.lang.String getError()
Return the last error message associated to the plane

Returns:
the error message, or null

getPlaneType

public java.lang.String getPlaneType()
Return the plane type. The possibilities are the following: Image, Image/RGB, Image/Mosaic, Image/Blink, Image/Cube, Image/Resampled Overlay/Catalog, Overlay/Tool", Overlay/Aperture, Overlay/Filter, Overlay/Image FoV, Folder

Returns:

isSelected

public boolean isSelected()
Return true if the plane is selected

Returns:
true if the plane is selected

isOn

public boolean isOn()
Return true if the plane is activated

Returns:
true if the plane is activated

isReady

public boolean isReady()
Return true if the plane is ready

Returns:
true if the plane is ready

getPixels

public double[][] getPixels()
                     throws AladinException
Return a copy of the image pixels in doubles This method is dedicated to the image planes

Returns:
image pixels ([0][0] at the bottom left, [width-1][height-1] at the top right)
Throws:
AladinException

getPixel

public double getPixel(int x,
                       int y)
                throws AladinException
Return the full pixel value convert in double for a dedicated position. This method is dedicated to the image planes

Parameters:
x,y - Image coordinates (line 0 at the bottom "a la Fits")
Returns:
the full pixel value (in double)
Throws:
AladinException

getPixel

public double getPixel(int x,
                       int y,
                       int z)
                throws AladinException
Return the full pixel value from a cube convert in double for a dedicated position. This method is dedicated to the cube planes

Parameters:
x,y,z - Cube coordinates (line 0 at the bottom "a la Fits")
Returns:
the full pixel value (in double)
Throws:
AladinException

getCube

public double[][][] getCube(int x,
                            int y,
                            int z,
                            int width,
                            int height,
                            int depth)
                     throws AladinException
Extract a sub-cube. The pixels are expressed in doubles This method is dedicated to the cube or blink planes

Returns:
cube pixels ([0][0][0] at the bottom left front, [width-1][height-1][depth-1] at the top right rear)
Throws:
AladinException

getCube

public double[][][] getCube()
                     throws AladinException
Return the cube pixels. The pixels are expressed in doubles This method is dedicated to the cube or blink planes

Returns:
cube pixels
Throws:
AladinException

setPixels

public void setPixels(double[][] pixels)
               throws AladinException
Replace the original image pixel values. This method is dedicated to the image planes Aladin will convert each double pixel value in the original image coding (see getFitsBitPix() )

Parameters:
pixels - image pixels (([0][0] at the bottom left, [width-1][height-1] at the top right)
Throws:
AladinException

setPixels

public void setPixels(double[][] pixels,
                      int bitpix)
               throws AladinException
Replace the original image and possibly modify its internal coding (byte,integer,float..)

Parameters:
pixels - image pixels (([0][0] at the bottom left, [width-1][height-1] at the top right)
bitpix - coding mode "a la Fits" (8, 16 or 32 for unsigned integers, -32 or -64 for reals)
Throws:
AladinException

getWidth

public int getWidth()
             throws AladinException
Return the image width This method is dedicated to the image planes

Returns:
image width
Throws:
AladinException

getHeight

public int getHeight()
              throws AladinException
Return the image height This method is dedicated to the image planes

Returns:
image heith
Throws:
AladinException

getDepth

public int getDepth()
             throws AladinException
Return the cube depth This method is dedicated to the blink or cube planes

Returns:
image depth
Throws:
AladinException

getFitsBitPix

public int getFitsBitPix()
                  throws AladinException
Return the image coding in FITS standard. Required to manipulate directly the original pixels (see seeCodedPixels()) (8, 16 or 32 for unsigned integers, -32 or -64 for reals) This method is dedicated to the image planes

Returns:
image coding (a la FITS)
Throws:
AladinException

getFitsBzero

public double getFitsBzero()
                    throws AladinException
Return the BZERO value of the original pixels. Required to manipulate directly the original pixels (see seeCodedPixels()) PhysicalPixelValue = codedPixelValue*BSCALE + BZERO This method is dedicated to the image planes

Returns:
BZERO (a la FITS)
Throws:
AladinException

getFitsBscale

public double getFitsBscale()
                     throws AladinException
Return the BSCALE value of the original pixels. Required to manipulate directly the original pixels (see seeCodedPixels()) PhysicalPixelValue = codedPixelValue*BSCALE + BZERO This method is dedicated to the image planes

Returns:
BSCALE (a la FITS)
Throws:
AladinException

getFitsHeader

public java.lang.String getFitsHeader()
                               throws AladinException
Return the Fits header as a String. This method is dedicated to the image planes

Returns:
the Fits header or "" if there is not.
Throws:
AladinException

setFitsHeader

public void setFitsHeader(java.lang.String header)
                   throws AladinException
Replace original Fits header, and modify the astrometrical projection according to the WCS keys in this new Fits header. The format is a simple string: FITSKEY = Value\n..... This method is dedicated to the image planes

Parameters:
header - the fits header
Throws:
AladinException

seeBytePixels

public byte[] seeBytePixels()
                     throws AladinException
FOR ADVANCED DEVELOPERS ONLY ! Provide the BYTE pixel buffer internal reference of the image plane. This method is dedicated for very fast image access in unsigned byte representation. See bytePixelsModified() method for notifying Aladin. WARNING : THE LINE 0 IS THE FIRST ONE (a la java) and THE BYTES ARE UNSIGNED USe getPixels() for slower but simpler pixel access.

Returns:
the byte pixel buffer reference
Throws:
AladinException

seeBytePixels

public byte[] seeBytePixels(int z)
                     throws AladinException
FOR ADVANCED DEVELOPERS ONLY ! Provide the BYTE pixel buffer internal reference for a specified cube frame This method is dedicated for very fast cube access in unsigned byte representation. See bytePixelsModified() method for notifying Aladin. WARNING : THE LINE 0 IS THE FIRST ONE (a la java) and THE BYTES ARE UNSIGNED USe getPixels() for slower but simpler pixel access.

Returns:
the byte pixel buffer reference
Throws:
AladinException

seeCodedPixels

public byte[] seeCodedPixels()
                      throws AladinException
FOR ADVANCED DEVELOPERS ONLY ! Provide the CODED pixel buffer internal reference of the image plane. This method is dedicated for very fast image access original representation See getFitsBitPix() and CodedPixelsToDouble() for reading these pixels. See codedPixelsModified() method for notifying Aladin. WARNING : THE LINE 0 IS THE LAST ONE (a la FITS) Use getPixels() for slower but simpler pixel access.

Returns:
the coded pixel buffer reference
Throws:
AladinException

seeFitsKeys

public java.util.Hashtable seeFitsKeys()
                                throws AladinException
FOR ADVANCED DEVELOPERS ONLY ! Provide the Aladin Hashtable internal reference of the FITS keys associating to the image plane This method is dedicated to the image planes see fitsKeysModified() method for notifying Aladin.

Returns:
FITS header keys
Throws:
AladinException

CodedPixelsToDouble

public static double CodedPixelsToDouble(byte[] codedPixels,
                                         int bitpix,
                                         int pos)
FOR ADVANCED DEVELOPERS ONLY ! Interpret a pixel in a coded pixel array at the position "pos" and coded in "bitpix". WARNING : remember that de PhysicalPixelValue = return * BSCALE + BZERO (see getFitsBzero() and getFitsBscale() methods)

Parameters:
codedPixels - Coded pixel array (see seeCodedPixels())
bitpix - pixel coding (see getFitsBitPix)
pos - pixel position in the array (takes into account the pixel size coding)
Returns:
the double pixel representation

DoubleToCodedPixels

public static void DoubleToCodedPixels(double val,
                                       byte[] codedPixels,
                                       int bitpix,
                                       int pos)
FOR ADVANCED DEVELOPERS ONLY ! Code a pixel double representation in a coded pixel array at the position "pos" and coded in "bitpix".

Parameters:
val - double pixel value
codedPixels - Coded pixel array (see seeCodedPixels())
bitpix - pixel coding (see getFitsBitPix)
pos - pixel position in the array (takes into account the pixel size coding)

bytePixelsModified

public void bytePixelsModified()
                        throws AladinException
FOR ADVANCED DEVELOPERS ONLY ! Notify to Aladin that the byte pixel array has been modified

Throws:
AladinException

codedPixelsModified

public void codedPixelsModified()
                         throws AladinException
FOR ADVANCED DEVELOPERS ONLY ! Notify to Aladin that the coded pixel array has been modified

Throws:
AladinException

fitsKeysModified

public void fitsKeysModified()
                      throws AladinException
FOR ADVANCED DEVELOPERS ONLY ! Notify to Aladin that the fits key hashtable has been modified

Throws:
AladinException

getCoord

public double[] getCoord(double x,
                         double y)
                  throws AladinException
Return the J2000 coordinates for a x,y position according to the image astrometrical calibration This method is dedicated to the image planes

Parameters:
x,y - image coordinates (the center of the left-bottom pixel is (1,1) "a la FITS")
Returns:
the RA and DEC J2000 coordinates
Throws:
AladinException

getXY

public double[] getXY(double ra,
                      double dec)
               throws AladinException
Return the x,y pixel coordinates for a ra,dec J2000 postion according to the image astrometrical calibration. This method is dedicated to the image planes

Parameters:
ra,dec - RA and DEC J2000 coordinates
Returns:
x,y image coordinates (the center of the left-bottom pixel is (1,1) "a la FITS")
Throws:
AladinException

seeObj

public Obj[] seeObj()
             throws AladinException
FOR ADVANCED DEVELOPERS ONLY ! This method is dedicated to the overlay planes Provide a direct access to the list of the overlay objects. The "Obj" class allows you to see the content of each overlay object... String getObjType() return the type of object (Source, Line, Tag, Circle...) String [] getFields() return values (in case of Source) String [] getColumnNames() return the column name (in case of Source) double ra,dec the object position in the sky (J2000) The number of objects is known by getNbObj().

Returns:
reference to the object list
Throws:
AladinException

getNbObj

public int getNbObj()
             throws AladinException
FOR ADVANCED DEVELOPERS ONLY ! Return the number of objects (see seeObj()). This method is dedicated to the overlay planes

Returns:
the number of objects
Throws:
AladinException

rmObj

public void rmObj(Obj obj)
           throws AladinException
FOR ADVANCED DEVELOPERS ONLY ! Remove a dedicated Object from the overlay planes

Parameters:
obj - the object to remove
Throws:
AladinException

setName

public void setName(java.lang.String[] name)
FOR ADVANCED DEVELOPERS ONLY ! This method is dedicated to the overlay planes and specifically source planes For providing a fast and direct way for creating overlay source plane. Set the column name list for a source plane.

Parameters:
name - column name list
See Also:
method for adding new sources

setDatatype

public void setDatatype(java.lang.String[] datatype)
FOR ADVANCED DEVELOPERS ONLY ! This method is dedicated to the overlay planes and specifically source planes For providing a fast and direct way for creating overlay source plane. Set the column data type list for a source plane => A la VOTABLE : int, long, char, float, double , boolean, short, bit, unsignedByte, floatComplex, doubleComplex => A la FORTRAN: J,K,A,E,D,L,I,X,B,C,M

Parameters:
name - column name list
See Also:
method for adding new sources

setUnit

public void setUnit(java.lang.String[] unit)
FOR ADVANCED DEVELOPERS ONLY ! This method is dedicated to the overlay planes and specifically source planes For providing a fast and direct way for creating overlay source plane. Set the column unit list for a source plane. (==> see VOTable standard)

Parameters:
name - column name list
See Also:
method for adding new sources

setUCD

public void setUCD(java.lang.String[] ucd)
FOR ADVANCED DEVELOPERS ONLY ! This method is dedicated to the overlay planes and specifically source planes For providing a fast and direct way for creating overlay source plane. Set the column UCD list of column names for a source plane. (==> see UCD standard)

Parameters:
name - column name list
See Also:
method for adding new sources

setWidth

public void setWidth(java.lang.String[] width)
This method is dedicated to the overlay planes and specifically source planes For providing a fast and direct way for creating overlay source plane. Set the column editing width list for a source plane (requires integers written as Strings).

Parameters:
name - column name list
See Also:
method for adding new sources

addSource

public Obj addSource(java.lang.String id,
                     double ra,
                     double dec,
                     java.lang.String[] value)
              throws AladinException
FOR ADVANCED DEVELOPERS ONLY ! This method is dedicated to the overlay planes and specifically source planes Add an object to the source plane.

Parameters:
id - source ID
ra - RA J2000 in degrees
dec - DEC J2000 in degrees
value - value list (according to the current measurement table description defined with setName(), setDatatype(), setUnit(), setUCD(), setWidth() methods)
Returns:
created obj
Throws:
AladinException

objModified

public void objModified()
                 throws AladinException
FOR ADVANCED DEVELOPERS ONLY ! Notify to Aladin that the overlay plane has been modified

Throws:
AladinException

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright © 2009 UDS/CNRS