RemoteSimulationServiceHandler

public class RemoteSimulationServiceHandler implements RemoteSimulationService.Iface

Implements the remote simulation service functions.

Author:Kyle M. Douglass

Constructors

RemoteSimulationServiceHandler

public RemoteSimulationServiceHandler()

Initializes the remote handler.

RemoteSimulationServiceHandler

public RemoteSimulationServiceHandler(SimulationManager inputManager)

Initializes the remote handler with a pre-specified SimulationManager.

Parameters:
  • inputManager – SimulationManager that handles multiple simulations.

Methods

createSimulation

public int createSimulation()

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.

Returns:The new simulation’s ID.

deleteSimulation

public void deleteSimulation(int id)

Deletes the simulation with the given ID.

Parameters:
  • id – The ID of the simulation to delete.

getCameraJsonName

public String getCameraJsonName(int id)

Returns the name of the JSON key for the camera info.

Parameters:
  • id – The simulation ID.
Throws:
Returns:

The name of the key indicating the camera information.

getControlSignal

public double getControlSignal(int id)

Returns the control signal for the current simulation.

Parameters:
  • id – The simulation ID.
Throws:
Returns:

The value of the simulation’s current control signal.

getFluorescenceJsonName

public String getFluorescenceJsonName(int id)

Returns the name of the JSON key for the fluorescence info.

Parameters:
  • id – The simulation ID.
Throws:
Returns:

The name of the key indicating the fluorescence information.

getFovSize

public double getFovSize(int id)

Returns the field-of-view size in object space units.

Parameters:
  • id – The simulation ID.
Throws:
Returns:

The size of the simulation’s FOV.

getImageCount

public int getImageCount(int id)

Returns the number of images already simulated.

Parameters:
  • id – The simulation ID.
Throws:
Returns:

The number of images already simulated.

getLaserJsonName

public String getLaserJsonName(int id)

Returns the name of the JSON key for the laser info.

Parameters:
  • id – The simulation ID.
Throws:
Returns:

The name of the key indicating the laser information.

getNextImage

public ByteBuffer getNextImage(int id)

Advances the simulator by one time step and returns the image.

Parameters:
  • id – The simulation ID.
Throws:
Returns:

A buffer containing the TIFF-encoded byte string of the simulator’s next image.

getObjectSpacePixelSize

public double getObjectSpacePixelSize(int id)

Returns the object space pixel size. Units are the same as those of the camera pixel size.

Parameters:
  • id – The simulation ID.
Throws:
Returns:

The object space pixel size.

getObjectiveJsonName

public String getObjectiveJsonName(int id)

Returns the name of the JSON key for the objective info.

Parameters:
  • id – The simulation ID.
Throws:
Returns:

The name of the key indicating the laser information.

getServerStatus

public String getServerStatus()

This method is used to determine whether the server is running.

Returns:Basic information concerning the status of the server.

getShortTrueSignalDescription

public String getShortTrueSignalDescription(int id)

Returns a brief description of the ground-truth signal.

Parameters:
  • id – The simulation ID.
Throws:
Returns:

A brief description of the ground truth signal.

getStageJsonName

public String getStageJsonName(int id)

Returns the name of the JSON key for the stage info.

Parameters:
  • id – The simulation ID.
Throws:
Returns:

The name of the key indicating the stage information.

getTrueSignal

public double getTrueSignal(int id, int imageNum)

Returns the ground-truth signal of the image at the given index.

Parameters:
  • id – The simulation ID.
  • imageNum – The index of the image to get the true signal for.
Throws:
Returns:

The ground truth signal.

incrementTimeStep

public void incrementTimeStep(int id)

Advances the simulation without creating an image.

Parameters:
  • id – The simulation ID.
Throws:

setControlSignal

public void setControlSignal(int id, double power)

Sets the activation laser power in the simulation.

Parameters:
  • id – The simulation ID.
  • power – The power of the laser.
Throws:

toJsonMessages

public String toJsonMessages(int id)

Returns messages about changes in the simulation state as a JSON string. Unlike 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.

Parameters:
  • id – The simulation ID.
Throws:
Returns:

A JSON string containing the messages that were recorded.

toJsonState

public String toJsonState(int id)

Returns information on the simulation’s current state as a JSON object. Unlike toJsonMessages(), which returns information about previous changes in the simulation’s state, this method reports on the current state of the simulation.

Parameters:
  • id – The simulation ID.
Throws:
Returns:

The state of the sample fluorescence as a JSON string.