Metadata-Version: 2.1
Name: fabio
Version: 2024.9.0
Summary: FabIO is an I/O library for images produced by 2D X-ray detectors and written in Python
Author: Erik Knudsen, Regis Perdreau, Gael Goret, Brian Pauw
Author-Email: Henning Sorensen <osho@fysik.dtu.dk>, "Jonathan P. Wright" <wright@esrf.fr>, =?utf-8?q?J=C3=A9r=C3=B4me_Kieffer?= <jerome.kieffer@esrf.fr>, Valentin Valls <valentin.valls@esrf.fr>
License: Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
         Upstream-Name: fabio
         Upstream-Contact: Jérôme Kieffer <kieffer@esrf.eu>
         Source: https://github.com/silx-kit/fabio/releases/tag/v0.10.0
         Files-Excluded: third_party
         
         Files: *
         Copyright: 2007-2009 Henning O. Sorensen & Erik Knudsen
                        Center for Fundamental Research: Metal Structures in Four Dimensions
                        Risoe National Laboratory
                        Frederiksborgvej 399
                        DK-4000 Roskilde
                        email:erik.knudsen@risoe.dk
                    2009-2016 Jonathan P. Wright, Jerome Kieffer and Gael Goret
                        European Synchrotron Radiation Facility
                        6 rue Jules Horowitz
                        38000 Grenoble, France
         License: MIT
         
         Files: debian/*
         Copyright: 2011 Jerome Kieffer <jerome.kieffer@esrf.fr>
                    2013-2014 Picca Frederic-Emmanuel <picca@debian.org>
         License: GPL-2.0+
         
         Files: fabio/raxisimage.py
         Copyright: 2013-2014 Brian R. Pauw <brian@stack.nl>
         License: MIT
         
         Files: fabio/mpaimage.py
         Copyright: 2017 Jesse Hopkins (CHESS, USA)
         License: MIT
         
         Files: fabio/ext/src/ccp4_pack.c
                fabio/ext/inlcude/ccp4_pack.h
         Copyright: 1995 Jan Pieter Abrahams
                         MRC Cambridge (UK)
                    2007-2009 Henning O. Sorensen & Erik Knudsen
                         Risoe National Laboratory (DK)
                    2012-2016 European Synchrotron Radiation Facility (FR)
         License: LGPL-3.0+
         
         Files: fabio/speimage
                fabio/test/testspeimage
         Copyright: 2016 University Köln, Germany
         License: MIT
         
         Files: src/stdint.h
         Copyright: 2006-2008 Alexander Chemeris
         License: BSD-3
         
         License: GPL-2.0+
          This package is free software; you can redistribute it and/or modify
          it under the terms of the GNU General Public License as published by
          the Free Software Foundation; either version 2 of the License, or
          (at your option) any later version.
          .
          This package is distributed in the hope that it will be useful,
          but WITHOUT ANY WARRANTY; without even the implied warranty of
          MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
          GNU General Public License for more details.
          .
          You should have received a copy of the GNU General Public License
          along with this program. If not, see <http://www.gnu.org/licenses/>
          .
          On Debian systems, the complete text of the GNU General
          Public License version 2 can be found in "/usr/share/common-licenses/GPL-2".
         
         License: GPL-3.0+
          This package is free software; you can redistribute it and/or modify
          it under the terms of the GNU General Public License as published by
          the Free Software Foundation; either version 3 of the License, or
          (at your option) any later version.
          .
          This package is distributed in the hope that it will be useful,
          but WITHOUT ANY WARRANTY; without even the implied warranty of
          MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
          GNU General Public License for more details.
          .
          You should have received a copy of the GNU General Public License
          along with this program. If not, see <http://www.gnu.org/licenses/>
          .
          On Debian systems, the complete text of the GNU General
          Public License version 3 can be found in "/usr/share/common-licenses/GPL-3".
         
         License: LGPL-3.0+
          This package is free software; you can redistribute it and/or modify
          it under the terms of the GNU Lesser General Public License as published by
          the Free Software Foundation; either version 3 of the License, or
          (at your option) any later version.
          .
          This package is distributed in the hope that it will be useful,
          but WITHOUT ANY WARRANTY; without even the implied warranty of
          MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
          GNU General Public License for more details.
          .
          You should have received a copy of the GNU Lesser General Public License
          along with this program. If not, see <http://www.gnu.org/licenses/>
          .
          On Debian systems, the complete text of the GNU Lesser General
          Public License version 3 can be found in "/usr/share/common-licenses/LGPL-3".
         
         License: BSD-3
          Redistribution and use in source and binary forms, with or without
          modification, are permitted provided that the following conditions are met:
          .
          1. Redistributions of source code must retain the above copyright notice,
             this list of conditions and the following disclaimer.
          .
          2. Redistributions in binary form must reproduce the above copyright
             notice, this list of conditions and the following disclaimer in the
             documentation and/or other materials provided with the distribution.
          .
          3. The name of the author may be used to endorse or promote products
             derived from this software without specific prior written permission.
          .
          THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
          WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
          MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
          EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
          SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
          PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
          OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
          WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
          OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
          ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
         
         License: MIT
          Permission is hereby granted, free of charge, to any person
          obtaining a copy of this software and associated documentation files
          (the "Software"), to deal in the Software without restriction,
          including without limitation the rights to use, copy, modify, merge,
          publish, distribute, sublicense, and/or sell copies of the Software,
          and to permit persons to whom the Software is furnished to do so,
          subject to the following conditions:
         
          The above copyright notice and this permission notice shall be
          included in all copies or substantial portions of the Software.
         
          THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
          EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
          OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
          NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
          HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
          WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
          FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
          OTHER DEALINGS IN THE SOFTWARE.
         
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Console
Classifier: Intended Audience :: End Users/Desktop
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: MacOS :: MacOS X
Classifier: Operating System :: Microsoft :: Windows
Classifier: Operating System :: POSIX
Classifier: Programming Language :: C
Classifier: Programming Language :: Cython
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Topic :: Scientific/Engineering :: Chemistry
Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
Classifier: Topic :: Scientific/Engineering :: Physics
Classifier: Topic :: Scientific/Engineering :: Visualization
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Project-URL: homepage, http://www.silx.org
Project-URL: documentation, http://www.silx.org/doc/fabio/latest/
Project-URL: source, https://github.com/silx-kit/fabio
Project-URL: download, https://github.com/silx-kit/fabio/releases
Project-URL: tracker, https://github.com/silx-kit/fabio/issues
Requires-Python: >=3.7
Requires-Dist: numpy
Requires-Dist: h5py
Requires-Dist: hdf5plugin
Requires-Dist: lxml
Requires-Dist: pillow
Provides-Extra: gui
Requires-Dist: pyqt5; extra == "gui"
Requires-Dist: matplotlib; extra == "gui"
Provides-Extra: all
Requires-Dist: pyqt5; extra == "all"
Requires-Dist: matplotlib; extra == "all"
Description-Content-Type: text/x-rst

FabIO: Fable Input/Output library
=================================

Main websites:

 * https://github.com/silx-kit/fabio
 * http://fable.sf.net (historical)


|Build Status| |Appveyor Status|

----

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)


.. contents::
    :depth: 1

Installation
------------

FabIO is available from `PyPI <https://pypi.python.org/pypi/fabio>`_:

``pip install fabio``


`Debian/Ubuntu packages <http://www.silx.org/pub/debian/binary/>`_, and
`wheels <http://www.silx.org/pub/wheelhouse/>`_ are available
for Windows, Linux and MacOSX from the silx repository. 

See the `installation instructions <http://www.silx.org/doc/fabio/latest/install.html>`_ 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 <http://www.silx.org/doc/fabio/latest/>`_ for further details.

Documentation of previous versions are available on `silx <http://www.silx.org/doc/fabio/>`_.

Changelog
---------

See http://www.silx.org/doc/fabio/latest/Changelog.html


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. <http://dx.doi.org/10.1107/S0021889813000150>`_

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



.. |Build Status| image:: https://travis-ci.org/silx-kit/fabio.svg?branch=master
   :target: https://travis-ci.org/silx-kit/fabio
.. |Appveyor Status| image:: https://ci.appveyor.com/api/projects/status/4k6lol1vq30qhf66/branch/master?svg=true
   :target: https://ci.appveyor.com/project/ESRF/fabio/branch/master
