Package: btpytools
StitchIt Python ToolsThis package contains Python code for managing BakingTray serial-section 2p data.
The main functions of interest arecompressRawData.pyandtransferToServer.py, which are aimed at end users of the microscope.
Therecipe.pyandtools.pymodules support these and are aimed at developers.Install instructionsIf you wish to use the data management tools and do not care about thebrainreghelper tool:$ pip install btpytoolsYou will then be able to run the following commands at the system command prompt:transferToServercompressRawDatasummariseAcqsIf you also want thebrainreghelper commandbrainregbt(see below) then install with$ pip install btpytools[register]This will also install brainreg and all of its dependencies, which are many.To build with "register" option on Apple SiliconFor$ pip install btpytools[register]to succeed on Apple Silicon you will first have to:pip install cython
brew install hdf5 c-blosc
export HDF5_DIR=/opt/homebrew/opt/hdf5 
export BLOSC_DIR=/opt/homebrew/opt/c-bloscUsage instructionsCompressing the raw data directorycdto the sample directory at the command line and runcompressRawData. This works much faster
if you to have installedlbzip2, which runs parallel bzip. Likely only works on Linux. The
command also confirms there is enough disk space available to complete successfully.$ cd /mnt/data/BakingTrayStacks/CC_125_1__125_2/ 
$ compressRawDataSending data to a remote serverThe server should be mounted locally to a mount point writable by the user. The tranfer is viarsync. The command just ensures no uncompressed raw data or uncropped stacks are copied. It brute-force retries if there is a failure for some reason.Firstcdto the directory whichcontains your samples. Not the sample directory. e.g.$ cd /mnt/data/BakingTrayStacksYou can now run in either of the following two ways (either one acquisition or multiple acquisitions)$ transferToServer RC_RabiesBrains01 /mnt/server/user/data/histology
$ transferToServer RC_RabiesBrains01 RC_TwoProbeTracks_test RC_MyOldSample /mnt/server/user/data/histologyNOTE: IfRC_RabiesBrains01contains a compressed raw data archive, the following willnottransfer it:$ transferToServer RC_RabiesBrains01/sample01 RC_RabiesBrains01/sample02 /mnt/server/user/data/histologyWrapper for brainreg with BakingTray dataWith this package installed and also brainreg installed you can run registrations with super easily at the command line using the downsampled stacks generated by StitchIt.cdto a BakingTray sample directoryRunbrainregbtSample session$ brainregbt
Select downsampled stack voxel size for registration.
(Enter a number and press return)
1. 25 micron
2. 50 micron

[1] ?
Choose channel for registration.
1. red channel
2. green channel

[1] ?


Registering data for sample SM_1099839 with 50 micron downsampled red stack.
Press return to startRunningbrainregbt -Dwill run the registration with the above defaults. Available resolutions depend on which downsampled stacks were generated by StitchIt.Developer notesCreate and activate a fresh conda environment and install with:$ pip install btpytools[dev]You can nowcdto the project root directory and do the following.Static code analysis:mypy btpytoolsRun pre-commit operations with the commandpre-commitRunblackto re-format files usingblack ./