Révision 20

bin/MGX_EdgeDetect.py (revision 20)
10 10
'''
11 11

  
12 12
# directory of grey images
13
filedata="/home/biophysics/Desktop/Fanfan/Col-0_A-tif"
13
filedata="/home/biophysics/Desktop/Annamaria/Sepals"
14 14

  
15 15

  
16 16
################### Parameters ###########
17 17

  
18 18
# smoothing
19
gaussianblurvalue=str(1)
19
#gaussianblurvalue=str(1)
20
gaussianblurvalue=str(2)
20 21

  
21
# threshold value for the Edgedetect procedure 
22
edgedetectvalue=str(8000)
22
# threshold value for the Edgedetect procedure
23
#edgedetectvalue=str(10000)
24
edgedetectvalue=str(2000)
23 25

  
24 26
# xy dilation value
25 27
dilatevalue=str(0)
......
39 41
Process.Stack__System__Clear_Work_Stack('1')
40 42
for i in listfiles:	
41 43
	Process.Stack__System__Set_Current_Stack('Main', '0')
42
	Process.Stack__System__Open(path+i, 'Main', '0')
43
	Process.Stack__System__Open(path+i, 'Main', '1')
44
	Process.Stack__System__Open(path+i, 'Main', '0','','Yes')
45
	Process.Stack__System__Open(path+i, 'Main', '1','','Yes')
44 46
	Process.Stack__Filters__Gaussian_Blur_Stack(gaussianblurvalue, gaussianblurvalue, gaussianblurvalue)
45 47
	Process.Stack__MultiStack__Copy_Work_to_Main_Stack()
46 48
	Process.Stack__MultiStack__Swap_or_Copy_Stack_1_and_2('Main', '1 -> 2')
......
56 58
	Process.Stack__MultiStack__Combine_Stacks('Product')
57 59
	Process.Stack__System__Set_Current_Stack('Work', '0')
58 60
	Process.Stack__Morphology__Dilate(dilatevalue, dilatevalue, "0", 'No', 'No')
59
	Process.Stack__System__Save(outputdir+"MGX_"+i[:-4]+'_e'+edgedetectvalue+'_d'+dilatevalue+'.tif', 'Work', '0', '0')
61
	Process.Stack__System__Save(outputdir+"MGX_"+i[:-4]+'_e'+edgedetectvalue+'_d'+dilatevalue+'.tif', 'Work', '0', '0','Yes')
60 62
	Process.Stack__System__Clear_Work_Stack('0')
61 63
	Process.Stack__System__Clear_Main_Stack('0')
62 64
	Process.Stack__System__Clear_Main_Stack('1')
bin/MGX_old/MGX_CurvatureMapSegmentation.py (revision 20)
1
import os
2

  
3
'''
4
Input:
5
 - directory with detected sepal contour stacks .tif
6
 
7
Output:
8
 - segmented meshes (up and down surfaces treated as cells)
9
 - csv file / sepale containing : up and down surface areas
