FabIO module
Run the benchmarks
Run the FabIO test suite.
If the test-images are not already installed (via the debian package for example), they need to be downloaded from sourceforge.net, which make take a while. Ensure your network connection is operational and your proxy settings are correct, for example:
export http_proxy=http://proxy.site.com:3128
Center for Fundamental Research: Metal Structures in Four Dimensions Risoe National Laboratory Frederiksborgvej 399 DK-4000 Roskilde email:erik.knudsen@risoe.dk
and Jon Wright, Jerome Kieffer: ESRF
Bases: object
A common object for images in fable
Contains a numpy array (.data) and dict of meta data (.header)
Add another Image - warning, does not clip to 16 bit images by default
Getter for bpp: data superseeds _bpp
Getter for bpp: data superseeds _bytecode
Empty for fabioimage but may be populated by others classes, especially for format accepting only integers
Parameters: | data – array like |
---|---|
Returns: | numpy array or None |
Empty for fabioimage but may be populated by others classes
Parameters: | header – dict like object |
---|---|
Returns: | Ordered dict |
Retrieves the name of the class :return: the name of the class
Convert a fabioimage object into another fabioimage object (with possible conversions) :param dest: destination type “EDF”, “edfimage” or the class itself :return: instance of the new class
Getter for dim1: data superseeds _dim1
Getter for dim2: data superseeds _dim2
A kind of factory... for image_classes
Parameters: | name (str) – name of the class to instantiate |
---|---|
Returns: | an instance of the class |
Return type: | fabioimage |
Getter for bpp: data superseeds _bpp
Getter for bpp: data superseeds _bytecode
Getter for dim1: data superseeds _dim1
Getter for dim2: data superseeds _dim2
Retrieves the name of the class :return: the name of the class
returns the file numbered ‘num’ in the series as a fabioimage
returns self.header
Find max value in self.data, caching for the future
return the mean
Find min value in self.data, caching for the future
return the standard deviation
Sums up a region of interest if len(coords) == 4 -> convert coords to slices if len(coords) == 2 -> use as slices floor -> ? removed as unused in the function.
Wrapper for read
Convert a len(4) set of coords into a len(2) tuple (pair) of slice objects the latter are immutable, meaning the roi can be cached
returns the next file in the series as a fabioimage
returns the previous file in the series as a fabioimage
To be overridden - fill in self.header and self.data
Method reading Region of Interest. This implementation is the trivial one, just doing read and crop
Call the _readheader function...
Rebin the data and adjust dims :param x_rebin_fact: x binning factor :param y_rebin_fact: y binning factor :param keep_I: shall the signal increase ? :type x_rebin_fact: int :type y_rebin_fact: int :type keep_I: boolean
Reset cache - call on changing data
wrapper for write
Setter for bpp
Setter for bpp
Setter for dim1
Setter for dim2
Convert to Python Imaging Library 16 bit greyscale image
update the header entries by default pass in a dict of key, values.
To be overwritten - write the file
Bases: type
Metaclass used to register all image classes inheriting from fabioImage
alias of FabioImage
General purpose utilities functions for fabio
Bases: bz2.BZ2File
Wrapper with lock
Bases: StringIO.StringIO
just an interface providing the name and mode property to a BytesIO
BugFix for MacOSX mainly
Bases: threading._Semaphore
threading.Semaphore like class with helper for fighting dead-locks
Bases: file
wrapper for “file” with locking
Bases: object
The ‘meaning’ of a filename ...
Break up a filename to get image type and number
Return a string representation
convert yourself to a string
Bases: gzip.GzipFile
Just a wrapper forgzip.GzipFile providing the correct seek capabilities for python 2.5
Bases: exceptions.RuntimeError
The reader used is probably not the good one
Bases: fabio.fabioutils.File
wrapper for “File” with locking
Try to construct the filename for a given frame
Function for backward compatibility. Deprecated
used to deprecate a function/method: prints a lot of warning messages to enforce the modification of the code
Test whether a path exists.
Replaces os.path.exists and handles in addition ”::” based URI as defined in http://odo.pydata.org/en/latest/uri.html#separating-parts-with
Parameters: | path – string |
---|---|
Returns: | boolean |
extract file number
# try to figure out a file number # guess it starts at the back
Parameters: |
|
---|---|
Returns: | True of False whether name is pure ascii or not |
jump to number
increment number
Workaround that int(‘1.0’) raises an exception
Parameters: | s – string to be converted to integer |
---|
cant see how to do without reversing strings Match 1 or more digits going backwards from the end of the string
Performs the padding of the string to the right size with the right pattern
Parameters: |
|
---|---|
Returns: | the padded string to a multiple of size |
decrement number
Parameters: |
|
---|---|
Returns: | the name with all non valid char removed |
Bases: list
Represents a series of files to iterate has an idea of a current position to do next and prev
Current position in a sequence
Current image in sequence
Returns: | fabioimage |
---|
Current image in sequence
Returns: | file_object |
---|
First image in series
First image in a sequence
Returns: | fabioimage |
---|
First image in a sequence
Returns: | file_object |
---|
Goto a position in sequence
Jump to and read image
Returns: | fabioimage |
---|
Jump to and read image
Returns: | file_object |
---|
Last in series
Last image in a sequence
Returns: | fabioimage |
---|
Last image in a sequence
Returns: | file_object |
---|
Number of files
Next in a sequence
Return the next image
Returns: | fabioimage |
---|
Return the next image
Returns: | file_object |
---|
Prev in a sequence
Return the previous image
Returns: | fabioimage |
---|
Return the previous image
Returns: | file_object |
---|
Much like the others, but created from a string filename
return current filename string
returns the current image as a fabioimage
returns the current filename as a fabio.FilenameObject
jump to a specific number
returns the image number as a fabioimage
returns the filename num as a fabio.FilenameObject
increment number
returns the next image as a fabioimage
returns the next filename as a fabio.FilenameObject
returns the previos image as a fabioimage
decrement number
returns the previous filename as a fabio.FilenameObject
A generator function that creates a file series starting from a a fabioimage. Iterates through all images in a file (if more than 1), then proceeds to the next file as determined by fabio.next_filename.
Parameters: |
|
---|
Suggested usage:
for obj in new_file_series( ... ):
if not isinstance(obj, fabio.fabioimage.fabioimage ):
# deal with errors like missing images, non readable files, etc
# e.g.
traceback.print_exception(obj[0], obj[1], obj[2])
Created from a fabio image first and last are file numbers
Bases: fabio.file_series.file_series
mydata0001.edf = “mydata” + 0001 + ”.edf” mydata0002.edf = “mydata” + 0002 + ”.edf” mydata0003.edf = “mydata” + 0003 + ”.edf”
mods for fabio by JPW modification for HDF5 by Jérôme Kieffer
Try to interpret the bytes starting the file as a magic number
return only the header
Try to open an image
Bases: fabio.fabioimage.FabioImage
Read an image in ADSC format (quite similar to edf?)
read in the file
Write adsc format
Authors: Gael Goret, Jerome Kieffer, ESRF, France
Binary files images are simple none-compressed 2D images only defined by their : data-type, dimensions, byte order and offset
This simple library has been made for manipulating exotic/unknown files format.
Bases: fabio.fabioimage.FabioImage
This simple library has been made for manipulating exotic/unknown files format.
if offset is set to a negative value, the image is read using the last data but n data in the file, skipping any header.
Estimates the size of a file
Read a binary image
Parameters: |
|
---|
Decide if we need to byteswap
alias of BinaryImage
Center for Fundamental Research: Metal Structures in Four Dimensions Risoe National Laboratory Frederiksborgvej 399 DK-4000 Roskilde email:erik.knudsen@risoe.dk
Jérôme Kieffer, ESRF, Grenoble, France Sigmund Neher, GWDG, Göttingen, Germany
Bases: fabio.brukerimage.BrukerImage
Generate headers (with some magic and guesses) format is Bruker100
Generate an overflow table, including the underflow, marked as 65535 .
Generate an underflow table
Generate one-byte overflow table
Generate two byte overflow table
data is stored in three blocks: data (uint8), overflow (uint32), underflow (int32). The blocks are zero paded to a multiple of 16 bits
Generate underflow table
Write a bruker image
alias of Bruker100Image
Writer by Jérôme Kieffer, ESRF, Grenoble, France
Bases: fabio.fabioimage.FabioImage
Read and eventually write ID11 bruker (eg smart6500) images
TODO: int32 -> float32 conversion according to the “linear” keyword. This is done and works but we need to check with other program that we are appliing the right formula and not the reciprocal one.
Does some basic population of the headers so that the writing is possible
Calculate the number of byte per pixel to get an optimal overflow table.
Returns: | byte per pixel |
---|
Generate headers (with some magic and guesses) :param format can be 86 or 100
Generate an overflow table
Read in and unpack the pixels (including overflow table
Write a bruker image
alias of BrukerImage
Cif Binary Files images are 2D images written by the Pilatus detector and others. They use a modified (simplified) byte-offset algorithm.
CIF is a library for manipulating Crystallographic information files and tries to conform to the specification of the IUCR
Bases: dict
This is the CIF class, it represents the CIF dictionary; and as a a python dictionary thus inherits from the dict built in class.
keys are always unicode (str in python3) values are bytes
Returns True if the key (string) exist in the array called loop
Check if the key exists in the CIF and is non empty. :param sKey: CIF key :type sKey: string :param cif: CIF dictionary :return: True if the key exists in the CIF dictionary and is non empty :rtype: boolean
Check if the key exists in the CIF dictionary. :param sKey: CIF key :type sKey: string :param cif: CIF dictionary :return: True if the key exists in the CIF dictionary and is non empty :rtype: boolean
Check if all characters in a string are ascii,
Parameters: | _strIn (python string) – input string |
---|---|
Returns: | boolean |
Return type: | boolean |
Load the powder diffraction CHIPLOT file and returns the pd_CIF dictionary in the object
Parameters: | _strFilename (string) – the name of the file to open |
---|---|
Returns: | the CIF object corresponding to the powder diffraction |
Return type: | dictionary |
Load the CIF file and populates the CIF dictionary into the object :param _strFilename: the name of the file to open :type _strFilename: string :param _strFilename: the name of the file to open :type _strFilename: string :return: None
Load the CIF file and populates the CIF dictionary into the object :param _strFilename: the name of the file to open :type _strFilename: string :param _strFilename: the name of the file to open :type _strFilename: string :return: None
Transforms the CIF object in string then write it into the given file :param _strFilename: the of the file to be written :param linesep: line separation used (to force compatibility with windows/unix) :param binary: Shall we write the data as binary (True only for imageCIF/CBF) :return: None
Converts a cif dictionnary to a string according to the CIF syntax
param _strFilename: the name of the filename to be appended in the header of the CIF file type _strFilename: string param linesep: default line separation: can be “
” or ” “
return: a string that corresponds to the content of the CIF-file.
Bases: fabio.fabioimage.FabioImage
Read the Cif Binary File data format
Read in header into self.header and the data into self.data
Param: | fname: name of the file |
---|---|
Returns: | fabioimage instance |
Read and return the raw data chunk
Parameters: | infile – opened file are correct position |
---|---|
Returns: | raw compressed stream |
write the file in CBF format :param fname: name of the file :type: string
Center for Fundamental Research: Metal Structures in Four Dimensions Risoe National Laboratory Frederiksborgvej 399 DK-4000 Roskilde email:erik.knudsen@risoe.dk
License: GPLv3+
Bases: fabio.fabioimage.FabioImage
Read and try to write the ESRF edf data format
Method used add a frame to an EDF file :param frame: frame to append to edf image :type frame: instance of Frame :return: None
property: capsHeader of EDF file, i.e. the keys of the header in UPPER case.
Empty for FabioImage but may be populated by others classes
property: data of EDF file
deleter for edf capsHeader
deleter for edf Data
Deleter for edf header
Method used to remove a frame from an EDF image. by default the last one is removed. :param frameNb: frame number to remove, by default the last. :type frameNb: integer :return: None
This is a special method that will read and return the data from another file ... The aim is performances, ... but only supports uncompressed files.
Returns: | data from another file using positions from current EdfImage |
---|
Method reading Region of Interest of another file based on metadata available in current EdfImage. The aim is performances, ... but only supports uncompressed files.
Returns: | ROI-data from another file using positions from current EdfImage |
---|---|
Return type: | numpy 2darray |
getter for edf headers keys in upper case :return: data for current frame :rtype: dict
getter for edf Data :return: data for current frame :rtype: numpy.ndarray
Getter for the headers. used by the property header,
Getter for number of frames
returns the file numbered ‘num’ in the series as a FabioImage
property: header of EDF file
returns the next file in the series as a FabioImage
Getter for number of frames
returns the previous file in the series as a FabioImage
Enforces the propagation of the header_keys to the list of frames :param _data: numpy array representing data
Enforces the propagation of the data to the list of frames :param _data: numpy array representing data
Enforces the propagation of the header to the list of frames
Setter for number of frames ... should do nothing. Here just to avoid bugs
Decide if we need to byteswap
:return True if needed, False else and None if not understood
Unpack a binary blob according to the specification given in the header and return the dataset
Returns: | dataset as numpy.ndarray |
---|
Try to write a file check we can write zipped also mimics that fabian was writing uint16 (we sometimes want floats)
Parameters: | force_type – can be numpy.uint16 or simply “float” |
---|---|
Returns: | None |
Bases: object
A class representing a single frame in an EDF file
Unpack a binary blob according to the specification given in the header
Returns: | dataset as numpy.ndarray |
---|
Unpack a binary blob according to the specification given in the header
Returns: | dataset as numpy.ndarray |
---|
Parameters: |
|
---|---|
Returns: | ascii header block + binary data block |
Return type: | python bytes with the concatenation of the ascii header and the binary data block |
Parse the header in some EDF format from an already open file
Parameters: | block (string, should be full ascii) – string representing the header block. |
---|---|
Returns: | size of the binary blob |
Setter for data in edf frame
Decide if we need to byteswap
Eiger data/master file reader for FabIO
Eiger data files are HDF5 files with one group called “entry” and a dataset called “data” in it (now in a data group).
Those dataset are usually compressed using LZ4 and/or bitshuffle compression:
H5py (>2.5) and libhdf5 (>1.8.10) with the corresponding compression plugin are needed to actually read the data. Under windows, those plugins can easily be installed via this repository: https://github.com/silx-kit/hdf5plugin
Bases: fabio.fabioimage.FabioImage
FabIO image class for Images from Eiger data files (HDF5)
returns the frame numbered ‘num’ in the stack if applicable
returns the next frame in the series as a fabioimage
returns the previous frame in the series as a fabioimage
try to read image :param fname: name of the file
try to write image :param fname: name of the file
alias of EigerImage
FabIO reader for Fit2D binary images
TODO: handle big-endian files
Bases: fabio.fabioimage.FabioImage
FabIO image class for Images for XXX detector
try to read image
Parameters: | fname – name of the file |
---|
alias of Fit2dImage
Author: Andy Hammersley, ESRF Translation into python/fabio: Jon Wright, ESRF. Writer: Jérôme Kieffer
Bases: fabio.fabioimage.FabioImage
Read and try to write Andy Hammersley’s mask format
Try to write a file
alias of Fit2dMaskImage
Bases: fabio.fabioimage.FabioImage
Read a fit2d ascii format
alias of Fit2dSpreadsheetImage
Bases: fabio.fabioimage.FabioImage
Returns a frame as a new FabioImage object
Get the next image in a series as a fabio image
Get the previous image in a series as a fabio image
Read in header into self.header and the data into self.data
Not yet implemented
HDF5 image for FabIO
Authors: Jerome Kieffer email: Jerome.Kieffer@terre-adelie.org
Specifications: input should being the form:
filename::path
Only supports ndim=2 or 3 (exposed as a stack of images
Bases: fabio.fabioimage.FabioImage
FabIO image class for Images from an HDF file
filename::dataset
Returns a frame as a new FabioImage object :param num: frame number
Get the next image in a series as a fabio image
Get the previous image in a series as a fabio image
try to read image :param fname: filename::datasetpath
Center for Fundamental Research: Metal Structures in Four Dimensions Risoe National Laboratory Frederiksborgvej 399 DK-4000 Roskilde email:erik.knudsen@risoe.dk
Information about the file format from Masakatzu Kobayashi is highly appreciated
alias of HipicImage
Bases: fabio.fabioimage.FabioImage
Read HiPic images e.g. collected with a Hamamatsu CCD camera
kcd images are 2D images written by the old KappaCCD diffractometer built by Nonius in the 1990’s Based on the edfimage.py parser.
Bases: fabio.fabioimage.FabioImage
Read the Nonius kcd data format
Supports Mar345 imaging plate and Mar555 flat panel
Documentation on the format is available from: http://rayonix.com/site_media/downloads/mar345_formats.pdf
Bases: fabio.fabioimage.FabioImage
Generate the ASCII header for writing
Parameters: |
|
---|---|
Returns: | string (unicode) containing the mar345 header |
Returns: | Binary header of mar345 file |
---|
Read a mar345 image
Try to write mar345 file. This is still in beta version. It uses CCP4 (LGPL) PCK1 algo from JPA
alias of Mar345Image
MRC image for FabIO
Authors: Jerome Kieffer email: Jerome.Kieffer@terre-adelie.org
Specifications from: http://ami.scripps.edu/software/mrctools/mrc_specification.php
Bases: fabio.fabioimage.FabioImage
FabIO image class for Images from a mrc image stack
Returns a frame as a new FabioImage object :param num: frame number
Get the next image in a series as a fabio image
Get the previous image in a series as a fabio image
try to read image :param fname: name of the file :param frame:
marccdimage can read MarCCD and MarMosaic images including header info.
JPW : Use a parser in case of typos (sorry?)
Bases: fabio.tifimage.TifImage
Read in data in mar ccd format, also MarMosaic images, including header info
given a format and header interpret it
Reads the header definition in c and makes the format string to pass to struct.unpack
alias of MarccdImage
Generic numpy file reader for FabIO
Bases: fabio.fabioimage.FabioImage
FabIO image class for Images for numpy array dumps
Source: http://docs.scipy.org/doc/numpy/neps/npy-format.html
The first 6 bytes are a magic string: exactly “x93NUMPY”.
The next 1 byte is an unsigned byte: the major version number of the file format, e.g. x01.
The next 1 byte is an unsigned byte: the minor version number of the file format, e.g. x00. Note: the version of the file format is not tied to the version of the numpy package.
The next 2 bytes form a little-endian unsigned short int: the length of the header data HEADER_LEN.
The next HEADER_LEN bytes form the header data describing the array’s format. It is an ASCII string which contains a Python literal expression of a dictionary. It is terminated by a newline (‘n’) and padded with spaces (‘x20’) to make the total length of the magic string + 4 + HEADER_LEN be evenly divisible by 16 for alignment purposes.
The dictionary contains three keys:
- “descr” : dtype.descr
- An object that can be passed as an argument to the numpy.dtype() constructor to create the array’s dtype.
- “fortran_order” : bool
- Whether the array data is Fortran-contiguous or not. Since Fortran-contiguous arrays are a common form of non-C-contiguity, we allow them to be written directly to disk for efficiency.
- “shape” : tuple of int
- The shape of the array.
For repeatability and readability, this dictionary is formatted using pprint.pformat() so the keys are in alphabetic order.
Following the header comes the array data. If the dtype contains Python objects (i.e. dtype.hasobject is True), then the data is a Python pickle of the array. Otherwise the data is the contiguous (either C- or Fortran-, depending on fortran_order) bytes of the array. Consumers can figure out the number of bytes by multiplying the number of elements given by the shape (noting that shape=() means there is 1 element) by dtype.itemsize.
The version 1.0 format only allowed the array header to have a total size of 65535 bytes. This can be exceeded by structured arrays with a large number of columns. The version 2.0 format extends the header size to 4 GiB. numpy.save will automatically save in 2.0 format if the data requires it, else it will always use the more compatible 1.0 format.
The description of the fourth element of the header therefore has become:
The next 4 bytes form a little-endian unsigned int: the length of the header data HEADER_LEN.
returns the frame numbered ‘num’ in the stack if applicable
returns the next frame in the series as a fabioimage
returns the previous frame in the series as a fabioimage
try to read image :param fname: name of the file
try to write image :param fname: name of the file
alias of NumpyImage
Reads Oxford Diffraction Sapphire 3 images
Bases: fabio.fabioimage.FabioImage
Oxford Diffraction Sapphire 3 images reader/writer class
Note: We assume the binary format is alway little-endian, is this True ?
Attempt to decode TY5 compression scheme
Parameters: | stream – input stream |
---|---|
Returns: | 1D array with data |
calculate the compression factor obtained vs raw data
Write Oxford diffraction images: this is still beta Only TY1 compressed images is currently possible :param fname: output filename
Bases: object
Small helper class for writing binary headers
Parameters: |
|
---|
Bases: fabio.tifimage.TifImage
Read in Pilatus format, also pilatus images, including header info
alias of PilatusImage
Author: Jon Wright, ESRF.
Bases: fabio.fabioimage.FabioImage
Returns a frame as a new FabioImage object
Get the next image in a series as a fabio image
Get the previous image in a series as a fabio image
License: GPLv3+
Bases: fabio.fabioimage.FabioImage
try to read PNM images :param fname: name of the file :param frame: not relevant here! PNM is always single framed
try to write image. For now, limited to :param fname: name of the file
Authors: Brian R. Pauw email: brian@stack.nl
Written using information gleaned from the ReadRAXISImage program written by T. L. Hendrixson, made available by Rigaku Americas. Available at: http://www.rigaku.com/downloads/software/readimage.html
Bases: fabio.fabioimage.FabioImage
FabIO image class to read Rigaku RAXIS image files. Write functions are not planned as there are plenty of more suitable file formats available for storing detector data. In particular, the MSB used in Rigaku files is used in an uncommon way: it is used as a multiply-by flag rather than a normal image value bit. While it is said to multiply by the value specified in the header, there is at least one case where this is found not to hold, so YMMV and be careful.
try to read image :param fname: name of the file :param frame:
not sure if this function is needed
alias of RaxisImage
FabIO class for dealing with TIFF images. In facts wraps TiffIO from V. Armando Solé (available in PyMca) or falls back to PIL
License: MIT
Bases: object
Bases: object
Bases: fabio.fabioimage.FabioImage
Images in TIF format Wraps TiffIO
Wrapper for TiffIO.
Overrides the FabioImage.write method and provides a simple TIFF image writer. :param fname: name of the file to save the image to @tag_type fname: string or unicode (file?)...
Bases: object
XSDimge are XML files containing numpy arrays
Bases: fabio.fabioimage.FabioImage
Read the XSDataImage XML File data format
Compression and decompression algorithm for various formats
Bases: object
Class to handle lazy discovery of external compression programs
Compress a dataset into a string using the byte_offet algorithm
Parameters: | data – ndarray |
---|---|
Returns: | string/bytes with compressed data |
test = numpy.array([0,1,2,127,0,1,2,128,0,1,2,32767,0,1,2,32768,0,1,2,2147483647,0,1,2,2147483648,0,1,2,128,129,130,32767,32768,128,129,130,32768,2147483647,2147483648])
Compress a dataset into a string using the byte_offet algorithm
Parameters: | data – ndarray |
---|---|
Returns: | string/bytes with compressed data |
test = numpy.array([0,1,2,127,0,1,2,128,0,1,2,32767,0,1,2,32768,0,1,2,2147483647,0,1,2,2147483648,0,1,2,128,129,130,32767,32768,128,129,130,32768,2147483647,2147483648])
Compress a dataset into a string using the byte_offet algorithm
Parameters: | data – ndarray |
---|---|
Returns: | string/bytes with compressed data |
test = numpy.array([0,1,2,127,0,1,2,128,0,1,2,32767,0,1,2,32768,0,1,2,2147483647,0,1,2,2147483648,0,1,2,128,129,130,32767,32768,128,129,130,32768,2147483647,2147483648])
Modified CCP4 pck compressor used in MAR345 images
Parameters: | data – numpy.ndarray (square array) |
---|---|
Returns: | compressed stream |
Modified byte offset compressor used in Oxford Diffraction images
Parameters: | data – numpy.ndarray with the input data (integers!) |
---|---|
Returns: | 3-tuple of strings: raw_8,raw_16,raw_32 containing raw data with integer of the given size |
Parameters: |
|
---|---|
Returns: | 1D-ndarray |
Parameters: |
|
---|---|
Returns: | 1D-ndarray |
Parameters: |
|
---|---|
Returns: | 1D-ndarray |
Decompress a chunk of data using the bzip2 algorithm from Python
Decompress a chunk of data using the gzip algorithm from system or from Python
Parameters: | stream – compressed data |
---|---|
Returns: | uncompressed stream |
Modified byte offset decompressor used in Oxford Diffraction images
Note: Always expect little endian data on the disk
Parameters: |
|
---|---|
Returns: | numpy.ndarray |
Modified CCP4 pck decompressor used in MAR345 images
Parameters: |
|
---|
:return : ndarray of 2D with the right size
Modified byte offset decompressor used in Oxford Diffraction images
Note: Always expect little endian data on the disk
Parameters: |
|
---|---|
Returns: | numpy.ndarray |
Decompress a chunk of data using the zlib algorithm from Python
Return the native endianness of the system
returns the md5sum of an object...
Converter module. This is for the moment empty (populated only with almost pass through anonymous functions) but aims to be populated with more sofisticated translators ...
Return data converted to the output format ... over-simplistic implementation for the moment ... :param inp,outp: input/output format like “cbfimage” :param data(ndarray): the actual dataset to be transformed
convert data to integer
return header converted to the output format :param inp,outp: input/output format like “cbfimage” :param header(dict):the actual set of headers to be transformed
Center for Fundamental Research: Metal Structures in Four Dimensions Risoe National Laboratory Frederiksborgvej 399 DK-4000 Roskilde email:erik.knudsen@risoe.dk
and Jon Wright, ESRF
Bases: fabio.datIO.fabiodata
Concrete fabiodata class
Bases: object
A common class for dataIO in fable Contains a 2d numpy array for keeping data, and two lists (clabels and rlabels) containing labels for columns and rows respectively
To be overridden by format specific subclasses
Reads a bytestream
Reads in a bytestream from a file (which may be a string indicating a filename, or an already opened file (should be “rb”)) offset is the position (in bytes) where the pixel data start nbytespp = number of bytes per pixel type can be int or float (4 bytes pp) or double (8 bytes pp) signed: normally signed data ‘y’, but ‘n’ to try to get back the right numbers when unsigned data are converted to signed (python once had no unsigned numeric types.) swap, normally do not bother, but ‘y’ to swap bytes typeout is the numpy type to output, normally uint16, but more if overflows occurred x and y are the pixel dimensions
TODO : Read in regions of interest
PLEASE LEAVE THE STRANGE INTERFACE ALONE - IT IS USEFUL FOR THE BRUKER FORMAT