pyjacket.filetools.image package

Submodules

pyjacket.filetools.image.image module

class pyjacket.filetools.image.image.FileType[source]

Bases: object

read(file_path, **kwargs) ndarray[source]
read_lazy(file_path, **kwargs) ImageHandle[source]
read_meta() Metadata[source]
seq_read(file_path, **kwargs) ndarray[source]
seq_read_lazy(file_path, **kwargs) ImageHandle[source]
write()[source]
write_lazy()[source]
class pyjacket.filetools.image.image.ImageHandle(file_path, unzip=1)[source]

Bases: object

Access image data lazily with numpy-like slicing

close()[source]
copy()[source]
get(i: int) ndarray[source]
get_max_shape()[source]
property ndim
open()[source]
operator: object
property shape

The shape of a cropped variant of this data

slices: list[slice]
class pyjacket.filetools.image.image.Metadata(file_path)[source]

Bases: object

property description
property dtype

Data format, e.g. 8bit or 12bit

exif: dict[int, ExifTag]
exif_value(i: int, default=None)[source]
fractional(tup=None)[source]
get_description()[source]
get_resolution()[source]

Pixels per um

read()[source]
property resolution

Pixels per um

property shape

Size of each dimension (pixels)

property shape_um
pyjacket.filetools.image.image.iter_dir(dirpath: str, ext: str = None, nat=True, exclude: set = None)[source]

Obtain files/folders in the <root>/<rel_path>/<folder>

ext: types of files to return
  • None: yield all file types

  • ‘/’: yield directories only

  • ‘.png’: yield only png.

pyjacket.filetools.image.image.read_img(file_path: str, lazy=False, **kwargs)[source]

Read image data from file.

Parameters:
  • filepath (str) – Location of the image file

  • lazy (bool, optional) – Read lazy to save memory. Defaults to False.

Raises:
  • ValueError – _description_

  • NotImplementedError – _description_

Returns:

pixel data

Return type:

np.ndarray (default) or ImageHandle (if lazy)

pyjacket.filetools.image.image.read_img_meta(file_path: str, **kwargs) Metadata[source]
pyjacket.filetools.image.image.write_img(file_path: str, data: ndarray | ImageHandle, meta: Metadata = None, **kwargs)[source]

Write image data. Supports tif, nd2

pyjacket.filetools.image.models module

class pyjacket.filetools.image.models.ExifTag[source]

Bases: object

name: None
value: None
class pyjacket.filetools.image.models.ImageHandle(file_path, unzip=1)[source]

Bases: object

Access image data lazily with numpy-like slicing

close()[source]
copy()[source]
get(i: int) ndarray[source]
get_max_shape()[source]
property ndim
open()[source]
operator: object
property shape

The shape of a cropped variant of this data

slices: list[slice]
class pyjacket.filetools.image.models.ImageReader[source]

Bases: object

read(file_path: str, **kwargs) ndarray[source]
read_lazy(file_path: str, **kwargs) ImageHandle[source]
read_meta(file_path: str, **kwargs) Metadata[source]
seq_read(file_path: str, **kwargs) ndarray[source]
seq_read_lazy(file_path: str, **kwargs) ImageHandle[source]
write(file_path: str, data: ndarray, meta: Metadata = None, **kwargs)[source]
write_lazy(file_path: str, data: ImageHandle, meta: Metadata = None, **kwargs)[source]
class pyjacket.filetools.image.models.Metadata(file_path)[source]

Bases: object

property description
property dtype

Data format, e.g. 8bit or 12bit

exif: dict[int, ExifTag]
exif_value(i: int, default=None)[source]
fractional(tup=None)[source]
get_description()[source]
get_resolution()[source]

Pixels per um

read()[source]
property resolution

Pixels per um

property shape

Size of each dimension (pixels)

property shape_um
pyjacket.filetools.image.models.slice_length(s: slice, n: int)[source]

Compute how many elements belong to a slice of an iterable of size n

Module contents

class pyjacket.filetools.image.ImageHandle(file_path, unzip=1)[source]

Bases: object

Access image data lazily with numpy-like slicing

close()[source]
copy()[source]
get(i: int) ndarray[source]
get_max_shape()[source]
property ndim
open()[source]
operator: object
property shape

The shape of a cropped variant of this data

slices: list[slice]
class pyjacket.filetools.image.Metadata(file_path)[source]

Bases: object

property description
property dtype

Data format, e.g. 8bit or 12bit

exif: dict[int, ExifTag]
exif_value(i: int, default=None)[source]
fractional(tup=None)[source]
get_description()[source]
get_resolution()[source]

Pixels per um

read()[source]
property resolution

Pixels per um

property shape

Size of each dimension (pixels)

property shape_um
pyjacket.filetools.image.read_img(file_path: str, lazy=False, **kwargs)[source]

Read image data from file.

Parameters:
  • filepath (str) – Location of the image file

  • lazy (bool, optional) – Read lazy to save memory. Defaults to False.

Raises:
  • ValueError – _description_

  • NotImplementedError – _description_

Returns:

pixel data

Return type:

np.ndarray (default) or ImageHandle (if lazy)

pyjacket.filetools.image.read_img_meta(file_path: str, **kwargs) Metadata[source]
pyjacket.filetools.image.write_img(file_path: str, data: ndarray | ImageHandle, meta: Metadata = None, **kwargs)[source]

Write image data. Supports tif, nd2