tifffile

TiffFile

class skimage.external.tifffile.TiffFile(arg, name=None, offset=None, size=None, multifile=True, multifile_close=True) [source]

Bases: object

Read image and metadata from TIFF, STK, LSM, and FluoView files.

TiffFile instances must be closed using the close method, which is automatically called when using the ‘with’ statement.

Examples

>>> with TiffFile('test.tif') as tif:  
...     data = tif.asarray()
...     data.shape
(256, 256, 4)

Attributes

pages (list) All TIFF pages in file.
series (list of Records(shape, dtype, axes, TiffPages)) TIFF pages with compatible shapes and types.
micromanager_metadata: dict Extra MicroManager non-TIFF metadata in the file, if exists.
All attributes are read-only.
__init__(arg, name=None, offset=None, size=None, multifile=True, multifile_close=True) [source]

Initialize instance from file.

Parameters:

arg : str or open file

Name of file or open file object. The file objects are closed in TiffFile.close().

name : str

Optional name of file in case ‘arg’ is a file handle.

offset : int

Optional start position of embedded file. By default this is the current file position.

size : int

Optional size of embedded file. By default this is the number of bytes from the ‘offset’ to the end of the file.

multifile : bool

If True (default), series may include pages from multiple files. Currently applies to OME-TIFF only.

multifile_close : bool

If True (default), keep the handles of other files in multifile series closed. This is inefficient when few files refer to many pages. If False, the C runtime may run out of resources.

asarray(key=None, series=None, memmap=False) [source]

Return image data from multiple TIFF pages as numpy array.

By default the first image series is returned.

Parameters:

key : int, slice, or sequence of page indices

Defines which pages to return as array.

series : int

Defines which series of pages to return as array.

memmap : bool

If True, return an array stored in a binary file on disk if possible.

close() [source]

Close open file handle(s).

filehandle

Return file handle.

filename

Return name of file handle.

fstat

Lazy object attribute whose value is computed on first access.

is_bigtiff

Lazy object attribute whose value is computed on first access.

is_fluoview

Lazy object attribute whose value is computed on first access.

is_imagej

Lazy object attribute whose value is computed on first access.

is_lsm

Lazy object attribute whose value is computed on first access.

is_mdgel

Lazy object attribute whose value is computed on first access.

is_mediacy

Lazy object attribute whose value is computed on first access.

is_micromanager

Lazy object attribute whose value is computed on first access.

is_nih

Lazy object attribute whose value is computed on first access.

is_ome

Lazy object attribute whose value is computed on first access.

is_palette

Lazy object attribute whose value is computed on first access.

is_rgb

Lazy object attribute whose value is computed on first access.

is_stk

Lazy object attribute whose value is computed on first access.

series

Lazy object attribute whose value is computed on first access.

doc_scikit_image
2017-01-12 17:23:49
Comments
Leave a Comment

Please login to continue.