impy.utils package

Submodules

impy.utils.axesop module

impy.utils.axesop.add_axes(axes, shape, key, key_axes='yx')[source]

Stack key to make its shape key_axes-> axes.

impy.utils.axesop.axes_included(img: AxesMixin, label: AxesMixin)[source]

e.g.) img.axes = “tyx”, label.axes = “yx” -> True img.axes = “tcyx”, label.axes = “zyx” -> False

impy.utils.axesop.complement_axes(axes, all_axes='ptzcyx')[source]
impy.utils.axesop.del_axis(axes, axis) str[source]

axes: str or Axes object. axis: int. delete axis from axes.

impy.utils.axesop.find_first_appeared(axes, include='', exclude='')[source]
impy.utils.axesop.switch_slice(axes, all_axes, ifin=None, ifnot=':')[source]

impy.utils.deco module

impy.utils.deco.check_input_and_output(func=None, *, inherit_label_info=False, only_binary=False, need_labels=False)[source]
impy.utils.deco.check_input_and_output_lazy(func=None, *, only_binary=False)[source]
impy.utils.deco.dims_to_spatial_axes(func)[source]

Decorator to convert input dims to correct spatial axes. Compatible with ImgArray and LazyImgArray e.g.) dims=None (default) -> “yx” or “zyx” depend on the input image dims=2 -> “yx” dims=3 -> “zyx” dims=”ty” -> “ty”

impy.utils.deco.same_dtype(func=None, asfloat: bool = False)[source]

Decorator to assure output image has the same dtype as the input image. This decorator is compatible with both ImgArray and LazyImgArray.

Parameters

asfloat (bool, optional) – If input image should be converted to float first, by default False

impy.utils.gauss module

class impy.utils.gauss.DiagonalGaussian(params=None)[source]

Bases: impy.utils.gauss.Gaussian

fit(data: numpy.ndarray, method: str = 'Powell')[source]
generate(shape: tuple) numpy.ndarray[source]
property mu
property ndim
property params
rescale(scale: float)[source]
property sg
shift(dxdy)[source]
class impy.utils.gauss.Gaussian[source]

Bases: object

mu_inrange(low, high)[source]
sg_inrange(low, high)[source]
class impy.utils.gauss.GaussianBackground(params=None)[source]

Bases: impy.utils.gauss.DiagonalGaussian

class impy.utils.gauss.GaussianParticle(params=None, initial_sg=1)[source]

Bases: impy.utils.gauss.DiagonalGaussian

impy.utils.gauss.diagonal_gaussian(r, *params)[source]
impy.utils.gauss.square(params, func, r, z)[source]

calculate ||z - func(x, y, *params)||^2 where x and y are determine by z.shape

impy.utils.io module

impy.utils.misc module

impy.utils.misc.check_nd(x: impy.utils.misc.T, ndim: int) Sequence[impy.utils.misc.T][source]
impy.utils.misc.largest_zeros(shape) numpy.ndarray[source]

impy.utils.slicer module

impy.utils.slicer.axis_targeted_slicing(ndim: int, axes: str, string: str) Tuple[Union[slice, int], ...][source]

Make a conventional slices from an axis-targeted slicing string.

Parameters
  • ndim (int) – Number of dimension of the array which will be sliced.

  • axes (str) – Axes of input ndarray.

  • string (str) – Axis-targeted slicing string. If an axis that does not exist in axes is contained, this function will raise ValueError.

Returns

Return type

slices

impy.utils.slicer.key_repr(key)[source]
impy.utils.slicer.str_to_slice(v: str) list[int] | slice | int[source]

impy.utils.utilcls module

class impy.utils.utilcls.ImportOnRequest(name: str)[source]

Bases: object

Module contents