diff --git a/CHANGES b/CHANGES index fc7fbb3..af3aadb 100644 --- a/CHANGES +++ b/CHANGES @@ -1,6 +1,10 @@ freesurferformats Changes ========================= +Version 0.1.18 +------------------------- +- Fix four minor docstring issues in internal functions. An email by the CRAN team required this. + Version 0.1.17 ------------------------- diff --git a/DESCRIPTION b/DESCRIPTION index 4b0474f..47a97ac 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: freesurferformats Type: Package Title: Read and Write 'FreeSurfer' Neuroimaging File Formats -Version: 0.1.17.9000 +Version: 0.1.18 Authors@R: person("Tim", "Schäfer", role = c("aut", "cre"), email = "ts+code@rcmd.org", comment = c(ORCID = "0000-0002-3683-8070")) Maintainer: Tim Schäfer Description: Provides functions to read and write neuroimaging data in various file formats, with a focus on 'FreeSurfer' formats. This includes, but is not limited to, the following file formats: 1) MGH/MGZ format files, which can contain multi-dimensional images or other data. Typically they contain time-series of three-dimensional brain scans acquired by magnetic resonance imaging (MRI). They can also contain vertex-wise measures of surface morphometry data. The MGH format is named after the Massachusetts General Hospital, and the MGZ format is a compressed version of the same format. 2) 'FreeSurfer' morphometry data files in binary 'curv' format. These contain vertex-wise surface measures, i.e., one scalar value for each vertex of a brain surface mesh. These are typically values like the cortical thickness or brain surface area at each vertex. 3) Annotation file format. This contains a brain surface parcellation derived from a cortical atlas. 4) Surface file format. Contains a brain surface mesh, given by a list of vertices and a list of faces. @@ -16,6 +16,7 @@ Imports: Suggests: knitr, rmarkdown, + curl, testthat (>= 2.1.0), oro.nifti (>= 0.9), gifti (>= 0.7.5), diff --git a/R/read_fs_curv.R b/R/read_fs_curv.R index 1831e6d..036a6ee 100644 --- a/R/read_fs_curv.R +++ b/R/read_fs_curv.R @@ -139,9 +139,9 @@ read.fs.morph.txt <- function(filepath) { #' #' @description Read a 3-byte integer from a binary file handle. Advances the pointer accordingly. #' -#' @param filehandle: file handle +#' @param filehandle file handle #' -#' @return integer: The read integer. +#' @return integer, The read integer. #' #' #' @keywords internal diff --git a/R/read_fs_surface.R b/R/read_fs_surface.R index 0cc33ed..8feac05 100644 --- a/R/read_fs_surface.R +++ b/R/read_fs_surface.R @@ -845,7 +845,7 @@ parse.stl.ascii.face <- function(stl_face_lines) { #' #' @description Some mesh file formats like STL do not store the faces as indices into a vertex list ('indexed mesh'), but repeat all vertex coordinates for each face ('polygon soup'). This function creates an indexed mesh from a polysoup. #' -#' @param face_vertex_coords numerical matrix with *n* rows and 3 columns, the vertex coordinates of the faces. Each row contains the x,y,z coordinates of a single vertex, and three consecutive vertex rows form a triangular face. +#' @param faces_vertex_coords numerical matrix with *n* rows and 3 columns, the vertex coordinates of the faces. Each row contains the x,y,z coordinates of a single vertex, and three consecutive vertex rows form a triangular face. #' #' @param digits the precision (number of digits after decimal separator) to use when to determine whether two x,y,z coords define the same vertex. #' @@ -1465,11 +1465,11 @@ int.to.col.brainvoyager <- function(int_val) { #' @title Stop unless surf is an fs.surface #' -#' @param surf fs.surface instance or anything else +#' @param surface fs.surface instance or anything else #' #' @param param_name character string, used in stop message to identify the parameter. #' -#' @return Called for the side effect of stopping if surf is not an fs.surface instance. +#' @return Called for the side effect of stopping if surface is not an fs.surface instance. #' #' @keywords internal assert.surface <- function(surface, param_name="surface") { diff --git a/R/write_fs_curv.R b/R/write_fs_curv.R index 61a9f86..bcdcf86 100644 --- a/R/write_fs_curv.R +++ b/R/write_fs_curv.R @@ -91,9 +91,9 @@ write.fs.morph.txt <- function(filepath, data) { #' #' @description Write a 3-byte integer to a binary file handle. #' -#' @param filehandle: file handle (connection) +#' @param filehandle file handle (connection) #' -#' @param data: number to write +#' @param data number to write #' #' #' @keywords internal diff --git a/R/write_fs_mgh.R b/R/write_fs_mgh.R index 5d804f1..dac4308 100644 --- a/R/write_fs_mgh.R +++ b/R/write_fs_mgh.R @@ -195,7 +195,7 @@ mri_dtype_numbytes <- function(mri_dtype_code) { #' #' @description This function provides an educated guess on whether the given dtype is suitable for the data. It is usually called for the site effect of printing warnings in case something seems off. #' -#' @param data the data to check, a vector, matrix or array typically +#' @param mridata the data to check, a vector, matrix or array typically #' #' @param mri_dtype_code integer, the MRI data type code. See \code{\link[freesurferformats]{translate.mri.dtype}}. #' @@ -204,21 +204,21 @@ mri_dtype_numbytes <- function(mri_dtype_code) { #' @return logical, whether the dtype could be suitable. This is only a guess, as the checks are in no way complete. #' #' @keywords internal -check.dtype.for.data <- function(data, mri_dtype_code) { +check.dtype.for.data <- function(mridata, mri_dtype_code) { could_be_okay = TRUE; mri_dtype_name = translate.mri.dtype(mri_dtype_code); if(mri_dtype_name == "MRI_UCHAR") { dtype_min_value = 0L; dtype_max_value = 255L; - if(is.integer(data)) { - if(min(data) < dtype_min_value | max(data) > dtype_max_value) { - warning(sprintf("Data type '%s' cannot store data outside of range [%d, %d], but your data has range [%d, %d]. Output will be wrong, check datatype.\n", mri_dtype_name, dtype_min_value, dtype_max_value, min(data), max(data))); + if(is.integer(mridata)) { + if(min(mridata) < dtype_min_value | max(mridata) > dtype_max_value) { + warning(sprintf("Data type '%s' cannot store mridata outside of range [%d, %d], but your mridata has range [%d, %d]. Output will be wrong, check datatype.\n", mri_dtype_name, dtype_min_value, dtype_max_value, min(mridata), max(mridata))); could_be_okay = FALSE; } } else { - warning(sprintf("Data type '%s' requires 'integer' data, found type '%s'.\n", mri_dtype_name, typeof(data))); + warning(sprintf("Data type '%s' requires 'integer' mridata, found type '%s'.\n", mri_dtype_name, typeof(mridata))); could_be_okay = FALSE; } } @@ -226,29 +226,29 @@ check.dtype.for.data <- function(data, mri_dtype_code) { if(mri_dtype_name == "MRI_SHORT") { dtype_min_value = 0L; dtype_max_value = 65535L; - if(is.integer(data)) { - if(min(data) < dtype_min_value | max(data) > dtype_max_value) { - warning(sprintf("Data type '%s' cannot store data outside of range [%d, %d], but your data has range [%d, %d]. Output will be wrong, check datatype.\n", mri_dtype_name, dtype_min_value, dtype_max_value, min(data), max(data))); + if(is.integer(mridata)) { + if(min(mridata) < dtype_min_value | max(mridata) > dtype_max_value) { + warning(sprintf("Data type '%s' cannot store mridata outside of range [%d, %d], but your mridata has range [%d, %d]. Output will be wrong, check datatype.\n", mri_dtype_name, dtype_min_value, dtype_max_value, min(mridata), max(mridata))); could_be_okay = FALSE; } } else { - warning(sprintf("Data type '%s' requires 'integer' data, found type '%s'.\n", mri_dtype_name, typeof(data))); + warning(sprintf("Data type '%s' requires 'integer' mridata, found type '%s'.\n", mri_dtype_name, typeof(mridata))); could_be_okay = FALSE; } } if(mri_dtype_name == "MRI_INT") { - if(!is.integer(data)) { - warning(sprintf("Data type '%s' requires 'integer' data, found type '%s'.\n", mri_dtype_name, typeof(data))); + if(!is.integer(mridata)) { + warning(sprintf("Data type '%s' requires 'integer' mridata, found type '%s'.\n", mri_dtype_name, typeof(mridata))); could_be_okay = FALSE; } } if(mri_dtype_name == "MRI_FLOAT") { - if(!is.double(data)) { - warning(sprintf("Data type '%s' requires 'double' data, found type '%s'.\n", mri_dtype_name, typeof(data))); + if(!is.double(mridata)) { + warning(sprintf("Data type '%s' requires 'double' mridata, found type '%s'.\n", mri_dtype_name, typeof(mridata))); could_be_okay = FALSE; } } diff --git a/man/assert.surface.Rd b/man/assert.surface.Rd index 6271cce..0f97f91 100644 --- a/man/assert.surface.Rd +++ b/man/assert.surface.Rd @@ -7,12 +7,12 @@ assert.surface(surface, param_name = "surface") } \arguments{ -\item{param_name}{character string, used in stop message to identify the parameter.} +\item{surface}{fs.surface instance or anything else} -\item{surf}{fs.surface instance or anything else} +\item{param_name}{character string, used in stop message to identify the parameter.} } \value{ -Called for the side effect of stopping if surf is not an fs.surface instance. +Called for the side effect of stopping if surface is not an fs.surface instance. } \description{ Stop unless surf is an fs.surface diff --git a/man/check.dtype.for.data.Rd b/man/check.dtype.for.data.Rd index a56f67b..85b8e8d 100644 --- a/man/check.dtype.for.data.Rd +++ b/man/check.dtype.for.data.Rd @@ -4,10 +4,10 @@ \alias{check.dtype.for.data} \title{Check whether the dtype is suitable for the data.} \usage{ -check.dtype.for.data(data, mri_dtype_code) +check.dtype.for.data(mridata, mri_dtype_code) } \arguments{ -\item{data}{the data to check, a vector, matrix or array typically} +\item{mridata}{the data to check, a vector, matrix or array typically} \item{mri_dtype_code}{integer, the MRI data type code. See \code{\link[freesurferformats]{translate.mri.dtype}}.} diff --git a/man/fread3.Rd b/man/fread3.Rd index 24f5f8d..984082d 100644 --- a/man/fread3.Rd +++ b/man/fread3.Rd @@ -7,10 +7,10 @@ fread3(filehandle) } \arguments{ -\item{filehandle:}{file handle} +\item{filehandle}{file handle} } \value{ -integer: The read integer. +integer, The read integer. } \description{ Read a 3-byte integer from a binary file handle. Advances the pointer accordingly. diff --git a/man/fwrite3.Rd b/man/fwrite3.Rd index 8de17b9..fcab3c3 100644 --- a/man/fwrite3.Rd +++ b/man/fwrite3.Rd @@ -7,9 +7,9 @@ fwrite3(filehandle, data) } \arguments{ -\item{filehandle:}{file handle (connection)} +\item{filehandle}{file handle (connection)} -\item{data:}{number to write} +\item{data}{number to write} } \description{ Write a 3-byte integer to a binary file handle. diff --git a/man/polygon.soup.to.indexed.mesh.Rd b/man/polygon.soup.to.indexed.mesh.Rd index f9b4091..829e47d 100644 --- a/man/polygon.soup.to.indexed.mesh.Rd +++ b/man/polygon.soup.to.indexed.mesh.Rd @@ -7,9 +7,9 @@ polygon.soup.to.indexed.mesh(faces_vertex_coords, digits = 6) } \arguments{ -\item{digits}{the precision (number of digits after decimal separator) to use when to determine whether two x,y,z coords define the same vertex.} +\item{faces_vertex_coords}{numerical matrix with *n* rows and 3 columns, the vertex coordinates of the faces. Each row contains the x,y,z coordinates of a single vertex, and three consecutive vertex rows form a triangular face.} -\item{face_vertex_coords}{numerical matrix with *n* rows and 3 columns, the vertex coordinates of the faces. Each row contains the x,y,z coordinates of a single vertex, and three consecutive vertex rows form a triangular face.} +\item{digits}{the precision (number of digits after decimal separator) to use when to determine whether two x,y,z coords define the same vertex.} } \value{ an indexed mesh, as an `fs.surface` instance (see \code{\link[freesurferformats]{read.fs.surface}}). diff --git a/web/examples/annot_unique_across_hemis.R b/web/examples/annot_unique_across_hemis.R old mode 100755 new mode 100644 diff --git a/web/examples/convert_pervertexdata_file.R b/web/examples/convert_pervertexdata_file.R old mode 100755 new mode 100644