Skip to content

Commit

Permalink
Fix minor formatting errors in server documentation.
Browse files Browse the repository at this point in the history
  • Loading branch information
kmdouglass committed Feb 13, 2018
1 parent 73c0c1c commit 0e4a339
Showing 1 changed file with 47 additions and 23 deletions.
70 changes: 47 additions & 23 deletions docs/source/server.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
---------------------

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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

0 comments on commit 0e4a339

Please sign in to comment.