|
a |
|
b/man/face_mask.Rd |
|
|
1 |
% Generated by roxygen2: do not edit by hand |
|
|
2 |
% Please edit documentation in R/face_mask.R |
|
|
3 |
\name{ct_face_mask} |
|
|
4 |
\alias{ct_face_mask} |
|
|
5 |
\alias{ct_face_mask,mri_face_mask} |
|
|
6 |
\alias{mri_face_mask} |
|
|
7 |
\title{Create Mask of the Face} |
|
|
8 |
\usage{ |
|
|
9 |
ct_face_mask( |
|
|
10 |
file, |
|
|
11 |
skull_strip = TRUE, |
|
|
12 |
mask = NULL, |
|
|
13 |
robust = TRUE, |
|
|
14 |
template.file = system.file(ifelse(skull_strip, "scct_unsmooth_SS_0.01.nii.gz", |
|
|
15 |
"scct_unsmooth.nii.gz"), package = "ichseg"), |
|
|
16 |
template.face_mask = NULL, |
|
|
17 |
template.face_mask_inds = list(50:130, 170:217, 1:15), |
|
|
18 |
extend_mask = TRUE, |
|
|
19 |
typeofTransform = "Affine", |
|
|
20 |
swapdim = TRUE, |
|
|
21 |
verbose = TRUE, |
|
|
22 |
... |
|
|
23 |
) |
|
|
24 |
|
|
|
25 |
mri_face_mask( |
|
|
26 |
..., |
|
|
27 |
skull_strip = TRUE, |
|
|
28 |
mask = NULL, |
|
|
29 |
robust = FALSE, |
|
|
30 |
template.file = mni_fname(brain = skull_strip) |
|
|
31 |
) |
|
|
32 |
} |
|
|
33 |
\arguments{ |
|
|
34 |
\item{file}{File for face masking - either filename or class nifti} |
|
|
35 |
|
|
|
36 |
\item{skull_strip}{Should the data require skull stripping if |
|
|
37 |
no mask is provided?} |
|
|
38 |
|
|
|
39 |
\item{mask}{file or \code{nifti} to mask the \code{file}} |
|
|
40 |
|
|
|
41 |
\item{robust}{If \code{mask = NULL}, then \code{robust} is |
|
|
42 |
passed to \code{\link{CT_Skull_Stripper}}} |
|
|
43 |
|
|
|
44 |
\item{template.file}{Template to warp to original image space} |
|
|
45 |
|
|
|
46 |
\item{template.face_mask}{Mask of template to use as rough face mask. If |
|
|
47 |
\code{template.file} is not specified, \code{template.face_mask_inds} |
|
|
48 |
must be} |
|
|
49 |
|
|
|
50 |
\item{template.face_mask_inds}{List of length 3 for indices of |
|
|
51 |
\code{template.file} to indicate the mask.} |
|
|
52 |
|
|
|
53 |
\item{extend_mask}{after transformation, should the mask be extended to the |
|
|
54 |
front of the image to ensure all face has been removed?} |
|
|
55 |
|
|
|
56 |
\item{typeofTransform}{Transformation for template to image, passed to |
|
|
57 |
\code{\link{ants_regwrite}}.} |
|
|
58 |
|
|
|
59 |
\item{swapdim}{Should the dimensions be swapped before registration, |
|
|
60 |
and then reset after} |
|
|
61 |
|
|
|
62 |
\item{verbose}{Print out diagnostic messages} |
|
|
63 |
|
|
|
64 |
\item{...}{arguments passed to \code{\link{CT_Skull_Stripper}}} |
|
|
65 |
} |
|
|
66 |
\value{ |
|
|
67 |
Object of class nifti |
|
|
68 |
} |
|
|
69 |
\description{ |
|
|
70 |
Creates a rough mask of the face from a head scan |
|
|
71 |
} |
|
|
72 |
\examples{ |
|
|
73 |
\dontrun{ |
|
|
74 |
file = "~/Desktop/Desktop/scratch/100-318_20070723_0957_CT_3_CT_Head-.nii.gz" |
|
|
75 |
mask = NULL |
|
|
76 |
robust = FALSE |
|
|
77 |
face = ct_face_mask( |
|
|
78 |
file = file, |
|
|
79 |
robust = FALSE |
|
|
80 |
) |
|
|
81 |
img = readnii(file) |
|
|
82 |
rimg = randomize_mask(img, mask = face) |
|
|
83 |
} |
|
|
84 |
|
|
|
85 |
\dontrun{ |
|
|
86 |
library(fslr) |
|
|
87 |
library(extrantsr) |
|
|
88 |
mri = "~/Desktop/Desktop/scratch/SUBJ0001-01-MPRAGE.nii.gz" |
|
|
89 |
|
|
|
90 |
template.file = mni_fname(brain = TRUE) |
|
|
91 |
tmask = mni_fname(brain = TRUE, mask = TRUE) |
|
|
92 |
|
|
|
93 |
template.face_mask_inds = list(50:130, 170:217, 1:15) |
|
|
94 |
brain = fslbet_robust(mri, |
|
|
95 |
remove.neck = TRUE, |
|
|
96 |
remover = "double_remove_neck", |
|
|
97 |
template.file = template.file, |
|
|
98 |
template.mask = tmask) |
|
|
99 |
mask = brain > 0 |
|
|
100 |
img = brain |
|
|
101 |
template.face_mask = NULL |
|
|
102 |
verbose = TRUE |
|
|
103 |
face = mri_face_mask( |
|
|
104 |
file = img, |
|
|
105 |
mask = mask, |
|
|
106 |
template.file = template.file |
|
|
107 |
) |
|
|
108 |
} |
|
|
109 |
|
|
|
110 |
} |