Skip to contents

Reads the tested text .cpc format used by the bundled examples: header row, four ROI vertices, point count, point coordinate rows, and point label rows. If an image with the same basename is present next to the .cpc file, image dimensions are read and x_px/y_px are calculated.

Usage

read_cpce_file(path)

Arguments

path

Path to a .cpc file.

Value

A tidy point table.

Examples

cpc <- system.file("extdata", "HIW_158_W_U-1.cpc", package = "pointcoral")
pts <- read_cpce_file(cpc)
dplyr::glimpse(pts)
#> Rows: 100
#> Columns: 36
#> $ project_id         <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,…
#> $ site               <chr> "Hole in the Wall", "Hole in the Wall", "Hole in th…
#> $ transect           <chr> "HIW_158_W_U-1", "HIW_158_W_U-1", "HIW_158_W_U-1", …
#> $ survey_date        <date> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
#> $ image_id           <chr> "HIW_158_W_U-1", "HIW_158_W_U-1", "HIW_158_W_U-1", …
#> $ image_file         <chr> "HIW_158_W_U-1.jpg", "HIW_158_W_U-1.jpg", "HIW_158_…
#> $ image_path         <chr> "/home/runner/work/_temp/Library/pointcoral/extdata…
#> $ point_id           <int> 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, …
#> $ cpce_x             <dbl> 982, 351, 1336, 3497, 1292, 2156, 119, 3748, 2157, …
#> $ cpce_y             <dbl> 567, 5422, 8356, 10228, 12293, 15436, 18377, 22870,…
#> $ cpce_width         <dbl> 45581.55, 45581.55, 45581.55, 45581.55, 45581.55, 4…
#> $ cpce_height        <dbl> 28658.92, 28658.92, 28658.92, 28658.92, 28658.92, 2…
#> $ image_width        <int> 900, 900, 900, 900, 900, 900, 900, 900, 900, 900, 9…
#> $ image_height       <int> 566, 566, 566, 566, 566, 566, 566, 566, 566, 566, 5…
#> $ x_px               <int> 19, 7, 26, 69, 26, 43, 2, 74, 43, 18, 136, 118, 113…
#> $ y_px               <int> 11, 107, 165, 202, 243, 305, 363, 452, 469, 541, 48…
#> $ raw_code           <chr> "SPO", "S", "CALG", "SPO", "SPO", "SPO", "PEYS", "C…
#> $ raw_label          <chr> "SPO", "S", "CALG", "SPO", "SPO", "SPO", "PEYS", "C…
#> $ full_label         <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,…
#> $ clean_label        <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,…
#> $ label_class        <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,…
#> $ major_category     <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,…
#> $ ml_class           <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,…
#> $ class_id           <int> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,…
#> $ reviewer           <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,…
#> $ notes              <chr> "NA", "NA", "NA", "NA", "NA", "NA", "NA", "NA", "NA…
#> $ cpce_note_type     <chr> "Notes", "Notes", "Notes", "Notes", "Notes", "Notes…
#> $ cpc_file           <chr> "/home/runner/work/_temp/Library/pointcoral/extdata…
#> $ codefile_path      <chr> "C:\\PROGRA~1\\CPCe36\\SHALLO~1.TXT", "C:\\PROGRA~1…
#> $ cpce_image_path    <chr> "E:\\Trasects June 09\\Deep Cres\\Hole in the Wall\…
#> $ cpce_header_width  <dbl> 45600, 45600, 45600, 45600, 45600, 45600, 45600, 45…
#> $ cpce_header_height <dbl> 28680, 28680, 28680, 28680, 28680, 28680, 28680, 28…
#> $ roi_x_min          <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, …
#> $ roi_x_max          <dbl> 45581.55, 45581.55, 45581.55, 45581.55, 45581.55, 4…
#> $ roi_y_min          <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, …
#> $ roi_y_max          <dbl> 28658.92, 28658.92, 28658.92, 28658.92, 28658.92, 2…