allen-cell-animated / agave

Other
33 stars 5 forks source link

Feature/js interface #112

Closed toloudis closed 1 year ago

toloudis commented 1 year ago

Rewrite the agave web client with an eye toward integrating it in other viewers.

The previous code was not very reusable. Note that the diff is so huge that you might as well ignore the old code. There are a few remnants of the old implementation still here, which could be refined but will save that for a separate PR.

This code change splits up the webclient directory into two sections: one containing the reusable agave websocket client, and one containing an example viewer that uses the client.

How it works: Much like the python interface, we connect to an already running agave server using websockets. We then encode small commands and send them to the agave server. The agave server returns a stream of images back via binary websocket messages. Currently the images are encoded as jpg files. This is slightly different than the python client, which receives images one at a time rather than streamed.

The python use case is more designed for automation and generating a whole image from a batch of commands. The web client is more designed for streaming interactive viewing.

A test viewer is implemented here, which simply deposits the received jpg data as a img.src which results in it being displayed on the web page. The vast majority of the test viewer code is setting up a simple gui so we can test many of the agave commands.