Skip to content

Commit d8026e6

Browse files
chore: add developer helper scripts for viewing and orienting x3p files
1 parent 8fd4a9e commit d8026e6

File tree

2 files changed

+50
-6
lines changed

2 files changed

+50
-6
lines changed

docs/developers/preprocess_x3p.R

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
preprocess_hamby44 <- function(filepath) {
2+
df <- readr::read_delim(
3+
filepath,
4+
delim = " ",
5+
col_names= c("x", "y", "value"),
6+
na = c("", "NA", "1.#QNAN0"),
7+
progress = FALSE
8+
) # There are no actual Nas created – probably because of the # in the name
9+
10+
# Should create a considerable number of NAs
11+
df$value <- as.numeric(df$value)
12+
13+
# Convert data frame into x3p. Value is measured in microns
14+
x3p <- x3ptools::df_to_x3p(df)
15+
16+
bullet <- list()
17+
bullet$x3p <- x3p
18+
bullet <- bullet %>% dplyr::mutate(
19+
x3p = x3p %>% purrr::map(.f = function(x) x %>%
20+
x3ptools::y_flip_x3p())
21+
)
22+
}
23+

docs/developers/view_land.R

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,31 @@ library(readr)
88
library(nbtrd)
99

1010

11-
cts <- read_bullet("/Users/stephanie/Documents/cts_set/scans/test_19-527_sample_F2/Item 1/Bullet A")
12-
image_x3p(cts$x3p[[1]])
13-
snapshot3d(filename ="~/Documents/CTS19.1.A.png")
11+
# cts <- read_bullet("/Users/stephanie/Documents/cts_set/scans/test_19-527_sample_F2/Item 1/Bullet A")
12+
# image_x3p(cts$x3p[[1]])
13+
# snapshot3d(filename ="~/Documents/CTS19.1.A.png")
14+
#
15+
# hamby <- read_bullet("/Users/stephanie/Documents/Hamby Set 44 Rescan Preprocessed/Barrel 1/Bullet 1")
16+
# image_x3p(hamby$x3p[[1]])
17+
# snapshot3d(filename ="~/Documents/hamby44.1.2.png")
1418

15-
hamby <- read_bullet("/Users/stephanie/Documents/Hamby Set 44 Rescan Preprocessed/Barrel 1/Bullet 1")
16-
image_x3p(hamby$x3p[[1]])
17-
snapshot3d(filename ="~/Documents/hamby44.1.2.png")
19+
main_dir <- "/Users/stephanie/Documents/Bullet_scans/St Louis"
20+
21+
files <- list.files(main_dir, pattern = ".dat", full.names = TRUE)
22+
df <- readr::read_delim(
23+
files[2],
24+
delim = " ",
25+
col_names= c("x", "y", "value"),
26+
na = c("", "NA", "1.#QNAN0"),
27+
progress = FALSE
28+
) # There are no actual Nas created – probably because of the # in the name
29+
30+
# Should create a considerable number of NAs
31+
df$value <- as.numeric(df$value)
32+
33+
# Convert data frame into x3p. Value is measured in microns
34+
x3p <- x3ptools::df_to_x3p(df)
35+
x3p_image(x3p)
36+
37+
# b1 <- read_bullet(main_dir)
38+
# x3p_image(b1$x3p[[1]])

0 commit comments

Comments
 (0)