ndstructs package¶
Subpackages¶
Submodules¶
ndstructs.array5D module¶
-
class
ndstructs.array5D.Array5D(arr: numpy.ndarray, axiskeys: str, location: ndstructs.point5D.Point5D = Point5D(t:0.0, c:0.0, x:0.0, y:0.0, z:0.0))¶ Bases:
ndstructs.utils.JsonSerializable.JsonSerializableA wrapper around np.ndarray with labeled axes. Enforces 5D, even if some dimensions are of size 1. Sliceable with Slice5D’s
-
DISPLAY_IMAGE_PREFIX= '/tmp/junk_test_image_'¶
-
classmethod
allocate(slc: ndstructs.point5D.Slice5D, dtype, axiskeys: str = 'txyzc', value: int = None)¶
-
as_mask() → ndstructs.array5D.Array5D¶
-
as_pil_images()¶
-
as_uint8(normalized=True)¶
-
property
axiskeys¶
-
channel_stacks(step)¶
-
channels() → Iterator[ndstructs.array5D.Array5D]¶
-
clamped(roi: ndstructs.point5D.Slice5D) → ndstructs.array5D.Array5D¶
-
cut(roi: ndstructs.point5D.Slice5D, *, copy: bool = False) → ndstructs.array5D.Array5D¶
-
property
dtype¶
-
frames() → Iterator[ndstructs.array5D.Array5D]¶
-
classmethod
fromArray5D(array: ndstructs.array5D.Array5D)¶
-
classmethod
from_file(filelike, location: ndstructs.point5D.Point5D = Point5D(t:0.0, c:0.0, x:0.0, y:0.0, z:0.0))¶
-
classmethod
from_json_data(data: dict)¶
-
images(through_axis='z') → Iterator[ndstructs.array5D.Image]¶
-
iter_over(axis: str, step: int = 1) → Iterator[ndstructs.array5D.Array5D]¶
-
property
json_data¶
-
linear_raw()¶ Returns a raw view with one spatial dimension and one channel dimension
-
local_cut(roi: ndstructs.point5D.Slice5D, *, copy: bool = False) → ndstructs.array5D.Array5D¶
-
normalized(iteration_axes: str = 'tzc') → ndstructs.array5D.Array5D¶
-
planes(key='z') → Iterator[ndstructs.array5D.Array5D]¶
-
raw(axiskeys: str) → numpy.ndarray¶ Returns a raw view of the underlying np.ndarray, containing only the axes identified by and ordered like ‘axiskeys’
-
property
rawshape¶
-
rebuild(arr: numpy.array, axiskeys: str, location: ndstructs.point5D.Point5D = None) → ndstructs.array5D.Array5D¶
-
reordered(axiskeys: str)¶
-
property
roi¶
-
sample_channels(mask: ndstructs.array5D.ScalarData) → ndstructs.array5D.LinearData¶ Extracts a ‘list’ of columnsi from self, one column for every True-valued element from the mask. Each element of a column represents the value in one of the channels of self. The expected raw shape of the output is therefore (N, c) where N is the number of True-valued elements in ‘mask’, and c is the number of channels in self.
-
set(value: ndstructs.array5D.Array5D, autocrop: bool = False)¶
-
setflags(*, write: bool)¶
-
property
shape¶
-
show_channels()¶
-
show_images()¶
-
property
squeezed_shape¶
-
to_slice_5d()¶
-
-
class
ndstructs.array5D.FlatData(*args, **kwargs)¶ Bases:
ndstructs.array5D.Array5DAn Array5D with less than 3 spacial dimensions having a size > 1
-
property
squeezed_shape¶
-
property
-
class
ndstructs.array5D.Image(*args, **kwargs)¶ Bases:
ndstructs.array5D.StaticData,ndstructs.array5D.FlatDataAn Array5D representing a 2D image
-
as_pil_image()¶
-
channels() → Iterator[ndstructs.array5D.ScalarImage]¶
-
-
class
ndstructs.array5D.LinearData(*args, **kwargs)¶ Bases:
ndstructs.array5D.Array5DAn Array5D with at most 1 spacial dimension having size > 1
-
property
length¶
-
property
squeezed_shape¶
-
property
-
class
ndstructs.array5D.RawShape(shape: ndstructs.point5D.Shape5D, *, t: int = None, c: int = None, x: int = None, y: int = None, z: int = None)¶ Bases:
object-
property
axiskeys¶
-
drop(axis: str) → ndstructs.array5D.RawShape¶
-
drop_one_spatial()¶
-
index(axis: str)¶
-
property
spatials¶
-
swapped(source: str, destination: str)¶
-
to_index_discard_tuple()¶
-
to_index_tuple()¶
-
to_linear()¶
-
to_n_spacials(n: int)¶
-
to_planar()¶
-
to_scalar()¶
-
to_shape_dict()¶
-
to_shape_tuple(*, with_t=None, with_c=None, with_x=None, with_y=None, with_z=None)¶
-
to_static()¶
-
property
-
class
ndstructs.array5D.ScalarData(*args, **kwargs)¶ Bases:
ndstructs.array5D.Array5DAn Array5D with a single channel
-
property
squeezed_shape¶
-
property
-
class
ndstructs.array5D.ScalarImage(*args, **kwargs)¶ Bases:
ndstructs.array5D.Image,ndstructs.array5D.ScalarData
-
class
ndstructs.array5D.ScalarLine(*args, **kwargs)¶ Bases:
ndstructs.array5D.LinearData,ndstructs.array5D.ScalarData
-
class
ndstructs.array5D.StaticData(*args, **kwargs)¶ Bases:
ndstructs.array5D.Array5DAn Array5D with a single time frame
-
property
squeezed_shape¶
-
property
-
class
ndstructs.array5D.StaticLine(*args, **kwargs)¶ Bases:
ndstructs.array5D.StaticData,ndstructs.array5D.LinearData-
DEFAULT_AXES= 'xc'¶
-
concatenate(*others) → ndstructs.array5D.LinearData¶
-
ndstructs.point5D module¶
-
class
ndstructs.point5D.Point5D(*, t: float = 0, x: float = 0, y: float = 0, z: float = 0, c: float = 0)¶ Bases:
ndstructs.utils.JsonSerializable.JsonSerializable-
DTYPE¶ alias of
numpy.float64
-
INF= inf¶
-
LABELS= 'txyzc'¶
-
LABEL_MAP= {'c': 4, 't': 0, 'x': 1, 'y': 2, 'z': 3}¶
-
NINF= -inf¶
-
SPATIAL_LABELS= 'xyz'¶
-
classmethod
as_ceil(arr: numpy.ndarray, axis_order: str = 'txyzc')¶
-
as_shape() → ndstructs.point5D.Shape5D¶
-
property
c¶
-
clamped(minimum: Optional[ndstructs.point5D.Point5D] = None, maximum: Optional[ndstructs.point5D.Point5D] = None)¶
-
classmethod
from_np(arr: numpy.ndarray, labels: str)¶
-
classmethod
from_tuple(tup: Tuple[float, float, float, float, float], labels: str)¶
-
classmethod
inf(*, t: float = None, x: float = None, y: float = None, z: float = None, c: float = None)¶
-
classmethod
ninf(*, t: float = None, x: float = None, y: float = None, z: float = None, c: float = None)¶
-
classmethod
one(*, t: float = 1, x: float = 1, y: float = 1, z: float = 1, c: float = 1)¶
-
property
t¶
-
to_dict()¶
-
to_np(axis_order: str = 'txyzc')¶
-
to_np_int(axis_order: str)¶
-
to_tuple(axis_order: str)¶
-
with_coord(*, t=None, c=None, x=None, y=None, z=None)¶
-
property
x¶
-
property
y¶
-
property
z¶
-
classmethod
zero(*, t: float = 0, x: float = 0, y: float = 0, z: float = 0, c: float = 0)¶
-
-
class
ndstructs.point5D.Shape5D(*, t: int = 1, x: int = 1, y: int = 1, z: int = 1, c: int = 1)¶ Bases:
ndstructs.point5D.Point5D-
DTYPE¶ alias of
numpy.uint64
-
classmethod
from_point(point: ndstructs.point5D.Point5D)¶
-
property
is_flat¶
-
property
is_line¶
-
property
is_scalar¶
-
property
is_static¶
-
property
missing_spatial_axes¶
-
property
present_spatial_axes¶
-
property
spatial_axes¶
-
to_slice_5d(offset: ndstructs.point5D.Point5D = Point5D(t:0.0, c:0.0, x:0.0, y:0.0, z:0.0)) → ndstructs.point5D.Slice5D¶
-
to_tuple(axis_order: str)¶
-
property
volume¶
-
-
class
ndstructs.point5D.Slice5D(*, t=slice(None, None, None), c=slice(None, None, None), x=slice(None, None, None), y=slice(None, None, None), z=slice(None, None, None))¶ Bases:
ndstructs.utils.JsonSerializable.JsonSerializableA labeled 5D slice
-
DTYPE¶ alias of
numpy.int64
-
static
all() → ndstructs.point5D.Slice5D¶
-
property
c¶
-
channel_stacks(step) → Iterator[ndstructs.point5D.Slice5D]¶
-
channels() → Iterator[ndstructs.point5D.Slice5D]¶
-
clamped(slc: ndstructs.point5D.Slice5D)¶
-
contains(other: ndstructs.point5D.Slice5D)¶
-
classmethod
create_from_start_stop(start: ndstructs.point5D.Point5D, stop: ndstructs.point5D.Point5D)¶
-
defined_with(shape: ndstructs.point5D.Shape5D) → ndstructs.point5D.Slice5D¶ Slice5D can have slices which are open to interpretation, like slice(None). This method forces those slices expand into their interpretation within an array of shape ‘shape’
-
enlarged(radius: ndstructs.point5D.Point5D)¶
-
classmethod
ensure_slice(value)¶
-
frames() → Iterator[ndstructs.point5D.Slice5D]¶
-
classmethod
from_json_data(data: dict)¶
-
from_start_stop(start: ndstructs.point5D.Point5D, stop: ndstructs.point5D.Point5D)¶
-
get_tiles(tile_shape: ndstructs.point5D.Shape5D) → Iterator[ndstructs.point5D.Slice5D]¶
-
images(through_axis='z') → Iterator[ndstructs.point5D.Slice5D]¶
-
is_defined() → bool¶
-
iter_over(axis: str, step: int = 1) → Iterator[ndstructs.point5D.Slice5D]¶
-
property
json_data¶
-
classmethod
make_slices(start: ndstructs.point5D.Point5D, stop: ndstructs.point5D.Point5D)¶
-
planes(key='z') → Iterator[ndstructs.point5D.Slice5D]¶
-
rebuild(*, t=slice(None, None, None), c=slice(None, None, None), x=slice(None, None, None), y=slice(None, None, None), z=slice(None, None, None))¶
-
property
shape¶
-
split(block_shape: ndstructs.point5D.Shape5D) → Iterator[ndstructs.point5D.Slice5D]¶
-
property
t¶
-
to_dict()¶
-
to_slices(axis_order: str = 'txyzc')¶
-
to_tuple(axis_order: str)¶
-
translated(offset: ndstructs.point5D.Point5D)¶
-
with_coord(*, t=None, c=None, x=None, y=None, z=None)¶
-
with_full_c() → ndstructs.point5D.Shape5D¶
-
property
x¶
-
property
y¶
-
property
z¶
-
classmethod
zero(*, t=0, c=0, x=0, y=0, z=0)¶
-