@aics/agave-webclient 1.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/agave.js +788 -0
- package/es/commandbuffer.js +232 -0
- package/es/index.js +2 -0
- package/es/types/agave.d.ts +380 -0
- package/es/types/commandbuffer.d.ts +58 -0
- package/es/types/index.d.ts +2 -0
- package/es/types/test/placeholder.test.d.ts +1 -0
- package/package.json +64 -0
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
2
|
+
import _createClass from "@babel/runtime/helpers/createClass";
|
|
3
|
+
// types:
|
|
4
|
+
// FLOAT32(f)
|
|
5
|
+
// INT32(i)
|
|
6
|
+
// STRING(s)=int32 and array of bytes
|
|
7
|
+
// FLOAT32ARRAY=int32 and array of floats
|
|
8
|
+
// INT32ARRAY=int32 and array of int32s
|
|
9
|
+
var types = {
|
|
10
|
+
I32: 4,
|
|
11
|
+
F32: 4,
|
|
12
|
+
S: -1,
|
|
13
|
+
F32A: -1,
|
|
14
|
+
I32A: -1
|
|
15
|
+
};
|
|
16
|
+
// command id will be int32 to future-proof it.
|
|
17
|
+
// note that the server needs to know these signatures too.
|
|
18
|
+
export var COMMANDS = {
|
|
19
|
+
// tell server to identify this session?
|
|
20
|
+
SESSION: [0, "S"],
|
|
21
|
+
// tell server where files might be (appends to existing)
|
|
22
|
+
ASSET_PATH: [1, "S"],
|
|
23
|
+
// load a volume (DEPRECATED)
|
|
24
|
+
LOAD_OME_TIF: [2, "S"],
|
|
25
|
+
// set camera pos
|
|
26
|
+
EYE: [3, "F32", "F32", "F32"],
|
|
27
|
+
// set camera target pt
|
|
28
|
+
TARGET: [4, "F32", "F32", "F32"],
|
|
29
|
+
// set camera up direction
|
|
30
|
+
UP: [5, "F32", "F32", "F32"],
|
|
31
|
+
APERTURE: [6, "F32"],
|
|
32
|
+
// perspective(0)/ortho(1), fov(degrees)/orthoscale(world units)
|
|
33
|
+
CAMERA_PROJECTION: [7, "I32", "F32"],
|
|
34
|
+
FOCALDIST: [8, "F32"],
|
|
35
|
+
EXPOSURE: [9, "F32"],
|
|
36
|
+
MAT_DIFFUSE: [10, "I32", "F32", "F32", "F32", "F32"],
|
|
37
|
+
MAT_SPECULAR: [11, "I32", "F32", "F32", "F32", "F32"],
|
|
38
|
+
MAT_EMISSIVE: [12, "I32", "F32", "F32", "F32", "F32"],
|
|
39
|
+
// set num render iterations
|
|
40
|
+
RENDER_ITERATIONS: [13, "I32"],
|
|
41
|
+
// (continuous or on-demand frames)
|
|
42
|
+
STREAM_MODE: [14, "I32"],
|
|
43
|
+
// request new image
|
|
44
|
+
REDRAW: [15],
|
|
45
|
+
SET_RESOLUTION: [16, "I32", "I32"],
|
|
46
|
+
DENSITY: [17, "F32"],
|
|
47
|
+
// move camera to bound and look at the scene contents
|
|
48
|
+
FRAME_SCENE: [18],
|
|
49
|
+
MAT_GLOSSINESS: [19, "I32", "F32"],
|
|
50
|
+
// channel index, 1/0 for enable/disable
|
|
51
|
+
ENABLE_CHANNEL: [20, "I32", "I32"],
|
|
52
|
+
// channel index, window, level. (Do I ever set these independently?)
|
|
53
|
+
SET_WINDOW_LEVEL: [21, "I32", "F32", "F32"],
|
|
54
|
+
// theta, phi in degrees
|
|
55
|
+
ORBIT_CAMERA: [22, "F32", "F32"],
|
|
56
|
+
SKYLIGHT_TOP_COLOR: [23, "F32", "F32", "F32"],
|
|
57
|
+
SKYLIGHT_MIDDLE_COLOR: [24, "F32", "F32", "F32"],
|
|
58
|
+
SKYLIGHT_BOTTOM_COLOR: [25, "F32", "F32", "F32"],
|
|
59
|
+
// r, theta, phi
|
|
60
|
+
LIGHT_POS: [26, "I32", "F32", "F32", "F32"],
|
|
61
|
+
LIGHT_COLOR: [27, "I32", "F32", "F32", "F32"],
|
|
62
|
+
// x by y size
|
|
63
|
+
LIGHT_SIZE: [28, "I32", "F32", "F32"],
|
|
64
|
+
// xmin, xmax, ymin, ymax, zmin, zmax
|
|
65
|
+
SET_CLIP_REGION: [29, "F32", "F32", "F32", "F32", "F32", "F32"],
|
|
66
|
+
// x, y, z pixel scaling
|
|
67
|
+
SET_VOXEL_SCALE: [30, "F32", "F32", "F32"],
|
|
68
|
+
// channel, method
|
|
69
|
+
AUTO_THRESHOLD: [31, "I32", "I32"],
|
|
70
|
+
// channel index, pct_low, pct_high. (Do I ever set these independently?)
|
|
71
|
+
SET_PERCENTILE_THRESHOLD: [32, "I32", "F32", "F32"],
|
|
72
|
+
MAT_OPACITY: [33, "I32", "F32"],
|
|
73
|
+
SET_PRIMARY_RAY_STEP_SIZE: [34, "F32"],
|
|
74
|
+
SET_SECONDARY_RAY_STEP_SIZE: [35, "F32"],
|
|
75
|
+
// r, g, b
|
|
76
|
+
BACKGROUND_COLOR: [36, "F32", "F32", "F32"],
|
|
77
|
+
// channel index, isovalue, isorange
|
|
78
|
+
SET_ISOVALUE_THRESHOLD: [37, "I32", "F32", "F32"],
|
|
79
|
+
// channel index, array of [stop, r, g, b, a]
|
|
80
|
+
SET_CONTROL_POINTS: [38, "I32", "F32A"],
|
|
81
|
+
// path, scene, time (DEPRECATED)
|
|
82
|
+
LOAD_VOLUME_FROM_FILE: [39, "S", "I32", "I32"],
|
|
83
|
+
// actually loads data
|
|
84
|
+
SET_TIME: [40, "I32"],
|
|
85
|
+
SET_BOUNDING_BOX_COLOR: [41, "F32", "F32", "F32"],
|
|
86
|
+
SHOW_BOUNDING_BOX: [42, "I32"],
|
|
87
|
+
TRACKBALL_CAMERA: [43, "F32", "F32"],
|
|
88
|
+
// path, scene, multiresolution level, t, channel indices, region
|
|
89
|
+
LOAD_DATA: [44, "S", "I32", "I32", "I32", "I32A", "I32A"],
|
|
90
|
+
SHOW_SCALE_BAR: [45, "I32"]
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
// strategy: add elements to prebuffer, and then traverse prebuffer to convert
|
|
94
|
+
// to binary before sending?
|
|
95
|
+
export var CommandBuffer = /*#__PURE__*/function () {
|
|
96
|
+
// [command, args],...
|
|
97
|
+
|
|
98
|
+
function CommandBuffer() {
|
|
99
|
+
_classCallCheck(this, CommandBuffer);
|
|
100
|
+
this.prebuffer = [];
|
|
101
|
+
this.buffer = null;
|
|
102
|
+
}
|
|
103
|
+
_createClass(CommandBuffer, [{
|
|
104
|
+
key: "prebufferToBuffer",
|
|
105
|
+
value: function prebufferToBuffer() {
|
|
106
|
+
// iterate length of prebuffer to compute size.
|
|
107
|
+
var bytesize = 0;
|
|
108
|
+
for (var i = 0; i < this.prebuffer.length; ++i) {
|
|
109
|
+
// for each command.
|
|
110
|
+
|
|
111
|
+
// one i32 for the command id.
|
|
112
|
+
bytesize += types.I32;
|
|
113
|
+
var command = this.prebuffer[i];
|
|
114
|
+
var commandCode = command[0];
|
|
115
|
+
var signature = COMMANDS[commandCode];
|
|
116
|
+
if (!signature) {
|
|
117
|
+
console.error("CommandBuffer: Unrecognized command " + commandCode);
|
|
118
|
+
}
|
|
119
|
+
var nArgsExpected = signature.length - 1;
|
|
120
|
+
// for each arg:
|
|
121
|
+
if (command.length - 1 !== nArgsExpected) {
|
|
122
|
+
console.error("BAD COMMAND: EXPECTED ".concat(nArgsExpected, " args and got ").concat(command.length - 1));
|
|
123
|
+
}
|
|
124
|
+
for (var j = 0; j < nArgsExpected; ++j) {
|
|
125
|
+
// get arg type
|
|
126
|
+
var argtype = signature[j + 1];
|
|
127
|
+
if (argtype === "S") {
|
|
128
|
+
// one int32 for string length
|
|
129
|
+
bytesize += 4;
|
|
130
|
+
// followed by one byte per char.
|
|
131
|
+
bytesize += command[j + 1].length;
|
|
132
|
+
} else if (argtype === "F32A") {
|
|
133
|
+
// one int32 for array length
|
|
134
|
+
bytesize += 4;
|
|
135
|
+
// followed by 4 bytes per float in the array
|
|
136
|
+
bytesize += 4 * command[j + 1].length;
|
|
137
|
+
} else if (argtype === "I32A") {
|
|
138
|
+
// one int32 for array length
|
|
139
|
+
bytesize += 4;
|
|
140
|
+
// followed by 4 bytes per int32 in the array
|
|
141
|
+
bytesize += 4 * command[j + 1].length;
|
|
142
|
+
} else {
|
|
143
|
+
bytesize += types[argtype];
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
// allocate arraybuffer and then fill it.
|
|
148
|
+
this.buffer = new ArrayBuffer(bytesize);
|
|
149
|
+
var dataview = new DataView(this.buffer);
|
|
150
|
+
var offset = 0;
|
|
151
|
+
var LITTLE_ENDIAN = true;
|
|
152
|
+
for (var _i = 0; _i < this.prebuffer.length; ++_i) {
|
|
153
|
+
var cmd = this.prebuffer[_i];
|
|
154
|
+
var _commandCode = cmd[0];
|
|
155
|
+
var _signature = COMMANDS[_commandCode];
|
|
156
|
+
var _nArgsExpected = _signature.length - 1;
|
|
157
|
+
|
|
158
|
+
// the numeric code for the command
|
|
159
|
+
dataview.setInt32(offset, _signature[0]);
|
|
160
|
+
offset += 4;
|
|
161
|
+
for (var _j = 0; _j < _nArgsExpected; ++_j) {
|
|
162
|
+
// get arg type
|
|
163
|
+
var _argtype = _signature[_j + 1];
|
|
164
|
+
switch (_argtype) {
|
|
165
|
+
case "S":
|
|
166
|
+
{
|
|
167
|
+
var str = cmd[_j + 1];
|
|
168
|
+
dataview.setInt32(offset, str.length);
|
|
169
|
+
offset += 4;
|
|
170
|
+
for (var k = 0; k < str.length; ++k) {
|
|
171
|
+
dataview.setUint8(offset, str.charCodeAt(k));
|
|
172
|
+
offset += 1;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
break;
|
|
176
|
+
case "F32":
|
|
177
|
+
dataview.setFloat32(offset, cmd[_j + 1], LITTLE_ENDIAN);
|
|
178
|
+
offset += 4;
|
|
179
|
+
break;
|
|
180
|
+
case "I32":
|
|
181
|
+
dataview.setInt32(offset, cmd[_j + 1]);
|
|
182
|
+
offset += 4;
|
|
183
|
+
break;
|
|
184
|
+
case "F32A":
|
|
185
|
+
{
|
|
186
|
+
var flist = cmd[_j + 1];
|
|
187
|
+
dataview.setInt32(offset, flist.length);
|
|
188
|
+
offset += 4;
|
|
189
|
+
for (var _k = 0; _k < flist.length; ++_k) {
|
|
190
|
+
dataview.setFloat32(offset, flist[_k], LITTLE_ENDIAN);
|
|
191
|
+
offset += 4;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
break;
|
|
195
|
+
case "I32A":
|
|
196
|
+
{
|
|
197
|
+
var ilist = cmd[_j + 1];
|
|
198
|
+
dataview.setInt32(offset, ilist.length);
|
|
199
|
+
offset += 4;
|
|
200
|
+
for (var _k2 = 0; _k2 < ilist.length; ++_k2) {
|
|
201
|
+
dataview.setInt32(offset, ilist[_k2], LITTLE_ENDIAN);
|
|
202
|
+
offset += 4;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
break;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
// result is in this.buffer
|
|
210
|
+
return this.buffer;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
// commands are added by command code string name followed by appropriate
|
|
214
|
+
// signature args.
|
|
215
|
+
}, {
|
|
216
|
+
key: "addCommand",
|
|
217
|
+
value: function addCommand() {
|
|
218
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
219
|
+
args[_key] = arguments[_key];
|
|
220
|
+
}
|
|
221
|
+
//const args = [].slice.call(arguments);
|
|
222
|
+
// TODO: check against signature!!!
|
|
223
|
+
this.prebuffer.push([].concat(args));
|
|
224
|
+
}
|
|
225
|
+
}, {
|
|
226
|
+
key: "length",
|
|
227
|
+
value: function length() {
|
|
228
|
+
return this.prebuffer.length;
|
|
229
|
+
}
|
|
230
|
+
}]);
|
|
231
|
+
return CommandBuffer;
|
|
232
|
+
}();
|
package/es/index.js
ADDED
|
@@ -0,0 +1,380 @@
|
|
|
1
|
+
export type JSONValue = string | number | boolean | {
|
|
2
|
+
[x: string]: JSONValue;
|
|
3
|
+
} | Array<JSONValue>;
|
|
4
|
+
export declare class AgaveClient {
|
|
5
|
+
private url;
|
|
6
|
+
private socket?;
|
|
7
|
+
private cb;
|
|
8
|
+
private sessionName;
|
|
9
|
+
private onOpen;
|
|
10
|
+
private onJson;
|
|
11
|
+
private onImage;
|
|
12
|
+
constructor(url?: string, rendermode?: string, onOpen?: () => void, onJson?: (_json: JSONValue) => void, onImage?: (_data: Blob) => void);
|
|
13
|
+
connect(): Promise<unknown>;
|
|
14
|
+
isReady(): boolean;
|
|
15
|
+
disconnect(): void;
|
|
16
|
+
/**
|
|
17
|
+
* Set the current session name. Use the full path to the name of the output
|
|
18
|
+
* image here.
|
|
19
|
+
*
|
|
20
|
+
* @param name This name is the full path to the output image, ending in .png or .jpg.
|
|
21
|
+
* Make sure the directory has already been created.
|
|
22
|
+
*
|
|
23
|
+
*/
|
|
24
|
+
session(name: string): void;
|
|
25
|
+
/**
|
|
26
|
+
* Sets a search path for volume files. NOT YET IMPLEMENTED.
|
|
27
|
+
*
|
|
28
|
+
* @param name This name is the path where volume images are located.
|
|
29
|
+
*/
|
|
30
|
+
assetPath(name: string): void;
|
|
31
|
+
/**
|
|
32
|
+
* Set the viewer camera position. Default is (500,500,500).
|
|
33
|
+
*
|
|
34
|
+
* @param x The x coordinate
|
|
35
|
+
* @param y The y coordinate
|
|
36
|
+
* @param z The z coordinate
|
|
37
|
+
*/
|
|
38
|
+
eye(x: number, y: number, z: number): void;
|
|
39
|
+
/**
|
|
40
|
+
* Set the viewer target position. This is a point toward which we are looking.
|
|
41
|
+
* Default is (0,0,0).
|
|
42
|
+
*
|
|
43
|
+
* @param x The x coordinate
|
|
44
|
+
* @param y The y coordinate
|
|
45
|
+
* @param z The z coordinate
|
|
46
|
+
*/
|
|
47
|
+
target(x: number, y: number, z: number): void;
|
|
48
|
+
/**
|
|
49
|
+
* Set the viewer camera up direction. This is a vector which should be nearly
|
|
50
|
+
* perpendicular to the view direction (target-eye), and defines the "roll" amount
|
|
51
|
+
* for the camera.
|
|
52
|
+
* Default is (0,0,1).
|
|
53
|
+
*
|
|
54
|
+
* @param x The x coordinate
|
|
55
|
+
* @param y The y coordinate
|
|
56
|
+
* @param z The z coordinate
|
|
57
|
+
*/
|
|
58
|
+
up(x: number, y: number, z: number): void;
|
|
59
|
+
/**
|
|
60
|
+
* Set the viewer camera aperture size.
|
|
61
|
+
*
|
|
62
|
+
* @param x The aperture size. This is a number between 0 and 1. 0 means no defocusing will occur, like a pinhole camera. 1 means maximum defocus. Default is 0.
|
|
63
|
+
*/
|
|
64
|
+
aperture(x: number): void;
|
|
65
|
+
/**
|
|
66
|
+
* Set the viewer camera projection type, along with a relevant parameter.
|
|
67
|
+
* @param projectionType 0 for Perspective, 1 for Orthographic. Default: 0
|
|
68
|
+
* @param x If Perspective, then this is the vertical Field of View angle in degrees.
|
|
69
|
+
* If Orthographic, then this is the orthographic scale dimension.
|
|
70
|
+
* Default: 55.0 degrees. (default Orthographic scale is 0.5)
|
|
71
|
+
*/
|
|
72
|
+
cameraProjection(projectionType: number, x: number): void;
|
|
73
|
+
/**
|
|
74
|
+
* Set the viewer camera focal distance
|
|
75
|
+
*
|
|
76
|
+
* @param x The focal distance. Has no effect if aperture is 0.
|
|
77
|
+
*/
|
|
78
|
+
focaldist(x: number): void;
|
|
79
|
+
/**
|
|
80
|
+
* Set the exposure level
|
|
81
|
+
*
|
|
82
|
+
* @param x The exposure level between 0 and 1. Default is 0.75. Higher numbers are brighter.
|
|
83
|
+
*/
|
|
84
|
+
exposure(x: number): void;
|
|
85
|
+
/**
|
|
86
|
+
* Set the diffuse color of a channel
|
|
87
|
+
*
|
|
88
|
+
* @param channel Which channel index, 0 based.
|
|
89
|
+
* @param r The red value between 0 and 1
|
|
90
|
+
* @param g The green value between 0 and 1
|
|
91
|
+
* @param b The blue value between 0 and 1
|
|
92
|
+
* @param a The alpha value between 0 and 1 (currently unused)
|
|
93
|
+
*/
|
|
94
|
+
matDiffuse(channel: number, r: number, g: number, b: number, a: number): void;
|
|
95
|
+
/**
|
|
96
|
+
* Set the specular color of a channel (defaults to black, for no specular
|
|
97
|
+
* response)
|
|
98
|
+
*
|
|
99
|
+
* @param channel Which channel index, 0 based.
|
|
100
|
+
* @param r The red value between 0 and 1
|
|
101
|
+
* @param g The green value between 0 and 1
|
|
102
|
+
* @param b The blue value between 0 and 1
|
|
103
|
+
* @param a The alpha value between 0 and 1 (currently unused)
|
|
104
|
+
*/
|
|
105
|
+
matSpecular(channel: number, r: number, g: number, b: number, a: number): void;
|
|
106
|
+
/**
|
|
107
|
+
* Set the emissive color of a channel (defaults to black, for no emission)
|
|
108
|
+
*
|
|
109
|
+
* @param channel Which channel index, 0 based.
|
|
110
|
+
* @param r The red value between 0 and 1
|
|
111
|
+
* @param g The green value between 0 and 1
|
|
112
|
+
* @param b The blue value between 0 and 1
|
|
113
|
+
* @param a The alpha value between 0 and 1 (currently unused)
|
|
114
|
+
*/
|
|
115
|
+
matEmissive(channel: number, r: number, g: number, b: number, a: number): void;
|
|
116
|
+
/**
|
|
117
|
+
* Set the number of paths per pixel to accumulate.
|
|
118
|
+
*
|
|
119
|
+
* @param x How many paths per pixel. The more paths, the less noise in the image.
|
|
120
|
+
*/
|
|
121
|
+
renderIterations(x: number): void;
|
|
122
|
+
/**
|
|
123
|
+
* Turn stream mode on or off. Stream mode will send an image back to the client
|
|
124
|
+
* on each iteration up to some server-defined amount. This mode is useful for
|
|
125
|
+
* interactive client-server applications but not for batch-mode offline rendering.
|
|
126
|
+
*
|
|
127
|
+
* @param x 0 for off, 1 for on. Default is off.
|
|
128
|
+
*/
|
|
129
|
+
streamMode(x: number): void;
|
|
130
|
+
/**
|
|
131
|
+
* Tell the server to process all commands and return an image
|
|
132
|
+
* TODO , and then save the image.
|
|
133
|
+
* TODO This function will block and wait for the image to be returned.
|
|
134
|
+
* TODO The image returned will be saved automatically using the session_name.
|
|
135
|
+
* TODO: a timeout is not yet implemented.
|
|
136
|
+
*/
|
|
137
|
+
redraw(): void;
|
|
138
|
+
/**
|
|
139
|
+
* Set the image resolution in pixels.
|
|
140
|
+
*
|
|
141
|
+
* @param x x resolution in pixels
|
|
142
|
+
* @param y y resolution in pixels
|
|
143
|
+
*/
|
|
144
|
+
setResolution(x: number, y: number): void;
|
|
145
|
+
/**
|
|
146
|
+
* Set the scattering density.
|
|
147
|
+
*
|
|
148
|
+
* @param x The scattering density, 0-100. Higher values will make the volume seem
|
|
149
|
+
* more opaque. Default is 8.5, which is relatively transparent.
|
|
150
|
+
*/
|
|
151
|
+
density(x: number): void;
|
|
152
|
+
/**
|
|
153
|
+
* Automatically set camera parameters so that the volume fills the view.
|
|
154
|
+
* Useful when you have insufficient information to position the camera accurately.
|
|
155
|
+
*/
|
|
156
|
+
frameScene(): void;
|
|
157
|
+
/**
|
|
158
|
+
* Set the channel's glossiness.
|
|
159
|
+
*
|
|
160
|
+
* @param channel Which channel index, 0 based.
|
|
161
|
+
* @param glossiness Sets the shininess, a number between 0 and 100.
|
|
162
|
+
*/
|
|
163
|
+
matGlossiness(channel: number, glossiness: number): void;
|
|
164
|
+
/**
|
|
165
|
+
* Show or hide a given channel
|
|
166
|
+
*
|
|
167
|
+
* @param channel Which channel index, 0 based.
|
|
168
|
+
* @param enabled 0 to hide, 1 to show
|
|
169
|
+
*/
|
|
170
|
+
enableChannel(channel: number, enabled: number): void;
|
|
171
|
+
/**
|
|
172
|
+
* Set intensity threshold for a given channel based on Window/Level
|
|
173
|
+
*
|
|
174
|
+
* @param channel Which channel index, 0 based.
|
|
175
|
+
* @param window Width of the window, from 0-1.
|
|
176
|
+
* @param level Intensity level mapped to middle of window, from 0-1
|
|
177
|
+
*/
|
|
178
|
+
setWindowLevel(channel: number, window: number, level: number): void;
|
|
179
|
+
/**
|
|
180
|
+
* Rotate the camera around the volume by angle deltas
|
|
181
|
+
*
|
|
182
|
+
* @param theta polar angle in degrees
|
|
183
|
+
* @param phi azimuthal angle in degrees
|
|
184
|
+
*/
|
|
185
|
+
orbitCamera(theta: number, phi: number): void;
|
|
186
|
+
/**
|
|
187
|
+
* Rotate the camera around the volume by angle deltas
|
|
188
|
+
*
|
|
189
|
+
* @param theta vertical screen angle in degrees
|
|
190
|
+
* @param phi horizontal screen angle in degrees
|
|
191
|
+
*/
|
|
192
|
+
trackballCamera(theta: number, phi: number): void;
|
|
193
|
+
/**
|
|
194
|
+
* Set the "north pole" color of the sky sphere
|
|
195
|
+
*
|
|
196
|
+
* @param r The red value between 0 and 1
|
|
197
|
+
* @param g The green value between 0 and 1
|
|
198
|
+
* @param b The blue value between 0 and 1
|
|
199
|
+
*/
|
|
200
|
+
skylightTopColor(r: number, g: number, b: number): void;
|
|
201
|
+
/**
|
|
202
|
+
* Set the "equator" color of the sky sphere
|
|
203
|
+
*
|
|
204
|
+
* @param r The red value between 0 and 1
|
|
205
|
+
* @param g The green value between 0 and 1
|
|
206
|
+
* @param b The blue value between 0 and 1
|
|
207
|
+
*/
|
|
208
|
+
skylightMiddleColor(r: number, g: number, b: number): void;
|
|
209
|
+
/**
|
|
210
|
+
* Set the "south pole" color of the sky sphere
|
|
211
|
+
*
|
|
212
|
+
* @param r The red value between 0 and 1
|
|
213
|
+
* @param g The green value between 0 and 1
|
|
214
|
+
* @param b The blue value between 0 and 1
|
|
215
|
+
*/
|
|
216
|
+
skylightBottomColor(r: number, g: number, b: number): void;
|
|
217
|
+
/**
|
|
218
|
+
* Set the position of an area light, in spherical coordinates
|
|
219
|
+
*
|
|
220
|
+
* @param index Which light to set. Currently unused as there is only one area light.
|
|
221
|
+
* @param r The radius, as distance from the center of the volume
|
|
222
|
+
* @param theta The polar angle
|
|
223
|
+
* @param phi The azimuthal angle
|
|
224
|
+
*/
|
|
225
|
+
lightPos(index: number, r: number, theta: number, phi: number): void;
|
|
226
|
+
/**
|
|
227
|
+
* Set the color of an area light. Overdrive the values higher than 1 to increase
|
|
228
|
+
* the light's intensity.
|
|
229
|
+
*
|
|
230
|
+
* @param index Which light to set. Currently unused as there is only one area light.
|
|
231
|
+
* @param r The red value between 0 and 1
|
|
232
|
+
* @param g The green value between 0 and 1
|
|
233
|
+
* @param b The blue value between 0 and 1
|
|
234
|
+
*/
|
|
235
|
+
lightColor(index: number, r: number, g: number, b: number): void;
|
|
236
|
+
/**
|
|
237
|
+
* Set the size dimensions of a rectangular area light.
|
|
238
|
+
*
|
|
239
|
+
* @param index Which light to set. Currently unused as there is only one area light.
|
|
240
|
+
* @param x The width dimension of the area light
|
|
241
|
+
* @param y The height dimension of the area light
|
|
242
|
+
*/
|
|
243
|
+
lightSize(index: number, x: number, y: number): void;
|
|
244
|
+
/**
|
|
245
|
+
* Set the axis aligned region of interest of the volume. All axis values are
|
|
246
|
+
* relative, where 0 is one extent of the volume and 1 is the opposite extent.
|
|
247
|
+
* For example, (0,1, 0,1, 0,0.5) will select the lower half of the volume's z
|
|
248
|
+
* slices.
|
|
249
|
+
*
|
|
250
|
+
* @param minx The lower x extent between 0 and 1
|
|
251
|
+
* @param maxx The higher x extent between 0 and 1
|
|
252
|
+
* @param miny The lower y extent between 0 and 1
|
|
253
|
+
* @param maxy The higher y extent between 0 and 1
|
|
254
|
+
* @param minz The lower z extent between 0 and 1
|
|
255
|
+
* @param maxz The higher z extent between 0 and 1
|
|
256
|
+
*/
|
|
257
|
+
setClipRegion(minx: number, maxx: number, miny: number, maxy: number, minz: number, maxz: number): void;
|
|
258
|
+
/**
|
|
259
|
+
* Set the relative scale of the pixels in the volume. Typically this is filled in
|
|
260
|
+
* with the physical pixel dimensions from the microscope metadata. Often the x
|
|
261
|
+
* and y scale will differ from the z scale. Defaults to (1,1,1)
|
|
262
|
+
*
|
|
263
|
+
* @param x x scale
|
|
264
|
+
* @param y y scale
|
|
265
|
+
* @param z z scale
|
|
266
|
+
*/
|
|
267
|
+
setVoxelScale(x: number, y: number, z: number): void;
|
|
268
|
+
/**
|
|
269
|
+
* Automatically determine the intensity thresholds
|
|
270
|
+
*
|
|
271
|
+
* @param channel Which channel index, 0 based.
|
|
272
|
+
* @param method Allowed values:
|
|
273
|
+
* 0: Auto2
|
|
274
|
+
* 1: Auto
|
|
275
|
+
* 2: BestFit
|
|
276
|
+
* 3: ChimeraX emulation
|
|
277
|
+
* 4: between 0.5 percentile and 0.98 percentile
|
|
278
|
+
*/
|
|
279
|
+
autoThreshold(channel: number, method: number): void;
|
|
280
|
+
/**
|
|
281
|
+
* Set intensity thresholds based on percentiles of pixels to clip min and max
|
|
282
|
+
* intensity
|
|
283
|
+
*
|
|
284
|
+
* @param channel Which channel index, 0 based.
|
|
285
|
+
* @param pctLow The low percentile to remap to 0(min) intensity
|
|
286
|
+
* @param pctHigh The high percentile to remap to 1(max) intensity
|
|
287
|
+
*/
|
|
288
|
+
setPercentileThreshold(channel: number, pctLow: number, pctHigh: number): void;
|
|
289
|
+
/**
|
|
290
|
+
* Set channel opacity. This is a multiplier against all intensity values in the
|
|
291
|
+
* channel.
|
|
292
|
+
*
|
|
293
|
+
* @param channel Which channel index, 0 based.
|
|
294
|
+
* @param opacity A multiplier between 0 and 1. Default is 1
|
|
295
|
+
*/
|
|
296
|
+
matOpacity(channel: number, opacity: number): void;
|
|
297
|
+
/**
|
|
298
|
+
* Set primary ray step size. This is an accuracy versus speed tradeoff. Low
|
|
299
|
+
* values are more accurate. High values will render faster.
|
|
300
|
+
* Primary rays are the rays that are cast from the camera out into the volume.
|
|
301
|
+
*
|
|
302
|
+
* @param stepSize A value in voxels. Default is 4. Minimum sensible value is 1.
|
|
303
|
+
*/
|
|
304
|
+
setPrimaryRayStepSize(stepSize: number): void;
|
|
305
|
+
/**
|
|
306
|
+
* Set secondary ray step size. This is an accuracy versus speed tradeoff. Low
|
|
307
|
+
* values are more accurate. High values will render faster.
|
|
308
|
+
* The secondary rays are rays which are cast toward lights after they have
|
|
309
|
+
* scattered within the volume.
|
|
310
|
+
*
|
|
311
|
+
* @param stepSize A value in voxels. Default is 4. Minimum sensible value is 1.
|
|
312
|
+
*/
|
|
313
|
+
setSecondaryRayStepSize(stepSize: number): void;
|
|
314
|
+
/**
|
|
315
|
+
* Set the background color of the rendering
|
|
316
|
+
*
|
|
317
|
+
* @param r The red value between 0 and 1
|
|
318
|
+
* @param g The green value between 0 and 1
|
|
319
|
+
* @param b The blue value between 0 and 1
|
|
320
|
+
*/
|
|
321
|
+
backgroundColor(r: number, g: number, b: number): void;
|
|
322
|
+
/**
|
|
323
|
+
* Set intensity thresholds based on values around an isovalue.
|
|
324
|
+
*
|
|
325
|
+
* @param channel Which channel index, 0 based.
|
|
326
|
+
* @param isovalue The value to center at maximum intensity, between 0 and 1
|
|
327
|
+
* @param isorange A range around the isovalue to keep at constant intensity, between 0 and 1.
|
|
328
|
+
* Typically small, to select for a single isovalue.
|
|
329
|
+
*/
|
|
330
|
+
setIsovalueThreshold(channel: number, isovalue: number, isorange: number): void;
|
|
331
|
+
/**
|
|
332
|
+
* Set intensity thresholds based on a piecewise linear transfer function.
|
|
333
|
+
*
|
|
334
|
+
* @param channel Which channel index, 0 based.
|
|
335
|
+
* @param data An array of values. 5 floats per control point. first is position (0-1),
|
|
336
|
+
* next four are rgba (all 0-1). Only alpha is currently used as the remapped
|
|
337
|
+
* intensity value. All others are linearly interpolated.
|
|
338
|
+
*/
|
|
339
|
+
setControlPoints(channel: number, data: number[]): void;
|
|
340
|
+
/**
|
|
341
|
+
* Load a time from the current volume file
|
|
342
|
+
*
|
|
343
|
+
* @param time zero-based index to select the time sample. Defaults to 0
|
|
344
|
+
*/
|
|
345
|
+
setTime(time: number): void;
|
|
346
|
+
/**
|
|
347
|
+
* Set the color for the bounding box display
|
|
348
|
+
*
|
|
349
|
+
* @param r the red value, from 0 to 1
|
|
350
|
+
* @param g the green value, from 0 to 1
|
|
351
|
+
* @param b the blue value, from 0 to 1
|
|
352
|
+
*/
|
|
353
|
+
boundingBoxColor(r: number, g: number, b: number): void;
|
|
354
|
+
/**
|
|
355
|
+
* Turn bounding box display on or off
|
|
356
|
+
*
|
|
357
|
+
* @param on 0 to hide bounding box, 1 to show it
|
|
358
|
+
*/
|
|
359
|
+
showBoundingBox(on: number): void;
|
|
360
|
+
/**
|
|
361
|
+
* Completely specify volume data to load
|
|
362
|
+
*
|
|
363
|
+
* @param path URL or directory or file path to the data. The path must be locally
|
|
364
|
+
* accessible from the AGAVE server.
|
|
365
|
+
* @param scene zero-based index to select the scene, for multi-scene files. Defaults to 0
|
|
366
|
+
* @param multiresolutionLevel zero-based index to select the multiresolution level. Defaults to 0
|
|
367
|
+
* @param time zero-based index to select the time sample. Defaults to 0
|
|
368
|
+
* @param channels zero-based indices to select the channels. Defaults to all channels
|
|
369
|
+
* @param region 6 integers specifying the region to load. Defaults to the entire volume.
|
|
370
|
+
* Any list length other than 0 or 6 is an error.
|
|
371
|
+
*/
|
|
372
|
+
loadData(path: string, scene?: number, multiresolutionLevel?: number, time?: number, channels?: number[], region?: number[]): void;
|
|
373
|
+
/**
|
|
374
|
+
* Turn scale bar display on or off
|
|
375
|
+
*
|
|
376
|
+
* @param on 0 to hide scale bar, 1 to show it
|
|
377
|
+
*/
|
|
378
|
+
showScaleBar(on: number): void;
|
|
379
|
+
flushCommandBuffer(): void;
|
|
380
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
type CmdArgs = string | number | number[];
|
|
2
|
+
export declare const COMMANDS: {
|
|
3
|
+
SESSION: (string | number)[];
|
|
4
|
+
ASSET_PATH: (string | number)[];
|
|
5
|
+
LOAD_OME_TIF: (string | number)[];
|
|
6
|
+
EYE: (string | number)[];
|
|
7
|
+
TARGET: (string | number)[];
|
|
8
|
+
UP: (string | number)[];
|
|
9
|
+
APERTURE: (string | number)[];
|
|
10
|
+
CAMERA_PROJECTION: (string | number)[];
|
|
11
|
+
FOCALDIST: (string | number)[];
|
|
12
|
+
EXPOSURE: (string | number)[];
|
|
13
|
+
MAT_DIFFUSE: (string | number)[];
|
|
14
|
+
MAT_SPECULAR: (string | number)[];
|
|
15
|
+
MAT_EMISSIVE: (string | number)[];
|
|
16
|
+
RENDER_ITERATIONS: (string | number)[];
|
|
17
|
+
STREAM_MODE: (string | number)[];
|
|
18
|
+
REDRAW: number[];
|
|
19
|
+
SET_RESOLUTION: (string | number)[];
|
|
20
|
+
DENSITY: (string | number)[];
|
|
21
|
+
FRAME_SCENE: number[];
|
|
22
|
+
MAT_GLOSSINESS: (string | number)[];
|
|
23
|
+
ENABLE_CHANNEL: (string | number)[];
|
|
24
|
+
SET_WINDOW_LEVEL: (string | number)[];
|
|
25
|
+
ORBIT_CAMERA: (string | number)[];
|
|
26
|
+
SKYLIGHT_TOP_COLOR: (string | number)[];
|
|
27
|
+
SKYLIGHT_MIDDLE_COLOR: (string | number)[];
|
|
28
|
+
SKYLIGHT_BOTTOM_COLOR: (string | number)[];
|
|
29
|
+
LIGHT_POS: (string | number)[];
|
|
30
|
+
LIGHT_COLOR: (string | number)[];
|
|
31
|
+
LIGHT_SIZE: (string | number)[];
|
|
32
|
+
SET_CLIP_REGION: (string | number)[];
|
|
33
|
+
SET_VOXEL_SCALE: (string | number)[];
|
|
34
|
+
AUTO_THRESHOLD: (string | number)[];
|
|
35
|
+
SET_PERCENTILE_THRESHOLD: (string | number)[];
|
|
36
|
+
MAT_OPACITY: (string | number)[];
|
|
37
|
+
SET_PRIMARY_RAY_STEP_SIZE: (string | number)[];
|
|
38
|
+
SET_SECONDARY_RAY_STEP_SIZE: (string | number)[];
|
|
39
|
+
BACKGROUND_COLOR: (string | number)[];
|
|
40
|
+
SET_ISOVALUE_THRESHOLD: (string | number)[];
|
|
41
|
+
SET_CONTROL_POINTS: (string | number)[];
|
|
42
|
+
LOAD_VOLUME_FROM_FILE: (string | number)[];
|
|
43
|
+
SET_TIME: (string | number)[];
|
|
44
|
+
SET_BOUNDING_BOX_COLOR: (string | number)[];
|
|
45
|
+
SHOW_BOUNDING_BOX: (string | number)[];
|
|
46
|
+
TRACKBALL_CAMERA: (string | number)[];
|
|
47
|
+
LOAD_DATA: (string | number)[];
|
|
48
|
+
SHOW_SCALE_BAR: (string | number)[];
|
|
49
|
+
};
|
|
50
|
+
export declare class CommandBuffer {
|
|
51
|
+
private prebuffer;
|
|
52
|
+
private buffer;
|
|
53
|
+
constructor();
|
|
54
|
+
prebufferToBuffer(): ArrayBuffer;
|
|
55
|
+
addCommand(...args: CmdArgs[]): void;
|
|
56
|
+
length(): number;
|
|
57
|
+
}
|
|
58
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|