Skip to content

Commit

Permalink
if user name rave_slices under fs folder, use it to display T1 slices
Browse files Browse the repository at this point in the history
  • Loading branch information
dipterix committed Jan 8, 2024
1 parent b28a22f commit f071216
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion R/threeBrain.R
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,10 @@ threeBrain <- function(
"brain.finalsurfs", "synthSR.norm", "synthSR", "brain",
"brainmask", "brainmask.auto", "T1"
)
allowed_fsmri_prefix <- c(
"brain.finalsurfs", "synthSR.norm", "synthSR", "brain",
"brainmask", "brainmask.auto", "T1"
)

path_mri <- file.path(fs_path, "mri", as.vector(rbind(
sprintf("%s.nii.gz", allowed_mri_prefix),
Expand All @@ -180,6 +184,13 @@ threeBrain <- function(
)))
path_mri <- path_mri[file.exists(path_mri)]
if(length(path_mri)){ path_mri <- path_mri[[1]] }
path_fsmri <- file.path(fs_path, "mri", as.vector(rbind(
sprintf("%s.nii.gz", allowed_fsmri_prefix),
sprintf("%s.nii", allowed_fsmri_prefix),
sprintf("%s.mgz", allowed_fsmri_prefix)
)))
path_fsmri <- path_fsmri[file.exists(path_fsmri)]
if(length(path_fsmri)){ path_fsmri <- path_fsmri[[1]] }

# xfm
path_xfm <- file.path(fs_path, "mri", "transforms", "talairach.xfm")
Expand Down Expand Up @@ -235,7 +246,7 @@ threeBrain <- function(
}

# Norig, Torig
mgz_files <- c(path_mri, path_atlas)
mgz_files <- c(path_fsmri, path_atlas)
if(!length(mgz_files)) {
mgz_files <- list.files(
file.path(fs_path, "mri"), pattern = "\\.mg(z|h)$", all.files = FALSE,
Expand Down

0 comments on commit f071216

Please sign in to comment.