ExportToGallery: Gallery Export

View source: R/ExportToGallery.R

ExportToGalleryR Documentation

Gallery Export

Description

Exports gallery of 'IFC_img' / 'IFC_msk' objects

Usage

ExportToGallery(
  ...,
  objects,
  offsets,
  image_type = "img",
  layout,
  export = c("file", "matrix", "base64")[2],
  write_to,
  base64_id = FALSE,
  base64_att = "",
  overwrite = FALSE,
  main = "",
  add_channels = TRUE,
  add_ids = 1,
  add_lines = 2,
  bg_color = "grey20",
  dpi = 300,
  scale = list(),
  extract_max = 10,
  sampling = FALSE,
  display_progress = TRUE
)

Arguments

...

arguments to be passed to objectExtract with the exception of 'ifd' and 'bypass'(=TRUE).
If 'param' is provided 'mode'(="rgb") and the above parameters will be overwritten.
If 'offsets' are not provided extra arguments can also be passed with ... getOffsets.
/!\ If not any of 'fileName', 'info' and 'param' can be found in ... then attr(offsets, "fileName_image") will be used as 'fileName' input parameter to pass to objectParam.

objects

integer vector, IDEAS objects ids numbers to use. This argument is not mandatory, if missing, the default, all objects will be used.

offsets

object of class 'IFC_offset'. This argument is not mandatory but it may allow to save time for repeated image export on same file.

image_type

image_type of desired offsets. Either "img" or "msk". Default is "img".

layout

a character vector of [acquired channels + 'composite' images] members to export. Default is missing to export everything. Note that members can be missing to be removed from final gallery export. Note that members not found will be automatically removed and a warning will be thrown.

export

export format. Either "file", "matrix", "base64". Default is "matrix".

write_to

used when 'export' is "file" or "base64" to compute respectively filename or base64 id attribute. Exported type will be deduced from this pattern. Allowed export are '.bmp', '.jpg', '.jpeg', '.png', '.tif', '.tiff'. Note that '.bmp' are faster but not compressed producing bigger data.
Placeholders, if found, will be substituted:
-%d: with full path directory
-%p: with first parent directory
-%e: with extension (without leading .)
-%s: with shortname (i.e. basename without extension)
-%o: with objects (at most 10, will be collapse with "_", if more than one).
-%c: with channel_id (will be collapse with "_", if more than one, composite in any will be bracketed). A good trick is to use:
-"%d/%s_gallery_Obj[%o]_Ch[%c].tiff", when 'export' is "file"
-"%s_gallery.bmp", when 'export' is "base64".
Note that if missing and 'export' is not "file", 'write_to' will be set to "%s_gallery.bmp".

base64_id

whether to add id attribute to base64 exported object. Default is TRUE.
Only applied when 'export' is "base64".

base64_att

attributes to add to base64 exported object. Default is "".
Only applied when export is "base64". For example, use "class=draggable".
Note that id (if base64_id is TRUE) and width and height are already used.

overwrite

whether to overwrite file or not. Default is FALSE.

main

main title that will be displayed on top center of the image. If too large it will be clipped.

add_channels

whether to add channels names. Default is TRUE.

add_ids

integer, indice of column to mark objects ids number. Default is 1. If add_ids < 1, no ids are added.

add_lines

integer, size of separating lines between objects. Default is 1. If add_lines < 1, no separating lines are added.

bg_color

background color for main, channels and separating lines. Default is "grey20".

dpi

integer, the resolution of the image in DPI (dots per inch). Default is 300.
Please note that whetever this parameter is final resolution will be 96 dpi.
However image will be scaled according this parameter and magnification factor will be equal to this parameter divided by 96.

scale

a named list whose members are 'size', 'style', 'color', 'xoff', 'yoff'. Default is list() to draw no scale. Otherwise,
-'size' positive integer. Scale's bar size in micro-meter. Default is '7'.
This parameter can't be lesser than 6px nor higher than image width + scale text.
-'style' a character string. Scale's bar style, either "dash" or "line". Default is "dash".
-'color' a character string. color of the scale. Default is "white".
-'xoff' positive integer. x offset in image to draw scale, starting from bottom left corner.
-'yoff' positive integer. y offset in image to draw scale, starting from bottom left corner.

extract_max

maximum number of objects to extract. Default is 10. Use +Inf to extract all.

sampling

whether to sample objects or not. Default is FALSE.

display_progress

whether to display a progress bar. Default is TRUE.

Details

arguments of objectExtract will be deduced from ExportToGallery input arguments. TRICK: for exporting only ONE 'objects', set 'add_channels' = FALSE, 'add_ids' >= 1, 'force_width' = FALSE, 'dpi' = 96; this allows generating image with its original size incrusted with its id number.

Value

Depending on 'export':
-"matrix", a rgb array,
-"base64", a data-uri string,
-"file", an invisible vector of ids corresponding to the objects exported.


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