|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
jview.JNormalizedCanvas
jview.JViewportCanvas
jview.JFrameCanvas
jview.JFitsCanvas
public class JFitsCanvas
A fits canvas takes a FITS object and displays the image as the background
image of a JViewportCanvas. Calls to setScaling(int) allows
different scaling algorithms to be used for the displayed images, as defined
in the ScaleUtils class. It uses the
jar-package from IVOA
fits. It additionally implements UserCoordinates to convert
normalized coordinates into true CCD-pixel values. This cannot be done as a
simple on-screen display, as we might have here scaling and windowing.
| Nested Class Summary | |
|---|---|
private class |
JFitsCanvas.PixelCoordinate
This class converts normalized coordinates into true CCD pixel values. |
static class |
JFitsCanvas.Show
A test class. |
| Nested classes/interfaces inherited from class jview.JFrameCanvas |
|---|
JFrameCanvas.Test |
| Nested classes/interfaces inherited from class jview.JViewportCanvas |
|---|
JViewportCanvas.ViewportKey |
| Nested classes/interfaces inherited from class jview.JNormalizedCanvas |
|---|
JNormalizedCanvas.ShowImage |
| Nested classes/interfaces inherited from class javax.swing.JComponent |
|---|
JComponent.AccessibleJComponent |
| Nested classes/interfaces inherited from class java.awt.Container |
|---|
Container.AccessibleAWTContainer |
| Nested classes/interfaces inherited from class java.awt.Component |
|---|
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy |
| Field Summary | |
|---|---|
static int |
ARRAY
Use this type int to get the array transform. |
private JHistogram.Bounds |
bounds
The bounds to use on display, null for non-bound. |
private static String |
DEFCURSORCLASSES
Default cursor classes, no special names. |
private static boolean |
DEFFORMATWCS
|
private static double |
DEFKEEP
The default fraction of pixels to keep. |
private static boolean |
DEFLOWKEEP
Default also include saturated counts. |
private static double |
DEFMAXMAGNIFY
Default maximum pixel magnification value. |
private static boolean |
DEFNEVERESTIMATESIZE
We estimate our preferred size. |
private static boolean |
DEFRGBGRAY
Default rgb-gray loading. |
private static int |
DEFSCALING
The default scaling algorithm used. |
private static boolean |
DEFSMARTKEEP
Default also include saturated counts. |
private static String |
DEFURLRESOURCES
Location of the LUT's. |
private static boolean |
DEFXFLIPIMAGE
Default flipping along x-axis. |
private static int |
DEFXTENSION
Default we use the first image hdu we find. |
private static boolean |
DEFYFLIPIMAGE
Default flipping along y-axis. |
private BufferedFitsImage |
display
The displayed image data. |
private int |
divide
After on-size screen has been established, this is the shrink factor. |
private nom.tam.fits.Fits |
fits
The fits file the image to be displayed is generated from. |
private Map<Integer,Boolean[]> |
fliptable
A lookup-table for linking extension numbers to flips. |
private nom.tam.fits.ImageHDU |
hdu
The image hdu of the fits file. |
private JHistogram |
hist
The historgram of the fits image data. |
private double |
keep
The last number of pixels kept. |
static String |
KEY_FORMATWCS
If true, we format the cross-cursor WCS with sexagesimal. |
static String |
KEY_HIGHMODE
If bounds to both sides of mode are wanted. |
static String |
KEY_KEEP
The default percentage of pixels to keep, from zero to one. |
static String |
KEY_LOWKEEP
If true we do not take the saturated counts int account |
static String |
KEY_LOWMODE
If bounds to both sides of mode are wanted. |
static String |
KEY_MAXMAGNIFY
If the magnification is higher than this, we display float pixels. |
static String |
KEY_NEVERESTIMATESIZE
If true, we do not estimate our preferred size, but return super. |
static String |
KEY_RGBGRAY
If true, we use a gray RGB bufferd image from the fits. |
static String |
KEY_SCALING
The default scaling algorithm. |
static String |
KEY_SMARTKEEP
If true we do not take the saturated counts int account |
static String |
KEY_XTENSION
The number of HDU we skip in the fits file, for multi-extension. |
static String |
KEY_XTENSIONFLIP
If we have different flips for different extensions. |
private CoordinateTransforming |
pixeltransform
A proxy to the user coordinates instance. |
private int |
scaling
The last scaling used. |
private Dimension |
totalsize
The dimension of the total image. |
static int |
WCS
Use this type int to get the WCS transform, if defined. |
private CoordinateTransforming |
wcstransform
A proxy to the user coordinates instance. |
private int |
xbin
The binning used in the fits file. |
private int |
xcount
Number of extensions found in fits file. |
private int |
xoff
The origin in the fits file, i.e. |
private int |
ybin
The binning used in the fits file. |
private int |
yoff
The origin in the fits file, i.e. |
| Fields inherited from class jview.JViewportCanvas |
|---|
MAXVIEW, VIEWPORTIMAGEPROPERTY, VIEWPORTPROPERTY |
| Fields inherited from class javax.swing.JComponent |
|---|
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
| Fields inherited from class java.awt.Component |
|---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
| Fields inherited from interface java.awt.image.ImageObserver |
|---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
| Constructor Summary | |
|---|---|
JFitsCanvas(ResourceSupplying prop)
Constructs a new fits canvas from the properties. |
|
| Method Summary | |
|---|---|
void |
clearHistogram()
Normally, histogram is ereased on new fits, but this method clears it anyhow. |
private Map<Integer,Boolean[]> |
createFlipLookup(String flipping)
Returns the flipping lookup table as parsed from a property of format:
0=true,true:1=false,false
|
private Dimension |
estimateSize()
Called from preferred size, if totalsize and maxsize is known (meaning they are not null). |
CoordinateTransforming |
getArrayTransformation()
Gets the array transform, which is used to convert normalized pixel into HDU-image array indices. |
Dimension |
getBinning()
Returns the binning factors as a dimension object. |
BufferedFitsImage |
getDisplay()
Returns the buffered fits image after scaling and percentage keep, but without contrast enhancement, color, or flipping. |
int |
getDisplayDivide()
Returns the shrink/enlarg of the display. |
Map<String,Object> |
getDisplayMap()
|
private static Map |
getDisplayMap(int scaling,
double keep)
Fills all properties that define the 'speciality' of our display into a map. |
nom.tam.fits.Fits |
getFits()
Returns the fits file associated with this canvas. |
int |
getFITSImageBits()
Returns the number of bits representing the image data. |
Object |
getFITSImageData()
Returns the image data as found in the original fits file. |
Dimension |
getFITSImageSize()
Returns the size of the FITS image array. |
double |
getFITSImageValue(int xpos,
int ypos)
Returns the value at FITS data as a double. |
double |
getFraction()
Returns the fraction of pixels currently kept from the image. |
nom.tam.fits.ImageHDU |
getHdu()
Returns the hdu currently displayed. |
JHistogram |
getHistogram()
If a fits image was applied, we return the histogram of the counts as an integer array here. |
JHistogram.Bounds |
getHistogramBounds()
Changes the percentage level of pixels to keep in the image. |
Point |
getOffset()
Returns the offset as a point object. |
Dimension |
getPreferredSize()
If we have a total size of the CCD, we calculate a preferred size by integer-scaling the total size such that it lies between min and max. |
int |
getScaling()
Returns the current scaling as an integer. |
CoordinateTransforming |
getSkyTransformation()
Gets the user transform. |
protected Dimension |
getTotalSize()
Returns the total size. |
CoordinateTransforming |
getUserTransformation()
Gets the user transform. |
CoordinateTransforming |
getUserTransformation(int type)
Gets the user transform. |
int |
getXtensionCount()
Returns the number of ImageHDU found. |
void |
init()
Initializes the shape canvas. |
void |
reconstructHdu()
Reloads the current HDU from the fits file, considering the current extension. |
boolean |
revertFromFits()
Reverts the display image by redoing scaling, fractional keep, contrast, brightness, negative and colorization from the original fits file. |
boolean |
revertImage()
Reverts from the buffered fits image, without rescaling it. |
Rectangle |
scanFits(nom.tam.fits.Fits display)
Sets the fits image and parses offset and binning from the header entries. |
void |
setComposedProperties(ResourceSupplying prp)
Defaults the scaling algorithm. |
void |
setFits(nom.tam.fits.Fits reload,
int xoffset,
int yoffset,
int xbinning,
int ybinning)
Sets the fits image. |
void |
setFraction(double f)
Changes the percentage level of pixels to keep in the image. |
void |
setHistogramBounds(double min,
double max)
Changes the percentage level of pixels to keep in the image. |
void |
setScaling(int newscale)
Changes the scaling of the image. |
void |
setTotalSize(Dimension tot)
Sets the dimension of the CCD, in unbinned values. |
void |
setUserTransformation(CoordinateTransforming user)
Sets the user transform. |
void |
setUserTransformation(CoordinateTransforming user,
int type)
Sets the user transform. |
protected boolean |
silentlySelectViewport(Rectangle2D newview)
Estimates the format. |
| Methods inherited from class jview.JFrameCanvas |
|---|
calculateActiveCanvas, calculateShapeTransform, getArea, isScreenInNormalized, paintObjects, prepareCanvas, wasReshaped |
| Methods inherited from class jview.JViewportCanvas |
|---|
addAttachedViewport, addZoom, getViewport, getViewportImage, isMaximalViewport, isNormalizedOnScreen, removeAttachedViewport, resetViewport, selectArea, selectViewport, setViewportImage, transferView |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface jview.NormalizedCoordinates |
|---|
getArea, getNormalized, getNormalizedRect, getScreen, getScreenRect, getViewport, isNormalizedOnScreen, isScreenInNormalized |
| Field Detail |
|---|
public static final int ARRAY
public static final int WCS
public static final String KEY_RGBGRAY
public static final String KEY_SCALING
public static final String KEY_KEEP
public static final String KEY_MAXMAGNIFY
public static final String KEY_XTENSION
public static final String KEY_XTENSIONFLIP
public static final String KEY_SMARTKEEP
public static final String KEY_LOWKEEP
public static final String KEY_HIGHMODE
public static final String KEY_LOWMODE
public static final String KEY_NEVERESTIMATESIZE
public static final String KEY_FORMATWCS
private static final String DEFURLRESOURCES
private static final int DEFSCALING
private static final boolean DEFRGBGRAY
private static final double DEFKEEP
private static final boolean DEFXFLIPIMAGE
private static final boolean DEFYFLIPIMAGE
private static final double DEFMAXMAGNIFY
private static final String DEFCURSORCLASSES
private static final int DEFXTENSION
private static final boolean DEFSMARTKEEP
private static final boolean DEFLOWKEEP
private static final boolean DEFNEVERESTIMATESIZE
private static final boolean DEFFORMATWCS
private nom.tam.fits.Fits fits
private int xcount
private nom.tam.fits.ImageHDU hdu
private JHistogram hist
private JHistogram.Bounds bounds
private BufferedFitsImage display
private int scaling
private double keep
private int xoff
private int yoff
private int xbin
private int ybin
private Dimension totalsize
private CoordinateTransforming pixeltransform
private CoordinateTransforming wcstransform
private Map<Integer,Boolean[]> fliptable
private int divide
| Constructor Detail |
|---|
public JFitsCanvas(ResourceSupplying prop)
| Method Detail |
|---|
public void setComposedProperties(ResourceSupplying prp)
setComposedProperties in interface ResourceAwaresetComposedProperties in class JFrameCanvaspublic void init()
JFrameCanvas
init in interface Initializableinit in class JFrameCanvaspublic void setUserTransformation(CoordinateTransforming user)
setUserTransformation in interface UserCoordinates
public void setUserTransformation(CoordinateTransforming user,
int type)
setUserTransformation in interface UserCoordinatespublic CoordinateTransforming getUserTransformation()
getUserTransformation in interface UserCoordinatespublic CoordinateTransforming getUserTransformation(int type)
getUserTransformation in interface UserCoordinatestype - Zero for main type, others for special use.public CoordinateTransforming getArrayTransformation()
public CoordinateTransforming getSkyTransformation()
protected boolean silentlySelectViewport(Rectangle2D newview)
silentlySelectViewport in class JViewportCanvaspublic boolean revertFromFits()
public boolean revertImage()
public Rectangle scanFits(nom.tam.fits.Fits display)
public void setFits(nom.tam.fits.Fits reload,
int xoffset,
int yoffset,
int xbinning,
int ybinning)
public void reconstructHdu()
throws nom.tam.fits.FitsException,
IOException
nom.tam.fits.FitsException
IOExceptionpublic void clearHistogram()
public BufferedFitsImage getDisplay()
private Map<Integer,Boolean[]> createFlipLookup(String flipping)
0=true,true:1=false,false
public int getXtensionCount()
public Dimension getBinning()
public Point getOffset()
public void setTotalSize(Dimension tot)
protected Dimension getTotalSize()
public Dimension getPreferredSize()
getPreferredSize in class JNormalizedCanvasprivate Dimension estimateSize()
public int getDisplayDivide()
public int getScaling()
ScaleFactory scaling values.
public void setScaling(int newscale)
ScaleFactory. This directly uses fits data and constructs a new
display image, thus internally, the scaling is changed and the
revertFromFits() method is called.
public double getFraction()
public void setFraction(double f)
revertFromFits() method is called.
public void setHistogramBounds(double min,
double max)
revertFromFits() method is called.
public JHistogram.Bounds getHistogramBounds()
revertFromFits() method is called.
public nom.tam.fits.Fits getFits()
public nom.tam.fits.ImageHDU getHdu()
public JHistogram getHistogram()
2^16-1.
public Object getFITSImageData()
case 8:
((byte[][])data)[y][x];
case 16:
((short[][])data)[y][x];
case 32:
((int[][])data)[y][x];
case -32:
((float[][])data)[y][x];
case -64:
((double[][])data)[y][x];
All of the values are as-is, so no BZERO or BSCALE is applied.
public Dimension getFITSImageSize()
public double getFITSImageValue(int xpos,
int ypos)
public int getFITSImageBits()
getFITSImageData() to
properly cast the data returned from that method.
public Map<String,Object> getDisplayMap()
private static Map getDisplayMap(int scaling,
double keep)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||