Table Of Contents

Previous topic

Segmentation

Next topic

Reference guide

This Page

Modeling and Structural Analysis

Analysis of tissue properties

The goal of this document is to describe how extract a modeling template for the tissue, ie get some information about the number of cells, each cells volume, neighborhood structure and the shared surface area of two neighboring cells.

The python script for this example can be downloaded (download file : mars_alt_analysis.py) along with the images (download images: plantB-data.tar.gz). To run the script, it must be in the same directory than the images and run in a shell console using:

user@computer:$ python mars_alt_analysis.py

Reading and display a segmented image

A segmented image (for example in inrimage format) can be loaded in openalea.image as follows:

1
2
3
4
5
6
from openalea.image import imread,display
im = imread('segmentation.inr.gz')

from PyQt4 import QtGui
app = QtGui.QApplication([])
w = display(im)

Dealing with cells

First, let us read the properties of tissue with the function VTissueAnalysis().

1
2
from vplants.mars_alt import VTissueAnalysis
properties = VTissueAnalysis(im)

Properties

Number of cells

nlabels() look at the number of cells in the tissue

1
properties.nlabels()

Center of mass

center_of_mass() look at the center of mass of cells in the tissue.

For a single cell :

1
properties.center_of_mass(255)

Warning

Default, the center of mass is determined in the in real-world units.

To compute the center of mass in voxels :

1
properties.center_of_mass(255, real=False)

For a sequence of cells :

1
properties.center_of_mass([265,300])

For all of cells :

1
properties.center_of_mass()

Volume

volume() look at the volume of cells in the tissue.

For a single cell :

1
properties.volume(255)

Warning

Default, the volume is determined in the in real-world units.

To compute the volume in voxels :

1
properties.volume(255, real=False)

For a sequence of cells :

1
properties.volume([265,300])

For all of cells :

1
properties.volume()

Neighbors

neighbors() look at the neighborhood cells eg. which cells have contact with a given cell.

For a single cell :

1
properties.neighbors(255)

Warning

Any non-one values are used as labels of cells and one values are considered the background.

For a sequence of cells :

1
properties.neighbors([265,300])

For all of cells :

1
properties.neighbors()

Warning

The computing time can be quite long depending on the number of cells.

Shared surface area of two neighboring cells

surface_area() look at the surface area between two neighborhood cells.

1
properties.surface_area(255,1)

Note

The following functions are implemented as nodes within VisuAlea .

../_images/dataflow_analysis4.png

Figure 1 : Analysis functions in VisuAlea.

Extract cells in the layer 1

extract_L1() return the list of all the cells in the layer 1.

1
2
3
4
5
from openalea.image import imread
im = imread('segmentation.inr.gz')

from vplants.mars_alt import extract_L1
L1 = extract_L1(im)
../_images/dataflow_extract_L14.png

Figure 2 : extract_L1 function in VisuAlea.

Structural Analysis

The goal of this document is to describe how extract structures for the tissue, ie get walls for example.

The python script for this example can be downloaded (download file : mars_alt_structural_analysis.py) along with the images (download images: plantB-data.tar.gz). To run the script, it must be in the same directory than the images and run in a shell console using:

user@computer:$ python mars_alt_structural_analysis.py

Draw walls

draw_walls() can be used for drawing walls from a segmented image.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
from openalea.image import imread,display
im = imread('segmentation.inr.gz')

from PyQt4 import QtGui
app = QtGui.QApplication([])
w1 = display(im)

from vplants.mars_alt import draw_walls
walls = draw_walls(im)

w2 = display(walls)
../_images/extract_walls4.png

Figure 3 : Display walls from a segmented image.

It is possible to inverse the walls with the openalea.image.reverse_image() function.

1
2
3
4
from openalea.image import reverse_image
walls_inv = reverse_image(walls)

w3 = display(walls_inv)
../_images/walls_inverse4.png

Figure 4 : Display walls from a segmented image.

../_images/dataflow_draw_walls4.png

Figure 5 : Display walls from a segmented image in VisuAlea.

Draw L1

draw_L1() can be used for drawing the cells in the layer1 from a segmented image.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
from openalea.image import imread,display
im = imread('segmentation.inr.gz')

from PyQt4 import QtGui
app = QtGui.QApplication([])
w1 = display(im)

from vplants.mars_alt import draw_L1
imL1 = draw_L1(im)

w2 = display(imL1)
../_images/draw_L14.png

Figure 6 : Display the cells in the layer 1 from a segmented image.

../_images/dataflow_draw_L14.png

Figure 7 : Display the cells in the layer 1 from a segmented image in VisuAlea.