read.ijdata: Read ImageJ zip file containing several ROI files and extract...

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/read.ijdata.R

Description

A wrapper function, which reads an ImageJ zip file containing a collection of ROI files and outputs a list of data frames ready for convert.ijdata function.

Usage

1
2
3
read.ijdata(X, spots = "point", gbs = "polyline", main = "line",
  names = "generate.invalid", spot.names = NULL, gbs.names = NULL,
  main.name = "main", sample.name = "file", scale = 1, unit = NULL)

Arguments

X

character string defining the name (including extension) or file path of an ImageJ zip file. Alternatively an ijzip object.

spots

optional. A character argument specifying the type of ROI objects that should be considered as sample spot sequences. Alternatively a numeric vector specifying the order of elements or a character vector specifying the names of ROI objects that should be assigned as sampling spot sequences. Defaults to "point" (See "Details" for further information).

gbs

optional. A character argument, numeric vector or character vector specifying the type of ROI objects that should be considered as growth bands. Defauls to "polyline". f left empty the remaining elements that are not defined in holes and main are assumed to be growth lines. For further information see spots and "Details". At the moment spots must be specified for this option to work.

main

optional. A character argument specifying the type of ROI object that should be considered as the measurement axis. Only one measurement axis per ImageJ .zip file is allowed. Defaults to "line". At the moment spots must be specified for this option to work.

names

optional. A character argument specifying how the names of spots and gbs should be generated. These names will be used in further functions (convert.ijdata, spot.dist). In general, it is adviced to use simple ROI names without special characters (for example - is not allowed in a ROI name; see 'Details'). Possible names options are:

  • "generate.invalid" (default). Uses the ROI object names, except when they are not valid data.frame column names. In the latter case sequential names will be generated.

  • "generate". Generates sequential names for all elements.

  • "keep". Uses the ROI object names, except when they are not valid data.frame column names. In the latter case make.names function will be used to generate data.frame combatible column names.

  • "force.keep". Uses the ROI object names as they are in the .zip file. Using this option might cause problems in consequent functions and is not recommended.

  • "manual". Names for both spots and gbs are searched from spot.names and gbs.names arguments, respectively.

  • "manual.spots". Names for spots are searched from spot.names argument. Names for gbs are generated following "generate.invalid".

  • "manual.gbs". Names for gbs are searched from gbs.names argument. Names for spots are generated following "generate.invalid".

spot.names

optional. A character vector of equal length to spots defining the names of sample spot sequences. Required if names = "manual" or "manual.spots". Ignored otherwise.

gbs.names

optional. A character vector of equal length to gbs defining the names of growth bands. Required if names = "manual" or "manual.gbs". Ignored otherwise.

main.name

optional. A character vector of lenght 1 defining the name of the measurement axis (main). If main.name = "keep", the ROI object name will be used (not recommended, see "Details"). Otherwise the name will be taken from the argument. Defaults to "main".

sample.name

optional. A character vector of length 1 defining the name of the sample. File name without the extension or alternatively ijzip object name is used as a default (sample.name = "file").

scale

optional. A numeric value defining the scale of photograph in pixels / unit. Defaults to 1.

unit

optional. A charater vector of length 1 defining the unit of measurements. See scale.

Details

In order to minimize the amount of text to be typed by a user, ROI objects of type "point" (this includes the "Multi-point Tool" points) are considered as sample spot sequences (spots) by default. Further, all "polyline" objects are assumed as growth bands (gbs) and "line" objects as the measurement axis (main) resulting to that only one "line" object is allowed per .zip file using the default settings. Alternatively, the user can specify the spots, gbs, and main objects manually using the order of the ImageJ .zip file with the exception that only one measurement axis is allowed per rawDist or spotDist object.

Punctuation characters other than _ or . should not be used as names of spots or gbs, because they tend to confuse the internal grep functions in spot.dist function. Hence it is adviced to use one of the options renaming invalid names of spots and gbs ("generate.invalid", "generate", "keep").

Value

Returns an "IJDATA" object, which is a list of data frames containing the x and y coordinates for sampling spot sequences (spots.x and spots.y), growth bands (gbs.x and gbs.y), and measurement axis (main.x and main.y) together with sample name, scaling factor and unit of measurement.

Author(s)

Mikko Vihtakari

See Also

order.ijdata for ordering and subsetting read.ijdata output.

convert.ijdata for converting the coordinate information to spatstat point patterns.

spot.dist for aligning sample spot sequences.

read.ijroi and read.ijzip for reading ImageJ ROI and .zip files.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# Locate the example zip file
path <- file.path(system.file("extdata", package = "sclero"), "shellspots.zip") 

# You can replace 'path' by 'Your_file_name.zip'
dat <- read.ijdata(path) 
summary(dat)

## Works also for IJZIP objects
dat2 <- read.ijzip(path)
dat2 <- read.ijdata(dat2)
dat[!(dat %in% dat2)] # Only the sample name differs

sclero documentation built on May 2, 2019, 2:26 p.m.