pwem.emlib.image.image_readers module
- class pwem.emlib.image.image_readers.EMANImageReader[source]
Bases:
ImageReader
Image reader for eman file formats
- 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 write(images: ImageStack, fileName: str, isStack: bool) None [source]
Generate a stack of images or a volume from a list of PIL images. :param images: An ImageStack instance with one or more images :param fileName: Path of the new stack :param isStack: Specifies whether to generate a volume or an image stack
- 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) ImageReader [source]
Returns the reader or None able to deal with filePath based on the extension.
- classmethod write(imgStack: ImageStack, fileName: str, isStack=False) None [source]
Generate a stack of images from a list of PIL images.
- class pwem.emlib.image.image_readers.ImageStack(images=None, properties=None)[source]
Bases:
object
Class to hold image stacks. A single image is considered a stack of one image
- Parameters
images – either None, an image as returned by the readers or a list of them. Images are numpy arrays
properties – optional: dictionary of key value pairs for header information for those files tha may need it
- class pwem.emlib.image.image_readers.MRCImageReader[source]
Bases:
ImageReader
Image reader for MRC files
- static getCompatibleExtensions() list [source]
Returns a list of the compatible extensions the reader can handle
- classmethod write(imageStack: ImageStack, fileName: str, isStack=False) None [source]
Generate a stack of images or a volume from a list of PIL images.
- 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
- classmethod write(imgStack: ImageStack, fileName: str, isStack=False) None [source]
Generate a stack of images or a volume from a list of PIL images. :param images: An ImageStack instance with one or more images :param fileName: Path of the new stack :param isStack: Specifies whether to generate a volume or an image stack
- class pwem.emlib.image.image_readers.STKImageReader(fileName)[source]
Bases:
ImageReader
- FLOAT32_BYTES = 4
- HEADER_OFFSET = 1024
- IMG_BYTES = None
- TYPE = None
- classmethod getCompatibleExtensions() list [source]
Returns a list of the compatible extensions the reader can handle
- header_info = None
- 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
- classmethod write(imgStack: ImageStack, fileName: str, isStack=False) None [source]
Generate a stack of images or a volume from a list of PIL images. :param images: An ImageStack instance with one or more images :param fileName: Path of the new stack :param isStack: Specifies whether to generate a volume or an image stack