This self-standing codebase is based on an earlier version of ImSwitch. The etSTED widget and controller are now impemented in the latest version of ImSwitch in the main ImSwitch repository.
This is a version of the control software ImSwitch (https://github.com/kasasxav/ImSwitch) from TestaLab (www.testalab.org) that integrates control of two imaging techniques in the etSTED widget for performing event-triggered STED imaging, as used in the manuscript: "Event-triggered STED imaging", Jonatan Alvelid, Martina Damenti, Ilaria Testa (manuscript, submitted, 2021)
The widget is available in view\widgets\etstedwidget.py
, and the associated controller is available in controller\controllers\etstedcontroller.py
.
The optimised real-time BAPTA calcium spike event detection analysis pipeline is available in etsted\analysis_pipelines\bapta_calcium_spikes.py
(GPU-version) and bapta_calcium_spikes_cpu.py
(CPU-version).
The coordinate transforms are available in etsted\transform_pipelines\coord_transform.py
(general, for calibration during running ImSwitch) and wf_800_scan_80.py
(pre-calibrated for the microscope used in the manuscript).
The software was tested to run on Windows 10 and with python=3.7. Typical install time for the required environment is 3-5 min in conda. For further instructions, follow Installation Option B in the ImSwitch documentation (https://imswitch.readthedocs.io/), and addditionally install opencv according to below.
To prepare an environment, install ImSwitch from PyPI with the following command in an environment running python=3.7:
pip install ImSwitch
To run the optimised real-time BAPTA calcium spike event detection analysis pipeline, both real and mock, additionally opencv has to be installed in the same environment, use the following command:
pip install opencv-python
In order to run the GPU-boosted analysis pipeline in real etSTED experiments, CUDA Toolkit has additionally to be installed on the machine, together with the cupy package in the same environment. See instructions at https://docs.cupy.dev/en/stable/install.html.
Choose the configuration file for your microscope in \config_files\options.json.
Prepare ImSwitch-etSTED by downloading or forking the code, and to start it run the __main__.py
file.
Mock etSTED experiments can be performed with the simulated camera provided in ImSwitch-etSTED.
The default configuration file is etsted_sim.json, which contains a mock camera generating noisy images with occasional intensity spikes running at 10 Hz, a mock point-detector, and two mock lasers for performing mock etSTED experiments. The following steps can be followed to initiate a mock experiment, taking 1-3 min to set up and run:
- Start LIVEVIEW of the mock camera by pressing
LIVEVIEW
in theImage Controls
widget. - Switch to the etSTED widget by pressing the etSTED tab above the
Laser Control
widget. - Record a binary mask containing all the pixels by pressing
Record binary mask
(it will show as all black due to all pixels having the same value). - Load a CPU-version of the bapta calcium spike detection pipeline by pressing
Load pipeline
. - Tick
Visualize
in order to run the mock experiment while showing the preprocessed images in real-time in the pop-out help widget. - Run mock experiment by pressing
Initiate
. - The real-time red crosses on the image in the
Image Display
widget show detected events and spots where the STED scanning would have taken place. The mock camera returns an image with at most 1 peak at the same time, and as such at most 1 cross will be displayed at the same time.
If the widget softlocks due to not following the steps above and not having hardware connected, press the Unlock softlock
button.
For real etSTED experiments, the software requires a NI-DAQ data acquisition board and surrounding microscope hardware (see ImSwitch documentation for further information). To perform etSTED experiments, use at least one camera for the fast method, one laser for the fast method, one laser for the scanning method, and one point-detector for the scanning method. Compile a configuration JSON file according to the instructions in the ImSwitch documentation and looking at the provided examples. The etSTED widget section requires the above-mentioned pieces of hardware to be listed. Compile an analysis pipeline for your task at hand, using the same input and output as the ones provided and additional numerical input parameters, alternatively use the intensity spike detection pipeline provided. Then follow the steps described above, with the following modifications:
- Configure the camera settings in the
Image Controls
widget. Use an exposure time smaller than theUpdate period
set in the etSTED widget. - Adjust the binary threshold and smoothing until a binary mask of the region of interest is calculated. This will automatically be used by the method upon recording.
- Choose an analysis pipeline in the dropdown menu, which displays all the ones in the etsted\analysis_pipelines\ folder, and load it by pressing
Load pipeline
. - Perform a coordinate transform between the fast image space and the scanning image space by first recording the same area of a sample in both techniques (see ImSwitch documentation), and loading these in the
Transform calibration
help widget. Mark the coordinates of the same objects in the two images (at least 10), and pressSave calibration
. Choosecoord_transform
in the dropdown menu to use the calibrated transform. - Use the visualization mode described above while adjusting the pipeline parameters of the chosen analysis pipeline until the true events are detected in the best way possible.
- Set the scanning parameters (size, pixel size, lasers, and pixel dwell time) of the triggered scans in the scanning widget (see ImSwitch documenation).
- Untick
Visualize
, and run the etSTED experiment by pressingInitiate
. TickEndless
if you want to run an endless experiment, repeating the process after each detected triggering event. - All data and images are saved in the folder provided in the
Recording
widget (see ImSwitch documentation).