Package qubx :: Module tifffile :: Class TiffFile
[hide private]
[frames] | no frames]

Class TiffFile

source code

object --+
         |
        TiffFile

Read image and meta-data 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.

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.

Examples

>>> tif = TiffFile('test.tif')
... try:
...     images = tif.asarray()
... except Exception as e:
...     print(e)
... finally:
...     tif.close()
Instance Methods [hide private]
 
__init__(self, arg, name=None, multifile=False)
Initialize instance from file.
source code
 
close(self)
Close open file handle(s).
source code
 
_fromfile(self)
Read TIFF header and all page records from file.
source code
 
series(self)
Lazy object attribute whose value is computed on first access.
source code
 
asarray(self, key=None, series=None, memmap=False)
Return image data of multiple TIFF pages as numpy array.
source code
 
_omeseries(self)
Return image series in OME-TIFF file(s).
source code
 
__len__(self)
Return number of image pages in file.
source code
 
__getitem__(self, key)
Return specified page.
source code
 
__iter__(self)
Return iterator over pages.
source code
 
__str__(self)
Return string containing information about file.
source code
 
__enter__(self) source code
 
__exit__(self, exc_type, exc_value, traceback) source code
 
fstat(self)
Lazy object attribute whose value is computed on first access.
source code
 
is_bigtiff(self)
Lazy object attribute whose value is computed on first access.
source code
 
is_rgb(self)
Lazy object attribute whose value is computed on first access.
source code
 
is_palette(self)
Lazy object attribute whose value is computed on first access.
source code
 
is_mdgel(self)
Lazy object attribute whose value is computed on first access.
source code
 
is_mediacy(self)
Lazy object attribute whose value is computed on first access.
source code
 
is_stk(self)
Lazy object attribute whose value is computed on first access.
source code
 
is_lsm(self)
Lazy object attribute whose value is computed on first access.
source code
 
is_imagej(self)
Lazy object attribute whose value is computed on first access.
source code
 
is_micromanager(self)
Lazy object attribute whose value is computed on first access.
source code
 
is_nih(self)
Lazy object attribute whose value is computed on first access.
source code
 
is_fluoview(self)
Lazy object attribute whose value is computed on first access.
source code
 
is_ome(self)
Lazy object attribute whose value is computed on first access.
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __subclasshook__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, arg, name=None, multifile=False)
(Constructor)

source code 

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
Human readable label of open file.
multifile : bool
If True, series may include pages from multiple files.
Overrides: object.__init__

series(self)

source code 
Lazy object attribute whose value is computed on first access.
Decorators:
  • @lazyattr

asarray(self, key=None, series=None, memmap=False)

source code 

Return image data of 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, use numpy.memmap to read arrays from file if possible.

__str__(self)
(Informal representation operator)

source code 
Return string containing information about file.
Overrides: object.__str__

fstat(self)

source code 
Lazy object attribute whose value is computed on first access.
Decorators:
  • @lazyattr

is_bigtiff(self)

source code 
Lazy object attribute whose value is computed on first access.
Decorators:
  • @lazyattr

is_rgb(self)

source code 
Lazy object attribute whose value is computed on first access.
Decorators:
  • @lazyattr

is_palette(self)

source code 
Lazy object attribute whose value is computed on first access.
Decorators:
  • @lazyattr

is_mdgel(self)

source code 
Lazy object attribute whose value is computed on first access.
Decorators:
  • @lazyattr

is_mediacy(self)

source code 
Lazy object attribute whose value is computed on first access.
Decorators:
  • @lazyattr

is_stk(self)

source code 
Lazy object attribute whose value is computed on first access.
Decorators:
  • @lazyattr

is_lsm(self)

source code 
Lazy object attribute whose value is computed on first access.
Decorators:
  • @lazyattr

is_imagej(self)

source code 
Lazy object attribute whose value is computed on first access.
Decorators:
  • @lazyattr

is_micromanager(self)

source code 
Lazy object attribute whose value is computed on first access.
Decorators:
  • @lazyattr

is_nih(self)

source code 
Lazy object attribute whose value is computed on first access.
Decorators:
  • @lazyattr

is_fluoview(self)

source code 
Lazy object attribute whose value is computed on first access.
Decorators:
  • @lazyattr

is_ome(self)

source code 
Lazy object attribute whose value is computed on first access.
Decorators:
  • @lazyattr