SPIEPy Image Structure¶
All SPIEPy functions can accept and output both 2D NumPy arrays
<type 'numpy.ndarray'>
and SPIEPy Image Structures <class 'spiepy.Im'>
(Im
). The SPIEPy Image Structure is specially made for your
convenience. It can contain, in addition to the 2D array of data, the metadata
of the image. The metadata will not be used in any of the SPIEPy functions. The
attribute data
of the structure is mandatory and contains the 2D array
of image data.
Creating a SPIEPy Image Structure Object¶
Creating a new SPIEPy Image Structure Object im:
>>> im = spiepy.Im()
Creating a SPIEPy Image Structure Object from an existing image structure im
which contains the mandatory attribute data
:
>>> im.__class__ = spiepy.Im
SPIEPy Image Structure Object Attributes¶
Listing, adding, reading, writing and deleting attributes of object im:
>>> dir(im)
['__class__', '__delattr__', '__dict__', '__doc__', '__format__', '__getattribute__', '__hash__', '__init__', '__module__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', 'copy', 'data']
>>> im.x_offset = 0.0
>>> im.x_offset
0.0
>>> im.x_offset = 1.0
>>> del im.x_offset