Skip to content

Latest commit

 

History

History
372 lines (291 loc) · 16.8 KB

README.md

File metadata and controls

372 lines (291 loc) · 16.8 KB

CRAN status status DOI R-CMD-check Build Status

iconr R package
modeling Prehistoric iconography

Created by Thomas Huet, Jose M Pozo, Craig Alexander

The iconr R package purpose is to contribute to cross-cultural comparison of iconography through a greater normalization of quantitative analysis. The package stable version deals with composition analysis1, the package development version deals with both composition and geometric morphometric.


The R package iconr is grounded in graph theory, spatial analysis (composition analysis), and shape analysis (geometric morphometric) to offer concepts, measurments and functions for modeling Prehistoric iconography and preparing for further analysis (clustering, typology tree, Harris diagram, etc.). The theoretical background is as follows:

  • Some objects (eg, pottery, rock panels) have a decoration;
  • A decoration is composed of graphical units (GUs);
  • GUs can be modeled as POINTS or drawn as LINES or POLYGONS (2D);
  • Shape analysis can measures the similarities between two GUs (eg. Procrustes distance);
  • GUs are considered as nodes;
  • Nodes have neighbourhood relations one with another depending on their spatial proximities;
  • A decoration is considered as a spatial graph, modeled with graph theory and analysed with network and spatial analysis;

Spatial, network and shape indices can be calculated for every nodes and every decoration (i.e. graph). Each decoration can be compared to another decoration on the basis of local or global indices (e.g. degree and degree distribution) and on the basis of their shape indices;

As favored GIS entry, GIS indices (x and y dimensions) can also be used.


See how to contribute to the next package release; how to report an issue using the issue template.

Stable version: the Analysis of Compositions

The iconr v. 0.1.0 stable version can be installed from the CRAN. It allows GUs composition analysis)

install.packages("iconr")

The v. 0.1.0 allows the analysis of compositions

Photograph of Solana de Cabañas (Extremadura, Spain) Late Bronze Age stele2 [1]. Graphical units (GUs) drawing [2]. Each GU is recorded with a vertex (POINT) [3], and each contiguous vertex (Voronoi cell) is linked with an edge [4, 5].

See the package vignette

Overview of the functions for the analysis of compositions

The iconr v. 0.1.0 functions' descriptions and examples are available on this website.

Description

The package as a sample of 5 decorations3:

idf site decor img
1 Cerro Muriano Cerro Muriano 1 Cerro_Muriano.Cerro_Muriano_1.jpg
2 Torrejon Rubio Torrejon Rubio 1 Torrejon_Rubio.Torrejon_Rubio_1.jpg
3 Brozas Brozas Brozas.Brozas.jpg
4 Zarza de Montanchez Zarza De Montanchez Zarza_de_Montanchez.Zarza_De_Montanchez.jpg
5 Ibahernando Ibahernando Ibahernando.Ibahernando.jpg
1 2 3 4 5
Cerro Muriano, stele 1 Torrejon Rubio, stele 1 Brozas stele Zarza de Montanchez, stele Ibahernando stele
Plot

Set data folder, select the decoration to be plotted, read files of nodes, edges, and images and plot a decoration

dataDir <- system.file("extdata", package = "iconr")
site <- "Brozas" ; decor <- "Brozas"
nds.df <- read_nds(site, decor, dataDir)
eds.df <- read_eds(site, decor, dataDir)
imgs <- read.table(paste0(dataDir, "/imgs.tsv"),
                   sep="\t", stringsAsFactors = FALSE)
plot_dec_grph(nds.df, eds.df, imgs,
              site, decor,
              dir = dataDir,
              lbl.size = 0.4,
              nd.var = "type")

Comparisons

Common edges between pairs of decorations allow to measure the similarities in their composition. Common edges are more accurate than common nodes (see also, nds_compar() and eds_compar()) For example, we plot common edges shared by the three first decorations of the training dataset with the plot_compar() function

imgs <- read.table(system.file("extdata", "imgs.tsv", package = "iconr"),
                   sep="\t", stringsAsFactors = FALSE)
nodes <- read.table(system.file("extdata", "nodes.tsv", package = "iconr"),
                    sep="\t", stringsAsFactors = FALSE)
edges <- read.table(system.file("extdata", "edges.tsv", package = "iconr"),
                    sep="\t", stringsAsFactors = FALSE)
lgrph <- list_dec(imgs, nodes, edges)
g.compar <- list_compar(lgrph, nd.var="type")
plot_compar(g.compar, c(1, 2, 3), 
            focus = "edges",
            nd.size = c(0.5, 1.5),
            ed.width = c(1, 2.5),
            dir = dataDir,
            img.format = "png")

The same result, but in the form of a coincidence matrix, can be obtained with the function same_elements()

Comparisons between sets can be based on common edges, which take into account the common combination of two nodes with their edge type, and common nodes, which take into account only the presence of common nodes

In this example, in both groupings, the Brozas stela (decoration 3) and the Ibahernando stela (decoration 5) have the highest proximities (i.e. the lowest Euclidean distance)

Citation

Use the canonical form to cite the package in R (citation("iconr")):

