Index: bin/MGX_old/MGX_CurvatureMapSegmentation.py
===================================================================
--- bin/MGX_old/MGX_CurvatureMapSegmentation.py	(revision 0)
+++ bin/MGX_old/MGX_CurvatureMapSegmentation.py	(revision 20)
@@ -0,0 +1,92 @@
+import os
+
+'''
+Input:
+ - directory with detected sepal contour stacks .tif
+ 
+Output:
+ - segmented meshes (up and down surfaces treated as cells)
+ - csv file / sepale containing : up and down surface areas
+
+'''
+
+# directory with detected sepal contours
+filedata1="/home/akiss/RDP/Projects/Sepals/RNA-Seq_Final/06.ContourDetection/JL_22C/mgx-contours"
+
+
+################### Parameters ###########
+
+# cubesize for mesh creation
+cubesize=str(15)
+
+# size of neighbourhood for the segmented curvature map
+curv_neighb=str(100)
+
+# segmentation
+signal_ratio=str(3) # minimal border / cell signal ratio (if less, cells are fused)
+# - cell
+cell_blur_radius=str(100)
+seed_radius=str(150)
+# - border
+border_distance=str(100)
+border_blur_radius=str(100)
+
+#########################################
+
+filedata=filedata1+'/'
+meshresult=filedata1+'-MGX-mesh'+cubesize+'/'
+curvaturecsvresult=filedata1+'-MGX-curvature-csv/'
+arearesult=filedata1+'-MGX-area/'
+segresult=filedata1+'-MGX-seg/'
+
+
+os.system("mkdir "+meshresult)
+os.system("mkdir "+curvaturecsvresult)
+os.system("mkdir "+arearesult)
+os.system("mkdir "+segresult)
+
+
+listfiles=os.listdir(filedata)
+listfiles=[ i for i in listfiles if '.tif' in i]
+
+
+Process.Stack__System__Clear_Work_Stack('0')
+Process.Stack__System__Clear_Main_Stack('0')
+Process.Stack__System__Clear_Main_Stack('1')
+Process.Stack__System__Clear_Work_Stack('1')
+for i in listfiles:	
+	Process.Stack__System__Set_Current_Stack('Main', '0')
+	Process.Stack__System__Open(filedata+i, 'Main', '0')
+	# --- creating surface mesh
+	Process.Mesh__Creation__Marching_Cubes_Surface(cubesize, '5000')
+	Process.Mesh__Structure__Smooth_Mesh('1', 'No')
+	Process.Mesh__Structure__Smooth_Mesh('1', 'No')
+	Process.Mesh__Structure__Smooth_Mesh('1', 'No')
+	Process.Mesh__Structure__Smooth_Mesh('1', 'No')
+	# --- computing maximal curvature
+	csvname=i[:-4]+'-carte-courbure-Maximal'+curv_neighb+'.csv'
+	Process.Mesh__Signal__Project_Mesh_Curvature(curvaturecsvresult+csvname, 'Maximal', curv_neighb, 'Yes', '-50.0', '50.0', '85')
+	meshname=i[:-4]+'-mesh.mgxm'
+	Process.Mesh__System__Save(meshresult+meshname, 'no', '0')
+	Process.Stack__System__Clear_Work_Stack('0')
+	Process.Stack__System__Clear_Main_Stack('0')
+	Process.Stack__System__Clear_Main_Stack('1')
+	Process.Stack__System__Clear_Work_Stack('1')
+	# --- watershed segmentation of the maximal curvature map
+	Process.Mesh__Segmentation__Auto_Segmentation('Yes', 'No', cell_blur_radius, seed_radius, border_blur_radius, '100.0', border_distance, signal_ratio)
+	segname=i[:-4]+'-seg.mgxm'
+	Process.Mesh__System__Save(segresult+segname, 'no', '0')
+	# --- computing the area of the faces
+	csvname=i[:-4]+'-area.csv'
+	Process.Mesh__Heat_Map__Heat_Map_Classic('Area', 'Geometry', arearesult+csvname, 'Geometry', 'No', '0', '65535', 'Yes', 'No', 'None', 'No', 'Decreasing', 'Ratio', '0.001', '1')
+	# --- computing teh perimeter
+	#csvname=i[:-4]+'-perimeter.csv'
+	#Process.Mesh__Heat_Map__Heat_Map('/Geometry/Perimeter', 'No', 'No', '', 'No', '', '', 'Yes', 'Yes')
+	# --- computing gaussian curvature
+	#Process.Mesh__Signal__Project_Mesh_Curvature('', 'Gaussian', '100', 'Yes', '-50.0', '50.0', '85')
+	"""print("Please put two seeds on the two sides of the sepal :-) ... ")
+	a=input("")
+	Process.Mesh__Segmentation__Watershed_Segmentation('50000')
+	csvname=i[:-4]+'-area.csv'
+	Process.Mesh__Heat_Map__Heat_Map_Classic('Area', 'Geometry', csvresult+csvname, 'Geometry', 'No', '0', '65535', 'Yes', 'No', 'None', 'No', 'Decreasing', 'Ratio', '0.001', '1')
+	"""
Index: bin/MGX_old/MGX_EdgeDetect.py
===================================================================
--- bin/MGX_old/MGX_EdgeDetect.py	(revision 0)
+++ bin/MGX_old/MGX_EdgeDetect.py	(revision 20)
@@ -0,0 +1,65 @@
+import os
+
+'''
+Input:
+ - directory with grey images of sepals
+ 
+Output:
+ - detected sepal contour stacks
+
+'''
+
+# directory of grey images
+filedata="/home/biophysics/Desktop/Fanfan/Col-0_A-tif"
+
+
+################### Parameters ###########
+
+# smoothing
+gaussianblurvalue=str(1)
+
+# threshold value for the Edgedetect procedure 
+edgedetectvalue=str(8000)
+
+# xy dilation value
+dilatevalue=str(0)
+
+#########################################
+
+path=filedata+'/'
+outputdir=filedata+'-MGX-EdgeDetect_Blur'+gaussianblurvalue+'_ED'+edgedetectvalue+'_d'+dilatevalue+'/'
+os.system("mkdir "+outputdir)
+
+listfiles=os.listdir(path)
+listfiles=[ i for i in listfiles if '.tif' in i]
+
+Process.Stack__System__Clear_Work_Stack('0')
+Process.Stack__System__Clear_Main_Stack('0')
+Process.Stack__System__Clear_Main_Stack('1')
+Process.Stack__System__Clear_Work_Stack('1')
+for i in listfiles:	
+	Process.Stack__System__Set_Current_Stack('Main', '0')
+	Process.Stack__System__Open(path+i, 'Main', '0')
+	Process.Stack__System__Open(path+i, 'Main', '1')
+	Process.Stack__Filters__Gaussian_Blur_Stack(gaussianblurvalue, gaussianblurvalue, gaussianblurvalue)
+	Process.Stack__MultiStack__Copy_Work_to_Main_Stack()
+	Process.Stack__MultiStack__Swap_or_Copy_Stack_1_and_2('Main', '1 -> 2')
+	Process.Stack__Morphology__Edge_Detect(edgedetectvalue, '2.0', '0.3', '30000')
+	Process.Stack__MultiStack__Copy_Work_to_Main_Stack()
+	Process.Stack__MultiStack__Swap_or_Copy_Stack_1_and_2('Main', '1 <-> 2')
+	Process.Stack__System__Set_Current_Stack('Main', '0')
+	Process.Stack__Canvas__Reverse_Axes('No', 'No', 'Yes')
+	Process.Stack__Morphology__Edge_Detect(edgedetectvalue, '2.0', '0.3', '30000')
+	Process.Stack__Canvas__Reverse_Axes('No', 'No', 'Yes')
+	Process.Stack__MultiStack__Swap_or_Copy_Stack_1_and_2('Main', '1 <- 2')
+	Process.Stack__System__Set_Current_Stack('Both', '0')
+	Process.Stack__MultiStack__Combine_Stacks('Product')
+	Process.Stack__System__Set_Current_Stack('Work', '0')
+	Process.Stack__Morphology__Dilate(dilatevalue, dilatevalue, "0", 'No', 'No')
+	Process.Stack__System__Save(outputdir+"MGX_"+i[:-4]+'_e'+edgedetectvalue+'_d'+dilatevalue+'.tif', 'Work', '0', '0')
+	Process.Stack__System__Clear_Work_Stack('0')
+	Process.Stack__System__Clear_Main_Stack('0')
+	Process.Stack__System__Clear_Main_Stack('1')
+	Process.Stack__System__Clear_Work_Stack('1')
+	Process.Stack__System__Clear_Main_Stack('2')
+	Process.Stack__System__Clear_Work_Stack('2')
Index: bin/MGX_CurvatureMapSegmentation.py
===================================================================
--- bin/MGX_CurvatureMapSegmentation.py	(revision 19)
+++ bin/MGX_CurvatureMapSegmentation.py	(revision 20)
@@ -11,13 +11,14 @@
 '''
 
 # directory with detected sepal contours
-filedata1="/home/akiss/RDP/Projects/Sepals/RNA-Seq_Final/06.ContourDetection/JL_22C/mgx-contours"
+filedata1="/home/biophysics/Desktop/Annamaria/SepalContours"
 
 
 ################### Parameters ###########
 
 # cubesize for mesh creation
-cubesize=str(15)
+#cubesize=str(15)
+cubesize=str(5)
 
 # size of neighbourhood for the segmented curvature map
 curv_neighb=str(100)
@@ -56,7 +57,7 @@
 Process.Stack__System__Clear_Work_Stack('1')
 for i in listfiles:	
 	Process.Stack__System__Set_Current_Stack('Main', '0')
-	Process.Stack__System__Open(filedata+i, 'Main', '0')
+	Process.Stack__System__Open(filedata+i, 'Main', '0', '', "Yes")
 	# --- creating surface mesh
 	Process.Mesh__Creation__Marching_Cubes_Surface(cubesize, '5000')
 	Process.Mesh__Structure__Smooth_Mesh('1', 'No')
Index: bin/MGX_EdgeDetect.py
===================================================================
--- bin/MGX_EdgeDetect.py	(revision 19)
+++ bin/MGX_EdgeDetect.py	(revision 20)
@@ -10,16 +10,18 @@
 '''
 
 # directory of grey images
