Wiki

Version 44 (Annamaria Kiss, 18/05/2022 15:27)

1 18 Annamaria Kiss
*Table of contents*
2 17 Annamaria Kiss
3 17 Annamaria Kiss
{{TOC}}
4 17 Annamaria Kiss
5 38 Annamaria Kiss
Pipeline to detect, orient and measure sepals. The pipeline is based on different type of scripts that we developed and can be found in this repository.
6 37 Annamaria Kiss
- image type transformations are done with "ImageJ":https://imagej.net/Welcome macros
7 37 Annamaria Kiss
- python scripts making use of "MorphoGraphX":https://morphographx.org/
8 37 Annamaria Kiss
- python scripts that make use of "TimageTk":https://mosaic.gitlabpages.inria.fr/timagetk/
9 1 Annamaria Kiss
10 30 Annamaria Kiss
h2. 1. Preliminaries
11 1 Annamaria Kiss
12 43 Annamaria Kiss
You will need to change different image file formats to .tif format. For this purpose, you have suitable ImageJ macros in this repository's _bin/ImageJ_ folder : lif2tif, lsm2tif, inr2tif, tif2tif.
13 20 Annamaria Kiss
14 43 Annamaria Kiss
Install the macro: ImageJ → Plugins → Macros → Install → macroname.ijm
15 20 Annamaria Kiss
16 44 Annamaria Kiss
Their usage is the same. Lounch the macro and select the directory, where the files to transform are ; a new directory with the output tif files is created.
17 1 Annamaria Kiss
18 14 Annamaria Kiss
h2. 2. Normalise images
19 10 Annamaria Kiss
20 28 Annamaria Kiss
<pre> normalise.py imagefolder 30 </pre>
21 28 Annamaria Kiss
imagefolder=folder containing the images to normalise (.tif format)
22 11 Annamaria Kiss
30=common Otsu value
23 1 Annamaria Kiss
24 19 Annamaria Kiss
h2. 3. Detect the contour
25 1 Annamaria Kiss
26 15 Annamaria Kiss
The followings are different possibilities. Choose your favorite detection method and apply it on your normalised images.
27 12 Annamaria Kiss
28 19 Annamaria Kiss
h3. 3.1. By a threshold
29 2 Annamaria Kiss
30 19 Annamaria Kiss
h3. 3.2. Using the EdgeDetect of MorphoGraphX (mgx)
31 1 Annamaria Kiss
32 31 Annamaria Kiss
Use the MGX_EdgeDetect.py script on MorphoGraphX:
33 31 Annamaria Kiss
- open the script file with a texteditor;
34 31 Annamaria Kiss
- put the path to the directory of grey sepal images (line 13)
35 31 Annamaria Kiss
- save the script file
36 31 Annamaria Kiss
- drag and drop the script file on the MorphoGraphX black window
37 31 Annamaria Kiss
38 39 Annamaria Kiss
*Remark:*
39 40 Annamaria Kiss
Before you lounch the scrcipt the first time in a session, you need to do a clicks on MorphographX:
40 39 Annamaria Kiss
-> Process -> System -> set current stack -> Both + double click on Set current stack
41 31 Annamaria Kiss
42 19 Annamaria Kiss
h3. 3.3. By the level set method (lsm)
43 3 Annamaria Kiss
44 1 Annamaria Kiss
cd in the directory with the smoothed tif files
45 1 Annamaria Kiss
<pre>
46 8 Annamaria Kiss
lsm-contour_mp.py imagefolder
47 1 Annamaria Kiss
</pre>
48 6 Annamaria Kiss
49 19 Annamaria Kiss
h3. 3.4. Lounch lsm on an already prepared initial contour (mgx for instance)
50 1 Annamaria Kiss
51 1 Annamaria Kiss
cd the directory, which contains a directory of (normalised and smoothed) images and another with the initial contours (same filename cooresponding to the same image)
52 1 Annamaria Kiss
<pre>
53 1 Annamaria Kiss
lsm-contour_mp-from-init.py imagefolder initcontourfolder
54 1 Annamaria Kiss
</pre>
55 1 Annamaria Kiss
detected contours are written in the folder « contours »
56 1 Annamaria Kiss
57 19 Annamaria Kiss
h2. 4. Orient sepals
58 1 Annamaria Kiss
59 1 Annamaria Kiss
cd in the folder containing the contours folder and type
60 1 Annamaria Kiss
<pre>orient_sepals.sh contours filetype</pre>
61 1 Annamaria Kiss
contours = folder name containing the contours
62 1 Annamaria Kiss
filetype = '.tif' or '.inr.gz'
63 1 Annamaria Kiss
the oriented sepals are written in the "contours_oriented" folder
64 1 Annamaria Kiss
65 19 Annamaria Kiss
h2. 5. Do measurements
66 1 Annamaria Kiss
67 32 Annamaria Kiss
h3. 5.1. All but area measurements
68 32 Annamaria Kiss
69 1 Annamaria Kiss
detected contours are in the folder « contours »
70 7 Annamaria Kiss
cd in the folder containing the oriented contours and type
71 1 Annamaria Kiss
<pre>measure_sepals.py foldername filetype</pre>
72 1 Annamaria Kiss
foldername = folder name containing the oriented contours
73 1 Annamaria Kiss
filetype = '.tif' or '.inr.gz'
74 1 Annamaria Kiss
the measurements are written in the "foldername_measures.csv" file
75 32 Annamaria Kiss
76 32 Annamaria Kiss
h3. 5.2. Area measurements
77 32 Annamaria Kiss
78 32 Annamaria Kiss
Use the MGX_CurvatureMapSegmentation.py script on MorphoGraphX:
79 32 Annamaria Kiss
- open the script file with a texteditor;
80 32 Annamaria Kiss
- put the path to the directory of sepal contours (line 13)
81 32 Annamaria Kiss
- save the script file
82 32 Annamaria Kiss
- drag and drop the script file on the MorphoGraphX black window
83 32 Annamaria Kiss
84 34 Annamaria Kiss
The segmented meshes (abaxial and adaxial surfaces are treated as cells) as well as one csv file per sepal containing the surface areas are saved.