pwem.emlib.image.image_readers module

class pwem.emlib.image.image_readers.EMANImageReader[source]

Bases: ImageReader

Image reader for eman file formats

static getCompatibleExtensions() list[source]

Returns a list of the compatible extensions the reader can handle

static getDimensions(filePath)[source]

Returns the dimensions [X,Y,Z,N] of the file

class pwem.emlib.image.image_readers.ImageReader[source]

Bases: object

static getCompatibleExtensions() list[source]

Returns a list of the compatible extensions the reader can handle

static getDimensions(filePath)[source]

Returns the dimensions [X,Y,Z,N] of the file

class pwem.emlib.image.image_readers.ImageReadersRegistry[source]

Bases: object

Class to register image readers to provide basic information about an image like dimensions or getting an image

classmethod addReader(imageReader: ImageReader)[source]
classmethod getReader(filePath)[source]

Returns the reader or None able to deal with filePath based on the extension.

class pwem.emlib.image.image_readers.MRCImageReader[source]

Bases: ImageReader

Image reader for MRC files

classmethod getArray(filename)[source]
static getCompatibleExtensions() list[source]

Returns a list of the compatible extensions the reader can handle

static getDimensions(filePath)[source]

Returns the dimensions [X,Y,Z,N] of the file

classmethod getMrcImage(fileName)[source]
classmethod open(path: str)[source]
class pwem.emlib.image.image_readers.PILImageReader[source]

Bases: ImageReader

PIL image reader

static getCompatibleExtensions() list[source]

Returns a list of the compatible extensions the reader can handle

static getDimensions(filePath)[source]

Returns the dimensions [X,Y,Z,N] of the file

class pwem.emlib.image.image_readers.STKImageReader(fileName)[source]

Bases: ImageReader

FLOAT32_BYTES = 4
HEADER_OFFSET = 1024
IMG_BYTES = None
TYPE = None
classmethod getArray(filename)[source]
classmethod getCompatibleExtensions() list[source]

Returns a list of the compatible extensions the reader can handle

static getDimensions(filePath)[source]

Returns the dimensions [X,Y,Z,N] of the file

header_info = None
classmethod open(path)[source]
classmethod read(filename, id)[source]
Reads a given image

:param filename (str) –> Image to be read

classmethod readBinary(start, end)[source]
Read bytes between start and end

:param start (int) –> Start byte :param end (int) –> End byte :returns the bytes read

classmethod readHeader()[source]
Reads the header of the current file as a dictionary

:returns The current header as a dictionary

classmethod readImage(iid)[source]
Reads a given image in the stack according to its ID

:param iid (int) –> Image id to be read :returns Image as Numpy array

classmethod readNumpy(start, end)[source]
Read bytes between start and end as a Numpy array

:param start (int) –> Start byte :param end (int) –> End byte :returns decoded bytes as Numpy array

classmethod seek(pos)[source]
Move file pointer to a given position

:param pos (int) –> Byte to move the pointer to

stk_handler = None
class pwem.emlib.image.image_readers.TiffImageReader[source]

Bases: ImageReader

Tiff image reader

static getCompatibleExtensions() list[source]

Returns a list of the compatible extensions the reader can handle

static getDimensions(filePath)[source]

Returns the dimensions [X,Y,Z,N] of the file

classmethod open(path: str)[source]
class pwem.emlib.image.image_readers.XMIPPImageReader[source]

Bases: ImageReader

static getCompatibleExtensions()[source]

Returns a list of the compatible extensions the reader can handle

static getDimensions(filePath)[source]

Returns the dimensions [X,Y,Z,N] of the file