public class TcpIp
extends Object
Requirements
The Imaging Machine GUI must be opened to be able to exchange TcpIp commands, and the "Block remote access" option in the service panel deactivated (restart of the software needed to take effect).
If the access is enabled, the beginning of the Log should contain a line such as
[09:48:34:102] inf|SmartImaging IP Server started on port 6200
Note : Access to the service panel is protected by a password. Contact your system administrator or the acquifer support team to activate the option for you.
The TCPIP communication protocol of the IM software relies on IPv6, with the following IP "::1" (localhost).Modifier and Type | Class and Description |
---|---|
static class |
TcpIp.ControllerMode |
static class |
TcpIp.FilenameMetadata |
static class |
TcpIp.GoToMode |
Constructor and Description |
---|
TcpIp()
Open the TcpIp connection on localhost, and default Port 6200.
|
TcpIp(int port)
Open the TcpIp connection to the Imaging Machine (localhost), with custom port.
|
Modifier and Type | Method and Description |
---|---|
String |
acquireVideo(int channelNumber,
int objective,
String lightSource,
int detectionFilter,
int intensity,
int exposure,
double zPosition,
int nFrames)
Same as
acquireVideo(int, int, String, int, int, int, double, int, boolean, String) using default project folder for the image directory and lightConstantOn to false. |
String |
acquireVideo(int channelNumber,
int objective,
String lightSource,
int detectionFilter,
int intensity,
int exposure,
double zPosition,
int nFrames,
boolean lightConstantOn,
String saveDirectory)
Acquire a short video of nFrames at the current XY position and given Z-position.
|
String |
acquireZstack(int channelNumber,
int objective,
String lightSource,
int detectionFilter,
int intensity,
int exposure,
double zStackCenter,
int nSlices,
double zStepSize)
Similar to
acquireZstack(int, int, String, int, int, int, double, int, double, boolean, String) , but using the default project folder/plateID for the image directory and the light-source blinking (lightConstantOn to false). |
String |
acquireZstack(int channelNumber,
int objective,
String lightSource,
int detectionFilter,
int intensity,
int exposure,
double zStackCenter,
int nSlices,
double zStepSize,
boolean lightConstantOn,
String saveDirectory)
Acquire at the current XY-position, a Z-stack composed of nSlices, distributed evenly around a Z-centre position, using current camera settings.
|
void |
closeConnection()
Close the tcpip connection, no more commands can be sent to the IM with this object after that.
|
void |
closeLid() |
static double[] |
convertXYpixelToMillimeters(int x,
int y,
String imageName,
int width,
int height)
Convert from pixel coordinates in an image to the corresponding objective axis-coordinates of the imaging machine.
|
TcpIp.ControllerMode |
getMode()
Return the current controller mode (LIVE/SCRIPT).
|
String |
getModeAsString()
Return the current controller mode (LIVE/SCRIPT) as a upper-case string.
|
int |
getNumberOfColumns()
Return the number of plate columns.
|
int |
getNumberOfRows()
Return the number of plate rows.
|
int |
getObjectiveIndex()
Return the currently selected objective-index (1 to 4).
|
double |
getPositionX()
Return the current objective x-axis position in mm.
|
double |
getPositionY()
Return the current objective y-axis position in mm.
|
double |
getPositionZ()
Return the current objective z-axis position in µm.
|
double |
getTemperatureAmbient()
Get the current ambient temperature (°C).
|
double |
getTemperatureSample()
Get the current sample temperature (°C).
|
double |
getTemperatureTarget()
Get the temperature set as target (°C).
|
boolean |
isLidClosed() |
boolean |
isLidOpened() |
boolean |
isLiveMode()
Check if currently in live mode.
|
boolean |
isScriptMode()
Check if currently in script mode.
|
boolean |
isTemperatureRegulated() |
void |
log(String message)
Log a message to display in the imgui log.
|
void |
moveXYby(double x,
double y)
Move x,y by a given step-size (mode Relative), in mm with 0.001 decimal precision.
|
void |
moveXYto(double x,
double y)
Move x,y to target position (mode Absolute), in mm with 0.001 decimal precision.
|
void |
moveXYto(acquifer.core.WellPosition wellPosition)
Move x,y to a specific well position and update current well/subposition metadata.
|
void |
moveXYZto(double x,
double y,
double z)
Move to x,y position (mm, 0.001 precision) and z-position in µm (0.1 precision).
|
void |
moveZby(double z)
Move Z-position by given step size (mode Relative), in µm with 0.1 precision.
|
void |
moveZto(double z)
Move Z-position to target position (mode Absolute), in µm with 0.1 precision.
|
void |
openLid() |
void |
resetCamera()
Reset camera to full-size field of view (2048x2048 pixels) and no binning.
|
double |
runHardwareAutoFocus(int objective,
int detectionFilter,
double zStart,
double calibrationOffset)
Run a hardware autofocus and return the Z-position found.
|
void |
runScript(String scriptPath)
Start a .imsf or .cs script to run an acquisition.
|
double |
runSoftwareAutoFocus(int objective,
String lightSource,
int detectionFilter,
int intensity,
int exposure,
double zStackCenter,
int nSlices,
double zStepSize)
Same as
runSoftwareAutoFocus(int, String, int, int, int, double, int, double, boolean) with lightConstantOn default to false. |
double |
runSoftwareAutoFocus(int objective,
String lightSource,
int detectionFilter,
int intensity,
int exposure,
double zStackCenter,
int nSlices,
double zStepSize,
boolean lightConstantOn)
Run a software autofocus with a custom channel and current objective and camera settings.
|
void |
setBrightField(int channelNumber,
int detectionFilter,
int intensity,
int exposure)
Same as
setBrightField(int, int, int, int, boolean) with default lightConstantOn to false (ie light-source is synchronised with the camera/blinking). |
void |
setBrightField(int channelNumber,
int detectionFilter,
int intensity,
int exposure,
boolean lightConstantOn)
Activate the brightfield light lightSource.
|
void |
setBrightFieldOff()
Switch-off the brightfield channel if in live-mode, by setting intensity and exposure time to 0.
|
void |
setCamera(int x,
int y,
int width,
int height)
Set the fraction of the camera sensor used for the next acquisition, also reset binning to default (1=no binning).
|
void |
setCamera(int x,
int y,
int width,
int height,
int binning)
Set camera acquisition settings such as sensor area used for acquisition and binning factor.
|
void |
setCameraBinning(int binning)
Set the binning factor (1,2 or 4), also reset the camera sensor area to full-frame (2048x2048).
|
void |
setDefaultProjectFolder(String folder)
Set the default project folder, used when no path is specified for the acquire command.
|
void |
setFluoChannel(int channelNumber,
String lightSource,
int detectionFilter,
int intensity,
int exposure)
Same as
setFluoChannel(int, String, int, int, int, boolean) with default lightConstantOn to false (ie light-source is synchronised with the camera/blinking). |
void |
setFluoChannel(int channelNumber,
String lightSource,
int detectionFilter,
int intensity,
int exposure,
boolean lightConstantOn)
Activate one or multiple LED light sources for fluorescence imaging.
|
void |
setFluoChannelOff()
Switch off all the LED light sources (fluorescence) by setting the intensities to 0%.
|
void |
setLightSource(int channelNumber,
String lightSource,
int detectionFilter,
int intensity,
int exposure)
Same as setLightSource but with default lightConstantOn to false.
|
void |
setLightSource(int channelNumber,
String lightSource,
int detectionFilter,
int intensity,
int exposure,
boolean lightConstantOn)
Switch-on light source, brightfield or fluorescent one(s).
|
void |
setLightSourceOff(String lightSource)
Switch-off a light-source (brightfield or fluo).
|
void |
setMetadata(String wellId,
int wellNumber,
int subposition,
int timepoint)
Update multiple metadata at once, used to name image files for the next acquisition(s).
|
void |
setMetadataChannel(int channel)
Update the channel metadata used to name the image files for the next acquisitions (CO tag).
|
void |
setMetadataSubposition(int subposition)
Update the well subposition index (within a given well), used to name the image files for the next acquisitions (PO tag).
|
void |
setMetadataTimepoint(int timepoint)
Update the timepoint (or loop iteration) index, used to name the image files for the next acquisitions (LO tag).
|
void |
setMetadataWellId(String wellID)
Update the well ID (ex: "A001") using the default leading character '-' for compatibility with Acquifer software suite.
|
void |
setMetadataWellId(String wellID,
char leadingChar)
Update the well ID (ex: "A001"), used to name the image files for the next acquisitions.
|
void |
setMetadataWellNumber(int number) |
void |
setMode(String mode)
Alias for
setMode(ControllerMode) using "script" or "live" for the mode. |
void |
setMode(TcpIp.ControllerMode mode)
Set controller mode to LIVE or SCRIPT.
|
void |
setObjective(int index)
Set the objective based on the index (1 to 4).
|
void |
setPlateId(String plateId)
Set the plateId, used when no path is specified for the acquire command.
|
void |
setTemperatureRegulation(boolean state)
Activate (state=True) or deactivate (state=False) temperature regulation.
|
void |
setTemperatureTarget(double temperature)
Set the target temperature in °C, between 18 and 34°C with max 0.1 precision .
|
void |
stopScript()
Stop any script currently running.
|
public TcpIp() throws IOException
IOException
- if a connection cannot be established (I off, software not running, remote control option not activated)public TcpIp(int port) throws IOException
IOException
- if a connection cannot be established (I off, software not running, remote control option not activated)public void log(String message)
public TcpIp.ControllerMode getMode()
public String getModeAsString()
public void setMode(String mode)
setMode(ControllerMode)
using "script" or "live" for the mode.IllegalArgumentException
- if mode is not one of "script" or "live".public void setMode(TcpIp.ControllerMode mode)
public void openLid()
public void closeLid()
public boolean isLidOpened()
public boolean isLidClosed()
public boolean isLiveMode()
public boolean isScriptMode()
public boolean isTemperatureRegulated()
public double getTemperatureAmbient()
public double getTemperatureSample()
public double getTemperatureTarget()
public void setTemperatureTarget(double temperature)
setTemperatureRegulation(boolean)
for this purpose.public void setBrightField(int channelNumber, int detectionFilter, int intensity, int exposure, boolean lightConstantOn)
channelNumber
- this value is used for the image file name (tag CO).detectionFilter
- positional index of the detection filter (1 to 5), depending on the filter, the overall image intensity varies.intensity
- intensity for the brightfield lightSource (between 0 and 100)exposure
- exposure time in ms, used by the camera when imaging/previewing this channel.lightConstantOn
- if true, the light is constantly on (only during the acquisition in script mode).public void setBrightField(int channelNumber, int detectionFilter, int intensity, int exposure)
setBrightField(int, int, int, int, boolean)
with default lightConstantOn to false (ie light-source is synchronised with the camera/blinking).public void setBrightFieldOff()
public void setFluoChannel(int channelNumber, String lightSource, int detectionFilter, int intensity, int exposure, boolean lightConstantOn)
channelNumber
- (>0) this value is used for the image file name (tag CO).lightSource
- this should be a 6-character string of 0 and 1, corresponding to the LED light lightSource to activate.detectionFilter
- positional index of the detection filter (1 to 5), depending on the filter, the overall image intensity varies.intensity
- intensity for the LED fluorescent light lightSource(s) [0-100]. With multiple light sources, this is the power used for each of them.exposure
- exposure time in ms, used by the camera when imaging/previewing this channel.lightConstantOn
- if true, the light is constantly on (only during the acquisition in script mode).public void setFluoChannel(int channelNumber, String lightSource, int detectionFilter, int intensity, int exposure)
setFluoChannel(int, String, int, int, int, boolean)
with default lightConstantOn to false (ie light-source is synchronised with the camera/blinking).public void setFluoChannelOff()
public void setLightSource(int channelNumber, String lightSource, int detectionFilter, int intensity, int exposure, boolean lightConstantOn)
channelNumber
- (>0) this value is used for the image file name (tag CO).lightSource
- light-source used for the acquisition.detectionFilter
- positional index of the detection filter (1 to 5), depending on the filter, the overall image intensity varies.intensity
- relative intensity for the light-source(s), between 0 and 100.exposure
- exposure time in mslightConstantOn
- if true, the light is constantly on (only during the acquisition in script mode)public void setLightSource(int channelNumber, String lightSource, int detectionFilter, int intensity, int exposure)
public void setLightSourceOff(String lightSource)
lightSource
- same as in setLightSource(int, String, int, int, int, boolean)
public String acquireZstack(int channelNumber, int objective, String lightSource, int detectionFilter, int intensity, int exposure, double zStackCenter, int nSlices, double zStepSize, boolean lightConstantOn, String saveDirectory)
setMode(String)
to avoid time-consuming switch between script/live mode.Images are named according to the IM filenaming convention, and saved in saveDirectory, or in the default acquisition directory if none is mentioned. Use setMetadata functions to update image-metadata used for filenaming before calling acquire.
In live mode, this function first switch to script mode (needed for acquire commands) and switch back to live mode after acquisition.
Note : different camera settings can be used between autofocus and acquisition, usesetCamera(int, int, int, int, int)
before the respective commands.channelNumber
- (>0) this value is used for the image file name (tag CO).objective
- index of the objective to use for acquisition (1 to 4 as in setObjective(int)
)lightSource
- light-source used for the acquisition.detectionFilter
- positional index of the detection filter (1 to 5). Depending on the filter, the overall image intensity varies.intensity
- relative intensity for the light-source(s), between 0 and 100.exposure
- exposure time in mszStackCenter
- centre position of the Z-stack in µm, with 0.1 precision.nSlices
- Number of slices composing the stack.zStepSize
- distance between slices in µm with 0.1 precisionlightConstantOn
- if true, the light is constantly on (only during the acquisition in script mode)saveDirectory
- Custom directory where the images should be saved. Use double-backslash \\ or single forward slash / as delimiter between path elements.setDefaultProjectFolder(String)
and setPlateId(String)
to define the default values for these fields.acquireZstack(int, int, String, int, int, int, double, int, double)
,
acquireVideo(int, int, String, int, int, int, double, int, boolean, String)
public String acquireZstack(int channelNumber, int objective, String lightSource, int detectionFilter, int intensity, int exposure, double zStackCenter, int nSlices, double zStepSize)
acquireZstack(int, int, String, int, int, int, double, int, double, boolean, String)
, but using the default project folder/plateID for the image directory and the light-source blinking (lightConstantOn to false). setMode(String)
to make sure images from the successive calls to "acquireZstack" are saved in the same directory.
The images are saved within the default project directory, in a subdirectory named with the current acquisition timestamp (defined when switching to script mode) and the default plateID (in the form timestamp_plateID).
Use setDefaultProjectFolder(String)
and setPlateId(String)
to define the default values for these fields.
The timestamp is generated when the software is switched to script mode, such that for successive acquire commands (for wells and channels) the timestamp is identical, and images end up in the same directory.
public String acquireVideo(int channelNumber, int objective, String lightSource, int detectionFilter, int intensity, int exposure, double zPosition, int nFrames, boolean lightConstantOn, String saveDirectory)
channelNumber
- (>0) this value is used for the image file name (tag CO).objective
- index of the objective to use for acquisition (1 to 4 as in setObjective(int)
)lightSource
- light-source used for the acquisition.detectionFilter
- positional index of the detection filter (1 to 5). Depending on the filter, the overall image intensity varies.intensity
- relative intensity for the light-source(s), between 0 and 100.exposure
- exposure time in ms. This is also the time-interval between frame in the video.zPosition
- Z-axis position of the objective in µm, with 0.1 precision.nFrames
- number of frames in the video.lightConstantOn
- if true, the light is constantly on (only during the acquisition in script mode)saveDirectory
- Custom directory where the images should be saved. Use double-backslash \\ or single forward slash / as delimiter between path elements.public String acquireVideo(int channelNumber, int objective, String lightSource, int detectionFilter, int intensity, int exposure, double zPosition, int nFrames)
acquireVideo(int, int, String, int, int, int, double, int, boolean, String)
using default project folder for the image directory and lightConstantOn to false. setDefaultProjectFolder(String)
public double runSoftwareAutoFocus(int objective, String lightSource, int detectionFilter, int intensity, int exposure, double zStackCenter, int nSlices, double zStepSize, boolean lightConstantOn)
lightSource
- light-source used for the acquisition.detectionFilter
- positional index of the detection filter (1 to 5). intensity
- relative intensity for the light-source(s), between 0 and 100.exposure
- exposure time in mszStackCenter
- centre position of the Z-stack in µm, with 0.1 precision.nSlices
- Number of slices composing the stack.zStepSize
- distance between slices in µm with 0.1 precisionlightConstantOn
- if true, the light is constantly on (only during the acquisition in script mode).public double runSoftwareAutoFocus(int objective, String lightSource, int detectionFilter, int intensity, int exposure, double zStackCenter, int nSlices, double zStepSize)
runSoftwareAutoFocus(int, String, int, int, int, double, int, double, boolean)
with lightConstantOn default to false. public double runHardwareAutoFocus(int objective, int detectionFilter, double zStart, double calibrationOffset)
objective
- Objective index used for autofocus, one of 1,2,3,4.detectionFilter
- Positional index of the detection filter used for the autofocus.zStart
- Starting position for the autofocus search.calibrationOffset
- this value should be read from IM Control Software, tab autofocus when clicking "calibration" for hardware autofocus.public void setTemperatureRegulation(boolean state)
public int getNumberOfColumns()
public int getNumberOfRows()
public int getObjectiveIndex()
public void setObjective(int index)
public void setDefaultProjectFolder(String folder)
setPlateId(String)
public void setPlateId(String plateId)
setDefaultProjectFolder(String)
public void setMetadata(String wellId, int wellNumber, int subposition, int timepoint)
public void setMetadataWellNumber(int number)
public void setMetadataWellId(String wellID, char leadingChar)
wellID
- leadingChar
- Character added before the well id, at the beginning of the filename.public void setMetadataWellId(String wellID)
public void setMetadataSubposition(int subposition)
public void setMetadataTimepoint(int timepoint)
public void setMetadataChannel(int channel)
public double getPositionX()
public double getPositionY()
public double getPositionZ()
public void moveXYto(double x, double y)
public void moveXYto(acquifer.core.WellPosition wellPosition)
public void moveXYby(double x, double y)
public void moveZto(double z)
public void moveZby(double z)
public void moveXYZto(double x, double y, double z)
public void runScript(String scriptPath)
public void setCamera(int x, int y, int width, int height, int binning)
x
- coordinate of the top-left pixel for the sensor area (in non-binned pixel units).y
- coordinate of the top-left pixel for the sensor area (in non-binned pixel units).width
- of the camera sensor area in pixel (in non-binned pixel units).height
- of the camera sensor area in pixel (in non-binned pixel units).binning
- one of 1 (no binning), 2 (2x2), 4 (4x4)public void setCamera(int x, int y, int width, int height)
setCamera(int, int, int, int, int)
.public void setCameraBinning(int binning)
public void resetCamera()
public void stopScript()
public static double[] convertXYpixelToMillimeters(int x, int y, String imageName, int width, int height)
x
- pixel coordinate in the image, to convert to objective X-axis positiony
- pixel coordinate in the image, to convert to objective Y-axis positionimageName
- used to recover the XY axis-position of the objective (in mm) and the pixel-size.width
- image width in pixels, used to recalculate the image centere (same for height)height
- image height in pixelspublic void closeConnection()