.. java:import:: ch.epfl.leb.sass.logging Message .. java:import:: ch.epfl.leb.sass.models Microscope .. java:import:: ch.epfl.leb.sass.simulator Simulator .. java:import:: ch.epfl.leb.sass.simulator SimulationManager .. java:import:: ch.epfl.leb.sass.simulator.internal RPCSimulator .. java:import:: ch.epfl.leb.sass.simulator.internal DefaultSimulationManager .. java:import:: ch.epfl.leb.sass.utils.images ImageS .. java:import:: ch.epfl.leb.sass.utils.images ImageShapeException .. java:import:: com.google.gson Gson .. java:import:: com.google.gson JsonArray .. java:import:: java.util List .. java:import:: java.nio ByteBuffer .. java:import:: java.util.logging Level .. java:import:: java.util.logging Logger RemoteSimulationServiceHandler ============================== .. java:package:: ch.epfl.leb.sass.server :noindex: .. java:type:: public class RemoteSimulationServiceHandler implements RemoteSimulationService.Iface Implements the remote simulation service functions. :author: Kyle M. Douglass Constructors ------------ RemoteSimulationServiceHandler ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. java:constructor:: public RemoteSimulationServiceHandler() :outertype: RemoteSimulationServiceHandler Initializes the remote handler. RemoteSimulationServiceHandler ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. java:constructor:: public RemoteSimulationServiceHandler(SimulationManager inputManager) :outertype: RemoteSimulationServiceHandler Initializes the remote handler with a pre-specified SimulationManager. :param inputManager: SimulationManager that handles multiple simulations. Methods ------- createSimulation ^^^^^^^^^^^^^^^^ .. java:method:: @Override public int createSimulation() :outertype: RemoteSimulationServiceHandler Creates a new simulation and returns its ID. This creates a copy of one of the already created simulations in the SimulationManager. If you wish to create a simulation with all new parameters, then you will need to create a new SimulationManager. :return: The new simulation's ID. deleteSimulation ^^^^^^^^^^^^^^^^ .. java:method:: @Override public void deleteSimulation(int id) throws UnknownSimulationIdException :outertype: RemoteSimulationServiceHandler Deletes the simulation with the given ID. :param id: The ID of the simulation to delete. getCameraJsonName ^^^^^^^^^^^^^^^^^ .. java:method:: @Override public String getCameraJsonName(int id) throws UnknownSimulationIdException :outertype: RemoteSimulationServiceHandler Returns the name of the JSON key for the camera info. :param id: The simulation ID. :throws UnknownSimulationIdException: :return: The name of the key indicating the camera information. getControlSignal ^^^^^^^^^^^^^^^^ .. java:method:: @Override public double getControlSignal(int id) throws UnknownSimulationIdException :outertype: RemoteSimulationServiceHandler Returns the control signal for the current simulation. :param id: The simulation ID. :throws ch.epfl.leb.sass.server.UnknownSimulationIdException: :return: The value of the simulation's current control signal. getFluorescenceJsonName ^^^^^^^^^^^^^^^^^^^^^^^ .. java:method:: @Override public String getFluorescenceJsonName(int id) throws UnknownSimulationIdException :outertype: RemoteSimulationServiceHandler Returns the name of the JSON key for the fluorescence info. :param id: The simulation ID. :throws UnknownSimulationIdException: :return: The name of the key indicating the fluorescence information. getFovSize ^^^^^^^^^^ .. java:method:: @Override public double getFovSize(int id) throws UnknownSimulationIdException :outertype: RemoteSimulationServiceHandler Returns the field-of-view size in object space units. :param id: The simulation ID. :throws ch.epfl.leb.sass.server.UnknownSimulationIdException: :return: The size of the simulation's FOV. getImageCount ^^^^^^^^^^^^^ .. java:method:: @Override public int getImageCount(int id) throws UnknownSimulationIdException :outertype: RemoteSimulationServiceHandler Returns the number of images already simulated. :param id: The simulation ID. :throws UnknownSimulationIdException: :return: The number of images already simulated. getLaserJsonName ^^^^^^^^^^^^^^^^ .. java:method:: @Override public String getLaserJsonName(int id) throws UnknownSimulationIdException :outertype: RemoteSimulationServiceHandler Returns the name of the JSON key for the laser info. :param id: The simulation ID. :throws UnknownSimulationIdException: :return: The name of the key indicating the laser information. getNextImage ^^^^^^^^^^^^ .. java:method:: @Override public ByteBuffer getNextImage(int id) throws ImageGenerationException, UnknownSimulationIdException :outertype: RemoteSimulationServiceHandler Advances the simulator by one time step and returns the image. :param id: The simulation ID. :throws ch.epfl.leb.sass.server.ImageGenerationException: :return: A buffer containing the TIFF-encoded byte string of the simulator's next image. getObjectSpacePixelSize ^^^^^^^^^^^^^^^^^^^^^^^ .. java:method:: @Override public double getObjectSpacePixelSize(int id) throws UnknownSimulationIdException :outertype: RemoteSimulationServiceHandler Returns the object space pixel size. Units are the same as those of the camera pixel size. :param id: The simulation ID. :throws UnknownSimulationIdException: :return: The object space pixel size. getObjectiveJsonName ^^^^^^^^^^^^^^^^^^^^ .. java:method:: @Override public String getObjectiveJsonName(int id) throws UnknownSimulationIdException :outertype: RemoteSimulationServiceHandler Returns the name of the JSON key for the objective info. :param id: The simulation ID. :throws UnknownSimulationIdException: :return: The name of the key indicating the laser information. getServerStatus ^^^^^^^^^^^^^^^ .. java:method:: @Override public String getServerStatus() :outertype: RemoteSimulationServiceHandler This method is used to determine whether the server is running. :return: Basic information concerning the status of the server. getShortTrueSignalDescription ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. java:method:: @Override public String getShortTrueSignalDescription(int id) throws UnknownSimulationIdException :outertype: RemoteSimulationServiceHandler Returns a brief description of the ground-truth signal. :param id: The simulation ID. :throws UnknownSimulationIdException: :return: A brief description of the ground truth signal. getStageJsonName ^^^^^^^^^^^^^^^^ .. java:method:: @Override public String getStageJsonName(int id) throws UnknownSimulationIdException :outertype: RemoteSimulationServiceHandler Returns the name of the JSON key for the stage info. :param id: The simulation ID. :throws UnknownSimulationIdException: :return: The name of the key indicating the stage information. getTrueSignal ^^^^^^^^^^^^^ .. java:method:: @Override public double getTrueSignal(int id, int imageNum) throws UnknownSimulationIdException :outertype: RemoteSimulationServiceHandler Returns the ground-truth signal of the image at the given index. :param id: The simulation ID. :param imageNum: The index of the image to get the true signal for. :throws UnknownSimulationIdException: :return: The ground truth signal. incrementTimeStep ^^^^^^^^^^^^^^^^^ .. java:method:: @Override public void incrementTimeStep(int id) throws UnknownSimulationIdException :outertype: RemoteSimulationServiceHandler Advances the simulation without creating an image. :param id: The simulation ID. :throws UnknownSimulationIdException: setControlSignal ^^^^^^^^^^^^^^^^ .. java:method:: @Override public void setControlSignal(int id, double power) throws UnknownSimulationIdException :outertype: RemoteSimulationServiceHandler Sets the activation laser power in the simulation. :param id: The simulation ID. :param power: The power of the laser. :throws UnknownSimulationIdException: toJsonMessages ^^^^^^^^^^^^^^ .. java:method:: @Override public String toJsonMessages(int id) throws UnknownSimulationIdException :outertype: RemoteSimulationServiceHandler Returns messages about changes in the simulation state as a JSON string. Unlike \ :java:ref:`toJsonState() `\ , which returns information about the *current* state of just the fluorophores, this method returns the messages from individual simulation components that contain information about changes in their state that have occurred since the last time this method was called. :param id: The simulation ID. :throws UnknownSimulationIdException: :return: A JSON string containing the messages that were recorded. toJsonState ^^^^^^^^^^^ .. java:method:: @Override public String toJsonState(int id) throws UnknownSimulationIdException :outertype: RemoteSimulationServiceHandler Returns information on the simulation's current state as a JSON object. Unlike \ :java:ref:`toJsonMessages() `\ , which returns information about previous changes in the simulation's state, this method reports on the current state of the simulation. :param id: The simulation ID. :throws UnknownSimulationIdException: :return: The state of the sample fluorescence as a JSON string.