Learn R Programming

nandb (version 0.2.1)

Bin2Tiff: Convert a binary image to tiff.

Description

Read a binary image (pixels must be integers), specifying its dimension and write it back to disk as a tifff file. The Bin2TiffFolder function does this for an entire folder.

Usage

Bin2Tiff(bin.path, bits, height, width, frames = 1,
  endian = .Platform$endian, signed = TRUE)

Bin2TiffFolder(folder.path = ".", bits, height, width, frames = 1, endian = .Platform$endian, signed = TRUE)

Arguments

bin.path

The path to the binary file.

bits

How many bits are there per pixel? This should be a multiple of 8.

height

The height of the image (in pixels).

width

The width of the image (in pixels).

frames

How many frames are there in the stack (default 1).

endian

Eigher "big" or "little" (see readBin).

signed

Logical. Only used for integers of sizes 1 and 2, when it determines if the quantity on file should be regarded as a signed or unsigned integer.

folder.path

The path to the folder (defaults to current location).

Details

When using Bin2TiffFolder, the images must all have the same dimension.

Examples

Run this code
# NOT RUN {
setwd(tempdir())
dir.create("temp_dir")
file.copy(system.file("extdata", "b.bin", package = "nandb"), "temp_dir")
Bin2Tiff("temp_dir/b.bin", height = 2, width = 2, bits = 8)
Bin2TiffFolder("temp_dir", height = 2, width = 2, bits = 8)
list.files("temp_dir")
# }

Run the code above in your browser using DataLab