jview
Class JFitsCanvas

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by jview.JNormalizedCanvas
                  extended by jview.JViewportCanvas
                      extended by jview.JFrameCanvas
                          extended by jview.JFitsCanvas
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, NormalizedCoordinates, NormalizedShapes, UserCoordinates, Zoomable, Initializable, ResourceAware, ResourceComposed, Savable
Direct Known Subclasses:
JCameraCanvas, JGuiderCanvas, JSkyCanvas

public class JFitsCanvas
extends JFrameCanvas
implements UserCoordinates

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.

See Also:
Serialized Form

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.JFrameCanvas
KEY_ABSOLUTEHEIGHT, KEY_ABSOLUTEWIDTH, KEY_DRAWBOX, KEY_RELATIVEHEIGHT, KEY_RELATIVEWIDTH, KEY_TITLECOLOR, KEY_TITLEFONT, KEY_TITLEJUSTIFY, KEY_TITLEOFFSET, KEY_TITLETEXT, KEY_TOPCOLOR, KEY_TOPFONT, KEY_TOPJUSTIFY, KEY_TOPOFFSET, KEY_TOPSEPARATOR, KEY_TOPTEXT, KEY_XFRAME, KEY_XINSETABSOLUTE, KEY_XINSETRELATIVE, KEY_YFRAME, KEY_YINSETABSOLUTE, KEY_YINSETRELATIVE
 
Fields inherited from class jview.JViewportCanvas
MAXVIEW, VIEWPORTIMAGEPROPERTY, VIEWPORTPROPERTY
 
Fields inherited from class jview.JNormalizedCanvas
BACKGROUNDIMAGEPROPERTY, EXPORTACTION, GENERIC, inverse, KEY_BACKGROUND, KEY_CANVASNAME, KEY_CANVASTIP, KEY_CURSORCLASSES, KEY_CURSORPROPS, KEY_DRAWINGSETS, KEY_FOREGROUND, KEY_MAXIMUMHEIGHT, KEY_MAXIMUMWIDTH, KEY_MINIMUMHEIGHT, KEY_MINIMUMWIDTH, KEY_PREFERREDHEIGHT, KEY_PREFERREDWIDTH, KEY_PRINTFONT, KEY_PRINTFONTSCALE, KEY_PRINTSHAPESCALE, KEY_RESTORESHAPES, KEY_XFLIPIMAGE, KEY_YFLIPIMAGE, PRINTACTION, SAVEACTION, transform
 
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 jview.JNormalizedCanvas
addCrossCursor, addDrawable, addDrawable, addDrawable, addDrawingInfo, addLink, addLink, addPoint, addPoint, addText, addText, allInside, applyDrawingInfo, assignCursorLabel, clearAllDrawable, clearAllText, clearDrawable, clearText, createCanvasCursor, disabledCanvas, drawPoints, drawPointsMap, drawShapes, drawShapesMap, drawText, drawTextMap, firePropertyChange, getActions, getAllCanvasCursors, getAnimationInfo, getBackground, getBackgroundImage, getCanvasCursor, getClosest, getClosest, getClosest, getClosestShape, getComposedProperties, getFromName, getImageOperation, getInside, getInsideShapes, getInverseTransform, getLink, getLinkedTo, getMaximumSize, getMinimumSize, getNormalized, getNormalizedRect, getSaveBuffer, getScreen, getScreenRect, getShapeTransform, isEmpty, isFlipX, isFlipY, paintComponent, paintPointsList, paintShapesList, paintTextList, printComponent, removeDrawable, removeDrawable, removeLink, removeText, removeText, repaintLater, repaintNow, setBackgroundImage, setBounds, setComplete, setCursor, setCursor, setDrawable, setImageOperation, setLink, setPrepare, startAnimation, stopAnimation
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getAccessibleContext, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getNextFocusableComponent, getPopupLocation, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUI
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setComponentOrientation, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
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

ARRAY

public static final int ARRAY
Use this type int to get the array transform.