10

  
11
'''
12

  
13
# directory with detected sepal contours
14
filedata1="/home/akiss/RDP/Projects/Sepals/RNA-Seq_Final/06.ContourDetection/JL_22C/mgx-contours"
15

  
16

  
17
################### Parameters ###########
18

  
19
# cubesize for mesh creation
20
cubesize=str(15)
21

  
22
# size of neighbourhood for the segmented curvature map
23
curv_neighb=str(100)
24

  
25
# segmentation
26
signal_ratio=str(3) # minimal border / cell signal ratio (if less, cells are fused)
27
# - cell
28
cell_blur_radius=str(100)
29
seed_radius=str(150)
30
# - border
31
border_distance=str(100)
32
border_blur_radius=str(100)
33

  
34
#########################################
35

  
36
filedata=filedata1+'/'
37
meshresult=filedata1+'-MGX-mesh'+cubesize+'/'
38
curvaturecsvresult=filedata1+'-MGX-curvature-csv/'
39
arearesult=filedata1+'-MGX-area/'
40
segresult=filedata1+'-MGX-seg/'
41

  
42

  
43
os.system("mkdir "+meshresult)
44
os.system("mkdir "+curvaturecsvresult)
45
os.system("mkdir "+arearesult)
46
os.system("mkdir "+segresult)
47

  
48

  
49
listfiles=os.listdir(filedata)
50
listfiles=[ i for i in listfiles if '.tif' in i]
51

  
52

  
53
Process.Stack__System__Clear_Work_Stack('0')
54
Process.Stack__System__Clear_Main_Stack('0')
55
Process.Stack__System__Clear_Main_Stack('1')
56
Process.Stack__System__Clear_Work_Stack('1')
57
for i in listfiles:	
58
	Process.Stack__System__Set_Current_Stack('Main', '0')
59
	Process.Stack__System__Open(filedata+i, 'Main', '0')
60
	# --- creating surface mesh
61
	Process.Mesh__Creation__Marching_Cubes_Surface(cubesize, '5000')
62
	Process.Mesh__Structure__Smooth_Mesh('1', 'No')
63
	Process.Mesh__Structure__Smooth_Mesh('1', 'No')
64
	Process.Mesh__Structure__Smooth_Mesh('1', 'No')
65
	Process.Mesh__Structure__Smooth_Mesh('1', 'No')
66
	# --- computing maximal curvature
67
	csvname=i[:-4]+'-carte-courbure-Maximal'+curv_neighb+'.csv'
68
	Process.Mesh__Signal__Project_Mesh_Curvature(curvaturecsvresult+csvname, 'Maximal', curv_neighb, 'Yes', '-50.0', '50.0', '85')
69
	meshname=i[:-4]+'-mesh.mgxm'
70
	Process.Mesh__System__Save(meshresult+meshname, 'no', '0')
71
	Process.Stack__System__Clear_Work_Stack('0')
72
	Process.Stack__System__Clear_Main_Stack('0')
73
	Process.Stack__System__Clear_Main_Stack('1')
74
	Process.Stack__System__Clear_Work_Stack('1')
75
	# --- watershed segmentation of the maximal curvature map
76
	Process.Mesh__Segmentation__Auto_Segmentation('Yes', 'No', cell_blur_radius, seed_radius, border_blur_radius, '100.0', border_distance, signal_ratio)
77
	segname=i[:-4]+'-seg.mgxm'
78
	Process.Mesh__System__Save(segresult+segname, 'no', '0')
79
	# --- computing the area of the faces
80
	csvname=i[:-4]+'-area.csv'
81
	Process.Mesh__Heat_Map__Heat_Map_Classic('Area', 'Geometry', arearesult+csvname, 'Geometry', 'No', '0', '65535', 'Yes', 'No', 'None', 'No', 'Decreasing', 'Ratio', '0.001', '1')
82
	# --- computing teh perimeter
83
	#csvname=i[:-4]+'-perimeter.csv'
84
	#Process.Mesh__Heat_Map__Heat_Map('/Geometry/Perimeter', 'No', 'No', '', 'No', '', '', 'Yes', 'Yes')
85
	# --- computing gaussian curvature
86
	#Process.Mesh__Signal__Project_Mesh_Curvature('', 'Gaussian', '100', 'Yes', '-50.0', '50.0', '85')
87
	"""print("Please put two seeds on the two sides of the sepal :-) ... ")
88
	a=input("")
89
	Process.Mesh__Segmentation__Watershed_Segmentation('50000')
90
	csvname=i[:-4]+'-area.csv'
91
	Process.Mesh__Heat_Map__Heat_Map_Classic('Area', 'Geometry', csvresult+csvname, 'Geometry', 'No', '0', '65535', 'Yes', 'No', 'None', 'No', 'Decreasing', 'Ratio', '0.001', '1')
92
	"""
bin/MGX_old/MGX_EdgeDetect.py (revision 20)
1
import os
2

  
3
'''
4
Input:
5
 - directory with grey images of sepals
6
 
7
Output:
8
 - detected sepal contour stacks
