fsl.data.bitmap

This module contains the Bitmap class, for loading bitmap image files. Pillow is required to use the Bitmap class.

fsl.data.bitmap.BITMAP_EXTENSIONS = ['.bmp', '.png', '.jpg', '.jpeg', '.tif', '.tiff', '.gif', '.rgba', '.jp2', '.jpg2', '.jp2k']

File extensions we understand.

fsl.data.bitmap.BITMAP_DESCRIPTIONS = ['Bitmap', 'Portable Network Graphics', 'JPEG', 'JPEG', 'TIFF', 'TIFF', 'Graphics Interchange Format', 'Raw RGBA', 'JPEG 2000', 'JPEG 2000', 'JPEG 2000']

A description for each BITMAP_EXTENSION.

class fsl.data.bitmap.Bitmap(bmp)[source]

Bases: object

The Bitmap class can be used to load a bitmap image. The asImage() method will convert the bitmap into an Image instance.

__init__(bmp)[source]

Create a Bitmap.

Parameters:

bmp – File name of an image, or a numpy array containing image data.

__hash__()[source]

Returns a number which uniquely idenfities this Bitmap instance (the result of id(self)).

__str__()[source]

Return a string representation of this Bitmap instance.

__repr__()[source]

See the __str__() method.

property name

Returns the name of this Bitmap, typically the base name of the file.

property dataSource

Returns the bitmap data source - typically the file name.

property data

Convenience method which returns the bitmap data as a (w, h, c) array, where c is either 3 or 4.

__dict__ = mappingproxy({'__module__': 'fsl.data.bitmap', '__doc__': 'The ``Bitmap`` class can be used to load a bitmap image. The\n    :meth:`asImage` method will convert the bitmap into an :class:`.Image`\n    instance.\n    ', '__init__': <function Bitmap.__init__>, '__hash__': <function Bitmap.__hash__>, '__str__': <function Bitmap.__str__>, '__repr__': <function Bitmap.__repr__>, 'name': <property object>, 'dataSource': <property object>, 'data': <property object>, 'shape': <property object>, 'asImage': <function Bitmap.asImage>, '__dict__': <attribute '__dict__' of 'Bitmap' objects>, '__weakref__': <attribute '__weakref__' of 'Bitmap' objects>, '__annotations__': {}})
__module__ = 'fsl.data.bitmap'
__weakref__

list of weak references to the object (if defined)

property shape

Returns the bitmap shape - (width, height, nchannels).

asImage()[source]

Convert this Bitmap into an Image instance.