Settings Files

BakingTray uses configuration files located in the SETTINGS directory. The configuration files are:

  1. systemSettings.yml -- defines properties of the rig as a whole

  2. componentSettings.m -- describes how BakingTray should connect to each piece of hardware/

  3. frameSizes.yml -- defines image sizes and stitching parameters.

  4. SIBT_settings.yml -- defines a small number of settings associated with the BakingTray/ScanImage bridge.

  5. startup_bt.m -- this optional MATLAB script runs each time BakingTray starts

It will require multiple passes through all the files to get everything dialed in correctly. The following description is broken down by settings file.

System Settings

The so-called "system settings" are those that describe parameters of the rig that are unlikely to change between sessions. This includes things like how fast the stages are supposed to move, and general features of the cutting cycle. BakingTray.settings.readSystemSettings parses systemSettings.yml and creates it if does not already exist. Here is what each parameter means:

Main system settings

  • SYSTEM.ID - A string defining the unique name of your microscope. This will allow you to distinguish between different microscopes should you have multiple systems. You can set this right now, but it's a good idea not to change the name once the system becomes productive.

  • SYSTEM.xySpeed - The target maximum speed of your X/Y stage in mm/s. You can leave this alone.

  • SYSTEM.cutterSide - set to 1 if the vibrotome is on the right as you look at the system. Set to -1 if the vibrotome is on the left.

  • SYSTEM.homeZjackOnZeroMove - If 1 the Z stage is zeroed each time the user asks for it to go to the lowest position (0 mm). 0 otherwise. Do this if your Z-jack has no encoder, otherwise it is not needed.

  • SYSTEM.dominantTilingDirection - The stage axis which will conduct the bulk of the motions in the S-shaped tile scan. It makes sense to set this as being the top stage in your stack, as this will be carrying the smallest load. This should be the string y or x. Likely you can leave this as y.

  • SYSTEM.defaultSavePath - The default path to bring up for saving data. If missing or not valid we use the current directory instead. Likely you are saving data to a separate RAID array or SSD. In this case set it to the drive letter: D:\ or whatever. Doing this reduces user errors and questions regarding to where data should be saved.

  • SYSTEM.autoROIchannelOrder - By default this is the list {'red','green','blue'}. It is suggested to leave like this. The red channel is best for the auto-ROI algorithm, as the agar fluoresces least in this channel. You can leave this setting as it is.

  • SYSTEM.bladeXposAtSlideEnd - Scalar corresponding to the the X stage position associated with when the blade just reaches the edge of the slide.

  • SYSTEM.slideFrontLeft - A vector of length 2 defining the X/Y position at which the objective is directly over the front/left corner of the slide.

  • SYSTEM.raisedZposition - The position the Z stage should go to when the "Raise sample" button is pressed. If not supplied, the button will do nothing.

  • SYSTEM.raisedXposition - The position the X stage should go to when the "Raise sample" button is pressed. If not supplied, the button will do nothing.

How to set the blade and stage position values

Filling in these settings will require an operational system, with all stages functional. Place a blade in the blade holder and mount on the vibratome.

SYSTEM.bladeXposAtSlideEnd

You will need a water bath in the system. Raise the the water bath until the blade is within about 5 mm of the platform. Translate the water bath along the X axis until the tip of the blade is level with the end of the platform. Read off the X stage value and enter this in the SYSTEM.bladeXposAtSlideEnd section of the YML file in mm.

SYSTEM.slideFrontLeft

You will need a water bath with an empty slide clamped onto the platform. The bath should be half-filled with water. Turn on the laser, tune it to 750 nm, "POINT" the beam and set power to about 10 mW. Translate the X and Y stages such that the white frosted part of the slide under the objective and raise the bath until the beam is near focus: about 1 mm in diameter. Translate the water bath until the focused spot is at the front/left corner of the slide. Enter the X and Y stage values in mm in the SYSTEM.slideFrontLeft section of the YML file in the format [X_mm, Y_mm]

SYSTEM.raisedXposition and SYSTEM.raisedZposition

