Révision 9

bin/image2geometry/MGX_EdgeDetect_RNASeq.py (revision 9)
1
import os
2
gaussianblurvalue=str(0)
3
edgedetectvalue=str(8000)
4
dilatevalue=str(5)
5
path="/home/biophysics/Desktop/Virginie/stade 11/02. normalised_30_scaled/27C/normalised-OtsuT30/27C_PMT3/"
6
os.chdir(path)
7
listfiles=os.listdir(path)
8
listfiles=[ i for i in listfiles if '.tif' in i]
9

  
10
Process.Stack__System__Clear_Work_Stack('0')
11
Process.Stack__System__Clear_Main_Stack('0')
12
Process.Stack__System__Clear_Main_Stack('1')
13
Process.Stack__System__Clear_Work_Stack('1')
14
for i in listfiles:	
15
	Process.Stack__System__Set_Current_Stack('Main', '0')
16
	Process.Stack__System__Open(path+i, 'Main', '0')
17
	Process.Stack__System__Open(path+i, 'Main', '1')
18
	Process.Stack__Filters__Gaussian_Blur_Stack(gaussianblurvalue, gaussianblurvalue, gaussianblurvalue)
19
	Process.Stack__MultiStack__Copy_Work_to_Main_Stack()
20
	Process.Stack__MultiStack__Swap_or_Copy_Stack_1_and_2('Main', '1 -> 2')
21
	Process.Stack__Morphology__Edge_Detect(edgedetectvalue, '2.0', '0.3', '30000')
22
	Process.Stack__MultiStack__Copy_Work_to_Main_Stack()
23
	Process.Stack__MultiStack__Swap_or_Copy_Stack_1_and_2('Main', '1 <-> 2')
24
	Process.Stack__System__Set_Current_Stack('Main', '0')
25
	Process.Stack__Canvas__Reverse_Axes('No', 'No', 'Yes')
26
	Process.Stack__Morphology__Edge_Detect(edgedetectvalue, '2.0', '0.3', '30000')
27
	Process.Stack__Canvas__Reverse_Axes('No', 'No', 'Yes')
28
	Process.Stack__MultiStack__Swap_or_Copy_Stack_1_and_2('Main', '1 <- 2')
29
	Process.Stack__System__Set_Current_Stack('Both', '0')
30
	Process.Stack__MultiStack__Combine_Stacks('Product')
31
	Process.Stack__System__Set_Current_Stack('Work', '0')
32
	Process.Stack__Morphology__Dilate(dilatevalue, dilatevalue, "0", 'No', 'No')
33
	Process.Stack__System__Save(path+"MGX_"+i[:-4]+'_e'+edgedetectvalue+'_d'+dilatevalue+'.tif', 'Work', '0', '0')
34
	Process.Stack__System__Clear_Work_Stack('0')
35
	Process.Stack__System__Clear_Main_Stack('0')
36
	Process.Stack__System__Clear_Main_Stack('1')
37
	Process.Stack__System__Clear_Work_Stack('1')
38
	Process.Stack__System__Clear_Main_Stack('2')
39
	Process.Stack__System__Clear_Work_Stack('2')
bin/image2geometry/MGX_EdgeDetect.py (revision 9)
1 1
import os
2 2

  
3
path="/home/cmollier/Documents/WORK/Confocal_whole_sepal/CSI1-WT/20200723/Col-1/2_TIF/"
4
outpath="/home/cmollier/Documents/WORK/Confocal_whole_sepal/CSI1-WT/20200723/Col-1/3_MGX/"
5
edgedetectvalue=str(7000)
3
'''
4
Input:
5
 - directory with grey images of sepals
6
 
7
Output:
8
 - detected sepal contour stacks
6 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

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

  
......
11 37
Process.Stack__System__Clear_Main_Stack('0')
12 38
Process.Stack__System__Clear_Main_Stack('1')
13 39
Process.Stack__System__Clear_Work_Stack('1')
14

  
15 40
for i in listfiles:	
16
	if i.split(".")[1]=="tif":
17
		Process.Stack__System__Set_Current_Stack('Main', '0')
18
		Process.Stack__System__Open(path+i, 'Main', '0')
19
		Process.Stack__System__Open(path+i, 'Main', '1')
20
		Process.Stack__Filters__Gaussian_Blur_Stack('10', '10', '10')
21
		Process.Stack__MultiStack__Copy_Work_to_Main_Stack()
22
		Process.Stack__MultiStack__Swap_or_Copy_Stack_1_and_2('Main', '1 -> 2')
23
		Process.Stack__Morphology__Edge_Detect(edgedetectvalue, '2.0', '0.3', '30000')
24
		Process.Stack__MultiStack__Copy_Work_to_Main_Stack()
25
		Process.Stack__MultiStack__Swap_or_Copy_Stack_1_and_2('Main', '1 <-> 2')
26
		Process.Stack__System__Set_Current_Stack('Main', '0')
27
		Process.Stack__Canvas__Reverse_Axes('No', 'No', 'Yes')
28
		Process.Stack__Morphology__Edge_Detect(edgedetectvalue, '2.0', '0.3', '30000')
29
		Process.Stack__Canvas__Reverse_Axes('No', 'No', 'Yes')
30
		Process.Stack__MultiStack__Swap_or_Copy_Stack_1_and_2('Main', '1 <- 2')
31
		Process.Stack__System__Set_Current_Stack('Both', '0')
32
		Process.Stack__MultiStack__Combine_Stacks('Product')
33
		Process.Stack__System__Set_Current_Stack('Work', '0')
34
		Process.Stack__System__Save(outpath+i[:-4]+'_'+str(edgedetectvalue)+'.tif', 'Work', '0', '0')
35
		Process.Stack__System__Clear_Work_Stack('0')
36
		Process.Stack__System__Clear_Main_Stack('0')
37
		Process.Stack__System__Clear_Main_Stack('1')
38
		Process.Stack__System__Clear_Work_Stack('1')
39
		Process.Stack__System__Clear_Main_Stack('2')
40
		Process.Stack__System__Clear_Work_Stack('2')
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')

Formats disponibles : Unified diff