Scripting

Last updated: November 13th, 2019

LOBSTER panel is handy to handle journals, perform measurements and export object models, but it is limited to two journals and for some more advanced features it might be necessary to directly script LOBSTER computational modules from the console. This section provides an introduction to this topic.

Identifying Objects (JENI)

Workflows identifying objects are configured inside journals, human readable text files configuring input/output folders, the sequence of LOBSTER functions to apply to each input image and their associated parameters. Journals are processed by JENI from MATLAB console by typing:

  • >> JENI();
  • >> JENI(‘Tissue_SegWaterTiles.jl’);
  • >> JENI(‘C:/MyFolder/MyJournal.jl’);
The first call opens a file browser to select the journal to launch, the second call assumes that the journal file is located in LOBSTER /Journals and the third call sets the complete path to the journal.

If you plan some further operations such as measuring the object masks from output folder, Input and Output folder paths can be conveniently stored to MATLAB variables (placeholders) so as to be easily reused in later calls:

InputFolder OutputFolder = JENI(‘MyJournal.jl’);

Measuring Objects (IRMA)

Objects encoded in object masks (JENI) are measured by calling IRMA:

>> IRMA(‘PathToOutputFolder’, ‘PathToReportFolder’, MaskType, ImgDim, ZRatio);

  • ‘PathToOutputFolder’: full path or OutputFolder (if stored during call to JENI)
  • ‘PathToReportFolder’: full path, '' no report, '.' default LOBSTER /Reports folder (Name of OutputFolder)
  • MaskType: 'Objs', 'Skls', 'Spts' or 'Trks', see section Architecture for types of object masks
  • ImgDim: 2 (2D images) or 3 (3D images)
  • ZRatio: ratio between Z spacing and pixel size (only relevant for 3D images)

It is possible to measure object intensity statistics by providing extra arguments:

>> IRMA(… , ‘PathToInputFolder’, ‘ChanFilter’);

  • ‘PathToInputFolder’: full path or InputFolder (if stored from JENI call)
  • ‘ChanFilter’: text string such as '*_C01.tif' where * is a wild card. The intensity statistics inside the object masks are only measured in the images with name matching ‘ChanFilter’.

Object intensity measurements is illustrated in this video.

Exporting Objects (IRMA/JOSE)

Object 3D models are exported by passing a list {} as IRMA 5th argument:

  • Objs’ {ZRatio, Frc, ‘PathtoExpFolder’} exports plain objects as STL mesh (see this video)
    • Frc: fraction of node to keep (1: keep all)
    • ‘PathtoExpFolder’: mesh exportation folder
  • Skls’ {ZRatio, Stp, ‘PathtoExpFolder’, ExportationFormat} exports filament networks as 3D model (see this video)
    • Stp: network tracing step (pix, typical: 2-4)
    • ‘PathtoExpFolder’: model exportation folder
    • ExportationFormat: 'SWC' (default) or 'OBJ'
  • Trks’ {ZRatio,'',‘PathtoExpFolder’} exports object tracks as SWC model
    • ZRatio: Time stretching for 2D time-lapses
    • ‘PathtoExpFolder’: model exportation folder

Object markers 'Spts' can be exported as CellInsight project (.xls file) from MATLAB console:

>> JOSE('PathToReportFolder','Spts', 'PathToExportFolder','CellInsight', '', '');

It is recommended to export CellInsight project to input image folder since CellInsight attempts to import the project from this location by default. See this video for basic usage of CellInsight ImageJ macro.

Job Scripts

Job scripts are MATLAB files used to record sequential calls to JENI, IRMA and JOSE so as to automate their further execution. For instance the job script (/Jobs/FISM.m) sequentially calls two journals: one segmenting nuclei into object masks and another one detecting FISH spots from another channel to output a seed mask. The number of spots per nuclei is then reported by calling IRMA and using the seed mask as intensity channel and the object mask as measurement mask.

[InputFolder1 MaskFolder1] = GENI('FISH_nucseg.jl');
[InputFolder2 MaskFolder2] = GENI('FISH_sptdet.jl');
IRMA(MaskFolder1,'.','Objs',2,1, MaskFolder2);

Note here that GENI was used instead of JENI to prevent image display and user interaction (equivalent to switch between Batch and Adjust in LOBSTER Panel). A video demo of this job script into action is provided here.

Job scripts can be called by typing their name from MATLAB console. Many sample Job Scripts are provided in /Jobs folder.

Note: When Run All is pressed from the Panel, the job script performing the actions of the project is logged to the console after processing. It is possible to copy these lines to an empty .m file and use it as a job script (e.g. to send to LOBSTER server or to further edit it).

LOBSTER Image Analysis Server (JULI)

Job scripts can be sent to JULI, an image analysis server able to email results (CSV files, object models) upon job completion. For more details refer to LOBSTER documentation (section JULI) or watch this video.