Commit 4ea02367 authored by Félix Hartmann's avatar Félix Hartmann
Browse files

Cleaning.

parent df97c8e6
......@@ -1067,8 +1067,8 @@ def launch_process():
# Doit on faire un pre-processing pour estimer la taille max (en faisant la détection sur la dernière image)
if Nimgs > 5:
print('Pre-processing last image (to get maximum plant size)')
#Preprocessing to guess the max size of the objects and set crop zone for each of them
# Preprocessing to guess the max size of the objects and set the crop zone for each of them
# print('Pre-processing last image (to get maximum plant size)')
pre_data = {}
pre_data = ProcessImages(file_names=hdf5file,
......@@ -1082,7 +1082,7 @@ def launch_process():
tiges_x = traite_tiges2(pre_data[0]['tiges_data'], pas=detection_step)[0]
max_array_size = tiges_x.shape[2] + 100
print("Maximum size for iterations: %i" % max_array_size)
# print("Maximum size for iterations: %i" % max_array_size)
else:
max_array_size = 10000
......@@ -3414,7 +3414,7 @@ def detection_step_setting():
skeleton detection.
"""
window_detection_step = Tk.Toplevel(master=root)
window_detection_step.title(_("Skeleton detection step"))
window_detection_step.title(_("Stepsize for skeleton detection"))
step_frame = Frame(window_detection_step)
......@@ -3827,7 +3827,7 @@ class Interekt:
# Set the space step for skeleton detection process
self.detection_step = Tk.DoubleVar()
options_menu.add_command(label=_("Step for skeleton detection"),
options_menu.add_command(label=_("Stepsize for skeleton detection"),
command=detection_step_setting)
# If we want to select an image as steady state
......@@ -4470,8 +4470,8 @@ class Interekt:
except Exception as e:
print(u'Erreur de mise à jour des données pour la tige %s en position %i du gui'%(tiges_names[ti], ti))
print(e)
else:
print("Aucune tige n'a de données")
# else:
# print("No organ has data")
if keep_zoom:
......
......@@ -335,7 +335,6 @@ def get_number_of_tiges(hdf5file):
N = len([i.startswith('tige') for i in f['/data'].keys()])
else:
N = 0
print("Pas de tiges dans le fichier hdf5")
return N
......@@ -356,7 +355,6 @@ def get_tiges_indices(hdf5file):
outid += [int(dataname.replace('tige', ''))]
else:
outid = []
print("Pas de tiges dans le fichier hdf5")
return outid
......@@ -548,9 +546,9 @@ def create_tige_in_hdf(hdf5file, tige_id):
tige_path = 'data/tige%i' % tige_id
if tige_path not in f:
f.create_group(tige_path)
print('Tige enregistrée dans %s' % tige_path)
# print('Tige enregistrée dans %s' % tige_path)
else:
print('La tige %s existe déjà dans le fichier hdf5' % tige_path)
print('Organ %s already exists in the hdf5 file' % tige_path)
......@@ -934,10 +932,8 @@ def get_tigesmanager(hdf5file):
print("No data for the organ (gui: %i, h5: tige%i)" % (i, tid))
output.Mask_invalid()
# print("Fin du chargement")
else:
output = None
# print('Pas de tiges dans le fichier hdf5')
return output
......
......@@ -562,7 +562,7 @@ def MethodeOlivier(image, tige_table, id_tige, nbimage, xi, yi, pas, Np,
if cpt >= Max_iter:
passflag = False
print("Iterations coupure")
# print("Iterations coupure")
# Add a stop condition if target is defined (distance relative to target less than a value)
if xc != None and target != None:
......@@ -894,7 +894,7 @@ def ProcessImages(file_names, num_images, num_tiges, pas=0.3, seuil="auto", Np=1
use_h5 = False
elif isinstance(file_names, str) or isinstance(file_names, unicode):
if 'h5' in os.path.splitext(file_names)[-1]:
print(u"Images obtenues à partir du fichier h5 %s" % file_names)
# print(u"Images obtenues à partir du fichier h5 %s" % file_names)
imgs = arange(0, h5store.get_number_of_images(file_names))
use_h5 = True
else:
......@@ -923,7 +923,6 @@ def ProcessImages(file_names, num_images, num_tiges, pas=0.3, seuil="auto", Np=1
img_stop = len(imgs)
imgs = imgs[img_start:img_stop]
print("traitement de %s -> %s" % (imgs[0], imgs[-1]))
num_images = len(imgs)
Num_tiges = num_tiges
......@@ -1289,7 +1288,7 @@ def traite_tiges2(tiges, itige=None, pas=0.3, causette=True,
if xt is None and yt is None:
if causette:
print("La taille de la tige %i sur l'image %i est trop faible" % (itige[i], t))
print("The size of organ %i on image %i is too small" % (itige[i], t))
measure_zonet += [(0, 0)] # sinon on a des inconsistance de taille
else:
......@@ -1309,7 +1308,7 @@ def traite_tiges2(tiges, itige=None, pas=0.3, causette=True,
else:
if causette:
print(u"La tige %i sur image %i a merdée" % (itige[i], t))
print("A problem occurred with organ %i on image %i" % (itige[i], t))
measure_zonet += [(0, 0)] # sinon on a des inconsistance de taille
lines[i] = ma.dstack((x[i], y[i]))
......@@ -1935,11 +1934,10 @@ def compute_pattern_motion(images_names, pattern, pattern_center, output_data=No
###############################################################################
# TRAITEMENT DES MARQUES LAGRANGIENNES #
# PROCESSING OF LAGRANGIAN MARKS #
###############################################################################
# https://www.geeksforgeeks.org/check-if-two-given-line-segments-intersect/
# https://stackoverflow.com/questions/563198/how-do-you-detect-where-two-line-segments-intersect/565282
def orientation(A, B, C):
"""Return the orientation of the triedron ABC.
......@@ -1956,42 +1954,3 @@ def do_intersect(A, B, C, D):
"""Return True if the line segments AB and CD intersect."""
return orientation(A, C, D) != orientation(B, C, D) \
and orientation(A, B, C) != orientation(A, B, D)
def find_intersection_point(p0, p1, p2, p3):
s10_x = p1[0] - p0[0]
s10_y = p1[1] - p0[1]
s32_x = p3[0] - p2[0]
s32_y = p3[1] - p2[1]
denom = s10_x * s32_y - s32_x * s10_y
if denom == 0 : return None # collinear
denom_is_positive = denom > 0
s02_x = p0[0] - p2[0]
s02_y = p0[1] - p2[1]
s_numer = s10_x * s02_y - s10_y * s02_x
if (s_numer < 0) == denom_is_positive : return None # no collision
t_numer = s32_x * s02_y - s32_y * s02_x
if (t_numer < 0) == denom_is_positive : return None # no collision
if (s_numer > denom) == denom_is_positive or (t_numer > denom) == denom_is_positive : return None # no collision
# collision detected
t = t_numer / denom
intersection_point = [ p0[0] + (t * s10_x), p0[1] + (t * s10_y) ]
return intersection_point
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment