Version: | 0.1.1 |
Date: | 2022-11-04 |
Title: | A Pipe-Friendly Image Calculator |
Maintainer: | Jon Clayden <code@clayden.org> |
Imports: | Rcpp, RNifti, magrittr |
LinkingTo: | Rcpp, RNifti |
Suggests: | mmand, tinytest, covr |
Description: | Provides a set of fast, chainable image-processing operations which are applicable to images of two, three or four dimensions, particularly medical images. |
License: | BSD_3_clause + file LICENCE |
URL: | https://github.com/jonclayden/imbibe |
BugReports: | https://github.com/jonclayden/imbibe/issues |
Encoding: | UTF-8 |
RoxygenNote: | 7.2.1 |
NeedsCompilation: | yes |
Packaged: | 2022-11-06 12:26:15 UTC; jon |
Author: | Jon Clayden |
Repository: | CRAN |
Date/Publication: | 2022-11-09 21:50:16 UTC |
Basic binary operations
Description
Basic binary operations
Usage
add(image, arg)
subtract(image, arg)
multiply(image, arg)
divide(image, arg)
remainder(image, arg)
mask(image, arg)
maximum(image, arg)
minimum(image, arg)
Arguments
image |
An image object or pipeline. |
arg |
Numeric or image argument. |
Value
An updated pipeline.
Mathematical morphology and filtering operations
Description
Mathematical morphology and filtering operations
Usage
dilate(image, kernel = NULL, ..., max = FALSE, nonzero = TRUE)
dilateall(image, kernel = NULL, ...)
erode(image, kernel = NULL, ..., min = FALSE)
filter_median(image, kernel = NULL, ...)
filter_mean(image, kernel = NULL, ..., norm = TRUE)
smooth_gauss(image, sigma)
subsample(image, offset = FALSE)
Arguments
image |
An image object or pipeline. |
kernel |
A suitable kernel function (see |
... |
Additional arguments to the kernel function, if any. |
max |
Logical value: if |
nonzero |
Logical value: if |
min |
Logical value: if |
norm |
Logical value indicating whether the mean filter will be normalised or not. |
sigma |
Numeric value giving the standard deviation of the Gaussian smoothing kernel. |
offset |
Logical value indicating whether subsampled pixels should be offset from the original locations or not. |
Value
An updated pipeline.
Dimensionality reduction operations
Description
Dimensionality reduction operations
Usage
dim_mean(image, dim = 4L)
dim_sd(image, dim = 4L)
dim_max(image, dim = 4L)
dim_whichmax(image, dim = 4L)
dim_min(image, dim = 4L)
dim_median(image, dim = 4L)
dim_quantile(image, dim = 4L, prob)
dim_AR1(image, dim = 4L)
Arguments
image |
An image object or pipeline. |
dim |
Integer value between 1 and 4, giving the dimension to apply the reduction along. |
prob |
For |
Value
An updated pipeline.
Expectation for testing pipeline output
Description
This function provides an expectation for use with the "tinytest" package, which runs the pipeline specified in its first argument and compares the result to its second.
Usage
expect_pipeline_result(current, target, precision = "double", ...)
Arguments
current |
The pipeline to run, which should have class |
target |
The target value to compare against, a numeric array of some
kind, which will be converted to a |
precision |
A string specifying the working precision. Passed to
|
... |
Further arguments to |
Value
A "tinytest"
object.
Basic unary operations
Description
Basic unary operations
Usage
exponent(image)
logarithm(image)
sine(image)
cosine(image)
tangent(image)
arcsine(image)
arccosine(image)
arctangent(image)
square(image)
squareroot(image)
reciprocal(image)
absolute(image)
binarise(image, invert = FALSE)
binarize(image, invert = FALSE)
Arguments
image |
An image object or pipeline. |
invert |
Logical value: if |
Value
An updated pipeline.
Create an operation pipeline
Description
Create an operation pipeline
Usage
imbibe(image)
## S3 method for class 'imbibe'
asNifti(x, ...)
## S3 method for class 'imbibe'
as.array(x, ...)
## S3 method for class 'imbibe'
print(x, ...)
Arguments
image |
An image object or existing pipeline. |
x |
An |
... |
Additional arguments to methods. |
Mathematical morphology kernels
Description
Mathematical morphology kernels
Usage
kernel_3d(image)
kernel_2d(image)
kernel_box(image, width, voxels = FALSE)
kernel_gauss(image, sigma)
kernel_sphere(image, radius)
kernel_file(image, file)
Arguments
image |
An image object or pipeline. |
width |
The width of the kernel in appropriate units. If |
voxels |
Logical value: if |
sigma |
Numeric value giving the standard deviation of a Gaussian kernel, in millimetres. |
radius |
Numeric value giving the radius of a sphere kernel, in millimetres. |
file |
Name of a NIfTI file containing the kernel. |
Value
An updated pipeline.
Objects exported from other packages
Description
These objects are imported from other packages. Follow the links below to see their documentation.
- magrittr
Run a pipeline and return an image result
Description
Run a pipeline and return an image result
Usage
run(pipe, precision = getOption("imbibe.precision", "double"))
Arguments
pipe |
An operation pipeline. |
precision |
The internal precision used for calculations. May be
|
Value
An image
Examples
im <- RNifti::readNifti(system.file("extdata", "example.nii.gz", package="RNifti"))
pipe <- im %>% threshold_below(500) %>% binarise()
run(pipe)
Image thresholding
Description
Image thresholding
Usage
threshold(
image,
value,
reference = c("none", "image", "nonzero"),
above = FALSE
)
threshold_below(image, value, reference = c("none", "image", "nonzero"))
threshold_above(image, value, reference = c("none", "image", "nonzero"))
Arguments
image |
An image object or pipeline. |
value |
Numeric threshold value. |
reference |
String indicating what the |
above |
Logical value: if |
Value
An updated pipeline.