Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions .github/workflows/r-package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# This workflow will install R dependencies and run tests with a variety of R versions.

name: R package

on:
push:
branches: [master, develop]
pull_request:
branches: [master, develop]

jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
r-version: ["4.1.1"]

steps:
- uses: actions/checkout@v3
- name: Setup R
uses: r-lib/actions/setup-r@v2
with:
r-version: ${{ matrix.r-version }}
- name: Setup R dependencies
uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::rcmdcheck
needs: check
- name: Installing dependencies
run: |
sudo apt-get -y install libminc-dev
wget --quiet http://packages.bic.mni.mcgill.ca/minc-toolkit/Debian/minc-toolkit-1.9.18-20220625-Ubuntu_20.04-x86_64.deb
sudo dpkg -i minc-toolkit-1.9.18-20220625-Ubuntu_20.04-x86_64.deb
source /opt/minc/1.9.18/minc-toolkit-config.sh
git clone --recursive https://github.com/Mouse-Imaging-Centre/minc-stuffs.git
cd minc-stuffs
./autogen.sh
./configure --with-build-path=/opt/minc/1.9.18/
sudo make
sudo make install
sudo python setup.py install
- name: Running R CMD Check
run: |
source /opt/minc/1.9.18/minc-toolkit-config.sh
Rscript -e 'rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran"), build_args = "--no-manual", error_on = "warning", check_dir = "check")'
4 changes: 2 additions & 2 deletions R/minc_interface.R
Original file line number Diff line number Diff line change
Expand Up @@ -1346,12 +1346,12 @@ runRMINCTestbed <- function(..., dataPath = getOption("RMINC_DATA_DIR", tempdir(
getRMINCTestData <- function(dataPath = getOption("RMINC_DATA_DIR", tempdir()), method = "libcurl") {

downloadPath <- file.path(dataPath, "rminctestdata.tar.gz")
extractedPath <- file.path(dataPath, "rminctestdata/")
extractedPath <- file.path(dataPath, "RMINC-test-data-main/rminctestdata/")

if(!file.exists(extractedPath)){
if(!file.exists(downloadPath)){
dir.create(dataPath, showWarnings = FALSE, recursive = TRUE)
download.file("https://wiki.mouseimaging.ca/download/attachments/1654/rminctestdata2.tar.gz",
download.file("https://github.com/Mouse-Imaging-Centre/RMINC-test-data/archive/master.tar.gz",
destfile = downloadPath,
method = method) # changed from "wget" to stop freakouts on mac
}
Expand Down
5 changes: 5 additions & 0 deletions src/RcppExports.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@

using namespace Rcpp;

#ifdef RCPP_USE_GLOBAL_ROSTREAM
Rcpp::Rostream<true>& Rcpp::Rcout = Rcpp::Rcpp_cout_get();
Rcpp::Rostream<false>& Rcpp::Rcerr = Rcpp::Rcpp_cerr_get();
#endif

// anat_summary
List anat_summary(CharacterVector filenames, IntegerVector atlas, std::string method);
RcppExport SEXP _RMINC_anat_summary(SEXP filenamesSEXP, SEXP atlasSEXP, SEXP methodSEXP) {
Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/test_anatAnova.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ if(!exists("dataPath"))
dataPath <- tempdir()

getRMINCTestData(dataPath)
dataPath <- file.path(dataPath, "rminctestdata/")
dataPath <- file.path(dataPath, "RMINC-test-data-main/rminctestdata/")

gf <- read.csv(file.path(dataPath, "CIVET_TEST.csv"))
gf <- read.csv(file.path(dataPath, "CIVET_TEST.csv"), stringsAsFactors = TRUE)
gf <- civet.getAllFilenames(gf,"ID","TEST",file.path(dataPath, "CIVET"),"TRUE","1.1.12")
gf <- civet.readAllCivetFiles(file.path(dataPath, "AAL.csv"),gf)

Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/test_anatApply.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ if(!exists("dataPath"))
dataPath <- tempdir()

getRMINCTestData(dataPath)
dataPath <- file.path(dataPath, "rminctestdata/")
dataPath <- file.path(dataPath, "RMINC-test-data-main/rminctestdata/")

gf <- read.csv(file.path(dataPath, "CIVET_TEST.csv"))
gf <- read.csv(file.path(dataPath, "CIVET_TEST.csv"), stringsAsFactors = TRUE)
gf <- civet.getAllFilenames(gf,"ID","TEST",file.path(dataPath, "CIVET"),"TRUE","1.1.12")
gf <- civet.readAllCivetFiles(file.path(dataPath, "AAL.csv"),gf)

Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/test_anatFDR.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ if(!exists("dataPath"))
dataPath <- tempdir()

getRMINCTestData(dataPath)
dataPath <- file.path(dataPath, "rminctestdata/")
dataPath <- file.path(dataPath, "RMINC-test-data-main/rminctestdata/")

gf <- read.csv(file.path(dataPath, "CIVET_TEST.csv"))
gf <- read.csv(file.path(dataPath, "CIVET_TEST.csv"), stringsAsFactors = TRUE)
gf <- civet.getAllFilenames(gf,"ID","TEST",file.path(dataPath, "CIVET"),"TRUE","1.1.12")
gf <- civet.readAllCivetFiles(file.path(dataPath, "AAL.csv"),gf)

Expand Down
6 changes: 3 additions & 3 deletions tests/testthat/test_anatGet.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ if(!exists("dataPath"))
dataPath <- tempdir()

getRMINCTestData(dataPath)
dataPath <- file.path(dataPath, "rminctestdata/")
dataPath <- file.path(dataPath, "RMINC-test-data-main/rminctestdata/")

gf <- read.csv(file.path(dataPath, "minc_summary_test_data.csv"))
gf <- read.csv(file.path(dataPath, "minc_summary_test_data.csv"), stringsAsFactors = TRUE)
first_file <- gf$jacobians_0.2[1]
segmentation <- file.path(dataPath, "test_segmentation.mnc")
labels <- file.path(dataPath, "test_defs.csv")
label_frame <- read.csv(labels)
label_frame <- read.csv(labels, stringsAsFactors = TRUE)
known_labels <- with(label_frame, union(left.label, right.label))

unanat <- function(anat){
Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/test_anatLm.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ if(!exists("dataPath"))
dataPath <- tempdir()

getRMINCTestData(dataPath)
dataPath <- file.path(dataPath, "rminctestdata/")
dataPath <- file.path(dataPath, "RMINC-test-data-main/rminctestdata/")

gf <- read.csv(file.path(dataPath, "CIVET_TEST.csv"))
gf <- read.csv(file.path(dataPath, "CIVET_TEST.csv"), stringsAsFactors = TRUE)
gf <- civet.getAllFilenames(gf,"ID","TEST",file.path(dataPath, "CIVET"),"TRUE","1.1.12")
gf <- civet.readAllCivetFiles(file.path(dataPath, "AAL.csv"),gf)

Expand Down
6 changes: 3 additions & 3 deletions tests/testthat/test_anatLmer.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ if(!exists("dataPath"))
dataPath <- tempdir()

getRMINCTestData(dataPath)
dataPath <- file.path(dataPath, "rminctestdata/")
dataPath <- file.path(dataPath, "RMINC-test-data-main/rminctestdata/")

gf <- read.csv(file.path(dataPath, "minc_summary_test_data.csv"))
gf <- read.csv(file.path(dataPath, "minc_summary_test_data.csv"), stringsAsFactors = TRUE)
first_file <- gf$jacobians_0.2[1]
segmentation <- file.path(dataPath, "test_segmentation.mnc")
labels <- file.path(dataPath, "test_defs.csv")
label_frame <- read.csv(labels)
label_frame <- read.csv(labels, stringsAsFactors = TRUE)
known_labels <- with(label_frame, union(left.label, right.label))

anat_env <- new.env()
Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/test_anatomy.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ if(!exists("dataPath"))
dataPath <- tempdir()

getRMINCTestData(dataPath)
dataPath <- file.path(dataPath, "rminctestdata/")
dataPath <- file.path(dataPath, "RMINC-test-data-main/rminctestdata/")

gf <- read.csv(file.path(dataPath, "CIVET_TEST.csv"))
gf <- read.csv(file.path(dataPath, "CIVET_TEST.csv"), stringsAsFactors = TRUE)
gf <- civet.getAllFilenames(gf,"ID","TEST",file.path(dataPath, "CIVET"),"TRUE","1.1.12")
gf <- civet.readAllCivetFiles(file.path(dataPath, "AAL.csv"),gf)

Expand Down
10 changes: 5 additions & 5 deletions tests/testthat/test_civet.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@ if(!exists("dataPath"))
dataPath <- tempdir()

getRMINCTestData(dataPath)
dataPath <- file.path(dataPath, "rminctestdata/")
dataPath <- file.path(dataPath, "RMINC-test-data-main/rminctestdata/")

gf <- read.csv(file.path(dataPath, "CIVET_TEST.csv"))
gf <- read.csv(file.path(dataPath, "CIVET_TEST.csv"), stringsAsFactors = TRUE)
gf <- civet.getAllFilenames(gf,"ID","TEST",file.path(dataPath, "CIVET"),"TRUE","1.1.12")
gf <- civet.readAllCivetFiles(file.path(dataPath, "AAL.csv"),gf)

dataFile <- gf$lobeThickness
AALAtlas <- read.csv(file.path(dataPath, "AAL.csv"))
verticesL <- read.csv(file.path(dataPath, "AAL_atlas_left.txt"),header = FALSE)
verticesR <- read.csv(file.path(dataPath, "AAL_atlas_right.txt"),header = FALSE)
AALAtlas <- read.csv(file.path(dataPath, "AAL.csv"), stringsAsFactors = TRUE)
verticesL <- read.csv(file.path(dataPath, "AAL_atlas_left.txt"),header = FALSE, stringsAsFactors = TRUE)
verticesR <- read.csv(file.path(dataPath, "AAL_atlas_right.txt"),header = FALSE, stringsAsFactors = TRUE)
reducedVertices <- c(verticesL[0:40961,1],verticesR[0:40961,1])

atlasIndex <- pmatch(names(dataFile[1,1]),AALAtlas[,3])
Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/test_mincAnova.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ if(!exists("dataPath"))
dataPath <- tempdir()

getRMINCTestData(dataPath)
dataPath <- file.path(dataPath, "rminctestdata/")
dataPath <- file.path(dataPath, "RMINC-test-data-main/rminctestdata/")

gf <- read.csv(file.path(dataPath, "test_data_set.csv"))
gf <- read.csv(file.path(dataPath, "test_data_set.csv"), stringsAsFactors = TRUE)

voxel_left <- mincGetVoxel(gf$jacobians_fixed_2[1:10], 0,0,0)
voxel_right <- mincGetVoxel(gf$jacobians_fixed_2[11:20], 0,0,0)
Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/test_mincApply.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ if(!exists("dataPath"))
dataPath <- tempdir()

getRMINCTestData(dataPath)
dataPath <- file.path(dataPath, "rminctestdata/")
dataPath <- file.path(dataPath, "RMINC-test-data-main/rminctestdata/")

gf <- read.csv(file.path(dataPath, "test_data_set.csv"))
gf <- read.csv(file.path(dataPath, "test_data_set.csv"), stringsAsFactors = TRUE)

mm <- verboseRun("mincMean(gf$jacobians_fixed_2)",getOption("verbose"))
ma <- verboseRun("mincApply(gf$jacobians_fixed_2,quote(mean(x)))",getOption("verbose"))
Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/test_mincFDR.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ if(!exists("dataPath"))
dataPath <- tempdir()

getRMINCTestData(dataPath)
dataPath <- file.path(dataPath, "rminctestdata/")
dataPath <- file.path(dataPath, "RMINC-test-data-main/rminctestdata/")

gf <- read.csv(file.path(dataPath, "test_data_set.csv"))
gf <- read.csv(file.path(dataPath, "test_data_set.csv"), stringsAsFactors = TRUE)

voxel_left <- mincGetVoxel(gf$jacobians_fixed_2[1:10], 0,0,0)
voxel_right <- mincGetVoxel(gf$jacobians_fixed_2[11:20], 0,0,0)
Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/test_mincLm.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ if(!exists("dataPath"))
dataPath <- tempdir()

getRMINCTestData(dataPath)
dataPath <- file.path(dataPath, "rminctestdata/")
dataPath <- file.path(dataPath, "RMINC-test-data-main/rminctestdata/")

gf <- read.csv(file.path(dataPath, "test_data_set.csv"))
gf <- read.csv(file.path(dataPath, "test_data_set.csv"), stringsAsFactors = TRUE)

voxel_left <- mincGetVoxel(gf$jacobians_fixed_2[1:10], 0,0,0)
voxel_right <- mincGetVoxel(gf$jacobians_fixed_2[11:20], 0,0,0)
Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/test_mincLmer.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ if(!exists("dataPath"))
dataPath <- tempdir()

getRMINCTestData(dataPath)
dataPath <- file.path(dataPath, "rminctestdata/")
dataPath <- file.path(dataPath, "RMINC-test-data-main/rminctestdata/")

gf <- read.csv(file.path(dataPath, "test_data_set.csv"))
gf <- read.csv(file.path(dataPath, "test_data_set.csv"), stringsAsFactors = TRUE)
maskfile <- file.path(dataPath, "testminc-mask.mnc")

# pick a voxel inside the mask
Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/test_mincSummary.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ if(!exists("dataPath"))
dataPath <- tempdir()

getRMINCTestData(dataPath)
dataPath <- file.path(dataPath, "rminctestdata/")
dataPath <- file.path(dataPath, "RMINC-test-data-main/rminctestdata/")

gf <- read.csv(file.path(dataPath, "minc_summary_test_data.csv"))
gf <- read.csv(file.path(dataPath, "minc_summary_test_data.csv"), stringsAsFactors = TRUE)
gf$vox <- mincGetVoxel(gf$jacobians_0.2, 0, 0, 0)

#Calculate mean, sd, variance, and sum
Expand Down
6 changes: 3 additions & 3 deletions tests/testthat/test_mincTFCE.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ if(!exists("dataPath"))
dataPath <- tempdir()

getRMINCTestData(dataPath)
dataPath <- file.path(dataPath, "rminctestdata/")
dataPath <- file.path(dataPath, "RMINC-test-data-main/rminctestdata/")

gf <- read.csv(file.path(dataPath, "minc_summary_test_data.csv"))
gf <- read.csv(file.path(dataPath, "minc_summary_test_data.csv"), stringsAsFactors = TRUE)
first_file <- gf$jacobians_0.2[1]

first_vol <- mincGetVolume(first_file)
Expand Down Expand Up @@ -69,7 +69,7 @@ context("MincLm Randomization TFCE")
test_that("lm randomization works", {
evalq({
skip_on_cran()
skip_on_travis()
skip_on_ci()

verboseRun(lmod <- mincLm(jacobians_0.2 ~ Genotype, gf))
verboseRun(randomization_results <- mincTFCE(lmod, R = 10))
Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/test_mincTable.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ if(!exists("dataPath"))
dataPath <- tempdir()

getRMINCTestData(dataPath)
dataPath <- file.path(dataPath, "rminctestdata/")
dataPath <- file.path(dataPath, "RMINC-test-data-main/rminctestdata/")

gf <- read.csv(file.path(dataPath, "test_data_set.csv"))
gf <- read.csv(file.path(dataPath, "test_data_set.csv"), stringsAsFactors = TRUE)
maskfile <- file.path(dataPath, "testminc-mask.mnc")

ref <- sapply(gf$jacobians_fixed, function(f) mincGetVolume(f))
Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/test_minc_apply_rcpp.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ if(!exists("dataPath"))
dataPath <- tempdir()

getRMINCTestData(dataPath)
dataPath <- file.path(dataPath, "rminctestdata/")
dataPath <- file.path(dataPath, "RMINC-test-data-main/rminctestdata/")

gf <- read.csv(file.path(dataPath, "test_data_set.csv"))
gf <- read.csv(file.path(dataPath, "test_data_set.csv"), stringsAsFactors = TRUE)

mm <- verboseRun("mincMean(gf$jacobians_fixed_2)",getOption("verbose"))
ma <- verboseRun(
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test_misc.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ if(!exists("dataPath"))
dataPath <- tempdir()

getRMINCTestData(dataPath)
dataPath <- file.path(dataPath, "rminctestdata/")
dataPath <- file.path(dataPath, "RMINC-test-data-main/rminctestdata/")

matrix_3x4 <- mincGetTagFile(file.path(dataPath, "3rows_4cols.tag"))
matrix_4x3 <- mincGetTagFile(file.path(dataPath, "4rows_3cols_2comments.tag"))
Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/test_objects.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ if(!exists("dataPath"))
dataPath <- tempdir()

getRMINCTestData(dataPath)
dataPath <- file.path(dataPath, "rminctestdata/")
dataPath <- file.path(dataPath, "RMINC-test-data-main/rminctestdata/")

gf <- read.csv(file.path(dataPath, "test_data_set.csv"))
gf <- read.csv(file.path(dataPath, "test_data_set.csv"), stringsAsFactors = TRUE)


a <- structure(1, class = "mincSingleDim")
Expand Down
8 changes: 4 additions & 4 deletions tests/testthat/test_qminc.R
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ test_parallel <-
dataPath <- "."
}

if(!file.exists(file.path(dataPath, "rminctestdata"))){
if(!file.exists(file.path(dataPath, "RMINC-test-data-main/rminctestdata"))){

if(getOption("verbose")){
getRMINCTestData(dataPath)
Expand All @@ -30,15 +30,15 @@ test_parallel <-
}

on.exit({
unlink(file.path(dataPath, "rminctestdata"), recursive = TRUE)
unlink(file.path(dataPath, "RMINC-test-data-main/rminctestdata"), recursive = TRUE)
unlink(file.path("rminctestdata.tar.gz"))
}, add = TRUE)

}

dataPath <- file.path(dataPath, "rminctestdata/")
dataPath <- file.path(dataPath, "RMINC-test-data-main/rminctestdata/")

gf <- read.csv(file.path(dataPath, "test_data_set.csv"))
gf <- read.csv(file.path(dataPath, "test_data_set.csv"), stringsAsFactors = TRUE)
mask_file <- file.path(dataPath, "testminc-mask.mnc")
}

Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/test_vertexAnova.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ if(!exists("dataPath"))
dataPath <- tempdir()

getRMINCTestData(dataPath)
dataPath <- file.path(dataPath, "rminctestdata/")
dataPath <- file.path(dataPath, "RMINC-test-data-main/rminctestdata/")

gftest <- read.csv(file.path(dataPath, "subject.csv"))
gftest <- read.csv(file.path(dataPath, "subject.csv"), stringsAsFactors = TRUE)

subjectFile = matrix(data=NA,nrow=10,1)
subjectFile[1,1] = file.path(dataPath, "vertex2.txt")
Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/test_vertexApply.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ if(!exists("dataPath"))
dataPath <- tempdir()

getRMINCTestData(dataPath)
dataPath <- file.path(dataPath, "rminctestdata/")
dataPath <- file.path(dataPath, "RMINC-test-data-main/rminctestdata/")

gftest <- read.csv(file.path(dataPath, "subject.csv"))
gftest <- read.csv(file.path(dataPath, "subject.csv"), stringsAsFactors = TRUE)

subjectFile = matrix(data=NA,nrow=10,1)
subjectFile[1,1] = file.path(dataPath, "vertex2.txt")
Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/test_vertexFDR.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ if(!exists("dataPath"))
dataPath <- tempdir()

getRMINCTestData(dataPath)
dataPath <- file.path(dataPath, "rminctestdata/")
dataPath <- file.path(dataPath, "RMINC-test-data-main/rminctestdata/")

gftest <- read.csv(file.path(dataPath, "subject.csv"))
gftest <- read.csv(file.path(dataPath, "subject.csv"), stringsAsFactors = TRUE)

subjectFile = matrix(data=NA,nrow=10,1)
subjectFile[1,1] = file.path(dataPath, "vertex2.txt")
Expand Down
Loading