diff --git a/CHANGES b/CHANGES index 52b99bc..c2d2f59 100644 --- a/CHANGES +++ b/CHANGES @@ -14,6 +14,7 @@ Version 0.1.11 - add support for writing GIFTI format annotations - export rotate2D and flip2D to namespace - add support for reading transformation matrices from xfm files: read.fs.transform +- rename all optional data functions: replace optional_data with opt_data in function names to prevent clash with fsbrain names Version 0.1.10 diff --git a/NAMESPACE b/NAMESPACE index 9fe479d..7561927 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -11,15 +11,15 @@ S3method(read_nisurfacefile,fsnative) S3method(read_nisurfacefile,gifti) export(cdata) export(colortable.from.annot) -export(delete_all_optional_data) -export(download_optional_data) +export(delete_all_opt_data) +export(download_opt_data) export(faces.quad.to.tris) export(flip2D) export(flip3D) export(fs.get.morph.file.ext.for.format) export(fs.get.morph.file.format.from.filename) export(fs.patch) -export(get_optional_data_filepath) +export(get_opt_data_filepath) export(gifti_writer) export(gifti_xml) export(gifti_xml_add_global_metadata) @@ -29,7 +29,7 @@ export(is.fs.annot) export(is.fs.label) export(is.fs.surface) export(is.fs.volume) -export(list_optional_data) +export(list_opt_data) export(mghheader.centervoxelRAS.from.firstvoxelRAS) export(mghheader.crs.orientation) export(mghheader.is.conformed) diff --git a/R/optdata.R b/R/optdata.R index ebeae8e..5b91a35 100644 --- a/R/optdata.R +++ b/R/optdata.R @@ -6,7 +6,7 @@ #' #' @export #' @importFrom pkgfilecache get_pkg_info ensure_files_available -download_optional_data <- function() { +download_opt_data <- function() { pkg_info = pkgfilecache::get_pkg_info("freesurferformats"); # Replace these with your optional data files. @@ -94,7 +94,7 @@ download_optional_data <- function() { #' #' @export #' @importFrom pkgfilecache get_pkg_info list_available -list_optional_data <- function() { +list_opt_data <- function() { pkg_info = pkgfilecache::get_pkg_info("freesurferformats"); return(pkgfilecache::list_available(pkg_info)); } @@ -110,7 +110,7 @@ list_optional_data <- function() { #' #' @export #' @importFrom pkgfilecache get_pkg_info get_filepath -get_optional_data_filepath <- function(filename, mustWork=TRUE) { +get_opt_data_filepath <- function(filename, mustWork=TRUE) { pkg_info = pkgfilecache::get_pkg_info("freesurferformats"); return(pkgfilecache::get_filepath(pkg_info, filename, mustWork=mustWork)); } @@ -122,7 +122,7 @@ get_optional_data_filepath <- function(filename, mustWork=TRUE) { #' #' @export #' @importFrom pkgfilecache get_pkg_info erase_file_cache -delete_all_optional_data <- function() { +delete_all_opt_data <- function() { pkg_info = pkgfilecache::get_pkg_info("freesurferformats"); return(pkgfilecache::erase_file_cache(pkg_info)); } diff --git a/man/delete_all_optional_data.Rd b/man/delete_all_opt_data.Rd similarity index 78% rename from man/delete_all_optional_data.Rd rename to man/delete_all_opt_data.Rd index c5dda60..8f635cb 100644 --- a/man/delete_all_optional_data.Rd +++ b/man/delete_all_opt_data.Rd @@ -1,10 +1,10 @@ % Generated by roxygen2: do not edit by hand % Please edit documentation in R/optdata.R -\name{delete_all_optional_data} -\alias{delete_all_optional_data} +\name{delete_all_opt_data} +\alias{delete_all_opt_data} \title{Delete all data in the package cache.} \usage{ -delete_all_optional_data() +delete_all_opt_data() } \value{ integer. The return value of the unlink() call: 0 for success, 1 for failure. See the unlink() documentation for details. diff --git a/man/download_optional_data.Rd b/man/download_opt_data.Rd similarity index 90% rename from man/download_optional_data.Rd rename to man/download_opt_data.Rd index f88b809..96f3735 100644 --- a/man/download_optional_data.Rd +++ b/man/download_opt_data.Rd @@ -1,10 +1,10 @@ % Generated by roxygen2: do not edit by hand % Please edit documentation in R/optdata.R -\name{download_optional_data} -\alias{download_optional_data} +\name{download_opt_data} +\alias{download_opt_data} \title{Download optional data for the freesurferformats package.} \usage{ -download_optional_data() +download_opt_data() } \value{ Named list. The list has entries: "available": vector of strings. The names of the files that are available in the local file cache. You can access them using get_optional_data_file(). "missing": vector of strings. The names of the files that this function was unable to retrieve. diff --git a/man/get_optional_data_filepath.Rd b/man/get_opt_data_filepath.Rd similarity index 84% rename from man/get_optional_data_filepath.Rd rename to man/get_opt_data_filepath.Rd index 8a01583..dc36941 100644 --- a/man/get_optional_data_filepath.Rd +++ b/man/get_opt_data_filepath.Rd @@ -1,10 +1,10 @@ % Generated by roxygen2: do not edit by hand % Please edit documentation in R/optdata.R -\name{get_optional_data_filepath} -\alias{get_optional_data_filepath} +\name{get_opt_data_filepath} +\alias{get_opt_data_filepath} \title{Access a single file from the package cache by its file name.} \usage{ -get_optional_data_filepath(filename, mustWork = TRUE) +get_opt_data_filepath(filename, mustWork = TRUE) } \arguments{ \item{filename, }{string. The filename of the file in the package cache.} diff --git a/man/list_optional_data.Rd b/man/list_opt_data.Rd similarity index 84% rename from man/list_optional_data.Rd rename to man/list_opt_data.Rd index edd6578..fa15267 100644 --- a/man/list_optional_data.Rd +++ b/man/list_opt_data.Rd @@ -1,10 +1,10 @@ % Generated by roxygen2: do not edit by hand % Please edit documentation in R/optdata.R -\name{list_optional_data} -\alias{list_optional_data} +\name{list_opt_data} +\alias{list_opt_data} \title{Get file names available in package cache.} \usage{ -list_optional_data() +list_opt_data() } \value{ vector of strings. The file names available, relative to the package cache. diff --git a/tests/testthat/test-read-fs-surface.R b/tests/testthat/test-read-fs-surface.R index 2aaf5fe..568b5d4 100644 --- a/tests/testthat/test-read-fs-surface.R +++ b/tests/testthat/test-read-fs-surface.R @@ -3,8 +3,8 @@ test_that("Our demo surface file can be read using read.fs.surface", { skip_if(tests_running_on_cran_under_macos(), message = "Skipping on CRAN under MacOS, required test data cannot be downloaded."); - freesurferformats::download_optional_data(); - subjects_dir = freesurferformats::get_optional_data_filepath("subjects_dir"); + freesurferformats::download_opt_data(); + subjects_dir = freesurferformats::get_opt_data_filepath("subjects_dir"); surface_file = file.path(subjects_dir, "subject1", "surf", "lh.white"); skip_if_not(file.exists(surface_file), message="Test data missing.") ; @@ -36,8 +36,8 @@ test_that("Vertex connectivity in the demo surface file is as expected from refe skip_if(tests_running_on_cran_under_macos(), message = "Skipping on CRAN under MacOS, required test data cannot be downloaded."); - freesurferformats::download_optional_data(); - subjects_dir = freesurferformats::get_optional_data_filepath("subjects_dir"); + freesurferformats::download_opt_data(); + subjects_dir = freesurferformats::get_opt_data_filepath("subjects_dir"); surface_file = file.path(subjects_dir, "subject1", "surf", "lh.white"); skip_if_not(file.exists(surface_file), message="Test data missing."); @@ -60,8 +60,8 @@ test_that("The vertices of a face are close to each other", { skip_if(tests_running_on_cran_under_macos(), message = "Skipping on CRAN under MacOS, required test data cannot be downloaded."); - freesurferformats::download_optional_data(); - subjects_dir = freesurferformats::get_optional_data_filepath("subjects_dir"); + freesurferformats::download_opt_data(); + subjects_dir = freesurferformats::get_opt_data_filepath("subjects_dir"); surface_file = file.path(subjects_dir, "subject1", "surf", "lh.white"); skip_if_not(file.exists(surface_file), message="Test data missing."); diff --git a/tests/testthat/test-write-fs-surface.R b/tests/testthat/test-write-fs-surface.R index c2a72a6..b94d846 100644 --- a/tests/testthat/test-write-fs-surface.R +++ b/tests/testthat/test-write-fs-surface.R @@ -39,8 +39,8 @@ test_that("One can read, write and re-read triangular surface data", { skip_if(tests_running_on_cran_under_macos(), message = "Skipping on CRAN under MacOS, required test data cannot be downloaded."); - freesurferformats::download_optional_data(); - subjects_dir = freesurferformats::get_optional_data_filepath("subjects_dir"); + freesurferformats::download_opt_data(); + subjects_dir = freesurferformats::get_opt_data_filepath("subjects_dir"); surface_file = file.path(subjects_dir, "subject1", "surf", "lh.white"); skip_if_not(file.exists(surface_file), message="Test data missing.");