getOffsets: RIF/CIF File Image Field Directories Offsets Extraction

View source: R/getOffsets.R

getOffsetsR Documentation

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 extracted 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.

Details

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

Value

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

Source

TIFF 6.0 specifications archived from web https://web.archive.org/web/20211209104854/https://www.adobe.io/open/standards/TIFF.html

Examples

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.'))
}

IFC documentation built on Sept. 14, 2023, 1:08 a.m.