Skip to content

J2k

linc_convert.utils.io.j2k

Utilities for JPEG2000 files.

WrappedJ2K dataclass

WrappedJ2K(j2k, level=0, channel_first=True)

Array-like wrapper around a JPEG2000 object.

A wrapper around the J2K object at any resolution level, and with virtual transposition of the axes into [C, H, W] order.

The resulting object can be sliced, but each index must be a slice (dropping axes using integer indices or adding axes using None indices is forbidden).

The point is to ensure that the zarr writer only loads chunk-sized data.

Parameters:

Name Type Description Default
j2k Jp2k

The JPEG2000 object.

required
level int

Resolution level to map (highest resolution = 0).

0
channel_first bool

Return an array with shape (C, H, W) instead of (H, W, C) when there is a channel dimension.

True

shape property

shape

Shape of the current level.

dtype property

dtype

Data type of the wrapped image.

__getitem__

__getitem__(index)

Multidimensional slicing of the wrapped array.

get_pixelsize

get_pixelsize(j2k)

Read pixelsize from the JPEG2000 file.