Skip to content

Commit 656ad4f

Browse files
author
Amit Kapadia
committed
updated doc and setup script
1 parent 8c05396 commit 656ad4f

File tree

2 files changed

+34
-23
lines changed

2 files changed

+34
-23
lines changed

README.md

Lines changed: 29 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,22 @@
11
# WebFITS
22

3-
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. The following functions are currently supported:
4-
5-
* Linear
6-
* Logarithm
7-
* Square Root
8-
* Hyperbolic Inverse Sine
9-
* Power (order 2)
10-
* Lupton Color Algorithm
11-
12-
Extending these should be straight-forward.
13-
3+
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.
144

155
## API
16-
getContext()
17-
Setup a visualization context. For the WebGL implementation this function sets up all programs, shaders and buffers. For the Canvas implementation this function just extracts the 2d context and sets a few internal variables. This function is automatically called when a new WebFITS object is instantiated, but if `teardown` is called, this function needs to be explicitly called again.
18-
19-
setupControls(callback)
20-
Allow panning and zooming on the visualization context. `callback` is an optional user-defined function that accepts three arguments: `x`, `y`, and `opts`. The callback is executed when the mouse moves over the visualization context, passing the `x` and `y` coordinates of the image reference frame. This is useful for getting the pixel value at a given coordinate. See examples.
6+
7+
setupControls(mouseCallbacks, opts)
8+
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.
9+
10+
* `onmousedown`
11+
* `onmouseup`
12+
* `onmousemove`
13+
* `onmouseout`
14+
* `onmouseover`
15+
16+
`opts` is a second optional argument that can be used to pass values to the mouse callbacks.
2117

2218
loadImage(identifier, arr, width, height)
23-
Imports an image to the visualization. `identifier` is a user chosen name for the image. `arr` is a typed array representing the image of `width` and `height`.
19+
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`.
2420

2521
setImage(identifier)
2622
After loading images with `loadImage`, a specific image may be selected using this function.
@@ -29,19 +25,27 @@ After loading images with `loadImage`, a specific image may be selected using th
2925
Set the minimum and maximum pixels values that will be rendered.
3026

3127
setStretch(stretch)
32-
Sets the stretch for the image, the default is `linear`. Current valid values for `stretch` are `linear`, `logarithm`, `sqrt`, `arcsinh`, `power`.
28+
Sets the stretch for the image, the default is `linear`. Current valid values for `stretch`
29+
30+
* `linear`
31+
* `logarithm`
32+
* `sqrt`
33+
* `arcsinh`
34+
* `power`
35+
36+
-
3337

3438
setScales(r, g, b)
3539
This function is relevant to color composites, setting a normalized scale for each rgb channel.
3640

3741
setAlpha(value)
38-
This function is relevant to color composites, setting the `alpha` parameter in the Lupton algorithm.
42+
This function is relevant to color composites, setting the `alpha` parameter in the modifed Lupton algorithm.
3943

4044
setQ(value)
41-
This function is relevant to color composites, setting the `Q` parameter in the Lupton algorithm.
45+
This function is relevant to color composites, setting the `Q` parameter in the modifed Lupton algorithm.
4246

4347
drawColor(r_identifier, g_identifier, b_identifier)
44-
Render a color composite by specifying the identifiers for each channel. Note: `setScales`, `setAlpha`, and `setQ` must be called prior to this function, this WebFITS does not provide any default values.
48+
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.
4549

4650

4751
## Examples
@@ -50,9 +54,12 @@ Examples may be found in the `examples` directory. To get started run:
5054

5155
./setup.sh
5256

53-
This script downloads the latest version of [`fits.js`](http://astrojs.github.com/fitsjs/) and sample images needed for the examples. A local server is needed to see the examples. If familiar with NodeJS, you may run:
57+
This script downloads the latest version of [`fits.js`](http://astrojs.github.com/fitsjs/) and sample images needed for the examples. A local server is needed to see the examples. If familiar with [Node.js](http://nodejs.org/), you may install development dependencies by running:
5458

5559
npm install .
60+
61+
and spin up a local server
62+
5663
http-server
5764

5865
otherwise a local server can be started using Python.

setup.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,13 @@ mkdir -vp examples/lib
66
mkdir -vp examples/data
77

88
# Download JavaScript dependencies
9-
curl "https://raw.github.com/astrojs/fitsjs/master/lib/fits.js" -o 'examples/lib/fits.js'
9+
curl "https://raw.github.com/astrojs/fitsjs/rewrite/lib/fits.js" -o 'examples/lib/fits.js'
1010

1111
# Download data for examples
1212
curl "http://www.cadc-ccda.hia-iha.nrc-cnrc.gc.ca/data/pub/CFHTSG/W3-2%2B0.G.fits%5B16094%3A16605%2C7328%3A7839%5D" -o "examples/data/m101_g.fits"
1313
curl "http://www.cadc-ccda.hia-iha.nrc-cnrc.gc.ca/data/pub/CFHTSG/W3-2%2B0.R.fits%5B16094%3A16605%2C7328%3A7839%5D" -o "examples/data/m101_r.fits"
1414
curl "http://www.cadc-ccda.hia-iha.nrc-cnrc.gc.ca/data/pub/CFHTSG/W3-2%2B0.I.fits%5B16094%3A16605%2C7328%3A7839%5D" -o "examples/data/m101_i.fits"
15+
curl "http://astrojs.s3.amazonaws.com/sample/m101_g_sm.fits" -o "examples/data/m101_i.fits"
16+
curl "http://astrojs.s3.amazonaws.com/sample/CFHTLS_082_0001_g.fits.fz" -o "examples/data/CFHTLS_082_0001_g.fits.fz"
17+
curl "http://astrojs.s3.amazonaws.com/sample/CFHTLS_082_0001_r.fits.fz" -o "examples/data/CFHTLS_082_0001_r.fits.fz"
18+
curl "http://astrojs.s3.amazonaws.com/sample/CFHTLS_082_0001_i.fits.fz" -o "examples/data/CFHTLS_082_0001_i.fits.fz"

0 commit comments

Comments
 (0)