BakingTray
  • BakingTray Documentation
  • Getting Started
    • Hardware requirements
    • Known issues
    • Initial Installation
      • Software installation
      • Setting up ScanImage
    • Hardware setup
      • Motor Setup
        • PI stage setup
        • Calibrating a linear actuator
        • Verifying stage motions
      • Setting up a VT1000 vibratome
      • Setting up the laser
    • Finishing the install
      • Check the noise on your amplifiers
      • Starting BakingTray
      • Settings Files
      • Calibration
        • Basic calibrating procedures
        • Calibrating image size
        • Achieving high stitching accuracy
        • Fine-tuning positioning accuracy
        • Stitching tweak walkthrough
    • Stitching data
  • Users
    • Introduction
    • Sample preparation
    • User Guide
      • Starting BakingTray
      • Step 0: Loading the sample
      • Step 1: Setting imaging parameters
      • Step 2: Preparing the sample
      • Step 3: Selecting the imaging area
      • Step 4: Starting the acquisition
      • Step 5: Concluding the acquisition
      • Setting up checklist
      • Resuming an acquisition
      • Manual ROI acquisitions
    • Excitation choices
    • Choosing imaging settings
    • Troubleshooting
      • Hardware problems
      • Computer problems
      • Cutting problems
      • Imaging problems
    • Data structure
    • autoROI
  • Developers
    • Developers
      • Code overview
      • Developer notes
      • Motion control classes
      • The recipe file
      • Auto-ROI
      • Simulated mode
      • Contributing
    • FAQ
    • Gallery
Powered by GitBook
On this page
  • Modifying properties of the BT object using a startup file
  • Simulated mode
  • Running a minimal acquisition and benchmarking
  • To run the stages through a tile scan via the API
  • Caching dynamic values
  • Running BakingTray with a dummy laser for testing
  • How BakingTray access data from ScanImage to build the preview
  • How is the tile pattern generated?
  1. Developers
  2. Developers

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.

hBT.someProperty=123

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:

>> hBT.runTileScan; hBT.scanner.armScanner; hBT.scanner.initiateTileScan

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

>> hBT.scanner.armScanner; 
>> hBT.runTileScan;
  • Running in dummy mode on an office PC:

    >> %If no BakingTray in the path, cd to the project path and run:
    >> addBTtopath
    >> BakingTray('dummyMode',true)

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:

>> hBT.laser=dummyLaser;
>> hBT.laser.parent=hBT;

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:

>> hBT.recipe.NumTiles.X      
ans =
    11

>> hBT.recipe.NumTiles.Y
ans =
    12
PreviousCode overviewNextMotion control classes

Last updated 1 year ago