knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "man/figures/00-check_mr_images-", out.width = "100%" ) `%>%` <- purrr::`%>%` library(tidyverse) library(ANTsRCore) library(devtools) library(fs) library(rraysplot) packageVersion("rraysplot")
# info <- images_info("../120_images", extension = "dcm") info <- images_info("../40_images_06.12.2020", extension = "dcm") info
n_patients <- 40
testthat::expect_equal(length(info$file_path), n_patients * 4)
iList <- ANTsRCore::imageFileNames2ImageList(info$file_path) n_images <- length(iList) domainImage <- iList[[1]] domainImage
pixeltype(domainImage) components(domainImage) dim(domainImage) spacing(domainImage) origin(domainImage) direction(domainImage)
pixel_types <- purrr::map_chr(iList, pixeltype) expected_types <- rep("float", n_images) testthat::expect_identical(pixel_types, expected_types)
components_per_pixel <- purrr::map_dbl(iList, components) expected_components_per_pixel <- rep(3, n_images) testthat::expect_identical(components_per_pixel, expected_components_per_pixel)
Images have different y-dimensions: 494 495 496.
dims <- purrr::map(iList, dim) x <- purrr::map_int(dims, dplyr::nth, 1) y <- purrr::map_int(dims, dplyr::nth, 2) z <- purrr::map_int(dims, dplyr::nth, 3) expected_dims <- rep(list(dim(domainImage)), n_images) expected_x <- purrr::map_int(expected_dims, dplyr::nth, 1) expected_y <- purrr::map_int(expected_dims, dplyr::nth, 2) expected_z <- purrr::map_int(expected_dims, dplyr::nth, 3) testthat::expect_equal(x, expected_x) # testthat::expect_equal(y, expected_y) sort(unique(y)) testthat::expect_equal(z, expected_z)
spacings <- purrr::map(iList, spacing) expected_spacings <- rep(list(spacing(domainImage)), n_images) testthat::expect_identical(spacings, expected_spacings)
origins <- purrr::map(iList, origin) expected_origins <- rep(list(origin(domainImage)), n_images) testthat::expect_identical(origins, expected_origins)
directions <- purrr::map(iList, direction) expected_directions <- rep(list(direction(domainImage)), n_images) testthat::expect_identical(directions, expected_directions)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.