View source: R/SuBLIME_prediction.R
SuBLIME_prediction | R Documentation |
Takes in MRI images from followup and gets predictions (probabilities) of the enhancing of lesions
SuBLIME_prediction(
baseline_flair,
follow_up_flair,
baseline_pd = NULL,
follow_up_pd = NULL,
baseline_t2,
follow_up_t2,
baseline_t1,
follow_up_t1,
time_diff,
baseline_nawm_mask = NULL,
follow_up_nawm_mask = baseline_nawm_mask,
brain_mask,
model = sublime::sublime_model,
voxsel = TRUE,
smooth.using = c("GaussSmoothArray", "none"),
voxsel.sigma = diag(3, 3),
voxsel.ksize = 5,
s.sigma = diag(3, 3),
s.ksize = 3,
plot.imgs = FALSE,
slice = 90,
pdfname = "diag.pdf",
verbose = TRUE
)
sublime_prediction(
baseline_flair,
follow_up_flair,
baseline_pd = NULL,
follow_up_pd = NULL,
baseline_t2,
follow_up_t2,
baseline_t1,
follow_up_t1,
time_diff,
baseline_nawm_mask = NULL,
follow_up_nawm_mask = baseline_nawm_mask,
brain_mask,
model = sublime::sublime_model,
voxsel = TRUE,
smooth.using = c("GaussSmoothArray", "none"),
voxsel.sigma = diag(3, 3),
voxsel.ksize = 5,
s.sigma = diag(3, 3),
s.ksize = 3,
plot.imgs = FALSE,
slice = 90,
pdfname = "diag.pdf",
verbose = TRUE
)
baseline_flair |
Baseline FLAIR image, either array or class nifti |
follow_up_flair |
Followup FLAIR image, either array or class nifti |
baseline_pd |
Baseline PD image, either array or class nifti |
follow_up_pd |
Followup PD image, either array or class nifti |
baseline_t2 |
Baseline T2 image, either array or class nifti |
follow_up_t2 |
Followup T2 image, either array or class nifti |
baseline_t1 |
Baseline T1 image, either array or class nifti |
follow_up_t1 |
Followup T1 image, either array or class nifti |
time_diff |
Difference in time (in days) between baseline and followup, numeric |
baseline_nawm_mask |
Baseline Normal Appearing white matter mask, either array or class nifti. Will be coerced to logical usign baseline_nawm_mask $> 0$. If NULL, no NAWM normalization is done (assumes data is already normalized) |
follow_up_nawm_mask |
Followup Normal Appearing white matter mask, either array or class nifti. Will be coerced to logical usign follow_up_nawm_mask $> 0$. Defaults to baseline_nawm_mask if not specified. If NULL, no NAWM normalization is done (assumes data is already normalized) |
brain_mask |
Brain mask, either array or class nifti. Will be #' coerced to logical usign brain_mask $> 0$. |
model |
Model of class |
voxsel |
Do Voxel Selection based on normalized T2 (logical) |
smooth.using |
Character vector to decide if using
|
voxsel.sigma |
Sigma passed to |
voxsel.ksize |
Kernel size passed to |
s.sigma |
Sigma passed to |
s.ksize |
Kernel size passed to |
plot.imgs |
Plot images along the way |
slice |
Slice to be plotted |
pdfname |
Name of pdf created for |
verbose |
Print Diagnostic Messages |
array
predict
## Not run:
download_data()
modes = c("FLAIR", "PD", "T2", "VolumetricT1")
modals = paste0(modes, "norm.nii.gz")
base_files = system.file("01", "Baseline", modals,
package = "sublime")
base_imgs = lapply(base_files, readNIfTI, reorient = FALSE)
f_files = system.file("01", "FollowUp", modals, package="sublime")
f_imgs = lapply(f_files, readNIfTI, reorient=FALSE)
names(base_imgs) = names(f_imgs) = modes
baseline_nawm_file = system.file("01", "Baseline",
"nawm.nii.gz", package="sublime")
baseline_nawm_mask = readNIfTI(baseline_nawm_file, reorient=FALSE)
baseline_nawm_mask = drop(baseline_nawm_mask)
follow_up_nawm_file = system.file("01", "FollowUp",
"nawm.nii.gz", package="sublime")
follow_up_nawm_mask = readNIfTI(follow_up_nawm_file, reorient=FALSE)
brain_file = system.file("01", "duramask.nii.gz", package="sublime")
brain_mask = readNIfTI(brain_file, reorient=FALSE)
brain_mask = drop(brain_mask)
on_cran = !identical(Sys.getenv("NOT_CRAN"), "true")
if (on_cran) {
follow_up_nawm_mask = NULL
baseline_nawm_mask = NULL
}
smooth.using = "GaussSmoothArray"
verbose = TRUE
time_diff = 10
voxsel = TRUE
model = sublime_model
#voxsel.sigma = s.sigma =diag(3,3)
#s.ksize = 3
#voxsel.ksize = 5
outimg = SuBLIME_prediction(
baseline_flair = base_imgs[["FLAIR"]],
follow_up_flair= f_imgs[["FLAIR"]],
baseline_pd = base_imgs[["PD"]],
follow_up_pd = f_imgs[["PD"]],
baseline_t2 = base_imgs[["T2"]],
follow_up_t2 = f_imgs[["T2"]],
baseline_t1 = base_imgs[["VolumetricT1"]],
follow_up_t1 = f_imgs[["VolumetricT1"]],
time_diff = time_diff,
baseline_nawm_mask = baseline_nawm_mask,
brain_mask = brain_mask,
voxsel = voxsel,
model = model, plot.imgs= TRUE,
pdfname = file.path(tempdir(), "pckg_diagnostc.pdf")
)
nopd_outimg = SuBLIME_prediction(
baseline_flair = base_imgs[["FLAIR"]],
follow_up_flair= f_imgs[["FLAIR"]],
baseline_pd = NULL,
follow_up_pd = NULL,
baseline_t2 = base_imgs[["T2"]],
follow_up_t2 = f_imgs[["T2"]],
baseline_t1 = base_imgs[["VolumetricT1"]],
follow_up_t1 = f_imgs[["VolumetricT1"]],
time_diff = time_diff,
baseline_nawm_mask = baseline_nawm_mask,
brain_mask = brain_mask,
voxsel = TRUE,
model = sublime::nopd_sublime_model, plot.imgs= TRUE,
pdfname = file.path(tempdir(), "pckg_diagnostc.pdf")
)
names(base_imgs) = paste0("baseline_", c("flair", "pd", "t2", "t1"))
names(f_imgs) = paste0("follow_up_", c("flair", "pd", "t2", "t1"))
attach(base_imgs)
attach(f_imgs)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.