forImage
vignetteBiovolume is a valuable non-destructive option to estimate foraminiferal biomass. Time and effort are the usual constrains associated with biovolume method through manual and semi-automatic measurements, which are often more susceptible to bias (Mazurkiewicz et al. 2016). These limitations lead us to develop the forImage
package as an alternative to manual and/or multi-software dependent methods for biometry and biomass estimation. This and other issues were considered during the package development to guide size data acquisition and processing, to turn biomass estimation friendlier to non-experts in biometry and expand the use of foraminiferal biomass in marine ecology and paleoecology.
The forImage
is available in GitHub. To install the package via GitHub use:
remotes::install_github("ThaiseRF/forImage")
The package requires Python >= 3.5
# loading the package
library(forImage)
Use install_measure()
to install all Python modules dependencies at once in a virtual environment. This function is a wrapper of reticulate py_install()
and requires a conda
installation on Windows.
The package contains the raw format of the following data:
.tif
+ metadata .xml
).csv
), that were grouped in genus, and are available in the package.pco
) of the test of 73 Foraminifera genera individually measured, along with matching geometric model. See data_pco
These data were included to exemplify how the package is used within distinct morphological shapes and to illustrate the measurement acquisition.
To import the example photomicrograph use:
img <- system.file("extdata", "foram.tif", package="forImage")
To load the package size data use:
data("ammonia")
data("bolivina")
head(ammonia)
species ind h d_one d_two area pco
1 aparkinsoniana 1 124.36 52 121.34 11279.95 1.0000000
2 aparkinsoniana 2 113.33 64 111.67 9732.05 1.0000000
3 aparkinsoniana 3 99.88 46 99.43 7507.66 0.6341257
4 aparkinsoniana 4 98.68 40 93.24 6800.34 0.7330045
5 aparkinsoniana 5 189.64 75 184.05 25241.95 0.5468639
6 aparkinsoniana 6 160.18 72 162.75 20475.33 0.5011773
The ammonia
data contains test height (h
), minor (d_one
) and major diameter (d_two
), surface area (area
) and percent of cell occupancy of 867 individuals from two species of genus Ammonia that were previously measured individually. We calculate the test volume for this genus using the ellipsoid model as follows:
volume.total(ammonia, model = '10hl')
# A tibble: 867 x 8
species ind h d_one d_two area pco vol
<chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
1 aparkinsoniana 1 124. 52 121. 11280. 1 410853.
2 aparkinsoniana 2 113. 64 112. 9732. 1 424092.
3 aparkinsoniana 3 99.9 46 99.4 7508. 0.634 239195.
4 aparkinsoniana 4 98.7 40 93.2 6800. 0.733 192704.
5 aparkinsoniana 5 190. 75 184. 25242. 0.547 1370647.
6 aparkinsoniana 6 160. 72 163. 20475. 0.501 982789.
7 aparkinsoniana 7 109. 42 105. 8357. 1 253071.
8 aparkinsoniana 8 133. 53 118. 10862. 0.335 433931.
9 aparkinsoniana 9 122. 42 117. 10333. 0.698 312459.
10 aparkinsoniana 10 113. 49 111. 9135. 0.810 321234.
# ... with 857 more rows
total <- dplyr::bind_rows("ammonia" = ammonia, "bolivina" = bolivina, .id = "genus")
total$model[total$genus == "ammonia"] <- "10hl"
total$model[total$genus == "bolivina"] <- "13hlsl"
volume.total(total)
# A tibble: 1,495 x 10
genus species ind h d_one d_two area pco model vol
<chr> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <chr> <dbl>
1 ammonia aparkinsoniana 1 124. 52 121. 11280. 1 10hl 410853.
2 ammonia aparkinsoniana 2 113. 64 112. 9732. 1 10hl 424092.
3 ammonia aparkinsoniana 3 99.9 46 99.4 7508. 0.634 10hl 239195.
4 ammonia aparkinsoniana 4 98.7 40 93.2 6800. 0.733 10hl 192704.
5 ammonia aparkinsoniana 5 190. 75 184. 25242. 0.547 10hl 1370647.
6 ammonia aparkinsoniana 6 160. 72 163. 20475. 0.501 10hl 982789.
7 ammonia aparkinsoniana 7 109. 42 105. 8357. 1 10hl 253071.
8 ammonia aparkinsoniana 8 133. 53 118. 10862. 0.335 10hl 433931.
9 ammonia aparkinsoniana 9 122. 42 117. 10333. 0.698 10hl 312459.
10 ammonia aparkinsoniana 10 113. 49 111. 9135. 0.810 10hl 321234.
# ... with 1,485 more rows
The models volume formulas can be assessed in ?volume.total
For all genus that were already allocated in the best fitted geometric model (see ??data_pco
), is possible to calculate the biovolume directly using the argument genus
, which will not only set the geometric model but also attribute a specific pco
. If the genus is unknown the model
argument can be used to calculate biovolume. Then the default is pco = 0.76
. Here is a few of the genus that also contain example data.
genus |
geometric model |
---|---|
“ammonia” | ellipsoid |
“amphistegina” | cone or double cone |
“angulogerina” | cone + half-ellipsoid |
“asterotrochammina” | paraboloid |
“bolivina” | gomphonemoid |
“cibicidoides” | half sphere |
“discorbinella” | dome |
“laevipeneroplis” | prolate spheroid |
“loxostomina” | prism on elliptic base |
“nonionella” | half-elliptic prism |
“patellina” | cone |
“quinqueloculina” | triangular dipyramid or ellipsoid |
“rectocibicides” | area x height |
“spirillina” | cylinder |
textularia" | elliptic cone |
vt <- bio.volume(total)
head(vt)
# A tibble: 6 x 11
# Rowwise:
genus species ind h d_one d_two area pco model vol biovol
<chr> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <chr> <dbl> <dbl>
1 ammonia aparkinsoni~ 1 124. 52 121. 11280. 1 10hl 4.11e5 4.11e5
2 ammonia aparkinsoni~ 2 113. 64 112. 9732. 1 10hl 4.24e5 4.24e5
3 ammonia aparkinsoni~ 3 99.9 46 99.4 7508. 0.634 10hl 2.39e5 1.52e5
4 ammonia aparkinsoni~ 4 98.7 40 93.2 6800. 0.733 10hl 1.93e5 1.41e5
5 ammonia aparkinsoni~ 5 190. 75 184. 25242. 0.547 10hl 1.37e6 7.50e5
6 ammonia aparkinsoni~ 6 160. 72 163. 20475. 0.501 10hl 9.83e5 4.93e5
Organic carbon biomass can finally be individually calculated from informed biovolume and the chosen conversion factor as method
argument. The default conversion factor of (Michaels et al. 1995) is used when the method
is omitted
Reference | method |
Conversion factor |
---|---|---|
Saidova (1967) | "saidova" |
0.1027gCorg.cm-3 |
Strathmann (1967) | "strathmann" |
0.110pgCorg.cm-3 |
Gerlach, Hahn, and Schrage (1985) | "gerlach" |
0.113gCorg.cm-3 |
Turley, Newell, and Robins (1986) | "turley" |
0.132pgCorg.cm-3 |
Putt and Stoecker (1989) | "putt" |
0.140pgCorg.cm-3 |
Michaels et al. (1995) | "michaels" |
0.089pgCorg.cm-3 |
bt <- biomass(vt, method = "gerlach")
head(bt)
# A tibble: 6 x 12
genus species ind h d_one d_two area pco model vol biovol biomass
<chr> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <chr> <dbl> <dbl> <dbl>
1 ammo~ aparki~ 1 124. 52 121. 11280. 1 10hl 4.11e5 4.11e5 0.0464
2 ammo~ aparki~ 2 113. 64 112. 9732. 1 10hl 4.24e5 4.24e5 0.0479
3 ammo~ aparki~ 3 99.9 46 99.4 7508. 0.634 10hl 2.39e5 1.52e5 0.0171
4 ammo~ aparki~ 4 98.7 40 93.2 6800. 0.733 10hl 1.93e5 1.41e5 0.0160
5 ammo~ aparki~ 5 190. 75 184. 25242. 0.547 10hl 1.37e6 7.50e5 0.0847
6 ammo~ aparki~ 6 160. 72 163. 20475. 0.501 10hl 9.83e5 4.93e5 0.0557
In case you don’t have size data available to estimate biomass, you can measure the test size from photomicrographs with the measure
function. This function is partly written in Python via the reticulate
R package.
Let’s take a look into this specimen:
To measure the specimen run:
m <- measure(img)
m
filename diamA diamB area
1 foram 210.676 176.8162 28341.3
In this case, we are only measuring the individual’s size, and the function only returns a data frame with surface area, major and minor axis measured. To decrease the processing time and allow the processing of several images at once, the resulted images are not plotted, but can be saved as .png
files in a chosen directory if save = TRUE
.
Let’s see the resulted image:
More than one specimen in the same image can be measure at the same time, yet this should be used with caution to not decrease the accuracy. The possibility of assessing the percent of cell occupancy via the measure
function is also under development.
If the photomicrograph contains metadata is possible to access the scaling information directly. The metric/pixel information scale
or a reference scale ref_scale
can be also used in the measure
function to set the correct scaling.
Not only the pixel size but also the z-stack information (if available) can be accessed via the metadata. This function is still under construction to access other types of image metadata.
meta <- system.file("extdata", "foram.tif_meta.xml", package="forImage")
meta <- depth.xml(meta)
meta
filename z_depth
1 foram 72
m$z_depth <- meta$z_depth
The measured specimen data can be wrangled to fit the volumetric functions requirements.
library(magrittr)
library(dplyr)
df <- m %>%
rowwise() %>%
mutate(h = case_when(diamA > diamB ~ diamA, TRUE ~ diamB),
d_two = case_when(diamA > diamB ~ diamB, TRUE ~ diamA),
d_one = z_depth) %>%
select(-diamA, -diamB, -z_depth)
df <- bio.volume(df, genus = "ammonia")
biomass(df, method = "gerlach")
# A tibble: 1 x 9
filename area h d_two d_one model vol biovol biomass
<chr> <dbl> <dbl> <dbl> <int> <chr> <dbl> <dbl> <dbl>
1 foram 28341. 211. 177. 72 10hl 1404327. 1102860. 0.125
To obtain satisfactory results is important to keep in mind:
Image quality
Focus range
Lighting
Processed images revision