fabio.marccdimage
index
/usr/lib/python2.5/site-packages/fabio/marccdimage.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:henning.sorensen@risoe.dk
 
         + (mods for fabio) Jon Wright, ESRF
marccdimage can read MarCCD and MarMosaic images including header info.
 
JPW : Use a parser in case of typos (sorry?)

 
Modules
       
struct

 
Classes
       
fabio.tifimage.tifimage(fabio.fabioimage.fabioimage)
marccdimage

 
class marccdimage(fabio.tifimage.tifimage)
    Read in data in mar ccd format, also 
MarMosaic images, including header info
 
 
Method resolution order:
marccdimage
fabio.tifimage.tifimage
fabio.fabioimage.fabioimage

Methods inherited from fabio.tifimage.tifimage:
__init__(self, *args, **kwds)
Tifimage constructor adds an nbits member attribute
read(self, fname)
The fabian read was reading a PIL image
We convert this to a numpy array
write(self, fname)
... at least try ...

Methods inherited from fabio.fabioimage.fabioimage:
add(self, other)
Add another Image - warnign, does not clip to 16 bit images by default
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
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
TODO  - som objects are over-riding this method, why?
update_header(self, **kwds)
update the header entries
by default pass in a dict of key, values.

 
Functions
       
interpret_header(header, fmt, names)
given a format and header interpret it
make_format(c_def_string)
Reads the header definition in c and makes the format 
string to pass to struct.unpack

 
Data
        CDEFINITION = '\ntypedef struct frame_header_type {\n /* ...*128)+1024+512)]; \n\n } frame_header;\n'
C_SIZES = {'INT32': 4, 'UINT16': 2, 'UINT32': 4, 'char': 1}
C_TO_STRUCT = {'INT32': 'i', 'UINT16': 'H', 'UINT32': 'I', 'char': 'c'}
HEADER_FORMAT = 'IccccccccccccccccIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII...ccccccccccccccccccccccccccccccccccccccccccccccccc'
HEADER_NAMES = ['header_type', 'header_name[16]', 'header_name[16]', 'header_name[16]', 'header_name[16]', 'header_name[16]', 'header_name[16]', 'header_name[16]', 'header_name[16]', 'header_name[16]', 'header_name[16]', 'header_name[16]', 'header_name[16]', 'header_name[16]', 'header_name[16]', 'header_name[16]', 'header_name[16]', 'header_major_version', 'header_minor_version', 'header_byte_order', ...]
MAXIMAGES = 9