Package 'ultrapolaRplot'

Title: Plotting Ultrasound Tongue Traces
Description: Plots traced ultrasound tongue imaging data according to a polar coordinate system. There is currently support for plotting means and standard deviations of each category's trace; Smoothing Splines Analysis of Variance (SSANOVA) could be implemented as well. The origin of the polar coordinates may be defined manually or automatically determined based on different algorithms. Currently 'ultrapolaRplot' supports ultrasound tongue imaging trace data from 'UltraTrace' (<https://github.com/SwatPhonLab/UltraTrace>). 'UltraTrace' is capable of importing data from Articulate Instruments AAA. 'read_textgrid.R' is required for opening TextGrids to determine category and alignment information of ultrasound traces.
Authors: Yana Outkin [aut, cre], Jonathan Washington [aut]
Maintainer: Yana Outkin <[email protected]>
License: GPL-3
Version: 0.1.1
Built: 2024-12-15 07:23:45 UTC
Source: CRAN

Help Index


Processes metadata and TextGrids

Description

Processes layers, tiers, and categories within TextGrids. Extracts x and y coordinate data from metadata.

Usage

loadTraces(directory_name, tiernameAll = c(""), categoriesAll = list(c()),
layersAll = c(""), mergeCategories = c(FALSE))

Arguments

directory_name

a (readable binary-mode) connection or a character string giving the name of the folder containing metadata and textgrid files to load (when tilde expansion is done).

tiernameAll

respective tiers (if applicable) within layers. If none specified, all tiers are checked. Accepts either string or list of respective tiers.

categoriesAll

respective categories of segments to extract within tiers. If respective tiername and categories specified as "" and c(""), textgrids will not be checked and coordinates will be extracted from metadata without labeling segment. If all categories specified through c(), all labeled segments from respective layers and tiers will be extracted.

layersAll

list of layers within metadata to extract x and y coodinate data from. Defaults to 'tongue' layer. Accepts either string or list of layers.

mergeCategories

boolean or boolean array, as to whether to merge respective categories.

Value

Returns dataframe of filename, specific annotation number, segment, x-coordinate, y-coordinate.


Converts to polar coordinates

Description

Converts raw coordinate data from loadTraces into polar coordinates. Options available to specify the x-coodrindate of origin tranducer, including algorithms for BottomMean and BottomMiddle. Sample interval degrees of ray can be specified as well.

Usage

makeTracesPolar(rawTraces, origin.algorithm = "BottomMiddle", origin.x = NA, 
scaling.factor = 800/600)

Arguments

rawTraces

data frame returned from loadTraces()

origin.algorithm

takes list of all extracted x-coordinates and sets

origin.x

override x coordinate of origin

scaling.factor

default 800/600

Value

Returns a list of matrices. Each item within the list is labelled by its respective segment, such as 'e', 'i' and 'o'. Each segment is respectively further labeled by the trace number such as 'e[[1]]' and for example up to 'e[[11]]', if there are 11 traces for segment 'e'. There is a matrix for each trace within a segment. The column number represents the individual point along that trace, and the row values contain 1) x-coordinate, 2) y-coordinate, 3) angle in radians from origin (0,0), and 4) radius, for that point.


Plots ultrasound polar coordinate data

Description

Plots extracted segments with means and standard deviation bands calculated through use of polar coordinates.

Usage

plotTraces(rawTraces, polarTraces, interval = 1, mean.lines =
                 TRUE, points.display = FALSE, palette = c(),
                 bands.lines = FALSE, bands.fill = TRUE,
                 legend.position = "topleft", means.styles = c(),
                 standard.deviation.styles = "l", plot.ticks = FALSE,
                 plot.labels = FALSE, legend.size = 3, transparency =
                 0.37, pdf.filename = c(), bands.linewidth = 0.3,
                 png.filename = c(), legend.linewidth = 5,
                 means.linewidth = 3, tick.size = 2, maskCategories =
                 c())

Arguments

rawTraces

data frame returned from loadTraces()

polarTraces

returned from makeTracesPolar()

bands.fill

boolean, whether or not to show standard deviation bands

bands.lines

boolean, whether or not to show lines on edges of standard deviation bands

bands.linewidth

line thickness of standard deviation bands

interval

sampling interval, in degrees, for finding intersections with existing traces (default = '1')

mean.lines

boolean, whether or not to display mean lines

means.styles

array to override default solid line (sequentially in order of categories)

means.linewidth

size of mean lines

standard.deviation.styles

line type for standard deviation upper and low bands, (default = "l")

transparency

transparency of standard deviation bands (default = 0.37)

palette

array to override default colour palette

pdf.filename

pdf file name, saves in current directory

png.filename

png file name, saves in current directory

plot.labels

boolean, whether or not to show labels

plot.ticks

boolean, whether or not to show tick marks

tick.size

size of label scaling on axises

points.display

boolean, whether or not to show original annotated points

labels

array to override labels

legend.position

default "center", with an option of "topleft", "bottomright"

legend.size

size of legend (default = 0.6)

legend.linewidth

size of displayed legend lines

maskCategories

array to override current segment labels

Value

Returns a plot. User can additionally export plot to a pdf or png.


ultrapolaRplot

Description

The ultrapolaRplot library for R is designed for plotting traced ultrasound tongue imaging data according to a polar coordinate system. There is currently support for plotting means and standard deviations of each category's trace; SSANOVA could be implemented as well. The origin of the polar coordinates may be defined manually or automatically determined based on different algorithms. Currently ultrapolaRplot supports ultrasound tongue imaging trace data from UltraTrace (<https://github.com/SwatPhonLab/UltraTrace>). UltraTrace is capable of importing data from Articulate Instruments AAA.

Examples

library(ultrapolaRplot)
filepath <- system.file("extdata", package = "ultrapolaRplot")
rawTraces <- loadTraces(filepath, categoriesAll = c("o", "i"))
polarTraces <- makeTracesPolar(rawTraces, origin.algorithm = "BottomMean")
plotTraces(rawTraces, polarTraces)