'''This function imports a stack of images .TIF in a 3D matrix, it takes in arguments the path of the folder.'''
img=MultiImage(chemin)
size=len(img)
shape=img[0].shape
stack=np.zeros((shape[0],shape[1],size))
foriinrange(size):
stack[:,:,i]=img[i]
returnstack,size,shape
defnumber_MIP(matrix,shape,number):
'''This function makes a N-maximums intensity projection of a 3D matrix, it takes in arguments the 3D matrix, the shape of the 3D matri in a tuple and the number of maximas to project.'''
projection=np.zeros(shape)
forxinrange(shape[0]):
foryinrange(shape[1]):
array_sort=np.sort(matrix[x,y,:])
projection[x,y]=np.sum(array_sort[-number::])
returnprojection
defmain(chemin,num_max):
'''It's the main function of the program, it takes the path to a folder where the stacks .TIFF are placed, it projects the N-maximums, sets the background to 0 and computes the mean intensity normalized by the numbers of pixels non sets to 0.
It takes in argument the path of a folder and return the mean intensity.'''
'''This function applies an Otsu filter, it takes in arguments a matrix and return a mask where the background is set to 0 and the foreground to 1. Change nbins with the type of images (8bits = 256, 16bits = 65536'''
'''This function selects a pattern with two successives application of the analysis function, and computes the pattern of the second analysis divided by the invert of the pattern of the first analysis.
#This function draws a line between two bars of the bar chart and displays a text on top of it.It takes in arguments the i-th and the j-th bar of the bar chart, the text to display, the center of the bars as an array and the y value of the bars as an array
'''This function imports a stack of images .TIF in a 3D matrix, it takes in arguments the path of the folder.'''
img=MultiImage(chemin)
size=len(img)
shape=img[0].shape
stack=np.zeros((shape[0],shape[1],size))
foriinrange(size):
stack[:,:,i]=img[i]
returnstack,size,shape
defnumber_MIP(matrix,shape,number):
'''This function makes a N-maximums intensity projection of a 3D matrix, it takes in arguments the 3D matrix, the shape of the 3D matri in a tuple and the number of maximas to project.'''
projection=np.zeros(shape)
forxinrange(shape[0]):
foryinrange(shape[1]):
array_sort=np.sort(matrix[x,y,:])
projection[x,y]=np.sum(array_sort[-number::])
returnprojection
defmain(chemin,num_max):
'''It's the main function of the program, it takes the path to a folder where the stacks .TIFF are placed, it projects the N-maximums, sets the background to 0 and computes the mean intensity normalized by the numbers of pixels non sets to 0.
It takes in argument the path of a folder and return the mean intensity.'''
'''This function applies an Otsu filter, it takes in arguments a matrix and return a mask where the background is set to 0 and the foreground to 1. Change nbins with the type of images (8bits = 256, 16bits = 65536'''
'''This function selects a pattern with two successives application of the analysis function, and computes the pattern of the second analysis divided by the invert of the pattern of the first analysis.
Argz :
image = matrix of the image.
chemin = pathway of the stack image.
cheminActine = pathway of the stack image in the actine channel.