diff --git a/.nojekyll b/.nojekyll index 6c3868a..aa8c0e5 100644 --- a/.nojekyll +++ b/.nojekyll @@ -1 +1 @@ -09d391de \ No newline at end of file +ba3290f6 \ No newline at end of file diff --git a/index.html b/index.html index bb5b885..4d38625 100644 --- a/index.html +++ b/index.html @@ -206,7 +206,7 @@
Categories
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+

diff --git a/posts/AFM-data/Figure_1_quarto.png b/posts/AFM-data/Figure_1_quarto.png new file mode 100644 index 0000000..aa978bd Binary files /dev/null and b/posts/AFM-data/Figure_1_quarto.png differ diff --git a/posts/AFM-data/Figure_2_quarto.png b/posts/AFM-data/Figure_2_quarto.png new file mode 100644 index 0000000..04208eb Binary files /dev/null and b/posts/AFM-data/Figure_2_quarto.png differ diff --git a/posts/AFM-data/Figure_3_quarto.png b/posts/AFM-data/Figure_3_quarto.png new file mode 100644 index 0000000..6dd33fd Binary files /dev/null and b/posts/AFM-data/Figure_3_quarto.png differ diff --git a/posts/AFM-data/index.html b/posts/AFM-data/index.html index 2d10a4d..fdb3461 100644 --- a/posts/AFM-data/index.html +++ b/posts/AFM-data/index.html @@ -23,6 +23,40 @@ margin: 0 0.8em 0.2em -1em; /* quarto-specific, see https://github.com/quarto-dev/quarto-cli/issues/4556 */ vertical-align: middle; } +/* CSS for syntax highlighting */ +pre > code.sourceCode { white-space: pre; position: relative; } +pre > code.sourceCode > span { line-height: 1.25; } +pre > code.sourceCode > span:empty { height: 1.2em; } +.sourceCode { overflow: visible; } +code.sourceCode > span { color: inherit; text-decoration: inherit; } +div.sourceCode { margin: 1em 0; } +pre.sourceCode { margin: 0; } +@media screen { +div.sourceCode { overflow: auto; } +} +@media print { +pre > code.sourceCode { white-space: pre-wrap; } +pre > code.sourceCode > span { display: inline-block; text-indent: -5em; padding-left: 5em; } +} +pre.numberSource code + { counter-reset: source-line 0; } +pre.numberSource code > span + { position: relative; left: -4em; counter-increment: source-line; } +pre.numberSource code > span > a:first-child::before + { content: counter(source-line); + position: relative; left: -1em; text-align: right; vertical-align: baseline; + border: none; display: inline-block; + -webkit-touch-callout: none; -webkit-user-select: none; + -khtml-user-select: none; -moz-user-select: none; + -ms-user-select: none; user-select: none; + padding: 0 4px; width: 4em; + } +pre.numberSource { margin-left: 3em; padding-left: 4px; } +div.sourceCode + { } +@media screen { +pre > code.sourceCode > span > a:first-child::before { text-decoration: underline; } +} /* CSS for citations */ div.csl-bib-body { } div.csl-entry { @@ -231,6 +265,7 @@

On this page

  • Raw image pre-processing
  • Segmentation
  • Centerline
  • +
  • References
  • @@ -241,18 +276,13 @@

    On this page

    -
    -
    -
    1
    -
    -

    We present here the protocole to process biological images such as bacteria atomic force miroscopy data. We want to study the bacteria cell shape and extract the main geometrical feature.

    Biological context

    -

    Mycobacterium smegmatis is Grahm-positive rod shape bacterium. It is 3 to 5 \(\mu m\) long and around 500 \(nm\) wide. This non-pathogenic species is otften used a biological model to study the pathogenic Mycobacteria such as M.tuberculosis (responsible for the tubercuosis) or M.abscessus, with which it shares the same cell wall structure(Tyagi and Sharma 2002) . In particular M.smegmatis has a fast growth (3-4 hours doubling time compared to 24h for M. tuberculosis), allowing for faster experimental protocols.

    +

    Mycobacterium smegmatis is Grahm-positive rod shape bacterium. It is 3 to 5 \(\mu m\) long and around 500 \(nm\) wide. This non-pathogenic species is otften used a biological model to study the pathogenic Mycobacteria such as M.tuberculosis (responsible for the tubercuosis) or M.abscessus, with which it shares the same cell wall structure (Tyagi and Sharma 2002). In particular M.smegmatis has a fast growth (3-4 hours doubling time compared to 24h for M. tuberculosis), allowing for faster experimental protocols.

    Here are some know properties of M.smegmatis bacteria :

      -
    • They present variation of cell diameter along their longitudinal axis (Eskandarian et al. 2017). The cell diameter is represented as a height profile along the cell centerline. We respectively name peaks and troughs the local maxima and minima of this proile.
    • +
    • They present variation of cell diameter along their longitudinal axis (Eskandarian et al. 2017). The cell diameter is represented as a height profile along the cell centerline. We respectively name peaks and troughs the local maxima and minima of this profile.
    @@ -261,7 +291,7 @@

    Biological context

      -
    • They grow following a biphasic and asymetrical polar dynamics(Hannebelle et al. 2020). The cells elongate from the poles, where material is added. After division, the pre-existing pole (OP) elongate at a high rate, whereas the newly created pole (NP) has first a slow growth, and then switches to a fast growth, after the New End Take Off (NETO).
    • +
    • They grow following a biphasic and asymetrical polar dynamics (Hannebelle et al. 2020). The cells elongate from the poles, where material is added. After division, the pre-existing pole (OP) elongate at a high rate, whereas the newly created pole (NP) has first a slow growth, and then switches to a fast growth, after the New End Take Off (NETO).
    @@ -274,29 +304,188 @@

    Biological context

    Raw image pre-processing

    Data

    -

    Several data acquisitions were conducted with wild types and different mutant strains. The raw data is composed of AFM log files times series for each experiments. Each log file contain several images, each one representing a physical channel such as height, stiffness, adhesion etc.

    +

    Several data acquisitions were conducted with wild types and different mutant strains. The raw data is composed of AFM log files times series for each experiments. Each log file contain several images, each one representing a physical channel such as height, stiffness, adhesion etc. After extraction of the data, forward and backward cells are aligned, artefacts such as image scars are detected and corrected.

    +
    +
    +

    +
    At each time step, images representing different physical variables are produced by the AFM
    +
    +

    Segmentation

    +

    At each time steps, images are segmented to detect each cells using the cellpose package (Stringer et al. 2021). If available, different physical channels are combined to improve the segmentation. Forward and backward images are also combined.

    +
    +
    +

    +
    Images are combined to improve the segmentation
    +
    +
    +

    Here is an example on how to use cellpose on an image. Different models are available (with the seg_mod variable), depending on the training datasets. With cellpose 3, different denoising models are also available (with the denoise_mod variable).

    +
    +
    +Code +
    import numpy as np
    +import matplotlib.pyplot as plt
    +from cellpose import io, denoise, plot
    +from PIL import Image
    +
    +
    +'''
    +Parameters
    +'''
    +
    +image_path = 'raw_img.png'
    +path_to_save = 'segmented_img'
    +# Segmentation model type
    +seg_mod = 'cyto'   
    +# Denoizing model
    +denoise_mod = "denoise_cyto3"  
    +# Expected cell diameter (pixels)
    +dia = 40
    +# Type of segmentation (with / without nuclei, different color channels or not)
    +chan = [0,0] 
    +# Segmentation sensibility parameters
    +thres = 0.8
    +celp = 0.4
    +
    +'''
    +Computing segmentation
    +'''
    +
    +
    +# Opening image to segment
    +img=np.array(Image.open(image_path))[:,:,1]
    +
    +# Chosing a model type :
    +model = denoise.CellposeDenoiseModel(gpu=False, model_type=seg_mod, restore_type=denoise_mod)
    +
    +# Computing segmentaion
    +masks, flows, st, diams = model.eval(img, diameter = dia, channels=chan, flow_threshold = thres, cellprob_threshold=celp)
    +
    +
    +# Saving the results into a numpy file
    +io.masks_flows_to_seg(img, masks, flows, path_to_save, channels=chan, diams=diams)
    +
    +
    +

    We plot the final results :

    +
    +
    +Code +
    plt.imshow(img,cmap='gray')
    +plt.show()
    +
    +
    +
    +
    +

    +
    Raw image
    +
    +
    +
    +
    +
    +
    +Code +
    mask_RGB = plot.mask_overlay(img,masks)
    +plt.imshow(mask_RGB)
    +plt.show()
    +
    +
    +
    +
    +

    +
    Image with segmented masks overlaid
    +
    +
    +
    +
    +

    Centerline

    +

    Since we are interested in studying the variations of the cell diameter, we define height profile as the value of the cell height along the cell centerline. The cell centerline are computed using a skeletonization algorithm Lee, Kashyap, and Chu (1994). Here is an example of skeletonization

    +
    +
    +Code +
    from skimage.morphology import skeletonize
    +
    +# Selecting first mask
    +first_mask =  masks == 1
    +
    +skel_img = skeletonize(first_mask, method='lee')  
    +skel = np.argwhere(skel_img)
    +plt.imshow(first_mask, cmap='gray')
    +
    +plt.scatter(skel[:,1], skel[:,0], 0.5*np.ones(np.shape(skel[:,0])), color='r', marker='.')
    +plt.show()
    +
    +
    +
    +
    +

    +
    +
    +
    +
    +

    Depending on the masks shapes, centerlines may have branches :

    +
    +
    +Code +
    from skimage.morphology import skeletonize
    +
    +# Selecting first mask
    +first_mask =  masks == 3
    +
    +skel_img = skeletonize(first_mask)  #, method='lee'
    +skel = np.argwhere(skel_img)
    +plt.imshow(first_mask, cmap='gray')
    +
    +plt.scatter(skel[:,1], skel[:,0], 0.5*np.ones(np.shape(skel[:,0])), color='r', marker='.')
    +plt.show()
    +
    +
    +
    +
    +

    +
    +
    +
    +
    +

    In practice, centerlines are pruned and extended to the cell poles, in order to capture the cell length. Other geometrical properties such as masks centroids or outlines are computed as well.

    +
    +
    +

    +
    Final static processing results in real life data. White masks are excluded from the cell tracking algorithm (see part 2). Black dots are cell centroids. The yellow boxes represent artefacts cleaning.
    +
    +
    +
    +
    -

    Centerline

    +

    References

    Eskandarian, Haig A, Pascal D Odermatt, Joëlle XY Ven, Melanie Hannebelle, Adrian P Nievergelt, Neeraj Dhar, John D McKinney, and Georg E Fantner. 2017. “Division Site Selection Linked to Inherited Cell Surface Wave Troughs in Mycobacteria.” Nature Microbiology 2 (9): 1–6.
    Hannebelle, Mélanie, Joëlle XY Ven, Chiara Toniolo, Haig A Eskandarian, Gaëlle Vuaridel-Thurre, John D McKinney, and Georg E Fantner. 2020. “A Biphasic Growth Model for Cell Pole Elongation in Mycobacteria.” Nature Communications 11 (1): 1–10.
    +
    +Lee, Ta-Chih, Rangasami L Kashyap, and Chong-Nam Chu. 1994. “Building Skeleton Models via 3-d Medial Surface Axis Thinning Algorithms.” CVGIP: Graphical Models and Image Processing 56 (6): 462–78. +
    +
    +Stringer, Carsen, Tim Wang, Michalis Michaelos, and Marius Pachitariu. 2021. “Cellpose: A Generalist Algorithm for Cellular Segmentation.” Nature Methods 18 (1): 100–106. +
    Tyagi, Jaya Sivaswami, and Deepak Sharma. 2002. “Mycobacterium Smegmatis and Tuberculosis.” Trends in Microbiology 10 (2): 68–69.
    +
    +Zhang, Tongjie Y, and Ching Y. Suen. 1984. “A Fast Parallel Algorithm for Thinning Digital Patterns.” Communications of the ACM 27 (3): 236–39. +