Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/davebraze/FDBeye
Browse files Browse the repository at this point in the history
  • Loading branch information
davebraze committed Sep 6, 2017
2 parents 1cf8419 + e2c5bbc commit 4dff35b
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
16 changes: 16 additions & 0 deletions R/textRegions.R
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,17 @@ regdef2ias <- function(fname) {
yml <- paste(l[yml], collapse="\n")
parms <- yaml::yaml.load(yml)

## check if crucial parameters are in the yaml block
parms_check <- list(parms$margins$left,
parms$regions$maxH,
parms$regions$minH,
parms$lines$baseline)
if (sum(sapply(parms_check, is.null, simplify = TRUE)) > 0) {
stop(paste("At least one of the following parameters are missing in the yaml block:",
"margins: left, regions: maxH, regions: minH, lines: baselines",
sep = "\n"))
}

## get regdef block
tstart <- max(yidx)+1
tend <- length(l)
Expand All @@ -268,6 +279,11 @@ regdef2ias <- function(fname) {
sep <- FDButils::series(which(tidx), minseries=1)
text_line <- c(1, sep[,1]+sep[,3])

## check if number of lines matches between yaml-block defined baselines and regdef-block text
if (length(parms$lines$baselines)!=length(text_line)) {
stop("The number of baselines (defined in the yaml block) and the number of lines in text do not match.")
}

## set up ias data.frame to store regdef info
ias <- data.frame()

Expand Down
2 changes: 0 additions & 2 deletions inst/extdata/story01-regdef.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ lines:
- 576
- 637
- 698
- 763
- 824
margins:
top: 72 # distance from top of screen to top of 1st line of text in pixels
left: 215 # distance from left edge of screen to left edge of 1st character in line of text, in pixels.
Expand Down
1 change: 0 additions & 1 deletion inst/extdata/story03-regdef.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ lines:
- 777
- 838
- 899
- 960
margins:
top: 72 # distance from top of screen to top of 1st line of text in pixels
left: 215 # distance from left edge of screen to left edge of 1st character in line of text, in pixels.
Expand Down

0 comments on commit 4dff35b

Please sign in to comment.