Skip to main content

Helper functions for BakingTray and StitchIt

Project description

StitchIt Python Tools

PyPI Python Version License GNU GPL v3.0

This package contains Python code for managing BakingTray serial-section 2p data. The main functions of interest are compressRawData.py and transferToServer.py, which are aimed at end users of the microscope. The recipe.py and tools.py modules support these and are aimed at developers.

Install instructions

If you wish to use the data management tools and do not care about the brainreg helper tool:

$ pip install btpytools

You will then be able to run the following commands at the system command prompt:

  • transferToServer
  • compressRawData
  • summariseAcqs

If you also want the brainreg helper command brainregbt (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 Silicon

For $ 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-blosc

Usage instructions

Compressing the raw data directory

cd to the sample directory at the command line and run compressRawData. This works much faster if you to have installed lbzip2, 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/ 
$ compressRawData  

Sending data to a remote server

The server should be mounted locally to a mount point writable by the user. The tranfer is via rsync. 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.

First cd to the directory which contains your samples. Not the sample directory. e.g.

$ cd /mnt/data/BakingTrayStacks

You 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/histology

NOTE: If RC_RabiesBrains01 contains a compressed raw data archive, the following will not transfer it:

$ transferToServer RC_RabiesBrains01/sample01 RC_RabiesBrains01/sample02 /mnt/server/user/data/histology

Wrapper for brainreg with BakingTray data

With 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.

  • cd to a BakingTray sample directory
  • Run brainregbt

Sample 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 start

Running brainregbt -D will run the registration with the above defaults. Available resolutions depend on which downsampled stacks were generated by StitchIt.

Developer notes

Create and activate a fresh conda environment and install with:

$ pip install btpytools[dev]

You can now cd to the project root directory and do the following.

  • Static code analysis: mypy btpytools
  • Run pre-commit operations with the command pre-commit
  • Run black to re-format files using black ./

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

btpytools-0.1.32.tar.gz (149.6 kB view details)

Uploaded Source

Built Distribution

btpytools-0.1.32-py3-none-any.whl (34.9 kB view details)

Uploaded Python 3

File details

Details for the file btpytools-0.1.32.tar.gz.

File metadata

  • Download URL: btpytools-0.1.32.tar.gz
  • Upload date:
  • Size: 149.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.0

File hashes

Hashes for btpytools-0.1.32.tar.gz
Algorithm Hash digest
SHA256 acd46914960f1fa9fc3cdfe6cde3dd1ea4ed4753174f67b356cdc3712a2c8bbe
MD5 4145c91570ffaca2aa46af790b61de4d
BLAKE2b-256 52323bcb6d4ae9890b2c58c68dd40d30a7aec8fa39bb91dc1c757518228a5e4b

See more details on using hashes here.

File details

Details for the file btpytools-0.1.32-py3-none-any.whl.

File metadata

  • Download URL: btpytools-0.1.32-py3-none-any.whl
  • Upload date:
  • Size: 34.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.0

File hashes

Hashes for btpytools-0.1.32-py3-none-any.whl
Algorithm Hash digest
SHA256 bbb4d8fdc23a9cdc224fe2b0dfb4372dc9e8ce7923680fa33249dc5a5059271d
MD5 554953aec2cbd5aef3b7614e645892c2
BLAKE2b-256 4c3243ab8d2432bcbc99c8218d91af083b612b802a063699a0d12c89fc5da637

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page