Learn R Programming

nandb (version 0.2.1)

WriteIntImage: Write an integer array to disk as a tiff image.

Description

EBImage::writeImage truncates all values above 1 to 1 and all below 0 to 0 when writing images. This function allows you to write integer-vlued arrays to disk as tiff files as you would want.

Usage

WriteIntImage(img.arr, file.name, na = "error")

Arguments

img.arr

An integer array.

file.name

The name of the tif file (with or without the .tif) that you wish to write.

na

How do you want to treat NA values? R can only write integer values (and hence not NAs) to tiff pixels. na = 'saturate' sets them to saturated value. na = 'zero' sets them to zero, while na = 'error' will give an error if the image contains NAs. You can also specify directly here a natural number (must be between 0 and 2 ^ 16 - 1) to use in place of NAs.

Examples

Run this code
# NOT RUN {
img <- ReadImageData(system.file('extdata', '50.tif', package = 'nandb'))
setwd(tempdir())
WriteIntImage(img, '50.tif')
file.remove(list.files())  # cleanup

# }

Run the code above in your browser using DataLab