diff --git a/docs/source/server.rst b/docs/source/server.rst index 9c747f3..952c78a 100644 --- a/docs/source/server.rst +++ b/docs/source/server.rst @@ -25,40 +25,41 @@ firewall, are beyond the scope of this documentation. The RPC service was created using `Apache Thrift`_. -_`Apache Thrift`: https://thrift.apache.org/ +.. _`Apache Thrift`: https://thrift.apache.org/ Starting the server ------------------- -There are two ways to start the server: via a Beanshell script and via -the ImageJ GUI. +There are three ways to start the server: via the command line, inside +the ImageJ GUI, and via a Beanshell script. -Beanshell script -++++++++++++++++ +Command line +++++++++++++ -There is an example script called **example_server.bsh** in the -`scripts`_ folder of SASS that demonstrates how to launch the server -through a Beanshell script. After creating a Microscope instance named -*microscope*, simply create and launch the server with these lines :: +Enter the following command in a console window to start the server +from the command line :: - RPCServer server = new RPCServer(microscope, 9090); - server.serve(); + java -jar PATH_TO_SASS_JAR -r CONFIGURATION_FILE -Note that you will need to first import RPCServer with the command :: +The above command requires two arguments. **PATH_TO_SASS_JAR** is the +path and name of the SASS .jar file, which can be downloaded from the +`releases`_ page of the GitHub repository. **CONFIGURATION_FILE** is a +file that specifies the simulation configuration. This file can be +created created and saved from inside the SASS ImageJ GUI. - import ch.epfl.leb.sass.server.RPCServer; +The command will start the server on the default port, which was 9090 +at the time of this writing. If instead you wish to specify the port +number, use :: -This code will initialize the server to listen on port 9090 and launch -it. If you run the script from the command line, then you can kill the -server by typing **Ctrl-C**. + java -jar PATH_TO_SASS_JAR -p PORT -r CONFIGURATION_FILE -_`scripts`: https://github.com/kmdouglass/SASS/tree/master/scripts +.. _`releases`: https://github.com/LEB-EPFL/SASS/releases ImageJ ++++++ 1. Open the server configuration dialog from the menu bar by clicking -**Plugins > SASS > Server**. + **Plugins > SASS > Server**. 2. Enter the port number you wish to use for communications with the server. Usually the default (9090) is fine. 3. Next, you will need a configuration file that defines your @@ -79,6 +80,27 @@ ImageJ If you are using Fiji, then you can see status updates from the server by navigating to **Window >> Console** on the menu bar. +Beanshell script +++++++++++++++++ + +There is an example script called **example_server.bsh** in the +`scripts`_ folder of SASS that demonstrates how to launch the server +through a Beanshell script. After creating a Microscope instance named +*microscope*, simply create and launch the server with these lines :: + + RPCServer server = new RPCServer(microscope, 9090); + server.serve(); + +Note that you will need to first import RPCServer with the command :: + + import ch.epfl.leb.sass.server.RPCServer; + +This code will initialize the server to listen on port 9090 and launch +it. If you run the script from the command line, then you can kill the +server by typing **Ctrl-C**. + +.. _`scripts`: https://github.com/kmdouglass/SASS/tree/master/scripts + Server communications --------------------- @@ -164,7 +186,9 @@ rudimentary Python client to control a SASS simulation. 4. Install the Thrift bindings for Python, preferably inside a virtual environment. `pip install thrift` 4. Enter the folder **gen-py** (or move it to a convenient directory). -5. Create a file named client.py and add the following code :: +5. Create an emtpy file named client.py. + +Inside the client.py file, you will need to add the following code :: from thrift import Thrift from thrift.transport import TSocket @@ -207,7 +231,7 @@ tif-encoded byte strings.** You therefore will need the libtiff library in your target language to decode them. In Python, this can be provided by `pillow`_. -_`Apache Thrift`: https://thrift.apache.org/ -_`Get Apache Thrift`: https://thrift.apache.org/download -_`RPCServer.thrift`: https://github.com/LEB-EPFL/SASS/blob/master/thrift/RPCServer.thrift -_`pillow`: https://github.com/python-pillow/Pillow +.. _`Apache Thrift`: https://thrift.apache.org/ +.. _`Get Apache Thrift`: https://thrift.apache.org/download +.. _`RPCServer.thrift`: https://github.com/LEB-EPFL/SASS/blob/master/thrift/RPCServer.thrift +.. _`pillow`: https://github.com/python-pillow/Pillow