FabIO is an I/O library for images produced by 2D X-ray detectors and written in Python
Project description
Main websites:
http://fable.sf.net (historical)
FabIO is an I/O library for images produced by 2D X-ray detectors and written in Python. FabIO support images detectors from a dozen of companies (including Mar, Dectris, ADSC, Hamamatsu, Oxford, …), for a total of 30 different file formats (like CBF, EDF, TIFF, …) and offers an unified interface to their headers (as a Python dictionary) and datasets (as a numpy ndarray of integers or floats)
Installation
FabIO is available from PyPI:
pip install fabio
Debian/Ubuntu packages, and wheels are available for Windows, Linux and MacOSX from the silx repository.
See the installation instructions for more information.
Usage
Open an image
>>> import fabio >>> obj = fabio.open("mydata0000.edf") >>> obj.data.shape (2048, 2048) >>> obj.header["Omega"] 23.5 >>> obj.data array([...])
Save an image (ex: EDF)
>>> import fabio >>> obj = fabio.edfimage.EdfImage(data=[...]) >>> obj.write("mydata0000.edf")
Documentation
See the latest release documentation for further details.
Documentation of previous versions are available on silx.
Changelog
Citation
The general philosophy of the library is described in: FabIO: easy access to two-dimensional X-ray detector images in Python; E. B. Knudsen, H. O. Sørensen, J. P. Wright, G. Goret and J. Kieffer Journal of Applied Crystallography, Volume 46, Part 2, pages 537-539.
Transparent handling of compressed files
For FabIO to handle gzip and bzip2 compressed files transparently, bzip and gzip modules must be present when installing/building Python (e.g. libbz2-dev package for Ubuntu).
Benchmarking details have been collected at http://www.silx.org/doc/fabio/latest/performances.html.
Supported file formats
ADSC:
AdscImage
Bruker:
BrukerImage
Bruker100Image
KcdImage: Nonius KappaCCD diffractometer
D3M
D3mImage
Dectris:
CbfImage (implements a fast byte offset de/compression scheme in python/cython)
PilatusImage (fileformat derived from Tiff)
EigerImage (derived from HDF5/NeXus format, depends on h5py)
ESRF:
EdfImage: The ESRF data Format
XsdImage: XML serialized image from EDNA
Fit2dImage: Fit2d binary format
Fit2dmaskImage: Fit2d Mask format
Fit2dSpreadsheetImage: Fit2d ascii tables (spread-sheet)
LimaImage: image stacks written by the LImA aquisition system
SparseImage: single crystal diffractions images written by pyFAI
General Electrics
GEimage (including support for variant used at APS)
Hamamatsu
HiPiCImage
HDF5: generic format for stack of images based on h5py
Hdf5Image
EigerImage
LimaImage
SparseImage
JPEG image format:
JPEG using PIL
JPEG 2000 using Glymur
Mar Research:
MarccdImage (fileformat derived from Tiff)
Mar345Image imaging plate with PCK compression
MPA multiwire
MpaImage
Medical Research Council file format for 3D electron density and 2D images
MrcImage
Nonius -> now owned by Bruker
KcdImage
Numpy: generic reader for 2D arrays saved
NumpyImage
Oxford Diffraction Sapphire 3
OXDimage uncompressed or with TY1 or TY5 compression scheme
Esperanto format (with bitfield compression)
Pixirad Imaging
PixiImage
PNM
PnmImage
Princeton Instrument SPE
SpeImage
Raw Binary without compression
Rigaku
RaxisImage
DtrekImage
Tiff
- TifImage using either:
Pillow (external dependency)
TiffIO taken from PyMca
Design Specifications
Name:
FabIO = Fable Input/Output
Idea:
Have a base class for all our 2D diffraction greyscale images. This consists of a 2D array (numpy ndarray) and a python dictionary (actually an ordered dict) of header information in (string key, string value) pairs.
Class FabioImage
Needs a name which will not to be confused with an RGB color image.
Class attributes, often exposed as properties:
data -> 2D array
header -> ordered dictionary
rows, columns, dim1, dim2 -> data.shape (propertiy)
header_keys -> property for list(header.keys()), formerly used to retain the order of the header
bytecode -> data.typecode() (property)
m, minval, maxval, stddev -> image statistics, could add others, eg roi[slice]
Class methods (functions):
integrate_area() -> return sum(self.data) within slice
rebin(fact) -> rebins data, adjusts dims
toPIL16() -> returns a PILimage
getheader() -> returns self.header
resetvals() -> resets the statistics
getmean() -> (computes) returns self.m
getmin() -> (computes) returns self.minval
getmax() -> (computes) returns self.maxval
getstddev() -> (computes) returns self.stddev
read() -> read image from file [or stream, or shared memory]
write() -> write image to file [or stream, or shared memory]
readheader() -> read only the header [much faster for scanning files]
Each individual file format would then inherit all the functionality of this class and just make new read and write methods.
There are also fileseries related methods (next(), previous(), …) which returns a FabioImage instance of the next/previous frame in a fileserie
Other feature:
possibility for using on-the-fly external compression - i.e. if files are stored as something as .gz, .bz2 etc could decompress them, using an external compression mechanism (if available).
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Hashes for fabio-2024.9.0-cp312-cp312-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 42731db446b6887619b691b55a1a7de9102d8072b7f8351c1778a5b0f1ccde70 |
|
MD5 | 82fe6f0cb991cfb006be6c265c068f2b |
|
BLAKE2b-256 | bfff337753cd116f6eb9e97520a840e6d22fcb324cdd9d12e5443881c880f914 |
Hashes for fabio-2024.9.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0d4d56c5b61f2263b849c61f80ed06a4ed9551ea72bb15a99a076cf3fdef75e1 |
|
MD5 | a027b8e737aa990afb7d3468e23283f7 |
|
BLAKE2b-256 | 0385264142262da5ffee2ceb460d7d30b8346ea6533ccf2e10d9bf995b912d02 |
Hashes for fabio-2024.9.0-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e4bd5e008acae8a4182f882d0382096ff164c06274122ef7ef327af75cc81648 |
|
MD5 | 006ae744708f5ea4f7312c792bc34b9c |
|
BLAKE2b-256 | 2ccd9f40e6b94b4a5340bbed8519ec5a91dbca0092a536a9ca98d1e3e3682b6b |
Hashes for fabio-2024.9.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5a4b9f86dff43e9bcbaeb8b29ddeee81cbe6cb32a7747e58687cf1c3203c9bd8 |
|
MD5 | 4a0cbf79945bee4b75242d7a4d56a477 |
|
BLAKE2b-256 | 65d80ed9696afbcd2ceb19a46ad3962e0519491333a22ac6873b0c23b01b5b52 |
Hashes for fabio-2024.9.0-cp312-cp312-macosx_11_0_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 34c961e5a77f4ba202970dbbe4be3c5722e28685f715f1e501c825a8772fc1aa |
|
MD5 | cc53d4460d1457e7f8ab2d9f35cbdbb7 |
|
BLAKE2b-256 | 89098b76204992b6b651b23d739842b484464c56cc5704e2b02e55c63e7f38cc |
Hashes for fabio-2024.9.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 192c847295f38935dc6c681173f1624f648adb4ab409c7ba5d1a7836dce3bd3f |
|
MD5 | d4971bae066b73cca42e7569cd82878e |
|
BLAKE2b-256 | 4f5978575a4bfce784813a4bba207c1c5e733ab69ad0868a8cc5c403269a94ad |
Hashes for fabio-2024.9.0-cp311-cp311-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d435a675dc8be93779c339dafdcc3ed6f3dc624d0145c3260431ff860afed400 |
|
MD5 | bf3b0886d5881519fb73183bbdf0172d |
|
BLAKE2b-256 | aa4d5aa8b135a09a59fce8b13c5f638ce4add156cb24a83bcf27b1225c9c1b73 |
Hashes for fabio-2024.9.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 62916a274b89033f2020e3234c1c9c2ec23259d5c16298471831d5b02b0d5a9e |
|
MD5 | 7dc1787a95e50917580f00954412ee2e |
|
BLAKE2b-256 | e1021d48bf2b4f691376d3b529da3862f891182ad77ddd4d3cce423c998af843 |
Hashes for fabio-2024.9.0-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b608d8e9491b4e08c373ee392ac4f6bc37b4b05a08f32938214f6c0cdb9c3d0c |
|
MD5 | a6677e88795904b932b26a30058a368f |
|
BLAKE2b-256 | 3c0f8ba74a06358c2ae6c2de851bd0f82896c0c2296bedfaca80f2109691d068 |
Hashes for fabio-2024.9.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 204017b9f973e97c352d9c58e4c2367ee549ae9ac7ac7d491b70bcc0e06c3101 |
|
MD5 | cf975260ff8babb1e8341d18b3dff559 |
|
BLAKE2b-256 | f416f92bb4f69a820875c081cdc9cb4d45ec8de325a7578298c55af921fd2ad4 |
Hashes for fabio-2024.9.0-cp311-cp311-macosx_11_0_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cba1e5cb3ca3a9036cce242dbb9fb51ab9684dfb56660ef5561f381b69449ef7 |
|
MD5 | f513a97c308f673316d51ccf979f7c50 |
|
BLAKE2b-256 | e0212ea761cb61935116a18677dab2a992cadffbe16d9fd2d9df90364d699f89 |
Hashes for fabio-2024.9.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7d4c694948256b808d6b54dd3d421309062a839d7a1cd35d0e3d8cf7b2decb18 |
|
MD5 | db9196ea6b47fe7a9dec145b12e5e863 |
|
BLAKE2b-256 | ed39d827d527e54ba288a7aca823cee7ccf8694624ebce12c60e49bc288ef015 |
Hashes for fabio-2024.9.0-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1f697133808d916f3248b5ad2ffedaf966ee872b68a65acaf4bdf98ee1d06401 |
|
MD5 | 7a2ce91573f574b5d68f4e14d20d1599 |
|
BLAKE2b-256 | 3a50a06fbdc2851217311749d74023fc9e505b589e9d8ab3beff3378b4c4e8ae |
Hashes for fabio-2024.9.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 08ac1da22f94502aa532e89c04db2709155aa2f48a4562f6622991b8b5ebd0df |
|
MD5 | 5c7a5336e929e6538232d04132dcc2f6 |
|
BLAKE2b-256 | 3af32e32dfb332b7c5f80e7d27869dde63bdef0062978fb9b195e29cfd13174f |
Hashes for fabio-2024.9.0-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 26f480455786895dcd7ab67ebc71a6b0afc03d67bd475eb9cb51bc4458ee6581 |
|
MD5 | 488aacf1e696ad7d0041927045f62186 |
|
BLAKE2b-256 | c00e38c96f634d03aa12a3898f361dfe797c21bebc82265f550f0abe90d5818b |
Hashes for fabio-2024.9.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d748ef8026e1d5273d1c2bc801f957a9af2cb938c450125a04bd480d77f9d00a |
|
MD5 | 7d2b68c14e4001030ec59706689629ea |
|
BLAKE2b-256 | 8e97d3db97360afc4f20417c45a6f9eb116a21312818aa12d597f132a5c9b3bb |
Hashes for fabio-2024.9.0-cp310-cp310-macosx_11_0_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0bc080f4db8663f5dd5d2a1d0e63741450ea86fa435406b4f780f1afe6b59ebf |
|
MD5 | cf4fbe1fc88f0a99feac5ec461399485 |
|
BLAKE2b-256 | 2b49b5f80cf0cc7b4aea288150a9ac99cabfa3a7cfc16e0095e3985b1470859c |
Hashes for fabio-2024.9.0-cp310-cp310-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b41287c38511923fe0b6d62987453a227a13e306072f8e7463cd889571273ccd |
|
MD5 | 444c2622efbfe4919d34268bdca51e4a |
|
BLAKE2b-256 | 462025d49eed3bd2afc188fd9fa56a5c1dba78d9a32292b28332e24fe3c0e10f |
Hashes for fabio-2024.9.0-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b628c6db8816bba49e17c1e8cb0181b40acc5aa58164fb20065c4ce35a5b83b4 |
|
MD5 | 2e16ceabcfc07aa4b591c62e34738b51 |
|
BLAKE2b-256 | 926d4c17e4d694d97168bb7d780bf10fb45c39f2dcef4aa5790f1b794ef9e09e |
Hashes for fabio-2024.9.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6e876a7928473c89c1791b5f2d83b76736ef6af68906e70fc53e1c318e97b145 |
|
MD5 | f1542e28d2133842318dac7e7b20328e |
|
BLAKE2b-256 | 9912116c98e7094b6a70ae2031c524cf04612ca14e59284473f67107a5f9d48c |
Hashes for fabio-2024.9.0-cp39-cp39-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8852e542c1756cded055e658c02470da656250747e57149e81fe7ece4ac7bb9a |
|
MD5 | c3c0de5a0c1f44574a73a5d6406a578c |
|
BLAKE2b-256 | 64fd485267356a0d71da38280b5427af3d7269669f824d6b669dede0153c6fcf |
Hashes for fabio-2024.9.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e5672d06383de15e9204a91652b8f27a4360928318c50fd0b46faae619f9435f |
|
MD5 | c0c1009dd01bfba3b6f541761251cde6 |
|
BLAKE2b-256 | 68bc3586d1dbffe70d321d0eb8cbd5dd7b31c0b38bc8e241d263126ba6101ab4 |
Hashes for fabio-2024.9.0-cp39-cp39-macosx_11_0_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 66ca95469c65ada9d958ad71e3960910a69aab27d0c4ad5d18025aef5c139ffd |
|
MD5 | 10768772f5d45b79e56eb5a4160aa73c |
|
BLAKE2b-256 | 6b7019c931bbe63d9c34de5ee152595a256da0b33efbab5889b8d8fbdcb0ac67 |
Hashes for fabio-2024.9.0-cp39-cp39-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 54416cad9b4425609b55b5554b745412a68b1dfe4e401cbf51ae822a55dd6a67 |
|
MD5 | 20c49e2f1465b13f02219b7f6b081a15 |
|
BLAKE2b-256 | ed7b885e6293cd7c87af19059258ca7dc94101c5aab6ff1a3b4a2ba18e13fbd1 |
Hashes for fabio-2024.9.0-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0631202b5780fa9887816cee0cf7ecf68bcfd20d6ce1ae2f2df595f1acc4daae |
|
MD5 | b4a6506afa9041135930d2b51fc35568 |
|
BLAKE2b-256 | 6271c8037f33bdce35433e720ac7cea99573ff096cd37674c802ee6d7c61818a |
Hashes for fabio-2024.9.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2cdbedc6a042d07be2e6935252198661356de4950681720b8c12d3ac3046a386 |
|
MD5 | f3fc0a045e567b2ba71e621f866bb524 |
|
BLAKE2b-256 | 23a4b447970cc3cab07bb7976099a97bea79fe4dcdd4734445b02b4b31afaacf |
Hashes for fabio-2024.9.0-cp38-cp38-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | abd7aee21cda0a8ed203a531e61e2296551b30ebfe5d6d4264687a4da52644b3 |
|
MD5 | 595016e39edfc4404a3233ee589cad1c |
|
BLAKE2b-256 | 6f73919eb996b3e587e6b7338c71709a4337c1be91a58c9459ed9a822d46204d |
Hashes for fabio-2024.9.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 102e49f6106696143b13b70feccddf48a30eef2777e2b4365ce6af6683ec6c01 |
|
MD5 | cc12ce81022278d1326b566e07b95300 |
|
BLAKE2b-256 | 0ecd13494b8cf85decb1ab85439b85586f42567165a864845cdca7769d06c066 |
Hashes for fabio-2024.9.0-cp38-cp38-macosx_11_0_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1c91ec18294d55beec5203b778bcf757c333d5e09c9e6cd480e226be8226fa18 |
|
MD5 | b56c1a63775923b5d52be995a8ee103d |
|
BLAKE2b-256 | 8e06657a0b23b66945c64974511ba71b834d32a16daca43a5c430dbffb5e3aee |
Hashes for fabio-2024.9.0-cp38-cp38-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 60e7800b2efc9af0099538038a11b89579ea9a0eca643fbd1fc1e19b3fe4f261 |
|
MD5 | bd7251a07b2ebf561ada94f280c906a5 |
|
BLAKE2b-256 | 6c245bd6c0cfb9cec9472736d28af239536683e2692c7d48bb1358d466846543 |