fabio.edfimage
index
/usr/lib/pymodules/python2.6/fabio/edfimage.py

Authors: 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
 
        + Jon Wright, ESRF

 
Modules
       
logging
numpy

 
Classes
       
fabio.fabioimage.fabioimage
edfimage

 
class edfimage(fabio.fabioimage.fabioimage)
    Read and try to write the ESRF edf data format
 
  Methods defined here:
read(self, fname)
Read in header into self.header and
    the data   into self.data
swap_needed(self)
Decide if we need to byteswap
write(self, fname, force_type=<type 'numpy.uint16'>)
Try to write a file
check we can write zipped also
mimics that fabian was writing uint16 (we sometimes want floats)

Methods inherited from fabio.fabioimage.fabioimage:
__init__(self, data=None, header=None)
Set up initial values
add(self, other)
Add another Image - warnign, does not clip to 16 bit images by default
getframe(self, num)
returns the file numbered 'num' in the series as a fabioimage
getheader(self)
returns self.header
getmax(self)
Find max value in self.data, caching for the future
getmean(self)
return the mean
getmin(self)
Find min value in self.data, caching for the future
getstddev(self)
return the standard deviation
integrate_area(self, coords)
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.
make_slice(self, coords)
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
next(self)
returns the next file in the series as a fabioimage
previous(self)
returns the previous file in the series as a fabioimage
readheader(self, filename)
Call the _readheader function...
rebin(self, x_rebin_fact, y_rebin_fact)
Rebin the data and adjust dims
resetvals(self)
Reset cache - call on changing data
toPIL16(self, filename=None)
Convert to Python Imaging Library 16 bit greyscale image
 
FIXME - this should be handled by the libraries now
update_header(self, **kwds)
update the header entries
by default pass in a dict of key, values.

 
Data
        DATA_TYPES = {'DoubleValue': <type 'float'>, 'FLOAT': <type 'numpy.float32'>, 'Float': <type 'numpy.float32'>, 'FloatValue': <type 'numpy.float32'>, 'SignedByte': <type 'numpy.int8'>, 'SignedInteger': <type 'numpy.int32'>, 'SignedLong': <type 'numpy.int32'>, 'SignedShort': <type 'numpy.int16'>, 'UnsignedByte': <type 'numpy.uint8'>, 'UnsignedInteger': <type 'numpy.uint32'>, ...}
DEFAULT_VALUES = {'ByteOrder': 'LowByteFirst', 'DataType': 'FLOAT', 'HeaderID': 'EH:000001:000000:000000', 'Image': '1'}
MINIMUM_KEYS = ['HeaderID', 'Image', 'ByteOrder', 'DataType', 'Dim_1', 'Dim_2', 'Size']