9

  
10
'''
11

  
12
# directory of grey images
13
filedata="/home/biophysics/Desktop/Fanfan/Col-0_A-tif"
14

  
15

  
16
################### Parameters ###########
17

  
18
# smoothing
19
gaussianblurvalue=str(1)
20

  
21
# threshold value for the Edgedetect procedure 
22
edgedetectvalue=str(8000)
23

  
24
# xy dilation value
25
dilatevalue=str(0)
26

  
27
#########################################
28

  
29
path=filedata+'/'
30
outputdir=filedata+'-MGX-EdgeDetect_Blur'+gaussianblurvalue+'_ED'+edgedetectvalue+'_d'+dilatevalue+'/'
31
os.system("mkdir "+outputdir)
32

  
33
listfiles=os.listdir(path)
34
listfiles=[ i for i in listfiles if '.tif' in i]
35

  
36
Process.Stack__System__Clear_Work_Stack('0')
37
Process.Stack__System__Clear_Main_Stack('0')
38
Process.Stack__System__Clear_Main_Stack('1')
39
Process.Stack__System__Clear_Work_Stack('1')
40
for i in listfiles:	
41
	Process.Stack__System__Set_Current_Stack('Main', '0')
42
	Process.Stack__System__Open(path+i, 'Main', '0')
43
	Process.Stack__System__Open(path+i, 'Main', '1')
44
	Process.Stack__Filters__Gaussian_Blur_Stack(gaussianblurvalue, gaussianblurvalue, gaussianblurvalue)
45
	Process.Stack__MultiStack__Copy_Work_to_Main_Stack()
46
	Process.Stack__MultiStack__Swap_or_Copy_Stack_1_and_2('Main', '1 -> 2')
47
	Process.Stack__Morphology__Edge_Detect(edgedetectvalue, '2.0', '0.3', '30000')
48
	Process.Stack__MultiStack__Copy_Work_to_Main_Stack()
49
	Process.Stack__MultiStack__Swap_or_Copy_Stack_1_and_2('Main', '1 <-> 2')
50
	Process.Stack__System__Set_Current_Stack('Main', '0')
51
	Process.Stack__Canvas__Reverse_Axes('No', 'No', 'Yes')
52
	Process.Stack__Morphology__Edge_Detect(edgedetectvalue, '2.0', '0.3', '30000')
53
	Process.Stack__Canvas__Reverse_Axes('No', 'No', 'Yes')
54
	Process.Stack__MultiStack__Swap_or_Copy_Stack_1_and_2('Main', '1 <- 2')
55
	Process.Stack__System__Set_Current_Stack('Both', '0')
56
	Process.Stack__MultiStack__Combine_Stacks('Product')
57
	Process.Stack__System__Set_Current_Stack('Work', '0')
58
	Process.Stack__Morphology__Dilate(dilatevalue, dilatevalue, "0", 'No', 'No')
59
	Process.Stack__System__Save(outputdir+"MGX_"+i[:-4]+'_e'+edgedetectvalue+'_d'+dilatevalue+'.tif', 'Work', '0', '0')
60
	Process.Stack__System__Clear_Work_Stack('0')
61
	Process.Stack__System__Clear_Main_Stack('0')
62
	Process.Stack__System__Clear_Main_Stack('1')
63
	Process.Stack__System__Clear_Work_Stack('1')
64
	Process.Stack__System__Clear_Main_Stack('2')
65
	Process.Stack__System__Clear_Work_Stack('2')
bin/MGX_CurvatureMapSegmentation.py (revision 20)
11 11
'''
12 12

  
13 13
# directory with detected sepal contours
14
filedata1="/home/akiss/RDP/Projects/Sepals/RNA-Seq_Final/06.ContourDetection/JL_22C/mgx-contours"
14
filedata1="/home/biophysics/Desktop/Annamaria/SepalContours"
15 15

  
16 16

  
17 17
################### Parameters ###########
18 18

  
19 19
# cubesize for mesh creation
20
cubesize=str(15)
20
#cubesize=str(15)
21
cubesize=str(5)
21 22

  
22 23
# size of neighbourhood for the segmented curvature map
23 24
curv_neighb=str(100)
......
56 57
Process.Stack__System__Clear_Work_Stack('1')
57 58
for i in listfiles:	
58 59
	Process.Stack__System__Set_Current_Stack('Main', '0')
59
	Process.Stack__System__Open(filedata+i, 'Main', '0')
60
	Process.Stack__System__Open(filedata+i, 'Main', '0', '', "Yes")
60 61
	# --- creating surface mesh
61 62
	Process.Mesh__Creation__Marching_Cubes_Surface(cubesize, '5000')
62 63
	Process.Mesh__Structure__Smooth_Mesh('1', 'No')

Formats disponibles : Unified diff