From b69af63911d10e138a944c8f9a4b014eecae36ba Mon Sep 17 00:00:00 2001 From: Damon Pham Date: Thu, 18 Nov 2021 22:14:27 -0500 Subject: [PATCH 01/24] Iterate version. Patch to read v1 data. --- DESCRIPTION | 2 +- R/info_cifti.R | 18 +++++++++++------- tests/run_ciftiTools_tests.R | 2 ++ 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index cda3b74..80893d8 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: ciftiTools Type: Package Title: Tools for Reading, Writing, Viewing and Manipulating CIFTI Files -Version: 0.7.0 +Version: 0.8.0 Authors@R: c( person(given = "Amanda", family = "Mejia", diff --git a/R/info_cifti.R b/R/info_cifti.R index 77b28c9..b93ddad 100644 --- a/R/info_cifti.R +++ b/R/info_cifti.R @@ -264,14 +264,18 @@ get_data_meta_from_cifti_xml <- function(xml, intent=3000) { meta$subcort_trans_units <- as.numeric( attr(xml$Volume$TransformationMatrixVoxelIndicesIJKtoXYZ, "MeterExponent") ) - if (meta$subcort_trans_units == -3) { - meta$subcort_trans_units <- "mm" - } else if (meta$subcort_trans_units == -2) { - meta$subcort_trans_units <- "cm" - } else if (meta$subcort_trans_units == 0) { - meta$subcort_trans_units <- "m" + if (length(meta$subcort_trans_units) > 0) { + if (meta$subcort_trans_units == -3) { + meta$subcort_trans_units <- "mm" + } else if (meta$subcort_trans_units == -2) { + meta$subcort_trans_units <- "cm" + } else if (meta$subcort_trans_units == 0) { + meta$subcort_trans_units <- "m" + } else { + meta$subcort_trans_units <- paste0("10^(", meta$subcort_trans_units, ") m") + } } else { - meta$subcort_trans_units <- paste0("10^(", meta$subcort_trans_units, ") m") + meta["subcort_trans_units"] <- list(NULL) } meta$subcort_dims <- as.numeric( diff --git a/tests/run_ciftiTools_tests.R b/tests/run_ciftiTools_tests.R index c53bb52..7901177 100644 --- a/tests/run_ciftiTools_tests.R +++ b/tests/run_ciftiTools_tests.R @@ -13,3 +13,5 @@ source(file.path(tests_dir, "test-plotting_surf.R")) source(file.path(tests_dir, "test-plotting_sub.R")) source(file.path(tests_dir, "test-plotting_together.R")) source(file.path(tests_dir, "test-misc.R")) +# Other recommended tests +# Read a v1 CIFTI From 36e377cbeeb82520fb7b189e35191d35a12abdf5 Mon Sep 17 00:00:00 2001 From: Damon Pham Date: Thu, 18 Nov 2021 23:14:06 -0500 Subject: [PATCH 02/24] Add `move_from_mwall` and `move_to_mwall` to list of functions --- R/ciftiTools-package.R | 2 ++ 1 file changed, 2 insertions(+) diff --git a/R/ciftiTools-package.R b/R/ciftiTools-package.R index b281643..1856194 100644 --- a/R/ciftiTools-package.R +++ b/R/ciftiTools-package.R @@ -37,6 +37,8 @@ #' \item{\code{select_xifti}:}{ Select data matrix columns of a \code{"xifti"}} #' \item{\code{transform_xifti}:}{ Apply a univariate transformation to a \code{"xifti"} or pair of \code{"xifti"}s} #' \item{\code{add_surf}:}{ Add surfaces to a \code{"xifti"}} +#' \item{\code{move_from_mwall}:}{ Move medial wall vertices back into the \code{"xifti"} data matrix} +#' \item{\code{move_to_mwall}:}{ Move rows with a certain value into the \code{"xifti"} medial wall mask} #' } #' #' S3 methods for \code{"xifti"}s: From 297dcebd1cd77a506f0688414b764666a9fce726 Mon Sep 17 00:00:00 2001 From: Damon Pham Date: Sun, 21 Nov 2021 08:43:47 -0500 Subject: [PATCH 03/24] Use shQuote instead of escape characters --- R/utils.R | 11 +++++++---- man/sys_path.Rd | 3 ++- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/R/utils.R b/R/utils.R index 49bd4de..18f2899 100644 --- a/R/utils.R +++ b/R/utils.R @@ -73,17 +73,20 @@ is.fname <- function(x){ #' Format a path for \code{\link{system}} #' -#' Right now, it escapes spaces and parentheses with \code{"\\\\"}. +#' Right now, it uses \code{shQuote} #' #' @param R_path The name of the file. It should be properly formatted: if it #' exists, \code{file.exists(R_path)} should be \code{TRUE}. #' #' @return The name of the file #' +#' @keywords internal +#' sys_path <- function(R_path) { - R_path <- gsub("(", "\\(", R_path, fixed=TRUE) - R_path <- gsub(")", "\\)", R_path, fixed=TRUE) - gsub(" ", "\\ ", R_path, fixed=TRUE) + shQuote(R_path) + # R_path <- gsub("(", "\\(", R_path, fixed=TRUE) + # R_path <- gsub(")", "\\)", R_path, fixed=TRUE) + # gsub(" ", "\\ ", R_path, fixed=TRUE) } #' Get kwargs diff --git a/man/sys_path.Rd b/man/sys_path.Rd index e974bd1..f3c2b65 100644 --- a/man/sys_path.Rd +++ b/man/sys_path.Rd @@ -14,5 +14,6 @@ exists, \code{file.exists(R_path)} should be \code{TRUE}.} The name of the file } \description{ -Right now, it escapes spaces and parentheses with \code{"\\\\"}. +Right now, it uses \code{shQuote} } +\keyword{internal} From 236289180d0e6cbadd6f80f081b2318b810f7dd6 Mon Sep 17 00:00:00 2001 From: Damon Pham Date: Sun, 21 Nov 2021 08:44:21 -0500 Subject: [PATCH 04/24] coerce `pal_even$color` to character (if factor, problems on linux?) --- R/view_xifti_volume.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/view_xifti_volume.R b/R/view_xifti_volume.R index a64f532..f5d1720 100644 --- a/R/view_xifti_volume.R +++ b/R/view_xifti_volume.R @@ -841,7 +841,7 @@ view_xifti_volume <- function( oro.nifti::overlay( x=img2, y=img_overlay2, plane=plane, - col.y=pal_even$color, + col.y=as.character(pal_even$color), col.x=structural_img_colors, zlim.y=zlim, oma=c(5,0,5,0), From 12ef0e8ba3a4c6397d6b1ac178777975ab7a2d4b Mon Sep 17 00:00:00 2001 From: Damon Pham Date: Sun, 21 Nov 2021 08:44:49 -0500 Subject: [PATCH 05/24] Update ciftiTools.Rd --- man/ciftiTools.Rd | 2 ++ 1 file changed, 2 insertions(+) diff --git a/man/ciftiTools.Rd b/man/ciftiTools.Rd index f10ebdf..c23e8e4 100644 --- a/man/ciftiTools.Rd +++ b/man/ciftiTools.Rd @@ -43,6 +43,8 @@ Functions for manipulating \code{"xifti"}s: \item{\code{select_xifti}:}{ Select data matrix columns of a \code{"xifti"}} \item{\code{transform_xifti}:}{ Apply a univariate transformation to a \code{"xifti"} or pair of \code{"xifti"}s} \item{\code{add_surf}:}{ Add surfaces to a \code{"xifti"}} +\item{\code{move_from_mwall}:}{ Move medial wall vertices back into the \code{"xifti"} data matrix} +\item{\code{move_to_mwall}:}{ Move rows with a certain value into the \code{"xifti"} medial wall mask} } S3 methods for \code{"xifti"}s: From 499a664485ca1adde398a52645b742432e484bb5 Mon Sep 17 00:00:00 2001 From: Damon Pham Date: Wed, 12 Jan 2022 02:03:56 -0800 Subject: [PATCH 06/24] Do not require `trans_units` to exit in metadata (?) --- R/is.xifti.R | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/R/is.xifti.R b/R/is.xifti.R index 38ee372..175939c 100644 --- a/R/is.xifti.R +++ b/R/is.xifti.R @@ -287,8 +287,11 @@ is.xifti_meta <- function(x) { } # Subcortical. - if (!match_exactly(names(x$subcort), names(y$subcort))) { - message("Subcortical sublist names are not correct.\n"); return(FALSE) + if (!match_exactly(names(x$subcort), names(y$subcort), fail_action="nothing")) { + ny2 <- names(y$subcort)[names(y$subcort) != "trans_units"] + if (!match_exactly(names(x$subcort), ny2, fail_action="message")) { + message("Subcortical sublist names are not correct.\n"); return(FALSE) + } } if (!is.null(x$subcort$labels) && !is.subcort_labs(x$subcort$labels)) { message("Subcortical labels are invalid.\n"); return(FALSE) From 9d3cc28750b2ed13f640d36939e1ee9df2b0f9fa Mon Sep 17 00:00:00 2001 From: Damon Pham Date: Wed, 19 Jan 2022 19:10:14 -0500 Subject: [PATCH 07/24] minor things --- NAMESPACE | 1 + R/resample_surf.R | 2 ++ R/utils_xifti.R | 2 +- man/infer_resolution.Rd | 1 - 4 files changed, 4 insertions(+), 2 deletions(-) diff --git a/NAMESPACE b/NAMESPACE index 793a4dc..a46977e 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -47,6 +47,7 @@ export(convert_xifti) export(expand_color_pal) export(fix_xifti) export(get_wb_cmd_path) +export(infer_resolution) export(infoCIfTI) export(info_cifti) export(infocii) diff --git a/R/resample_surf.R b/R/resample_surf.R index d25d7c0..b5faa17 100644 --- a/R/resample_surf.R +++ b/R/resample_surf.R @@ -38,6 +38,8 @@ resample_surf <- function( gii_pre, gii_post, hemisphere=hemisphere, original_res = original_res, resamp_res=resamp_res ) + # [TO DO]: stop if above command failed. + # Otherwise, `gii_post` might exist but not be the result of resampling here. # Read new file. make_surf(gii_post, hemisphere) diff --git a/R/utils_xifti.R b/R/utils_xifti.R index f4a08c1..28c0e4c 100644 --- a/R/utils_xifti.R +++ b/R/utils_xifti.R @@ -340,7 +340,7 @@ as.matrix.xifti <- function(x, ...) { #' @param surfL Left surface #' @param surfR Right surface #' -#' @keywords internal +#' @export #' #' @return The inferred resolution #' diff --git a/man/infer_resolution.Rd b/man/infer_resolution.Rd index 0bd0e81..2206306 100644 --- a/man/infer_resolution.Rd +++ b/man/infer_resolution.Rd @@ -19,4 +19,3 @@ The inferred resolution \description{ Infer resolution from \code{"xifti"} and surfaces } -\keyword{internal} From 18fdc23b94016b3ef45edfc318dc4472b57c3d7c Mon Sep 17 00:00:00 2001 From: Damon Pham Date: Fri, 21 Jan 2022 12:55:01 -0500 Subject: [PATCH 08/24] expand tilde in `wb_path` --- R/wb_cmd.R | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/R/wb_cmd.R b/R/wb_cmd.R index 47d27b6..84a5092 100644 --- a/R/wb_cmd.R +++ b/R/wb_cmd.R @@ -34,12 +34,17 @@ wb_path_request <- function() { #' get_wb_cmd_path <- function(wb_path) { + stopifnot(length(wb_path)==1) + # Remove double slashes (except at very beginning) add_back <- startsWith(wb_path, "//") wb_path <- gsub("(/)+", "/", wb_path) if (add_back) { wb_path <- paste0("/", wb_path) } wb_path <- gsub("/$", "", wb_path) # Remove slash at end (will become double) + # Expand tilde: can vary between R and system() command + wb_path <- path.expand(wb_path) + # If `wb_path` doesn't exist, raise a warning but still use it. # (Sometimes the file does exist, even if `file.exists` fails?) if (!file.exists(wb_path)) { From 520d370ff7db65b86c7af28c5e699e46e4673d2d Mon Sep 17 00:00:00 2001 From: Damon Pham Date: Mon, 24 Jan 2022 02:31:50 -0500 Subject: [PATCH 09/24] problems related to `xifti$meta$cifti$brainstructures` --- R/expect_equal_xifti.R | 11 ++++++----- R/is.xifti.R | 5 ++++- R/make_xifti.R | 5 +++++ man/expect_equal_xifti.Rd | 4 ++-- 4 files changed, 17 insertions(+), 8 deletions(-) diff --git a/R/expect_equal_xifti.R b/R/expect_equal_xifti.R index f5c9611..79a11eb 100644 --- a/R/expect_equal_xifti.R +++ b/R/expect_equal_xifti.R @@ -2,8 +2,8 @@ #' #' Raise an error if the \code{"xifti"}s do not match. #' -#' \code{cifti$intent} and \code{cifti$brainstructures} are only compared if they -#' exist for both files. \code{cifti$misc} is never compared. +#' \code{cifti$intent} is only compared if it +#' exists for both files. \code{cifti$brainstructures} and \code{cifti$misc} are not compared. #' #' @param xii1 The first \code{"xifti"} #' @param xii2 The second \code{"xifti"} @@ -30,7 +30,8 @@ expect_equal_xifti <- function(xii1, xii2) { testthat::expect_equal(xii1$meta$cifti$intent, xii2$meta$cifti$intent) } - if (!is.null(xii1$meta$cifti$brainstructure) && !is.null(xii2$meta$cifti$brainstructure)) { - testthat::expect_equal(xii1$meta$cifti$brainstructure, xii2$meta$cifti$brainstructure) - } + # [TO DO]: Define this? + # if (!is.null(xii1$meta$cifti$brainstructure) && !is.null(xii2$meta$cifti$brainstructure)) { + # testthat::expect_equal(xii1$meta$cifti$brainstructure, xii2$meta$cifti$brainstructure) + # } } \ No newline at end of file diff --git a/R/is.xifti.R b/R/is.xifti.R index 175939c..b19d9e7 100644 --- a/R/is.xifti.R +++ b/R/is.xifti.R @@ -321,10 +321,13 @@ is.xifti_meta <- function(x) { if (!all(x$cifti$brainstructures %in% c("left", "right", "subcortical"))) { message(paste( "CIFTI brainstructures must be one or several of the following:", - "left, righ, subcortical.\n" + "left, right, subcortical.\n" )) return(FALSE) } + bs_expected <- names(x$data)[!vapply(x$data, is.null, FALSE)] + # [TO DO]: check `bs_expected` + # I forget if `brainstructures` are those originally in the `xifti`, or just those present now? if (!is.null(x$cifti$intent)) { intent <- x$cifti$intent diff --git a/R/make_xifti.R b/R/make_xifti.R index 0c11d71..94ac92f 100644 --- a/R/make_xifti.R +++ b/R/make_xifti.R @@ -273,6 +273,11 @@ make_xifti <- function( # Column names. if (!is.null(col_names)) { xifti$meta$cifti$names <- col_names } + # Brainstructures. + bs_names <- names(xifti$data)[!vapply(xifti$data, is.null, FALSE)] + bs_names <- c(cortex_left="left", cortex_right="right", subcort="subcortical")[bs_names] + xifti$meta$cifti$brainstructures <- bs_names + # idx metadata. if (!is.null(idx)) { xifti$meta$cifti$misc$idx <- idx } diff --git a/man/expect_equal_xifti.Rd b/man/expect_equal_xifti.Rd index ff0cf7e..b69da2e 100644 --- a/man/expect_equal_xifti.Rd +++ b/man/expect_equal_xifti.Rd @@ -18,7 +18,7 @@ expect_equal_xifti(xii1, xii2) Raise an error if the \code{"xifti"}s do not match. } \details{ -\code{cifti$intent} and \code{cifti$brainstructures} are only compared if they -exist for both files. \code{cifti$misc} is never compared. +\code{cifti$intent} is only compared if it +exists for both files. \code{cifti$brainstructures} and \code{cifti$misc} are not compared. } \keyword{internal} From c0608cd821caf088c874563218b99929c0085748 Mon Sep 17 00:00:00 2001 From: Damon Pham Date: Mon, 24 Jan 2022 02:32:19 -0500 Subject: [PATCH 10/24] Fix doc to say that a `"xifti"` object is returned if one was inputted. --- R/smooth_cifti.R | 3 ++- man/smooth_cifti.Rd | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/R/smooth_cifti.R b/R/smooth_cifti.R index 24746bd..0f3d3a9 100644 --- a/R/smooth_cifti.R +++ b/R/smooth_cifti.R @@ -31,7 +31,8 @@ #' @param subcortical_merged Smooth across subcortical structure boundaries? #' Default: \code{FALSE}. #' -#' @return The \code{cifti_target_fname}, invisibly +#' @return The \code{cifti_target_fname}, invisibly, if \code{x} was a CIFTI +#' file name. A \code{"xifti"} object if \code{x} was a \code{"xifti"} object. #' #' @family common #' @export diff --git a/man/smooth_cifti.Rd b/man/smooth_cifti.Rd index ceddc5d..3cb3cba 100644 --- a/man/smooth_cifti.Rd +++ b/man/smooth_cifti.Rd @@ -84,7 +84,8 @@ the subcortical volume or cortex be treated as NA? Default: \code{FALSE}.} Default: \code{FALSE}.} } \value{ -The \code{cifti_target_fname}, invisibly +The \code{cifti_target_fname}, invisibly, if \code{x} was a CIFTI +file name. A \code{"xifti"} object if \code{x} was a \code{"xifti"} object. } \description{ Spatially smooth the metric data of a CIFTI file or \code{"xifti"} object. From bb06875d359b43506ffd2c8b91e1863eb63d88d0 Mon Sep 17 00:00:00 2001 From: Damon Pham Date: Mon, 24 Jan 2022 02:32:44 -0500 Subject: [PATCH 11/24] Patch related to `resamp_res` not able to be referred. More work to do. --- R/add_surf.R | 4 ++-- R/utils_xifti.R | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/R/add_surf.R b/R/add_surf.R index 16101e1..6d78205 100644 --- a/R/add_surf.R +++ b/R/add_surf.R @@ -29,7 +29,7 @@ add_surf <- function(xifti, surfL=NULL, surfR=NULL) { xifti$surf$cortex_left <- load_surf("left", surfL, resamp_res) } else { z <- read_surf(surfL, "left") - if (nrow(z$vertices) != resamp_res) { z <- resample_surf(z, resamp_res, "left") } + if (!is.null(resamp_res) && nrow(z$vertices) != resamp_res) { z <- resample_surf(z, resamp_res, "left") } xifti$surf$cortex_left <- z } } @@ -43,7 +43,7 @@ add_surf <- function(xifti, surfL=NULL, surfR=NULL) { xifti$surf$cortex_right <- load_surf("right", surfR, resamp_res=resamp_res) } else { z <- read_surf(surfR, "right") - if (nrow(z$vertices) != resamp_res) { z <- resample_surf(z, resamp_res, "right") } + if (!is.null(resamp_res) && nrow(z$vertices) != resamp_res) { z <- resample_surf(z, resamp_res, "right") } xifti$surf$cortex_right <- z } } diff --git a/R/utils_xifti.R b/R/utils_xifti.R index 28c0e4c..c6e8e36 100644 --- a/R/utils_xifti.R +++ b/R/utils_xifti.R @@ -368,6 +368,7 @@ infer_resolution <- function(xifti, surfL=NULL, surfR=NULL) { res <- min(nvL, nvR) if (is.infinite(res)) { res <- NULL } } + # [TO DO]: if no medial wall mask exists, but a cortex has data? } res From ce929431fca81ae3a31dcb92274f7dbbde95b7d9 Mon Sep 17 00:00:00 2001 From: Damon Pham Date: Tue, 25 Jan 2022 03:43:32 -0500 Subject: [PATCH 12/24] Add `scale_xifti` --- R/scale_xifti.R | 24 ++++++++++++++++++++++++ man/scale_xifti.Rd | 18 ++++++++++++++++++ tests/testthat/test-misc.R | 2 ++ 3 files changed, 44 insertions(+) create mode 100644 R/scale_xifti.R create mode 100644 man/scale_xifti.Rd diff --git a/R/scale_xifti.R b/R/scale_xifti.R new file mode 100644 index 0000000..a6a3e13 --- /dev/null +++ b/R/scale_xifti.R @@ -0,0 +1,24 @@ +#' Scale CIFTI +#' +#' Scale CIFTI data. Similar to \code{\link[base]{scale}}. +#' +#' @inheritParams xifti_Param +#' @param center,scale Arguments to \code{\link[base]{scale}}. +#' +#' @return The input \code{"xifti"} with scaled columns. +#' +#' @keywords export +scale_xifti <- function(x, center=TRUE, scale=TRUE){ + stopifnot(is.xifti(x)) + + if (!is.null(x$meta$cifti$intent)) { + if (x$meta$cifti$intent == 3007) { + ciftiTools_warn("Converting to `dscalar` before scaling.\n") + x <- convert_xifti(x, "dscalar") + } + } + + x <- newdata_xifti(x, + scale(as.matrix(x), center=center, scale=scale) + ) +} \ No newline at end of file diff --git a/man/scale_xifti.Rd b/man/scale_xifti.Rd new file mode 100644 index 0000000..aa30211 --- /dev/null +++ b/man/scale_xifti.Rd @@ -0,0 +1,18 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/scale_xifti.R +\name{scale_xifti} +\alias{scale_xifti} +\title{Scale CIFTI} +\usage{ +scale_xifti(x, center = TRUE, scale = TRUE) +} +\arguments{ +\item{center, scale}{Arguments to \code{\link[base]{scale}}.} +} +\value{ +The input \code{"xifti"} with scaled columns. +} +\description{ +Scale CIFTI data. Similar to \code{\link[base]{scale}}. +} +\keyword{export} diff --git a/tests/testthat/test-misc.R b/tests/testthat/test-misc.R index d3b2384..0ea61f5 100644 --- a/tests/testthat/test-misc.R +++ b/tests/testthat/test-misc.R @@ -203,6 +203,8 @@ test_that("Miscellaneous functions are working", { is.xifti(fix_xifti(cii2)) } + scale_xifti(cii1, scale=FALSE) + # [TO DO]: Test concatenating xiftis of different types From 1c2917e6dbb7e8608fd7f00857d35d6064056fca Mon Sep 17 00:00:00 2001 From: Damon Pham Date: Tue, 25 Jan 2022 03:45:15 -0500 Subject: [PATCH 13/24] Allow `x$cifti$brainstructures` to be `NULL`. --- R/is.xifti.R | 31 ++++++++++++++++++++++--------- R/make_xifti.R | 7 ++++--- R/write_xifti2.R | 10 +++++----- 3 files changed, 31 insertions(+), 17 deletions(-) diff --git a/R/is.xifti.R b/R/is.xifti.R index b19d9e7..b1de0c9 100644 --- a/R/is.xifti.R +++ b/R/is.xifti.R @@ -318,16 +318,29 @@ is.xifti_meta <- function(x) { # cifti if (!is.null(x$cifti)) { - if (!all(x$cifti$brainstructures %in% c("left", "right", "subcortical"))) { - message(paste( - "CIFTI brainstructures must be one or several of the following:", - "left, right, subcortical.\n" - )) - return(FALSE) + if (!is.null(x$cifti$brainstructures)) { + # All entries must be valid. + if (!all(x$cifti$brainstructures %in% c("left", "right", "subcortical"))) { + message(paste( + "CIFTI brainstructures must be one or several of the following:", + "left, right, subcortical.\n" + )) + return(FALSE) + } + # All brainstructures with data must be included. + bs_expected <- names(x$data)[!vapply(x$data, is.null, FALSE)] + bs_missing <- setdiff(bs_expected, x$cifti$brainstructures) + if (length(bs_missing) > 0) { + message(paste( + "These brainstructures with data are not in $meta$cifti$brainstructures:", + paste(bs_missing, collapse=", "), + ". Add them or set this metadata entry to `NULL`.\n" + )) + return(FALSE) + } + # [TO DO]: check `bs_expected` + # I forget if `brainstructures` are those originally in the `xifti`, or just those present now? } - bs_expected <- names(x$data)[!vapply(x$data, is.null, FALSE)] - # [TO DO]: check `bs_expected` - # I forget if `brainstructures` are those originally in the `xifti`, or just those present now? if (!is.null(x$cifti$intent)) { intent <- x$cifti$intent diff --git a/R/make_xifti.R b/R/make_xifti.R index 94ac92f..2228259 100644 --- a/R/make_xifti.R +++ b/R/make_xifti.R @@ -274,9 +274,10 @@ make_xifti <- function( if (!is.null(col_names)) { xifti$meta$cifti$names <- col_names } # Brainstructures. - bs_names <- names(xifti$data)[!vapply(xifti$data, is.null, FALSE)] - bs_names <- c(cortex_left="left", cortex_right="right", subcort="subcortical")[bs_names] - xifti$meta$cifti$brainstructures <- bs_names + # bs_names <- names(xifti$data)[!vapply(xifti$data, is.null, FALSE)] + # bs_names <- c(cortex_left="left", cortex_right="right", subcort="subcortical")[bs_names] + # xifti$meta$cifti$brainstructures <- bs_names + xifti$meta$cifti["brainstructures"] <- list(NULL) # idx metadata. if (!is.null(idx)) { xifti$meta$cifti$misc$idx <- idx } diff --git a/R/write_xifti2.R b/R/write_xifti2.R index b3fe4c3..e6a9e68 100644 --- a/R/write_xifti2.R +++ b/R/write_xifti2.R @@ -28,8 +28,9 @@ write_xifti2 <- function( # Check arguments. stopifnot(is.xifti(xifti)) + bs_present <- c("left", "right", "subcortical")[!vapply(xifti$data, is.null, FALSE)] if (is.null(brainstructures)) { - brainstructures <- c("left", "right", "subcortical")[!vapply(xifti$data, is.null, FALSE)] + brainstructures <- bs_present } brainstructures <- match_input( brainstructures, c("left","right","subcortical","all"), @@ -55,13 +56,12 @@ write_xifti2 <- function( do <- x$do; ROI_do <- x$ROI_do; sep_fnames <- x$sep_fnames; rm(x) # Check brainstructures - bs_present <- brainstructures %in% xifti$meta$cifti$brainstructures - if (!all(bs_present)) { + if (!all(brainstructures %in% bs_present)) { warning(paste0( "Only the following brainstructures are present in the CIFTI file: ", - paste(xifti$meta$cifti$brainstructures, collapse=", "), "\n" + paste(bs_present, collapse=", "), "\n" )) - brainstructures <- brainstructures[bs_present] + brainstructures <- bs_present } do <- c("left","right","subcortical") %in% brainstructures names(do) <- c("left", "right", "sub") From 3feca1571ade54e6ca20a4a52906fd5ba756bef0 Mon Sep 17 00:00:00 2001 From: Damon Pham Date: Tue, 25 Jan 2022 04:31:21 -0500 Subject: [PATCH 14/24] `newdata_xifti` will not require same columns anymore. --- R/newdata_xifti.R | 62 +++++++++++++++++++++++++++++++------------- man/newdata_xifti.Rd | 22 +++++++++++----- 2 files changed, 60 insertions(+), 24 deletions(-) diff --git a/R/newdata_xifti.R b/R/newdata_xifti.R index 2c794a9..ff1032e 100644 --- a/R/newdata_xifti.R +++ b/R/newdata_xifti.R @@ -2,15 +2,25 @@ #' #' Replace the data in a \code{"xifti"} with new data from a data matrix. #' -#' If the \code{"xifti"} has \eqn{V} grayordinates and \code{T} measurements -#' in total, \code{newdata} should be a \eqn{V \times T} matrix. +#' If the \code{"xifti"} has \eqn{V} grayordinates and \eqn{T} measurements\, +#' \code{newdata} should be a \eqn{V \times Q} matrix. If \eqn{Q} +#' is not equal to \eqn{T}, then any column names or label tables will be +#' removed. (A "dlabel" will be converted to a "dscalar".) #' @param xifti The \code{"xifti"} -#' @param newdata The \eqn{V \ times T} matrix of data values to replace those +#' @param newdata The \eqn{V \times T} matrix of data values to replace those #' in \code{xifti} with. The left cortex vertices should be at the top, right #' cortex vertices in the middle, and subcortex vertices at the bottom (when -#' present). Can also be a length-one vector to set all values equally. -#' @param newnames Replace the names in the \code{xifti}. If \code{NULL} -#' (default), keep the original names. +#' present). +#' +#' If \code{newdata} is instead a \eqn{V \times Q} matrix where \eqn{Q} is not +#' \eqn{T}, then any column names or label tables will be removed. +#' (A "dlabel" will be converted to a "dscalar".) +#' +#' Can also be a length-one vector to set all values equally. +#' @param newnames Replaces the names in the \code{xifti}. If \code{NULL} +#' (default), keep the original names, except if the number of columns +#' in \code{newdata} doesn't match that of \code{xifti}, in which case +#' no names will be used. #' @return The new \code{"xifti"} #' #' @family manipulating @@ -25,17 +35,29 @@ newdata_xifti <- function(xifti, newdata, newnames=NULL) { if (length(newdata) == 1) { newdata <- matrix(newdata, nrow=xifti_dim[1], ncol=xifti_dim[2]) } else { - newdata <- matrix(newdata, ncol=xifti_dim[2]) + newdata <- matrix(newdata, nrow=xifti_dim[1]) } newdata_dim <- dim(newdata) } stopifnot(length(newdata_dim)==2) xifti_dim <- dim(xifti) + same_columns <- TRUE if (!all(xifti_dim == newdata_dim)) { + # Transposed input. if (all(xifti_dim == rev(newdata_dim))) { warning("Transposing `newdata`.\n") newdata <- t(newdata) + + # Different number of columns. + } else if (xifti_dim[1] == newdata_dim[1]) { + xifti <- select_xifti(xifti, rep(1, newdata_dim[2])) + same_columns <- FALSE + if (!is.null(xifti$meta$cifti$intent) && xifti$meta$cifti$intent == 3007) { + warning("Mismatch # columns: converting to `dscalar`.\n") + xifti <- convert_xifti(xifti, "dscalar") + } + # Error. } else { stop( "`xifti` and `newdata` do not have the same dimensions.\n", @@ -54,25 +76,29 @@ newdata_xifti <- function(xifti, newdata, newnames=NULL) { } } + # New data. + V_start <- 0 + for (bs in names(xifti$data)) { + if (!is.null(xifti$data[[bs]])) { + V_bs <- nrow(xifti$data[[bs]]) + xifti$data[[bs]] <- newdata[seq(V_start+1, V_bs+V_start),,drop=FALSE] + V_start <- V_bs+V_start + } + } + # New names. if (!is.null(newnames)) { - if (length(newnames) != xifti_dim[2]) { - stop("The length of `newnames` does not match the number of columns in the `xifti`.") + if (length(newnames) != newdata_dim[2]) { + stop("The length of `newnames` does not match the number of columns in the new `xifti`.") } if (!is.null(xifti$meta$cifti$intent) && xifti$meta$cifti$intent == 3002) { warning("The dtseries intent (3002) does not use column names. Ignoring `newnames`.") } else { xifti$meta$cifti$names <- newnames } - } - - # New data. - V_start <- 0 - for (bs in names(xifti$data)) { - if (!is.null(xifti$data[[bs]])) { - V_bs <- nrow(xifti$data[[bs]]) - xifti$data[[bs]] <- newdata[seq(V_start+1, V_bs+V_start),,drop=FALSE] - V_start <- V_bs+V_start + } else if (!same_columns) { + if (!(is.null(xifti$meta$cifti$intent) || xifti$meta$cifti$intent == 3002)) { + xifti$meta$cifti$names <- paste("Column", seq(ncol(newdata))) } } diff --git a/man/newdata_xifti.Rd b/man/newdata_xifti.Rd index 0322568..6eee592 100644 --- a/man/newdata_xifti.Rd +++ b/man/newdata_xifti.Rd @@ -9,13 +9,21 @@ newdata_xifti(xifti, newdata, newnames = NULL) \arguments{ \item{xifti}{The \code{"xifti"}} -\item{newdata}{The \eqn{V \ times T} matrix of data values to replace those +\item{newdata}{The \eqn{V \times T} matrix of data values to replace those in \code{xifti} with. The left cortex vertices should be at the top, right cortex vertices in the middle, and subcortex vertices at the bottom (when -present). Can also be a length-one vector to set all values equally.} +present). -\item{newnames}{Replace the names in the \code{xifti}. If \code{NULL} -(default), keep the original names.} +If \code{newdata} is instead a \eqn{V \times Q} matrix where \eqn{Q} is not +\eqn{T}, then any column names or label tables will be removed. +(A "dlabel" will be converted to a "dscalar".) + +Can also be a length-one vector to set all values equally.} + +\item{newnames}{Replaces the names in the \code{xifti}. If \code{NULL} +(default), keep the original names, except if the number of columns +in \code{newdata} doesn't match that of \code{xifti}, in which case +no names will be used.} } \value{ The new \code{"xifti"} @@ -24,8 +32,10 @@ The new \code{"xifti"} Replace the data in a \code{"xifti"} with new data from a data matrix. } \details{ -If the \code{"xifti"} has \eqn{V} grayordinates and \code{T} measurements -in total, \code{newdata} should be a \eqn{V \times T} matrix. +If the \code{"xifti"} has \eqn{V} grayordinates and \eqn{T} measurements\, +\code{newdata} should be a \eqn{V \times Q} matrix. If \eqn{Q} +is not equal to \eqn{T}, then any column names or label tables will be +removed. (A "dlabel" will be converted to a "dscalar".) } \seealso{ Other functions for manipulating `xifti` objects: From 43043b163cc811e6653210384629a90d60cbad45 Mon Sep 17 00:00:00 2001 From: Damon Pham Date: Tue, 25 Jan 2022 04:31:33 -0500 Subject: [PATCH 15/24] Enable removal of subcortical substructures. --- R/remove_xifti.R | 81 ++++++++++++++++++++++++++++++--------------- man/remove_xifti.Rd | 11 ++++-- 2 files changed, 63 insertions(+), 29 deletions(-) diff --git a/R/remove_xifti.R b/R/remove_xifti.R index a3f095a..0f11002 100644 --- a/R/remove_xifti.R +++ b/R/remove_xifti.R @@ -1,46 +1,75 @@ #' Remove a component from a \code{"xifti"} #' -#' Remove a brain structure or surface from a \code{"xifti"} +#' Remove a brain structure, surface, or subcortical structure from a +#' \code{"xifti"}. #' #' @inheritParams xifti_Param #' @param remove A character vector containing one or more of the following: #' \code{"cortex_left"}, \code{"cortex_right"}, \code{"subcortical"}, #' \code{"surf_left"}, and \code{"surf_right"}. Each of these components will -#' be removed from the \code{"xifti"} +#' be removed from \code{xifti}. +#' @param remove_sub A vector containing subcortical structures to be removed +#' from \code{xifti}. Can be specified with names, or with numeric factor +#' values: see \code{\link{substructure_table}}. #' #' @return The new \code{"xifti"} with the requested component(s) removed #' #' @family manipulating #' @export #' -remove_xifti <- function(xifti, remove=NULL){ - if (is.null(remove)) { stop("Must specify which components to `remove`.") } - remove <- match.arg(remove, c("cortex_left", "cortex_right", "subcortical", "surf_left", "surf_right"), several.ok=TRUE) - - if ("cortex_left" %in% remove) { - xifti$data["cortex_left"] <- list(NULL) - xifti$meta$cortex$medial_wall_mask["left"] <- list(NULL) - } - - if ("cortex_right" %in% remove) { - xifti$data["cortex_right"] <- list(NULL) - xifti$meta$cortex$medial_wall_mask["right"] <- list(NULL) - } +remove_xifti <- function(xifti, remove=NULL, remove_sub=NULL){ + if (!is.null(remove)) { + remove <- match.arg(remove, c("cortex_left", "cortex_right", "subcortical", "surf_left", "surf_right"), several.ok=TRUE) + + if ("cortex_left" %in% remove) { + xifti$data["cortex_left"] <- list(NULL) + xifti$meta$cortex$medial_wall_mask["left"] <- list(NULL) + } + + if ("cortex_right" %in% remove) { + xifti$data["cortex_right"] <- list(NULL) + xifti$meta$cortex$medial_wall_mask["right"] <- list(NULL) + } - if ("cortex_left" %in% remove && "cortex_right" %in% remove) { - xifti$meta$cortex["resamp_res"] <- list(NULL) - } + if ("cortex_left" %in% remove && "cortex_right" %in% remove) { + xifti$meta$cortex["resamp_res"] <- list(NULL) + } - if ("subcortical" %in% remove) { - xifti$data["subcort"] <- list(NULL) - xifti$meta$subcort <- template_xifti()$meta$subcort - } + if ("subcortical" %in% remove) { + xifti$data["subcort"] <- list(NULL) + xifti$meta$subcort <- template_xifti()$meta$subcort + } - if ("surf_left" %in% remove) { - xifti$surf["cortex_left"] <- list(NULL) + if ("surf_left" %in% remove) { + xifti$surf["cortex_left"] <- list(NULL) + } + if ("surf_right" %in% remove) { + xifti$surf["cortex_right"] <- list(NULL) + } } - if ("surf_right" %in% remove) { - xifti$surf["cortex_right"] <- list(NULL) + + if (!is.null(remove_sub)) { + if (is.null(xifti$data$subcort)) { + warning("No subcortical data to remove.\n") + } else { + sst <- substructure_table() + if (is.numeric(remove_sub)) { + remove_sub <- sst$ciftiTools_Name[match(remove_sub, rownames(sst))] + } else if (all(remove_sub == toupper(remove_sub))) { + remove_sub <- sst$ciftiTools_Name[match(remove_sub, sst$Original_Name)] + } + if (any(is.na(remove_sub)) || !all(remove_sub %in% sst$ciftiTools_Name)) { + stop("Invalid subcortical substructures in `remove_sub`.") + } + for (ii in seq(length(remove_sub))) { + x_brainstemMask <- xifti$meta$subcort$labels != remove_sub[ii] + + # Take subset + xifti$data$subcort <- xifti$data$subcort[x_brainstemMask,,drop=FALSE] + xifti$meta$subcort$labels <- xifti$meta$subcort$labels[x_brainstemMask] + xifti$meta$subcort$mask[xifti$meta$subcort$mask] <- x_brainstemMask + } + } } if (!is.xifti(xifti)) { stop("Could not make a valid \"xifti\" object.") } diff --git a/man/remove_xifti.Rd b/man/remove_xifti.Rd index c61aafa..df7ef18 100644 --- a/man/remove_xifti.Rd +++ b/man/remove_xifti.Rd @@ -4,7 +4,7 @@ \alias{remove_xifti} \title{Remove a component from a \code{"xifti"}} \usage{ -remove_xifti(xifti, remove = NULL) +remove_xifti(xifti, remove = NULL, remove_sub = NULL) } \arguments{ \item{xifti}{A \code{"xifti"} object.} @@ -12,13 +12,18 @@ remove_xifti(xifti, remove = NULL) \item{remove}{A character vector containing one or more of the following: \code{"cortex_left"}, \code{"cortex_right"}, \code{"subcortical"}, \code{"surf_left"}, and \code{"surf_right"}. Each of these components will -be removed from the \code{"xifti"}} +be removed from \code{xifti}.} + +\item{remove_sub}{A vector containing subcortical structures to be removed +from \code{xifti}. Can be specified with names, or with numeric factor +values: see \code{\link{substructure_table}}.} } \value{ The new \code{"xifti"} with the requested component(s) removed } \description{ -Remove a brain structure or surface from a \code{"xifti"} +Remove a brain structure, surface, or subcortical structure from a +\code{"xifti"}. } \seealso{ Other functions for manipulating `xifti` objects: From 45f50c6abdf197456fc189a33773981c1f425215 Mon Sep 17 00:00:00 2001 From: Damon Pham Date: Tue, 25 Jan 2022 04:36:18 -0500 Subject: [PATCH 16/24] patch to `scale_xifti` --- R/scale_xifti.R | 15 ++++++++------- man/scale_xifti.Rd | 4 +++- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/R/scale_xifti.R b/R/scale_xifti.R index a6a3e13..a961aaa 100644 --- a/R/scale_xifti.R +++ b/R/scale_xifti.R @@ -8,17 +8,18 @@ #' @return The input \code{"xifti"} with scaled columns. #' #' @keywords export -scale_xifti <- function(x, center=TRUE, scale=TRUE){ - stopifnot(is.xifti(x)) +scale_xifti <- function(xifti, center=TRUE, scale=TRUE){ + stopifnot(is.xifti(xifti)) - if (!is.null(x$meta$cifti$intent)) { - if (x$meta$cifti$intent == 3007) { + if (!is.null(xifti$meta$cifti$intent)) { + if (xifti$meta$cifti$intent == 3007) { ciftiTools_warn("Converting to `dscalar` before scaling.\n") - x <- convert_xifti(x, "dscalar") + xifti <- convert_xifti(xifti, "dscalar") } } - x <- newdata_xifti(x, - scale(as.matrix(x), center=center, scale=scale) + xifti <- newdata_xifti( + xifti, + scale(as.matrix(xifti), center=center, scale=scale) ) } \ No newline at end of file diff --git a/man/scale_xifti.Rd b/man/scale_xifti.Rd index aa30211..62e258f 100644 --- a/man/scale_xifti.Rd +++ b/man/scale_xifti.Rd @@ -4,9 +4,11 @@ \alias{scale_xifti} \title{Scale CIFTI} \usage{ -scale_xifti(x, center = TRUE, scale = TRUE) +scale_xifti(xifti, center = TRUE, scale = TRUE) } \arguments{ +\item{xifti}{A \code{"xifti"} object.} + \item{center, scale}{Arguments to \code{\link[base]{scale}}.} } \value{ From 752a65be604b7caa2a4bdcc6ad1e2441c0d28e58 Mon Sep 17 00:00:00 2001 From: Damon Pham Date: Tue, 25 Jan 2022 04:50:14 -0500 Subject: [PATCH 17/24] patch to `scale_xifti` again --- NAMESPACE | 1 + R/scale_xifti.R | 2 +- man/scale_xifti.Rd | 1 - 3 files changed, 2 insertions(+), 2 deletions(-) diff --git a/NAMESPACE b/NAMESPACE index a46977e..b47c55f 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -84,6 +84,7 @@ export(resamplecii) export(resamplegii) export(rotate_surf) export(run_wb_cmd) +export(scale_xifti) export(select_xifti) export(separateCIfTI) export(separate_cifti) diff --git a/R/scale_xifti.R b/R/scale_xifti.R index a961aaa..3a55969 100644 --- a/R/scale_xifti.R +++ b/R/scale_xifti.R @@ -7,7 +7,7 @@ #' #' @return The input \code{"xifti"} with scaled columns. #' -#' @keywords export +#' @export scale_xifti <- function(xifti, center=TRUE, scale=TRUE){ stopifnot(is.xifti(xifti)) diff --git a/man/scale_xifti.Rd b/man/scale_xifti.Rd index 62e258f..f093b32 100644 --- a/man/scale_xifti.Rd +++ b/man/scale_xifti.Rd @@ -17,4 +17,3 @@ The input \code{"xifti"} with scaled columns. \description{ Scale CIFTI data. Similar to \code{\link[base]{scale}}. } -\keyword{export} From be6bbb78a86b90832d49edfb639802acaa40a347 Mon Sep 17 00:00:00 2001 From: Damon Pham Date: Tue, 25 Jan 2022 04:50:27 -0500 Subject: [PATCH 18/24] test for `newdata_xifti` w/ unequal ncol --- tests/testthat/test-misc.R | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/testthat/test-misc.R b/tests/testthat/test-misc.R index 0ea61f5..6ade15d 100644 --- a/tests/testthat/test-misc.R +++ b/tests/testthat/test-misc.R @@ -204,6 +204,7 @@ test_that("Miscellaneous functions are working", { } scale_xifti(cii1, scale=FALSE) + newdata_xifti(cii1, as.matrix(cii1)[,rep(seq(ncol(cii1), 2))]) # [TO DO]: Test concatenating xiftis of different types From a095f0a1b73d3bcbf93df2c196ebb0be00a01902 Mon Sep 17 00:00:00 2001 From: Damon Pham Date: Wed, 26 Jan 2022 01:26:10 -0500 Subject: [PATCH 19/24] Patch if medial wall mask has zero TRUE/FALSE --- R/utils_xifti.R | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/R/utils_xifti.R b/R/utils_xifti.R index c6e8e36..37dbe25 100644 --- a/R/utils_xifti.R +++ b/R/utils_xifti.R @@ -43,6 +43,12 @@ summary.xifti <- function(object, ...) { if (dim(x$subcort_labels) < 1) { x["subcort_labels"] <- list(NULL) } + if (!is.null(x$medial_wall_mask$left)) { + x$medial_wall_mask$left[is.na(x$medial_wall_mask$left)] <- 0 + } + if (!is.null(x$medial_wall_mask$right)) { + x$medial_wall_mask$right[is.na(x$medial_wall_mask$right)] <- 0 + } # Add intent-specific entries if (!is.null(x$intent)) { From c8f420346815e8ae20f3b0874771fc39899eb92d Mon Sep 17 00:00:00 2001 From: Damon Pham Date: Sat, 29 Jan 2022 12:39:28 -0500 Subject: [PATCH 20/24] patch to `make_surf` --- R/read_surf.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/read_surf.R b/R/read_surf.R index adabc94..fa6bb54 100644 --- a/R/read_surf.R +++ b/R/read_surf.R @@ -118,5 +118,5 @@ read_surf <- function(surf, expected_hemisphere=NULL, resamp_res=NULL) { #' @rdname read_surf #' @export make_surf <- function(surf, expected_hemisphere=NULL, resamp_res=NULL){ - read_surf(surf=surf, expected_hemisphere=expected_hemisphere, resamp_res=NULL) + read_surf(surf=surf, expected_hemisphere=expected_hemisphere, resamp_res=resamp_res) } \ No newline at end of file From bc79655c487d70450443b60abdacda441bfb96fc Mon Sep 17 00:00:00 2001 From: Damon Pham Date: Sat, 29 Jan 2022 12:59:45 -0500 Subject: [PATCH 21/24] add newlines to warnings for `info_xifti` intent vs file ext. --- R/info_cifti.R | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/R/info_cifti.R b/R/info_cifti.R index b93ddad..6bf8f07 100644 --- a/R/info_cifti.R +++ b/R/info_cifti.R @@ -85,15 +85,15 @@ check_cifti_type <- function(intent, extn){ "This CIFTI file has intent code", intent, "and extension", extn, "neither of which is supported by ciftiTools (yet).", "Only the following types are:\n\t", - paste(supported_intents()$value, collapse="\t "), + paste(supported_intents()$value, collapse="\n\t "), "\nRespectively, they correspond to these file extensions:\n\t", - paste(supported_intents()$extension, collapse="\t ") + paste(supported_intents()$extension, collapse="\n\t ") )) } else { warning(paste( "This CIFTI file has extension", extn, "which is not yet supported by ciftiTools.", "Only the following types are:\t", - paste(supported_intents()$extension, collapse="\t "), + paste(supported_intents()$extension, collapse="\n\t "), "\nThe intent code", intent, "is supported but does not match the extension.", "Was the file named incorrectly?", "Continuing anyway with the intent code", intent, "and correct extension", From 6a8930db89d0ce96905fc46f887e5e4530115d21 Mon Sep 17 00:00:00 2001 From: Damon Pham Date: Sat, 29 Jan 2022 20:38:16 -0500 Subject: [PATCH 22/24] add `manipulateWidget` to Suggests --- DESCRIPTION | 1 + 1 file changed, 1 insertion(+) diff --git a/DESCRIPTION b/DESCRIPTION index 80893d8..d5cd266 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -49,6 +49,7 @@ Suggests: grid, gridExtra, htmlwidgets, + manipulateWidget, knitr, rmarkdown, papayar, From 9d466dc97e230ee7a2328a0e018e0ff1250e5350 Mon Sep 17 00:00:00 2001 From: Damon Pham Date: Sat, 29 Jan 2022 23:44:37 -0500 Subject: [PATCH 23/24] update URL to pub --- README.Rmd | 2 +- README.md | 2 +- inst/CITATION | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.Rmd b/README.Rmd index 95a50f4..4ca2e12 100644 --- a/README.Rmd +++ b/README.Rmd @@ -106,7 +106,7 @@ We can also convert metric GIFTI files and/or NIFTI files to CIFTI files (or vic ## Citation -You can cite our pre-print at [https://arxiv.org/abs/2106.11338](https://arxiv.org/abs/2106.11338). +You can cite our paper at [https://doi.org/10.1016/j.neuroimage.2022.118877](https://doi.org/10.1016/j.neuroimage.2022.118877). ## Data acknowledgement diff --git a/README.md b/README.md index 61e28e4..5fbf472 100644 --- a/README.md +++ b/README.md @@ -135,7 +135,7 @@ We can also convert metric GIFTI files and/or NIFTI files to CIFTI files ## Citation -You can cite our pre-print at . +You can cite our paper at . ## Data acknowledgement diff --git a/inst/CITATION b/inst/CITATION index 831cf2d..2111063 100644 --- a/inst/CITATION +++ b/inst/CITATION @@ -10,7 +10,7 @@ ciftiTools_citations <- c( as.person("Amanda F Mejia") ), year = "2021", - url = "https://arxiv.org/abs/2106.11338", + url = "https://doi.org/10.1016/j.neuroimage.2022.118877", key = "pham2021ciftitools" ) ) \ No newline at end of file From 267fb9badbb5d9a60a109e8f133ddd72786ff5f4 Mon Sep 17 00:00:00 2001 From: Damon Pham Date: Tue, 1 Feb 2022 09:44:55 -0500 Subject: [PATCH 24/24] Iterate version to 0.8.1 --- DESCRIPTION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index d5cd266..db929a1 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: ciftiTools Type: Package Title: Tools for Reading, Writing, Viewing and Manipulating CIFTI Files -Version: 0.8.0 +Version: 0.8.1 Authors@R: c( person(given = "Amanda", family = "Mejia",