Learn R Programming

IFC (version 0.1.2)

getOffsets: RIF/CIF File Image Field Directories Offsets Extraction

Description

Extracts offsets of the IFDs (Image Field Directories) within a XIF file. Users are highly encouraged to read TIFF specifications to have a better understanding about what offsets and IFDs are.

Usage

getOffsets(fileName, fast = TRUE, display_progress = TRUE, verbose = FALSE)

Arguments

fileName

path to file.

fast

whether to fast extract objects or not. Default is TRUE. Meaning that offsets will be extracting expecting that objects are stored in ascending order. A message will be thrown since fast extraction method does not ensure correct mapping between objects and offsets. If set to FALSE, all object_ids will be scanned from 'fileName' to ensure extraction of desired offsets.

display_progress

whether to display a progress bar. Default is TRUE.

verbose

whether to display information (use for debugging purpose). Default is FALSE.

Value

an integer vector of class `IFC_offset` of IFDs offsets found in XIF file.

Details

Offsets are byte positions of IFDs found within RIF or CIF file. For more details see TIFF specifications.

Examples

Run this code
# NOT RUN {
if(requireNamespace("IFCdata", quietly = TRUE)) {
  ## use a cif file
  file_cif <- system.file("extdata", "example.cif", package = "IFCdata")
  system.time(offsets_fast <- getOffsets(fileName = file_cif, fast = TRUE))
  system.time(offsets_slow <- getOffsets(fileName = file_cif, fast = FALSE))
  identical(offsets_fast, offsets_slow)   
} else {
  message(sprintf('Please run `install.packages("IFCdata", repos = "%s", type = "source")` %s',
                  'https://gitdemont.github.io/IFCdata/',
                  'to install extra files required to run this example.'))
}
# }

Run the code above in your browser using DataLab