BakingTray
Search…
Developer notes
This page is currently in note-form and contains a variety of useful information. This content will eventually be categorized more carefully.

Modifying properties of the BT object using a startup file

The best way to change properties in hBT is not by modifying the class file but using a startup script. To do this, make a file called startup_bt.m in the SETTINGS directory and in there any changes. e.g.
1
hBT.someProperty=123
Copied!
This will be run each time BakingTray starts.

Simulated mode

You may run BakingTray on any machine with no acquisition hardware or even now ScanImage install by running: BakingTray('dummyMode',true) Most features should work but simulated mode is less well tested than normal operation. Simulated mode assists in development whilst not at the rig.

Running a minimal acquisition and benchmarking

You can initiate a minimal acquisition with no tile saving and even no GUI by setting up the recipe and then running:
1
>> hBT.runTileScan; hBT.scanner.armScanner; hBT.scanner.initiateTileScan
Copied!
If you have the GUIs open then any relevant listeners in those GUIs will still fire. This is useful for working out things like timing bottlenecks. For example see issue #23. It's probably a good idea to benchmark a short acquisition if you're made changes to the acquisition GUI or to the SIBT tile acquired callback.

To run the stages through a tile scan via the API

1
>> hBT.scanner.armScanner;
2
>> hBT.runTileScan;
Copied!
  • Running in dummy mode on an office PC:
    1
    >> %If no BakingTray in the path, cd to the project path and run:
    2
    >> addBTtopath
    3
    >> BakingTray('dummyMode',true)
    Copied!

Caching dynamic values

Things like the NumTiles and TileStepSize properties of the recipe are calculated on the fly. So don't access these repeatedly in a time-critical loop.

Running BakingTray with a dummy laser for testing

Although it's possible to start BakingTray in "dummyMode" (see help BakingTray) for running without any hardware, you might want to run with just one hardware component missing. Running with a simulated laser attached is useful, since it allows the acquisition to proceed with the physical laser switched off. Start BakingTray normally then do the following:
1
>> hBT.laser=dummyLaser;
2
>> hBT.laser.parent=hBT;
Copied!

How BakingTray access data from ScanImage to build the preview

The callback function SIBT/tileAcqDone is run by ScanImage each time a tile position has been acquired. This happens because the SIBT constructor adds a listener to the ScanImage object at hSI.hUserFunctions.acqDone, one of the hooks for the ScanImage User-Functions. The tileAcqDone callback captures the last acquired images, downsamples them, and places them in hBT.downSampledTileBuffer, where other methods easily have access to the data.

How is the tile pattern generated?

The acquisition settings are stored in BT.recipe. The tile pattern is produced by the method BT.recipe.tilePattern, which generates an n-by-2 matrix. Each row is a different tile position. The first column is the X stage location and the second column the Y stage location. The matrix is generated by generateTileGrid, which is a function local to BT.recipe.tilePattern. This function produces the tile pattern based upon the following variables:
  • The microscope FOV: extracted from the scanner.
  • The amount of overlap needed at adjacent tiles: set by the user.
  • The size of the sample along X and Y: set by the user.
  • The "front/left" position of the whole pattern (this is just an offset): supplied by the user and stored in the structure recipe.FrontLeft
The size of the sample in mm along X and Y is converted into tiles using the class NumTiles, which is attached to recipe. The NumTiles class returns the number of tiles needed to cover the desired area in X and Y. It does this based upon the length and breadth of the bounding box and the tile overlap. At the command line you can do:
1
>> hBT.recipe.NumTiles.X
2
ans =
3
11
4
5
>> hBT.recipe.NumTiles.Y
6
ans =
7
12
Copied!