Before the system can slice a sample the user must defining a cutting start point by translating the sample in Z and X. To simplify this process there is a "Raise Sample" button, which the user can press after the water bath has been loaded. This button raises the sample to a safe position at which the sample is near the blade but definitely will not hit it. You must define this position using the SYSTEM.raisedZposition and SYSTEM.raisedXposition. If undefined, the "Raise Sample" button will simply do nothing. Glue to a slide one or more agar blocks representing the largest possible sample that might be loaded into the system. For example, you might glue into place two rat brains spaced quite far apart. Move the sample such that it is near the sample, as shown in the usage instructions, however leave a very comfortable gap between the blade and the agar. Note down the positions of the X and Z stages and enter these into the settings file at SYSTEM.raisedXposition and SYSTEM.raisedZposition.

  • SLICER.approachSpeed - The speed in mm/s with which the sample is brought to the cutting start point. You can leave this at around 25 mm/s. It's not critical.

  • SLICER.vibrateRate - Vibration frequency of the blade. This will be in RPM, assuming you have set up the motor controller to use the encoder. It is recommended you go through those steps.

  • SLICER.postCutDelay - Number of seconds to wait for the cut slice to settle to the bottom of the bath. About 5 seconds is reasonable.

  • SLICER.postCutVibrate - The vibrate rate to use during the post-cut delay period. We find that hugely reducing the blade speed (e.g. to 3 Hz) allows the slice to slide off the blade. See also SLICER.vibrateRate , above.

  • SLICER.defaultYcutPos - Scalar defining the Y position at which we cut. This depends on the water bath and vibratome position and is not sample-dependent. Find the Y stage value at which the blade midpoint is centered on the slide. Enter this value here in mm.

Slack message settings

The SLACK settings in the systemSettings.yml file are there to provide a Slack hook which is used by BakingTray to send progress messages to a Slack channel. This section is optional and is filled out as follows:

SLACK:
  user: '@MicroscopeName'
  hook: 'https://hooks.slack.com/services/T7S8UFJKL/CVG8T59LP/lKW6o9bw88jrEnJ87T27Ie2m1'

The user setting is simply the microscope name and is appended to the message. The hook is a string the corresponds to a web hook you create for a Slack channel. Once you have completed the above, restart BakingTray and test your Slack integration:

>> hBT.slack('This is a test message')

There is no feedback to the command line but you should see the Slack message appear on the target channel.

Component Settings

The componentSettings.m file defines how the hardware components of the rig are to be set up. It is read by BakingTray.settings.readComponentSettings and created if it does not exist. Instructions for filling in this file are present in the comments of that file. It's vital this file is filled in correctly to avoid damage to your system, particularly for the motion components. For instance, the motion limits of the stages are defined in this file and are used to make it impossible for out of bounds motions to be executed.

You should first run your stages using the manufacturer's software to familiarise yourself with them. When filling in the component settings file, keep the following in mind:

  • The X stage moves left/right as you look at the rig and positive is to the right. Middle of the travel range is 0.

  • The Y stage moves front/back as you look at the rig and positive is away from you. Middle of the travel range is 0.

  • The Z stage pushes up the sample and positive is up. Fully lowered is 0.

  • All motion commands need to be in mm.

For instance, you may find that your X stage moves from "0" to "100" mm with zero on the left. This means the middle of the motion range is 50 mm, not 0 mm, and positive values are to the left not to the right. Thus, the motion commands going to this device will need to be modified. The easiest way of doing this is to create a stage class specific to this stage and use the transformInputDistance and transformOutputDistance properties to effect the conversion. These properties can also be used to change units. Examples:

  • The haydon43K4U class which converts between stepper motor steps and mm.

Controlling the Pockels cell from ScanImage

It is helpful to have the Pockels cell switch on and off with the laser. You can construct a mains relay switchable via an optocoupler and connect a digital line to it. Then under the laser section of the component settings file add the following:

laser.pockels.doPockelsPowerControl=true;
laser.pockels.pockelsDAQ='scan';
laser.pockels.pockelsDigitalLine='port0/line0';

Obviously replace scan with your DAQ name and set the port and line number to values you are using. After this, the Pockels cell and laser will be switched on and off together.

Startup File

If present, a file named SETTINGS\startup_bt.m will run automatically once BakingTray has started. This is done by BakingTray.m You may put whatever code you want to execute into this file. It is not sanity checked!

Last updated