@Manual{Huet21pckg,
  title = {iconr: Graphical and Spatial Analysis for Prehistoric Iconography},
  author = {Thomas Huet and Jose Pozo},
  year = {2021},
  note = {R package version 0.1.0},
  url = {https://CRAN.R-project.org/package=iconr},
}

The iconr v. 0.1.0 package has also been published in the Journal of Open Source Software under this BibTex reference:

@article{Huet21joss,
  doi = {10.21105/joss.03191},
  url = {https://doi.org/10.21105/joss.03191},
  year = {2021},
  publisher = {The Open Journal},
  volume = {6},
  number = {61},
  pages = {3191},
  author = {Thomas Huet and Jose M. Pozo and Craig Alexander},
  title = {Analysis of Prehistoric Iconography with the R package iconr},
  journal = {Journal of Open Source Software}
}

Development version: the Analysis of Compositions and Geometric Morphometry

The iconr latest version, or development version v. 0.1.1, deals with both GUs composition and GUs shapes (geometric morphometric). Currently it takes in charge POLYGON geometries to perform Geometric Morphometry measurements (GMM). This development version can be downloaded from GitHub

devtools::install_github("zoometh/iconr")

Geometric Morphometry measurements' functions overview

The iconr v. 0.1.1 functions are named morph_* (morphology) and conv_* (conversions). Find their documentation directly on R (eg, ?morph_nds_compar). They are performed with the R package Momocs

flowchart LR
    T[User entry]:::iconRusr ---> A[(Postgres<br>DB)];
    T ---> Q[[GIS]];
    T ---> R((Geo<br>JSON));
    A ---> B{{"conv_pg_to_shp()"}}:::iconRpkg;
    B ---> C((SHP));
    Q ---> C;
    R ---> S{{"conv_geojson_to_wkt()"}}:::iconRpkg;
    S ---> E((WKT));
    C ---> D{{"conv_shp_to_wkt()"}}:::iconRpkg;
    D ---> E;
    E ---> F{{"conv_wkt_to_jpg()"}}:::iconRpkg;
    F ---> G((JPG));
    G ---> J{{"morph_nds_compar()"}}:::iconRpkg;
    J ---> K[elemental<br>comparison];
    J ---> U[User threshold]:::iconRusr;
    U ---> H{{"morph_nds_group()"}}:::iconRpkg;
    H ---> I[elemental<br>classification];
    E ---> L{{"morph_resume()"}}:::iconRpkg;
    L ---> P[dataset<br>description];
    I ---> M[[elemental<br>distance<br>matrix]];
    I ---> V[[elemental<br>distance<br>matrix]];
    I ---> W[[...<br>...<br>...]];
    M ---> N{{"morph_aggregate()"}}:::iconRpkg;
    V ---> N;
    W ---> N;
    N ---> O[decor<br>classification];
    classDef iconRpkg fill:#add8e6;
    classDef iconRusr fill:#ffa500;
Loading

Compare GUs' shapes

The sample dataset is composed on 5 decorated objects, belonging from 4 sites of the Near-East Pre-Pottery Neolithic:

Ain Ghazal, statue 2, cache 2 Ain Ghazal, statue 5, cache 2 Jericho, statue A, cache 195 Kfar Hahoresh, modelled skull Qarassa, bone wand

The graphical units 'faces' ('visages'), 'eyes' ('oeils'), and 'mouths' ('bouches') are drawn in a GIS

img-name

Resume the GUs geometries

After downloading the PPNB dataset, set 'PPN' as the current working directory (setwd("*my_path*/PPN"")), read and convert the 'nodes.csv' Well-Known Text geometries to JPG, and resume information

nodes <- read.csv2("*my_path*/PPN/_out/nodes.csv")
conv_wkt_to_jpg(nodes = nodes)
morph_resume(dataDir = "*my_path*/PPN",
             nodes = nodes)

Compare the different types of GUs

Stack the countours of 'faces' ('visages'), 'eyes' ('oeils'), and 'mouths' ('bouches')

conv_wkt_to_jpg(nodes = nodes)
nodes <- read.csv2("*my_path*/PPN/_out/nodes.csv")
conv_wkt_to_jpg(nodes = nodes)
morph_resume(dataDir = "*my_path*/PPN",
             nodes = nodes)

img-name
img-name
img-name

Typology of GUs

iconr uses a hierarchical thesaurus (a tree-like structure) for GUs' typology. See for example the whole typological tree:

Or these different subtrees: geometric, figurative, zoomorphic, technomorphic, or anthropomorphic. Such a structure is known as a with controlled vocabulary with an identity between GU name and value must be unique (URL), such a structure should also be used for other fields than the GU type (eg, 'technique'). Multi-linguism equivalences -- starting with English --, metadata insertion (IPTC) and standardization of the vocabulary (Dublin Core, CIDOC-CRM) is needed.

Superimpositions

The diachronic edge ->- allows to register the superimposition. The next iconr will integrate an on-the-fly function allowing to create Harris matrices of GUs when such an edge exists. For example here, the Ibahernando stele shows a Latin writing overlaping a spear and a shield representations

img-name

Magic wand

The selection of a colored continuous range can be done from a POINT coordinates (x, y) overlapping this colored range (ie. a GU displayed in black on white background). The next iconr will integrate a function allowing to extract automatically the shape behind the POINTS

img-name

Other documents

  • Analysis of Prehistoric Iconography with the R package iconr, Digital Archaeology seminar, 28th November 2022, University of Durham 🔗
  • Human face depictions of Early Neolithic in the Near East EAA 2021,session 238, 11th September 2021, Kiel 🔗

Footnotes

  1. Huet et al., (2021). Analysis of Prehistoric Iconography with the R package iconr. Journal of Open Source Software, 6(61), 3191, https://doi.org/10.21105/joss.03191

  2. credits Museo Arqueologico de Madrid

  3. unless otherwise stated, the drawings of the steles are all from: Díaz-Guardamino Uribe, M. (2010). Las estelas decoradas en la prehistoria de la penı́nsula ibérica [PhD thesis, Universidad Complutense de Madrid, Servicio de Publicaciones]. https://eprints.ucm.es/11070/1/T32200.pdf