organoid_tracker.core.resolution module

class organoid_tracker.core.resolution.ImageResolution(pixel_size_x_um: float, pixel_size_y_um: float, pixel_size_z_um: float, time_point_interval_m: float)

Bases: object

Represents the resolution of a 3D image. X and y resolution must be equal. The fields in this class should be treated as immutable: don’t modify their values after creation.

PIXELS: ImageResolution = ImageResolution(1, 1, 1, 1)
is_incomplete(*, require_time_resolution: bool = True, require_z: bool = True) bool

Returns True if the x, y, z and/or t resolution is zero. Otherwise it returns False.

property pixel_size_x_um: float
property pixel_size_y_um: float
property pixel_size_z_um: float
pixel_size_zyx_um: Tuple[float, float, float]
property time_point_interval_h: float
time_point_interval_m: float
class organoid_tracker.core.resolution.ImageTimings(min_time_point_number: int, cumulative_timings_m: ndarray)

Bases: object

For working with experiments where the timing between time points is variable. (Although a constant timing is also supported).

If you request timing information for a time point before the available range, then the time interval between the first and second time point is used. If you request timing information for a time point after the available range, then the timing between the last two time points is used.

You need to specify the timing for at least two subsequent time points, of which the first is set at time 0.

The object is immutable, and it’s best to keep it that way. The Images class hands out a fresh timings instance based on the current value of ImageResolution.time_point_interval_m if no explicit timings are available. This would not be possible if the class were mutable, as then any changes would be expected to be stored in the experiment.

static contant_timing(time_resolution_m: float) ImageTimings

For dealing with a constant time resolution.

copy() ImageTimings

Returns a copy of the current object. Changes to the copy won’t write through to this object.

get_cumulative_timings_array_m() ndarray

Gets a copy of the cumulative timings array. Pay attention to the fact that position 0 in the array corresponds to self.min_time_point_number(), and not necessarily to 0.

Normally, you don’t need this method, it’s mostly for serialization purposes.

get_time_h_since_start(time_point: Union[int, TimePoint]) float

Gets the amount of time (in hours) elapsed since the start of the experiment.

get_time_m_since_previous(time_point: Union[int, TimePoint]) float

Gets the amount of time (in minutes) elapsed since the previous time point.

get_time_m_since_start(time_point: Union[int, TimePoint]) float

Gets the amount of time (in minutes) elapsed since the start of the experiment.

is_simple_multiplication() bool

Checks if the timings object is just calculating time_point * dt, or whether more complex timings are stored.

limit_to_time(min_time_point_number: int, max_time_point_number: int) Optional[ImageTimings]

Returns a new instance with all timing information for time points outside the given range deleted.

max_time_point_number() int

Gets the highest time point number for which we have the timings.

min_time_point_number() int

Gets the lowest time point number for which we have the timings. The time will always be zero at this point.

move_in_time(time_point_delta: int)

Moves the timings the given amount of time points in time. So if delta is 2, then the reported timings of time point 2 will now be what the reported timings of time point 0 were.