Description Usage Arguments Value Note Examples
View source: R/flexconn_predict.R
Predict from FLEXCONN model
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | flexconn_predict_patch(
model,
t1,
flair,
t2 = NULL,
mask = NULL,
patchsize,
verbose = TRUE,
...,
batch_size = 1
)
flexconn_predict(
model,
t1,
flair,
t2 = NULL,
mask = NULL,
type = c("volume", "patch"),
patchsize,
verbose = TRUE,
normalize = TRUE,
...,
batch_size = 1
)
flexconn_predict_with_patches(
model,
t1,
flair,
t2 = NULL,
mask = NULL,
patchsize,
verbose = TRUE,
...,
batch_size = 1
)
flexconn_predict_with_volume(
model,
t1,
flair,
t2 = NULL,
verbose = TRUE,
normalize = TRUE,
...,
batch_size = 1
)
|
model |
A keras model object trained |
t1 |
3D array or |
flair |
3D array or |
t2 |
3D array or |
mask |
binary 3D array or |
patchsize |
Vector of length 2 (or more) |
verbose |
print diagnostic messages |
... |
additional arguments to |
batch_size |
Size of batches for prediction.
Integer. Passed to
|
type |
type of prediction to use, patch-based or slice/volume based |
normalize |
Run |
A vector of predictions, based on the indices of the mask
If mask = NULL
, a mask will be generated for
t1 > 0
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | ## Not run:
model_file = tempfile(fileext = ".h5")
base_url = paste0("https://github.com/muschellij2/flexconnr",
"/raw/master/inst/extdata/")
model_url = paste0(base_url, "21atlases/",
"atlas_with_mask1/FLEXCONNmodel2D_35x35_17-10-2017_21-53-35.h5")
download.file(model_url, destfile = model_file)
t1_file = tempfile(fileext = ".nii.gz")
download.file(paste0(base_url, "T1.nii.gz"), destfile = t1_file)
flair_file = tempfile(fileext = ".nii.gz")
download.file(paste0(base_url, "FLAIR.nii.gz"), destfile = flair_file)
model = keras::load_model_hdf5(model_file)
res = flexconn_predict(model,
t1 = t1_file,
flair = flair_file)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.