Skip to contents

Alter, add or remove lines in a template

Usage

change_lines(stimuli, line_id = 1, pts = NULL)

Arguments

stimuli

list of stimuli

line_id

index of the line to change

pts

vector of points to change the line_idx to (deletes line if NULL)

Value

stimlist with altered templates

Examples

# get image with dlib70 template and view lines
s <- demo_tems("dlib70")
s[[1]]$lines
#> [[1]]
#>  [1]  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18
#> 
#> [[2]]
#> [1] 19 20 21 22 23
#> 
#> [[3]]
#> [1] 24 25 26 27 28
#> 
#> [[4]]
#> [1] 29 30 31 32 35
#> 
#> [[5]]
#> [1] 33 34 35 36 37
#> 
#> [[6]]
#> [1] 38 39 40 41
#> 
#> [[7]]
#> [1] 41 42 43 38
#> 
#> [[8]]
#> [1] 44 45 46 47
#> 
#> [[9]]
#> [1] 47 48 49 44
#> 
#> [[10]]
#> [1] 50 51 52 53 54 55 56
#> 
#> [[11]]
#> [1] 62 63 64 65 66
#> 
#> [[12]]
#> [1] 66 67 68 69 62
#> 
#> [[13]]
#> [1] 56 57 58 59 60 61 50
#> 

# remove all lines
s2 <- change_lines(s, line_id = 1:13, pts = NULL)
s2[[1]]$lines
#> list()

# visualise point indices
draw_tem(s2, pt.shape = "index", pt.size = 15)


# add a new line
s3 <- change_lines(s2, line_id = "face_outline", 
                   pts = c(2:18, 28:19, 2))
s3[[1]]$lines
#> $face_outline
#>  [1]  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 28 27 26 25 24 23 22 21
#> [26] 20 19  2
#> 
draw_tem(s3)