Skip to main content

jfibsem_dat

Python implementation of the FIBSEM .dat file format developed at Janelia Research Campus, and associated tools. Written for CPython 3.8+.

Based on a reference MATLAB implementation formerly at https://github.com/david-hoffman/FIB-SEM-Aligner (now taken down) and vendorised in ./reference. The repo was unmaintained when these copies were made, and so may contain errors (indeed, there are some known inconsistencies).

There is a FIJI implementation here: https://github.com/fiji/IO/blob/master/src/main/java/sc/fiji/io/FIBSEM_Reader.java

This project currently supports v8 of the image specification.

Installation

Basic installation from github:

pip install 'git+https://github.com/clbarnes/jfibsem_dat.git[all]'

This package contains a number of extras:

  • vis contains dependencies used for viewing images
  • skimage contains dependencies for downsampling images
  • all contains all of the above

Utilities

datview

usage: datview [-h] [-c CHANNEL] [-C CALIBRATION] [-d DOWNSAMPLE] [-r] file

View a Janelia FIBSEM .dat file. The data can be scaled using the file's
metadata, viewed --raw, or scaled using a --calibration CSV. Uses matplotlib.

positional arguments:
  file                  .dat file to view

optional arguments:
  -h, --help            show this help message and exit
  -c CHANNEL, --channel CHANNEL
                        Which channel to view (default first). Not all
                        channels exist.
  -C CALIBRATION, --calibration CALIBRATION
                        CSV file calibrating raw to scaled values
  -d DOWNSAMPLE, --downsample DOWNSAMPLE
                        Downsample the image; good for quicker viewing.
  -r, --raw             Show raw data rather than scaled electron counts.

dathead

usage: dathead [-h] [-p] [-k KEY] file

Retrieve metadata from the header of a Janelia FIBSEM .dat file, in JSON
format.

positional arguments:
  file               .dat file to read headers for

optional arguments:
  -h, --help         show this help message and exit
  -p, --pretty       Pretty-printing the JSON.
  -k KEY, --key KEY  Read specific key(s), rather than the whole header. If a
                     single key is given, just the value is returned (as
                     JSON); if multiple are given, a JSON object is returned
                     with keys and values.

dathist

usage: dathist [-h] [-c CHANNEL] [-C CALIBRATION] [-d DOWNSAMPLE] [-r] file

View the histogram of pixel values for one channel of Janelia FIBSEM .dat file

positional arguments:
  file                  .dat file to view

optional arguments:
  -h, --help            show this help message and exit
  -c CHANNEL, --channel CHANNEL
                        Which channel to view (default first). Not all
                        channels exist.
  -C CALIBRATION, --calibration CALIBRATION
                        CSV file calibrating raw to scaled values
  -d DOWNSAMPLE, --downsample DOWNSAMPLE
                        Downsample the image; good for quicker viewing.
  -r, --raw             Show raw data rather than scaled electron counts.

datcalib

usage: datcalib [-h] [-c CHANNEL] [-C CALIBRATION] [-d DOWNSAMPLE] [-r]
                [-s SAMPLES] [-V]
                file operation [operation ...]

Produce a calibration CSV for some simple exposure corrections

positional arguments:
  file                  .dat file to view
  operation             Calibration functions to apply. Multiple functions can
                        be given, and will be applied in order. Given in the
                        form 'fn_name,kwarg1_name=kwarg1_value,...'. Values
                        given in JSON format (e.g. 'null' instead of 'None'),
                        although uncontained strings do not need quoting.
                        Functions are documented in scikit-image's exposure
                        package. Accepted functions are: adjust_gamma,
                        adjust_log, adjust_sigmoid, equalize_hist,
                        rescale_intensity

optional arguments:
  -h, --help            show this help message and exit
  -c CHANNEL, --channel CHANNEL
                        Which channel to view (default first). Not all
                        channels exist.
  -C CALIBRATION, --calibration CALIBRATION
                        CSV file calibrating raw to scaled values
  -d DOWNSAMPLE, --downsample DOWNSAMPLE
                        Downsample the image; good for quicker viewing.
  -r, --raw             Show raw data rather than scaled electron counts.
  -s SAMPLES, --samples SAMPLES
                        Maximum number of samples in the calibration CSV
  -V, --view            Whether to show the calibrated result

Format notes

  • Field sw_date encodes a date as a string of form DD/MM/YYYY
  • There are a number of unexplained constants and unanswered questions about the format/ its reference MATLAB implementation: grains of salt are a dependency of using this project.

Contributing

Contributions are welcome!

This project uses black and isort for formatting (run make fmt), and pre-commit for general code quality checks.

Use make fmt for formatting and make lint for spot checks, and pre-commit run --all to run all hooks.

If you modify any part of the CLI, use make readme to update the help text in the README.

Metadata

Release files for jfibsem-dat 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for jfibsem-dat 0.2.0
File Size Uploaded Provenance
jfibsem_dat-0.2.0.tar.gz 24.5 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for jfibsem-dat 0.2.0
File Interpreter ABI Platform
jfibsem_dat-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 39.0 kB

Release files / jfibsem_dat-0.2.0.tar.gz

Download URL jfibsem_dat-0.2.0.tar.gz
Size 24.5 kB
Tags Source
SHA-256 checksum
How to use checksums
569970e0e84491062667e34ac53bc60f729e75577b4725022c253939a5863a1b
BLAKE2b-256 checksum
How to use checksums
1447650ec9d63669e0cdc466df11842f6e93ae75bef6bd2f202bc2ea6a1a2371
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.10

Release files / jfibsem_dat-0.2.0-py3-none-any.whl

Download URL jfibsem_dat-0.2.0-py3-none-any.whl
Size 14.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
150d85fc9226304d78c6ce0e96e348ce12bbd0b3d33bb3e775bf01da9dcadd04
BLAKE2b-256 checksum
How to use checksums
d46dc129c8fe94b45d9c740a3e0dfe2e9663663e4f846bd3dc52f2febd78f77f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.10

Security for jfibsem-dat 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page