Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Visualize complex images with WebGL
JavaScript Shell Python CSS
branch: master
Failed to load latest commit information.
examples check GPU max texture size and downsample on the fly
scripts bug fix to prevent gl errors
src another check to conserve memory
.gitignore abstracting layering
LICENSE clean up examples, tweaks to api
README.md add doc on colormaps
bower.json
build.sh downsampling
package.json another check to conserve memory
rawimage.js another check to conserve memory
rawimage.min.js another check to conserve memory
setup.sh updated readme and setup

README.md

WebFITS

A JavaScript library to visualize astronomical images in a web browser. This library contains a set of functions that are frequently used to visualize the high dynamic range of astronomical images.

API

setupControls(mouseCallbacks, opts)

Enable panning and zooming on the visualization context. mouseCallbacks is an optional argument. Providing an object with functions defined on the following keys will hook into WebFITS mouse events. See examples/webgl-single-image-mouse-callbacks.html for an example.

  • onmousedown
  • onmouseup
  • onmousemove
  • onmouseout
  • onmouseover

opts is a second optional argument that can be used to pass values to the mouse callbacks.

loadImage(identifier, arr, width, height)

Load an image into the visualization. identifier is a user chosen name for the image. arr is a typed array representing the image of width and height.

setImage(identifier)

After loading images with loadImage, a specific image may be selected using this function.

setExtent(min, max)

Set the minimum and maximum pixels values that will be rendered.

setStretch(stretch)

Sets the stretch for the image, the default is linear. Current valid values for stretch

  • linear
  • logarithm
  • sqrt
  • arcsinh
  • power

setColorMap(cmap)

Set a colormap for the image. Default colormap is grayscale. Any colormap listed in ColorMaps may be used.

setScales(r, g, b)

This function is relevant to color composites, setting a normalized scale for each rgb channel.

setAlpha(value)

This function is relevant to color composites, setting the alpha parameter in the modifed Lupton algorithm.

setQ(value)

This function is relevant to color composites, setting the Q parameter in the modifed Lupton algorithm.

drawColor(r_identifier, g_identifier, b_identifier)

Render a color composite by specifying the identifiers for each channel. Note: setScales, setAlpha, and setQ must be called prior to this function. WebFITS does not provide default values.

Examples

Examples may be found in the examples directory. To get started run:

./setup.sh

This script downloads the latest version of fits.js and sample images needed for the examples. A local server is needed to see the examples. If familiar with Node.js, you may install development dependencies by running:

npm install .

and spin up a local server

http-server

TODO:

Something went wrong with that request. Please try again.