See Also:
Constant Field Values

WCS

public static final int WCS
Use this type int to get the WCS transform, if defined.

See Also:
Constant Field Values

KEY_RGBGRAY

public static final String KEY_RGBGRAY
If true, we use a gray RGB bufferd image from the fits.

See Also:
Constant Field Values

KEY_SCALING

public static final String KEY_SCALING
The default scaling algorithm.

See Also:
Constant Field Values

KEY_KEEP

public static final String KEY_KEEP
The default percentage of pixels to keep, from zero to one.

See Also:
Constant Field Values

KEY_MAXMAGNIFY

public static final String KEY_MAXMAGNIFY
If the magnification is higher than this, we display float pixels.

See Also:
Constant Field Values

KEY_XTENSION

public static final String KEY_XTENSION
The number of HDU we skip in the fits file, for multi-extension.

See Also:
Constant Field Values

KEY_XTENSIONFLIP

public static final String KEY_XTENSIONFLIP
If we have different flips for different extensions.

See Also:
Constant Field Values

KEY_SMARTKEEP

public static final String KEY_SMARTKEEP
If true we do not take the saturated counts int account

See Also:
Constant Field Values

KEY_LOWKEEP

public static final String KEY_LOWKEEP
If true we do not take the saturated counts int account

See Also:
Constant Field Values

KEY_HIGHMODE

public static final String KEY_HIGHMODE
If bounds to both sides of mode are wanted.

See Also:
Constant Field Values

KEY_LOWMODE

public static final String KEY_LOWMODE
If bounds to both sides of mode are wanted.

See Also:
Constant Field Values

KEY_NEVERESTIMATESIZE

public static final String KEY_NEVERESTIMATESIZE
If true, we do not estimate our preferred size, but return super.

See Also:
Constant Field Values

KEY_FORMATWCS

public static final String KEY_FORMATWCS
If true, we format the cross-cursor WCS with sexagesimal.

See Also:
Constant Field Values

DEFURLRESOURCES

private static final String DEFURLRESOURCES
Location of the LUT's.

See Also:
Constant Field Values

DEFSCALING

private static final int DEFSCALING
The default scaling algorithm used.

See Also:
Constant Field Values

DEFRGBGRAY

private static final boolean DEFRGBGRAY
Default rgb-gray loading.

See Also:
Constant Field Values

DEFKEEP

private static final double DEFKEEP
The default fraction of pixels to keep.

See Also:
Constant Field Values

DEFXFLIPIMAGE

private static final boolean DEFXFLIPIMAGE
Default flipping along x-axis.

See Also:
Constant Field Values

DEFYFLIPIMAGE

private static final boolean DEFYFLIPIMAGE
Default flipping along y-axis.

See Also:
Constant Field Values

DEFMAXMAGNIFY

private static final double DEFMAXMAGNIFY
Default maximum pixel magnification value.

See Also:
Constant Field Values

DEFCURSORCLASSES

private static final String DEFCURSORCLASSES
Default cursor classes, no special names.

See Also:
Constant Field Values

DEFXTENSION

private static final int DEFXTENSION
Default we use the first image hdu we find.

See Also:
Constant Field Values

DEFSMARTKEEP

private static final boolean DEFSMARTKEEP
Default also include saturated counts.

See Also:
Constant Field Values

DEFLOWKEEP

private static final boolean DEFLOWKEEP
Default also include saturated counts.

See Also:
Constant Field Values

DEFNEVERESTIMATESIZE

private static final boolean DEFNEVERESTIMATESIZE
We estimate our preferred size.

See Also:
Constant Field Values

DEFFORMATWCS

private static final boolean DEFFORMATWCS
See Also:
Constant Field Values

fits

private nom.tam.fits.Fits fits
The fits file the image to be displayed is generated from.


xcount

private int xcount
Number of extensions found in fits file.


hdu

private nom.tam.fits.ImageHDU hdu
The image hdu of the fits file.


