Skip to content

prevedel-lab/brimfile

Repository files navigation

brimfile package

Documentation

What is it?

brimfile is a package to read and write to brim (Brillouin imaging) files, containing spectral data and metadata from Brillouin microscopy.

The detailed specs of the brim file format can be found here.

How to install it

We recommend installing brimfile in a virtual environment.

After activating the environment, brimfile can be installed from PyPI using pip:

pip install brimfile

How to use it

The full documentation of the package can be found here.

To quickly start reading an existing .brim file, the following code shows how to:

  • open a .brim file
  • get an image for the Brillouin shift
  • get the spectrum at a specific pixel
  • get the metadata.
from brimfile import File, Data, Metadata, AnalysisResults
Quantity = AnalysisResults.Quantity
PeakType = AnalysisResults.PeakType

filename = 'path/to/your/file.brim.zarr' 
f = File(filename)

# get the first data group in the file
d = f.get_data()

# get the first analysis results in the data group
ar = d.get_analysis_results()

# get the image for the shift
img, px_size = ar.get_image(Quantity.Shift, PeakType.average)

# get the spectrum at the pixel (pz,py,px)
(pz,py,px) = (0,0,0)
PSD, frequency, PSD_units, frequency_units = d.get_spectrum_in_image((pz,py,px))

# get the metadata 
md = d.get_metadata()
all_metadata = md.all_to_dict()

# close the file
f.close()

More examples could be found in the examples folder

Matlab support

You can download the Matlab toolbox, which is basically a wrapper around the Python brimfile package, so you can refer to the same documentation. We only support Matlab >= R2023b, as brimfile needs Python 3.11.

Note that the current version of the Matlab toolbox is not supporting all the functions defined in brimfile and it has not been tested extensively yet.

About

Python library to read and write to brim (Brillouin imaging) files

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •