Learn R Programming

nandb (version 0.2.1)

FixLUTError: Fix lookup table error when reading images.

Description

Even if an image stored on disk has 1 channel only, if it has an associated LUT (lookup table, to tell programs like ImageJ to display them in (for example) green rather than grey, then EBImage::readImage() and hence ReadImageData() will read in the image as a 3-channel rgb colour image, where two of the channels have all-zero intensity values and one of them has the values you wanted. This function deletes the zero channels from the array. If there were no such LUT errors and the image read in as you desired, then this function does nothing.

Usage

FixLUTError(arr, ndim.out)

Arguments

arr

An array, representing the read image.

ndim.out

How many dimensions do you want the output array to have?

Value

An array. If the function implemented a 'fix', then the output array will have one less dimension than the input array.

Examples

Run this code
# NOT RUN {
has.lut.error <- abind::abind(matrix(0, nrow = 2, ncol = 2),
                              matrix(1:4, nrow = 2),
                              matrix(0, nrow = 2, ncol = 2),
                              along = 3)
has.lut.error
FixLUTError(has.lut.error, 2)
has.lut.error3d <- abind::abind(has.lut.error, has.lut.error, along = 4)
FixLUTError(has.lut.error3d, 3)
# }

Run the code above in your browser using DataLab