hist

private JHistogram hist
The historgram of the fits image data.


bounds

private JHistogram.Bounds bounds
The bounds to use on display, null for non-bound.


display

private BufferedFitsImage display
The displayed image data.


scaling

private int scaling
The last scaling used.


keep

private double keep
The last number of pixels kept.


xoff

private int xoff
The origin in the fits file, i.e. the number of pixel not present.


yoff

private int yoff
The origin in the fits file, i.e. the number of pixel not present.


xbin

private int xbin
The binning used in the fits file.


ybin

private int ybin
The binning used in the fits file.


totalsize

private Dimension totalsize
The dimension of the total image.


pixeltransform

private CoordinateTransforming pixeltransform
A proxy to the user coordinates instance.


wcstransform

private CoordinateTransforming wcstransform
A proxy to the user coordinates instance.


fliptable

private Map<Integer,Boolean[]> fliptable
A lookup-table for linking extension numbers to flips.


divide

private int divide
After on-size screen has been established, this is the shrink factor.

Constructor Detail

JFitsCanvas

public JFitsCanvas(ResourceSupplying prop)
Constructs a new fits canvas from the properties.

Method Detail

setComposedProperties

public void setComposedProperties(ResourceSupplying prp)
Defaults the scaling algorithm.

Specified by:
setComposedProperties in interface ResourceAware
Overrides:
setComposedProperties in class JFrameCanvas

init

public void init()
Description copied from class: JFrameCanvas
Initializes the shape canvas. This includes some default setting that might be overruled in subclasses.

Specified by:
init in interface Initializable
Overrides:
init in class JFrameCanvas

setUserTransformation

public void setUserTransformation(CoordinateTransforming user)
Sets the user transform. Ignores any calls with wrong instances.

Specified by:
setUserTransformation in interface UserCoordinates

setUserTransformation

public void setUserTransformation(CoordinateTransforming user,
                                  int type)
Sets the user transform. Ignores any calls with wrong instances.

Specified by:
setUserTransformation in interface UserCoordinates

getUserTransformation

public CoordinateTransforming getUserTransformation()
Gets the user transform. We return the proxy instance here.

Specified by:
getUserTransformation in interface UserCoordinates

getUserTransformation

public CoordinateTransforming getUserTransformation(int type)
Gets the user transform. We return the proxy instance here.

Specified by:
getUserTransformation in interface UserCoordinates
Parameters:
type - Zero for main type, others for special use.

getArrayTransformation

public CoordinateTransforming getArrayTransformation()
Gets the array transform, which is used to convert normalized pixel into HDU-image array indices.


getSkyTransformation

public CoordinateTransforming getSkyTransformation()
Gets the user transform. We return the proxy instance here.


silentlySelectViewport

protected boolean silentlySelectViewport(Rectangle2D newview)
Estimates the format.

Overrides:
silentlySelectViewport in class JViewportCanvas

revertFromFits

public boolean revertFromFits()
Reverts the display image by redoing scaling, fractional keep, contrast, brightness, negative and colorization from the original fits file.

Returns:
True on success, i.e. if background image was updated.

revertImage

public boolean revertImage()
Reverts from the buffered fits image, without rescaling it.


scanFits

public Rectangle scanFits(nom.tam.fits.Fits display)
Sets the fits image and parses offset and binning from the header entries.

Returns:
A Rectangle whose up-left pixel is the offset and binning according to width/height.

setFits

public void setFits(nom.tam.fits.Fits reload,
                    int xoffset,
                    int yoffset,
                    int xbinning,
                    int ybinning)
Sets the fits image. The background of the canvas is set according to the scaling algortihm of this component. If no total size has been set, we deduce it from the image size and the binning values active, i.e. we proceed as being this fits a CCD-fits from the main window.


reconstructHdu

public void reconstructHdu()
                    throws nom.tam.fits.FitsException,
                           IOException
Reloads the current HDU from the fits file, considering the current extension.

