Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
result[~mask] = no_parent
else:
result[~mask] = no_parent[~mask]
if np.any(mask):
result[mask] = self.backing_store[
idx.fwd_idx[parent_image_indexes[my_slice][mask]] +
parent_object_indexes[my_slice][mask]]
return result
def get_ancestor(self, index):
return self.backing_store[ancestral_index[slyce(index)]]
#
# Recalculate the trajectories
#
x = wrapped(M_LOCATION_CENTER_X)
y = wrapped(M_LOCATION_CENTER_Y)
trajectory_x = wrapped(self.measurement_name(F_TRAJECTORY_X))
trajectory_y = wrapped(self.measurement_name(F_TRAJECTORY_Y))
integrated = wrapped(self.measurement_name(F_INTEGRATED_DISTANCE))
dists = wrapped(self.measurement_name(F_DISTANCE_TRAVELED))
displ = wrapped(self.measurement_name(F_DISPLACEMENT))
linearity = wrapped(self.measurement_name(F_LINEARITY))
lifetimes = wrapped(self.measurement_name(F_LIFETIME))
label = wrapped(self.measurement_name(F_LABEL))
final_age = wrapped(self.measurement_name(F_FINAL_AGE))
age = {} # Dictionary of per-label ages
if self.wants_lifetime_filtering.value:
minimum_lifetime = self.min_lifetime.value if self.wants_minimum_lifetime.value else -np.Inf
maximum_lifetime = self.max_lifetime.value if self.wants_maximum_lifetime.value else np.Inf
para1 = self.max_gap_score.value #max upper-left
para2 = self.max_merge_score.value #max upper-middle
para3 = gap_termination_cost #value for upper-right
para4 = self.max_split_score.value #max for middle-left
para5 = split_termination_cost #value for middle-right
para6 = gap_initiation_cost #value for lower-left
para7 = merge_initiation_cost #value for lower-middle
para8 = self.max_frame_distance.value #max frame difference
image_numbers = self.get_image_numbers(workspace)
m = workspace.measurements
label = m.get_all_measurements(self.object_name.value,
self.measurement_name(F_LABEL))
orig_label = label
a = m.get_all_measurements(self.object_name.value, M_LOCATION_CENTER_X)
b = m.get_all_measurements(self.object_name.value, M_LOCATION_CENTER_Y)
Area = m.get_all_measurements(self.object_name.value,
self.measurement_name(F_AREA))
#
# Reduce the lists to only the ones in the group
#
for mlist in (label, a, b, Area):
mlist = [mlist[image_number] for image_number in image_numbers]
numFrames = len(b)
#Calculates the maximum number of cells in a single frame
i = 0
mlength = 0
while i
max_merge_score = self.max_merge_score.value
max_split_score = self.max_split_score.value / 2 # to match legacy
max_frame_difference = self.max_frame_distance.value
m = workspace.measurements
assert(isinstance(m, cpmeas.Measurements))
image_numbers = self.get_group_image_numbers(workspace)
object_name = self.object_name.value
label, object_numbers, a, b, Area, \
parent_object_numbers, parent_image_numbers = [
[m.get_measurement(object_name, feature, i).astype(mtype)
for i in image_numbers]
for feature, mtype in (
(self.measurement_name(F_LABEL), int),
(cpmeas.OBJECT_NUMBER, int),
(M_LOCATION_CENTER_X, float),
(M_LOCATION_CENTER_Y, float),
(self.measurement_name(F_AREA), float),
(self.measurement_name(F_PARENT_OBJECT_NUMBER), int),
(self.measurement_name(F_PARENT_IMAGE_NUMBER), int)
)]
group_indices, new_object_count, lost_object_count, merge_count, \
split_count = [
np.array([m.get_measurement(cpmeas.IMAGE, feature, i)
for i in image_numbers], int)
for feature in (cpmeas.GROUP_INDEX,
self.image_measurement_name(F_NEW_OBJECT_COUNT),
self.image_measurement_name(F_LOST_OBJECT_COUNT),
self.image_measurement_name(F_MERGE_COUNT),
self.image_measurement_name(F_SPLIT_COUNT))]
#
# Map image number to group index and vice versa