-filedata="/home/biophysics/Desktop/Fanfan/Col-0_A-tif"
+filedata="/home/biophysics/Desktop/Annamaria/Sepals"
 
 
 ################### Parameters ###########
 
 # smoothing
-gaussianblurvalue=str(1)
+#gaussianblurvalue=str(1)
+gaussianblurvalue=str(2)
 
-# threshold value for the Edgedetect procedure 
-edgedetectvalue=str(8000)
+# threshold value for the Edgedetect procedure
+#edgedetectvalue=str(10000)
+edgedetectvalue=str(2000)
 
 # xy dilation value
 dilatevalue=str(0)
@@ -39,8 +41,8 @@
 Process.Stack__System__Clear_Work_Stack('1')
 for i in listfiles:	
 	Process.Stack__System__Set_Current_Stack('Main', '0')
-	Process.Stack__System__Open(path+i, 'Main', '0')
-	Process.Stack__System__Open(path+i, 'Main', '1')
+	Process.Stack__System__Open(path+i, 'Main', '0','','Yes')
+	Process.Stack__System__Open(path+i, 'Main', '1','','Yes')
 	Process.Stack__Filters__Gaussian_Blur_Stack(gaussianblurvalue, gaussianblurvalue, gaussianblurvalue)
 	Process.Stack__MultiStack__Copy_Work_to_Main_Stack()
 	Process.Stack__MultiStack__Swap_or_Copy_Stack_1_and_2('Main', '1 -> 2')
@@ -56,7 +58,7 @@
 	Process.Stack__MultiStack__Combine_Stacks('Product')
 	Process.Stack__System__Set_Current_Stack('Work', '0')
 	Process.Stack__Morphology__Dilate(dilatevalue, dilatevalue, "0", 'No', 'No')
-	Process.Stack__System__Save(outputdir+"MGX_"+i[:-4]+'_e'+edgedetectvalue+'_d'+dilatevalue+'.tif', 'Work', '0', '0')
+	Process.Stack__System__Save(outputdir+"MGX_"+i[:-4]+'_e'+edgedetectvalue+'_d'+dilatevalue+'.tif', 'Work', '0', '0','Yes')
 	Process.Stack__System__Clear_Work_Stack('0')
 	Process.Stack__System__Clear_Main_Stack('0')
 	Process.Stack__System__Clear_Main_Stack('1')
