Wiki

Version 36 (Annamaria Kiss, 11/03/2021 10:09)

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