You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+29-22Lines changed: 29 additions & 22 deletions
Original file line number
Diff line number
Diff line change
@@ -1,26 +1,22 @@
1
1
# WebFITS
2
2
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.
14
4
15
5
## 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.
21
17
22
18
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`.
24
20
25
21
setImage(identifier)
26
22
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
29
25
Set the minimum and maximum pixels values that will be rendered.
30
26
31
27
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
+
-
33
37
34
38
setScales(r, g, b)
35
39
This function is relevant to color composites, setting a normalized scale for each rgb channel.
36
40
37
41
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.
39
43
40
44
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.
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.
45
49
46
50
47
51
## Examples
@@ -50,9 +54,12 @@ Examples may be found in the `examples` directory. To get started run:
50
54
51
55
./setup.sh
52
56
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:
54
58
55
59
npm install .
60
+
61
+
and spin up a local server
62
+
56
63
http-server
57
64
58
65
otherwise a local server can be started using Python.
0 commit comments