# BakingTray Documentation

BakingTray is an open source [ScanImage](https://www.mbfbioscience.com/products/scanimage/) wrapper written at the [Sainsbury Wellcome Centre Microscopy Facility](https://swc-advanced-microscopy.github.io/facility_webpage/) for performing automated serial-section tile scanning within [MATLAB](http://www.mathworks.com/). BakingTray was inspired by the [TeraVoxel](https://github.com/TeravoxelTwoPhotonTomography) ([Economo, et al](https://elifesciences.org/articles/10566)) and [MouseLight](https://github.com/MouseLightPipeline) ([Winnubst, et al](https://www.sciencedirect.com/science/article/pii/S0092867419308426?via%3Dihub)) projects and is made public for research and development purposes.

![](https://3832012848-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MAVhQ1tbEzz1UZd9NDb%2Fsync%2F575dadadaffb84ad4047b52dc7c38d511d43bfa5.jpg?generation=1592921659991284\&alt=media)

## Who is it for?

BakingTray is *not* scanning software: it is a wrapper around the [ScanImage](https://www.mbfbioscience.com/products/scanimage/) [API](https://github.com/SWC-Advanced-Microscopy/ScanImageAPI_Examples). This software is aimed at technically-minded people who want to experiment with serial-section imaging and have full control over all aspects of the process. Setting up BakingTray from scratch on your rig requires *significant effort*, good MATLAB programming skills, knowledge of ScanImage, and the know-how to set up and run a 2-photon microscope. *This is not a turn-key solution*. BakingTray will run on any microscope hardware supported by ScanImage.

## How does it work?

BakingTray is based upon an [existing tile-scanner extension for ScanImage](https://github.com/SWC-Advanced-Microscopy/ScanImageTileScan), simply adding the ability to slice the sample after each section. Imaging itself is performed via ScanImage, which is freely available MATLAB-based software for running 2-photon microscopes.

## Current features

This software has been thoroughly stress-tested and is capable of generating production-quality data. The current feature set is as follows:

* Easy sample set up: take a fast preview image of the sample then draw a box around the area to be imaged. An Auto-ROI feature is available for adaptively imaging only the tissue.
* Acquisition of up to four channels using resonant or linear scanning.
* A low-resolution preview image of the current section is assembled in real time.
* Graceful acquisition abort (either immediately or at the end of the current section) and pausing.
* Automatically halts if the laser drops out of modelock.
* PMTs and laser automatically switch off at the end of the acquisition.
* Support for multiple lasers via Scanimage.
* Easy control of illumination as a function of depth via ScanImage.
* Integrates with our [StitchIt](https://github.com/SWC-Advanced-Microscopy/StitchIt) software for assembling the stitched images from raw tiles.
* Easily resume a previously halted acquisition.
* Imaging of multiple samples at once.
* Modular API allows developers to easily extend the software or adapt it to different hardware.
* Slack messages on acquisition completion.

## What do the results look like?

See the [Gallery](https://bakingtray.mouse.vision/developers/gallery).

## How to get it?

Find the project [on GitHub](https://github.com/SWC-Advanced-Microscopy/BakingTray).
