Skip to main content

XCT related image processing tools

Project description

bhar: python module for XCT related image processing


To install the module and the associated dependencies, just type in python -m pip install bhar in the terminal/command prompt; import by >>>import bhar inside the python environment.


All these functions are written for grayscale images & volumes of 16bit-depth, unless mentioned otherwise.

Manual drift correction

bhar.getusershift(filenamesample, numoffiles, skip, displayscale)
eg. bhar.getusershift('abc_0010.tif', 801, 40, 0.5)

Generates a .csv file with a list of shift corrections for XCT projections using minimal manual input. Compatible with Zeiss data explorer program.

  • Filenames should contain 4 digit suffixes, staring with 0001 and increase by 1 with each subsequent file. Filenames should not contain any additional periods other than the one before file extensions.
  • Skip: 1, if the sample misalignment is abrupt; ~ (numoffiles/20) or less, if the misalignment is gradual.
  • Displayscale: scaling factor to display the image to capture user input.
  • Usershift.csv is exported to the current directory.

Read an image sequence as a volume

bhar.volread(filenamesample, numoffiles)
eg. volume = bhar.volread('abcd.tif', 183)

Read a grayscale image sequence into a 3d array.

Analyze volume


Generate a list of modes and standard deviations across all three axes. logs exported to the current directory.

Reduce noise

bhar.volsmooth(volume, px)
eg.bhar.volsmooth(volume, 2)

Simple average smoothing of each pixel with 'px' layers of surrounding pixels.

  • volume: 3d array
  • px: number of layers of pixels to smooth over.
  • slices of the processed volume exported to /volsmooth-x-px/ subfolder as an image sequence.


bhar.volnorm(volume, llf, ulf)
eg.bhar.volnorm(volume, 2.5, 4.6)

Normalizes the volume along all three axes.

  • volume: 3d array
  • llf = (mode - lower limit)/average standard deviation
  • ulf = (upper limit - mode)/average standard deviation
  • slices of the processed volume exported to /volnorm/ subfolder as an image sequence.


bhar.porosity(volume, thresh)
eg.bhar.porosity(volume, 21000)

Calculate the porosity of a volume.

  • volume: 3d array
  • thresh: binary threshold value
  • 'porosity.csv' file exported to the current directory.

Project details

Download files

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

Files for bhar, version 2.2.1
Filename, size File type Python version Upload date Hashes
Filename, size bhar-2.2.1-py3-none-any.whl (10.5 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size bhar-2.2.1.tar.gz (10.9 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page