Throws:
nom.tam.fits.FitsException
IOException

clearHistogram

public void clearHistogram()
Normally, histogram is ereased on new fits, but this method clears it anyhow. Should be followed by a revert to re-calculate the histogram.


getDisplay

public BufferedFitsImage getDisplay()
Returns the buffered fits image after scaling and percentage keep, but without contrast enhancement, color, or flipping.


createFlipLookup

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


getXtensionCount

public int getXtensionCount()
Returns the number of ImageHDU found.


getBinning

public Dimension getBinning()
Returns the binning factors as a dimension object.


getOffset

public Point getOffset()
Returns the offset as a point object.


setTotalSize

public void setTotalSize(Dimension tot)
Sets the dimension of the CCD, in unbinned values. Used for calculating a preferred size.


getTotalSize

protected Dimension getTotalSize()
Returns the total size.


getPreferredSize

public 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.

Overrides:
getPreferredSize in class JNormalizedCanvas

estimateSize

private Dimension estimateSize()
Called from preferred size, if totalsize and maxsize is known (meaning they are not null). Many different return path, allow preferred size to subtract a frame.


getDisplayDivide

public int getDisplayDivide()
Returns the shrink/enlarg of the display.


getScaling

public int getScaling()
Returns the current scaling as an integer. The integer complies with ScaleFactory scaling values.


setScaling

public void setScaling(int newscale)
Changes the scaling of the image. For valid numbers see ScaleFactory. This directly uses fits data and constructs a new display image, thus internally, the scaling is changed and the revertFromFits() method is called.


getFraction

public double getFraction()
Returns the fraction of pixels currently kept from the image.


setFraction

public void setFraction(double f)
Changes the percentage level of pixels to keep in the image. Valid numbers are zero to 1, thus it is a fraction rather than a percentage. This directly uses fits data and constructs a new display image, thus internally, the number of pixels to keep is changed and the revertFromFits() method is called.


setHistogramBounds

public void setHistogramBounds(double min,
                               double max)
Changes the percentage level of pixels to keep in the image. Valid numbers are zero to 1, thus it is a fraction rather than a percentage. This directly uses fits data and constructs a new display image, thus internally, the number of pixels to keep is changed and the revertFromFits() method is called.


getHistogramBounds

public JHistogram.Bounds getHistogramBounds()
Changes the percentage level of pixels to keep in the image. Valid numbers are zero to 1, thus it is a fraction rather than a percentage. This directly uses fits data and constructs a new display image, thus internally, the number of pixels to keep is changed and the revertFromFits() method is called.


getFits

public nom.tam.fits.Fits getFits()
Returns the fits file associated with this canvas.


getHdu

public nom.tam.fits.ImageHDU getHdu()
Returns the hdu currently displayed.


getHistogram

public JHistogram getHistogram()
If a fits image was applied, we return the histogram of the counts as an integer array here. The length of the array (the number of bins) is always 2^16-1.


getFITSImageData

public Object getFITSImageData()
Returns the image data as found in the original fits file. Depending on the bits per pixels, this is a
 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.

Returns:
An object being a double-array of a primitive type.

getFITSImageSize

public Dimension getFITSImageSize()
Returns the size of the FITS image array.


getFITSImageValue

public double getFITSImageValue(int xpos,
                                int ypos)
Returns the value at FITS data as a double. No ZERO-point or SCALE adjustment. If called from a mouse cursor, note that flipping has to be done by the caller.


getFITSImageBits

public int getFITSImageBits()
Returns the number of bits representing the image data. This follows fits standards and returns the number of bits as recorded in the header. This method can be used in conjuncture with getFITSImageData() to properly cast the data returned from that method.

Returns:
8, 16, 32, -32, -64, etc. or zero if invalid.

getDisplayMap

public Map<String,Object> getDisplayMap()

getDisplayMap

private static Map getDisplayMap(int scaling,
                                 double keep)
Fills all properties that define the 'speciality' of our display into a map.