Generic Image file reader
This module determines which image-specific module is required to
read a specific image file, based on the file extension. All
image reading operations from user programs should go through
this module; that makes it possible to read any file format supported
by the collect package.
The selection of the module is performed by a dictionary called
exttab: linking each possible extension to a module. This is the
only thing that needs to be extended to support new image modules.
An image module should have:
- Reader
a class that can be used to read images. It's constructor
should take an ImageSink as argument. It should have a
Read() method taking a filename as argument.
- header
reference to another module to handle the headers of the
image type. The header module should contain a Read()
function returning an ImagerHeader()
To be able to write images of the type, the image module should
also have:
- FileSink
an ImageSink that writes the file based on incoming
ImageSink events. This should be a subclass of the
imagesink.FileDump class.
and the header module should have:
- Build
Or any other way to turn any header info into the right
format to write it to disk, and the Header class needs a
__repr__ method returning this as a string. This can be used
by the FileSink.
- Default
Return a default header (optional, only currently used for
KCD files.
|
Functions
|
|
ReadHeader fastoradsc module
|
|
|
ReadHeader
|
ReadHeader ( fn )
Read the image header from the image file fn.
Return an instance of the corresponding Header() class. |
|
|
fastoradsc
|
fastoradsc ( filename )
|
|
|
module
|
module ( filenamin )
Return the module that should be used for handling the named image.
This routine is used internally by the ImageReader and -Writer
classes.
|
Exceptions
|
|
KeyError( "Can not handle images of this type: %s" % filename )
|
|
|
Classes
|
|
|
|