| Title: | R interface to Bio-Formats |
|---|---|
| Description: | An R package which interfaces the OME Bio-Formats Java library to allow reading of proprietary microscopy image data and metadata. |
| Authors: | Andrzej Oleś [aut, cre] (ORCID: <https://orcid.org/0000-0003-0285-2787>), John Lee [ctb] (ORCID: <https://orcid.org/0000-0001-5884-4247>) |
| Maintainer: | Andrzej Oleś <[email protected]> |
| License: | GPL-3 |
| Version: | 1.13.0 |
| Built: | 2026-05-30 07:05:51 UTC |
| Source: | https://github.com/bioc/RBioFormats |
Extends the Image class from the EBImage package.
AnnotatedImage(..., metadata = ImageMetadata()) ## S3 method for class 'AnnotatedImage' print(x, short = FALSE, ...) ## S4 method for signature 'AnnotatedImage' show(object) ## S3 method for class 'AnnotatedImage' as.Image(x)AnnotatedImage(..., metadata = ImageMetadata()) ## S3 method for class 'AnnotatedImage' print(x, short = FALSE, ...) ## S4 method for signature 'AnnotatedImage' show(object) ## S3 method for class 'AnnotatedImage' as.Image(x)
... |
arguments passed to the Image constructor. |
metadata |
an ImageMetadata object containing image metadata |
x |
an AnnotatedImage object. |
short |
logical, turns off image data preview. |
object |
an AnnotatedImage object |
AnnotatedImage returns a new AnnotatedImage object.
as.Image returns an Image object.
metadataan ImageMetadata object containing image metadata
Andrzej Oleś <[email protected]>, 2014-2023
f = mockFile(sizeX = 256, sizeY = 256) img = read.image(f) imgf = mockFile(sizeX = 256, sizeY = 256) img = read.image(f) img
A list of AnnotatedImage objects.
AnnotatedImageList(...)AnnotatedImageList(...)
... |
a list of AnnotatedImage objects to include in the new object. |
AnnotatedImageList returns a new AnnotatedImageList object.
f = mockFile(sizeX = 256, sizeY = 256, series = 2) img = read.image(f) imgf = mockFile(sizeX = 256, sizeY = 256, series = 2) img = read.image(f) img
Information about the Java heap space usage.
checkJavaMemory(units = "m")checkJavaMemory(units = "m")
units |
Units to return the size in: "k", "m" or "g" |
The maximum amount of memory that the JVM will attempt to use,
measured in units.
Andrzej Oleś <[email protected]>, 2014-2023
## Not run: ## assign 4 gigabytes of heap space to the Java environment. options( java.parameters = "-Xmx4g" ) library( "RBioFormats" ) ## End(Not run) checkJavaMemory()## Not run: ## assign 4 gigabytes of heap space to the Java environment. options( java.parameters = "-Xmx4g" ) library( "RBioFormats" ) ## End(Not run) checkJavaMemory()
Get and set image metadata.
coreMetadata(x, series, ...) globalMetadata(x, series, ...) seriesMetadata(x, series, ...) ## S4 method for signature 'ANY' metadata(x) ## S4 method for signature 'AnnotatedImage' metadata(x) ## S4 method for signature 'AnnotatedImageList' metadata(x) ## S4 method for signature 'ImageMetadata' metadata(x) ## S4 method for signature 'ImageMetadataList' metadata(x) ## S4 replacement method for signature 'AnnotatedImage' metadata(x) <- value coreMetadata(y) <- value ## S4 replacement method for signature 'AnnotatedImage' coreMetadata(y) <- value ## S4 replacement method for signature 'ImageMetadata' coreMetadata(y) <- value globalMetadata(y) <- value ## S4 replacement method for signature 'AnnotatedImage' globalMetadata(y) <- value ## S4 replacement method for signature 'ImageMetadata' globalMetadata(y) <- value seriesMetadata(y) <- value ## S4 replacement method for signature 'AnnotatedImage' seriesMetadata(y) <- value ## S4 replacement method for signature 'ImageMetadata' seriesMetadata(y) <- valuecoreMetadata(x, series, ...) globalMetadata(x, series, ...) seriesMetadata(x, series, ...) ## S4 method for signature 'ANY' metadata(x) ## S4 method for signature 'AnnotatedImage' metadata(x) ## S4 method for signature 'AnnotatedImageList' metadata(x) ## S4 method for signature 'ImageMetadata' metadata(x) ## S4 method for signature 'ImageMetadataList' metadata(x) ## S4 replacement method for signature 'AnnotatedImage' metadata(x) <- value coreMetadata(y) <- value ## S4 replacement method for signature 'AnnotatedImage' coreMetadata(y) <- value ## S4 replacement method for signature 'ImageMetadata' coreMetadata(y) <- value globalMetadata(y) <- value ## S4 replacement method for signature 'AnnotatedImage' globalMetadata(y) <- value ## S4 replacement method for signature 'ImageMetadata' globalMetadata(y) <- value seriesMetadata(y) <- value ## S4 replacement method for signature 'AnnotatedImage' seriesMetadata(y) <- value ## S4 replacement method for signature 'ImageMetadata' seriesMetadata(y) <- value
x |
an AnnotatedImage, AnnotatedImageList, ImageMetadata, or ImageMetadataList object |
series |
series ID |
... |
arguments passed to |
value |
depending on the context, an ImageMetadata object or a list |
y |
an AnnotatedImage or ImageMetadata object |
The ... arguments are passed to grep called on metadata names allowing for convenient subsetting.
Named list consisting of key value pairs.
Andrzej Oleś <[email protected]>, 2014-2023
img = read.image(system.file("images", "nuclei.tif", package="EBImage")) coreMetadata(img) # subset for specific names globalMetadata(img, pattern="Image")img = read.image(system.file("images", "nuclei.tif", package="EBImage")) coreMetadata(img) # subset for specific names globalMetadata(img, pattern="Image")
Get the ordering of image frames.
dimorder(x)dimorder(x)
x |
An |
A character vector giving the dimension names.
Andrzej Oleś <[email protected]>, 2014-2023
# sample timelapse image f = mockFile(sizeC=2, sizeT=10) img = read.image(f) dimorder(img)# sample timelapse image f = mockFile(sizeC=2, sizeT=10) img = read.image(f) dimorder(img)
A utility class for format reader and writer implementations.
FormatToolsFormatTools
An object of class jclassName of length 1.
Andrzej Oleś <[email protected]>, 2014-2023
# List available pixel types sapply(0:7, FormatTools$getPixelTypeString)# List available pixel types sapply(0:7, FormatTools$getPixelTypeString)
Formal representation of image metadata.
ImageMetadata( coreMetadata = NULL, globalMetadata = NULL, seriesMetadata = NULL ) ImageMetadataList(...) ## S3 method for class 'ImageMetadata' print(x, list.len = 5L, ...) ## S4 method for signature 'ImageMetadata' show(object) ## S4 method for signature 'ImageMetadataList' show(object) ## S3 method for class 'ImageMetadataList' print(x, ...)ImageMetadata( coreMetadata = NULL, globalMetadata = NULL, seriesMetadata = NULL ) ImageMetadataList(...) ## S3 method for class 'ImageMetadata' print(x, list.len = 5L, ...) ## S4 method for signature 'ImageMetadata' show(object) ## S4 method for signature 'ImageMetadataList' show(object) ## S3 method for class 'ImageMetadataList' print(x, ...)
coreMetadata |
a list of core metadata entries |
globalMetadata |
a list of global metadata entries |
seriesMetadata |
a list of series metadata entries |
... |
further arguments to be passed to other methods |
x |
An ImageMetadata object |
list.len |
numeric; maximum number of metadata entries to display |
object |
an |
ImageMetadata returns a new ImageMetadata object.
ImageMetadataList returns a new ImageMetadataList object.
Andrzej Oleś <[email protected]>, 2014-2023
f = mockFile(sizeX = 256, sizeY = 256) img = read.image(f) metadata(img)f = mockFile(sizeX = 256, sizeY = 256) img = read.image(f) metadata(img)
Create a mock image of specific parameters for testing.
mockFile(name = "mockfile", ...)mockFile(name = "mockfile", ...)
name |
File name. |
... |
File parameters; available parameters are listed below. |
Generates mock files of specific size or pixel type containing gradient
images. The desired parameters can be provided as key value pairs to the
mockFile function. For a list of available parameters see below.
A character string.
| Name | Default | Description |
| sizeX | 512 | horizontal size in pixels |
| sizeY | 512 | vertical size in pixels |
| sizeZ | 1 | number of Z sections |
| sizeC | 1 | number of channels |
| sizeT | 1 | number of time points |
| pixelType | uint8 | string specifying pixel type: int8, uint8, int16, uint16, int32, uint32, float, double |
| bitsPerPixel | 0 | number of valid bits (<= number of bits implied by pixel type) |
| rgb | 1 | number of channels that are merged together |
| dimOrder | XYZCT | string describing dimension order |
| orderCertain | true | |
| little | true | whether or not the pixel data should be little-endian |
| interleaved | true | whether or not merged channels are interleaved |
| indexed | false | whether or not a color lookup table is present |
| falseColor | false | whether or not the color lookup table is just for making the image look pretty |
| series | 1 | number of series (Images) |
| lutLength | 3 | number of entries in the color lookup table |
Andrzej Oleś <[email protected]>, 2014-2023
f = mockFile(sizeX = 256, sizeY = 256) img = read.image(f) imgf = mockFile(sizeX = 256, sizeY = 256) img = read.image(f) img
Interfaces the Bio-Formats Java library.
BioFormats.version()BioFormats.version()
A character string containing the Bio-Formats library version.
BioFormats.version(): Provides the version of the Bio-Formats library embedded in the package.
Andrzej Oleś <[email protected]>, 2014-2023
BioFormats.version()BioFormats.version()
Read image files using the Bio-Formats library. A list of supported formats can be found on the Bio-Formats website.
read.image( file, filter.metadata = FALSE, proprietary.metadata = TRUE, normalize = TRUE, series, resolution, subset, read.metadata = TRUE )read.image( file, filter.metadata = FALSE, proprietary.metadata = TRUE, normalize = TRUE, series, resolution, subset, read.metadata = TRUE )
file |
character, file name |
filter.metadata |
logical, specifies whether ugly metadata (entries with unprintable characters, and extremely large entries) should be discarded from the metadata table |
proprietary.metadata |
logical, should proprietary metadata be populated to OME-XML |
normalize |
logical, should the original image data be mapped to the [0,1] range |
series |
integer vector specifying series to read; if missing all series included in the file are read |
resolution |
integer vector specifying resolution levels to read; if missing all levels read |
subset |
named list specifing image subsetting |
read.metadata |
logical, should image metadata be read |
An AnnotatedImage object or an AnnotatedImageList object in case of multi-series data.
Andrzej Oleś <[email protected]>, 2014-2023
read.metadata for reading image metadata, read.omexml for reading image metadata as OME-XML
require(EBImage) f = system.file("images", "sample-color.png", package="EBImage") img = read.image(f) imgrequire(EBImage) f = system.file("images", "sample-color.png", package="EBImage") img = read.image(f) img
Read image metadata using the Bio-Formats library. The list of supported file formats can be found on the Bio-Formats website.
read.metadata(file, filter.metadata = FALSE, proprietary.metadata = TRUE)read.metadata(file, filter.metadata = FALSE, proprietary.metadata = TRUE)
file |
character, file name |
filter.metadata |
logical, specifies whether ugly metadata (entries with unprintable characters, and extremely large entries) should be discarded from the metadata table |
proprietary.metadata |
logical, should proprietary metadata be populated to OME-XML |
An ImageMetadata or ImageMetadataList object.
Andrzej Oleś <[email protected]>, 2014-2023
read.omexml for reading image metadata as OME-XML, read.image for reading image data
require(EBImage) f = system.file("images", "nuclei.tif", package="EBImage") metadata = read.metadata(f) str(metadata)require(EBImage) f = system.file("images", "nuclei.tif", package="EBImage") metadata = read.metadata(f) str(metadata)
Read the OME-XML DOM tree.
read.omexml(file, filter.metadata = FALSE, proprietary.metadata = TRUE)read.omexml(file, filter.metadata = FALSE, proprietary.metadata = TRUE)
file |
character, file name |
filter.metadata |
logical, specifies whether ugly metadata (entries with unprintable characters, and extremely large entries) should be discarded from the metadata table |
proprietary.metadata |
logical, should proprietary metadata be populated to OME-XML |
A string containing a dumped OME-XML DOM tree.
Andrzej Oleś <[email protected]>, 2014-2023
read.metadata for reading image metadata, read.image for reading image data
require(EBImage) f = system.file("images", "nuclei.tif", package="EBImage") omexml = read.omexml(f) omexmlrequire(EBImage) f = system.file("images", "nuclei.tif", package="EBImage") omexml = read.omexml(f) omexml
Get the number of image series contained in an object.
seriesCount(x) ## S4 method for signature 'ANY' seriesCount(x) ## S4 method for signature 'matrix' seriesCount(x) ## S4 method for signature 'array' seriesCount(x) ## S4 method for signature 'ImageMetadata' seriesCount(x) ## S4 method for signature 'AnnotatedImageList' seriesCount(x) ## S4 method for signature 'ImageMetadataList' seriesCount(x)seriesCount(x) ## S4 method for signature 'ANY' seriesCount(x) ## S4 method for signature 'matrix' seriesCount(x) ## S4 method for signature 'array' seriesCount(x) ## S4 method for signature 'ImageMetadata' seriesCount(x) ## S4 method for signature 'AnnotatedImageList' seriesCount(x) ## S4 method for signature 'ImageMetadataList' seriesCount(x)
x |
an images object. |
Image series are encoded by AnnotatedImageList or ImageMetadataList objects. Therefore, only these objects can possibly yield image series count higher than 1 while for all the rest of image objects this number is expected to be 1.
The number of image series the object contains, see Details.
Andrzej Oleś <[email protected]>, 2014-2023
f = mockFile(sizeX = 256, sizeY = 256, series = 2) img = read.image(f) seriesCount(img) meta <- metadata(img) seriesCount(meta)f = mockFile(sizeX = 256, sizeY = 256, series = 2) img = read.image(f) seriesCount(img) meta <- metadata(img) seriesCount(meta)
Save image files using the Bio-Formats library. A list of supported formats can be found on the Bio-Formats website.
write.image(x, file, force = FALSE, pixelType, littleEndian)write.image(x, file, force = FALSE, pixelType, littleEndian)
x |
an |
file |
character, file name |
force |
logical(1), if |
pixelType |
character(1), data type to store pixel values |
littleEndian |
boolean(1), pixel data endianness |
File path to file is returned invisibly.
Andrzej Oleś <[email protected]>, 2014-2023
read.image for reading images.
f = mockFile(sizeX = 256, sizeY = 256) img = read.image(f) tempfile = tempfile("", , ".png") write.image(img, tempfile)f = mockFile(sizeX = 256, sizeY = 256) img = read.image(f) tempfile = tempfile("", , ".png") write.image(img, tempfile)