DrawMULTIROI: Draw a Region of Interest

View source: R/DrawMULTIROI.R

DrawMULTIROIR Documentation

Draw a Region of Interest

Description

This function allows to draw one (or more) region(s) of interest (ROI) on a jpeg image. After phenopix version 2.4 this function allows to draw a region of interest potentially consisting of different polygons.

Usage

DrawMULTIROI(path_img_ref, path_ROIs, nroi = 1, 
	roi.names, file.type='.jpg')

Arguments

path_img_ref

Path in your folder for the reference image

path_ROIs

Path where to store image with ROI and ROI coordinates.

nroi

The number of ROIs you want to draw.

roi.names

A character vector with ROI names.

file.type

It must match the syntax of your file extension (e.g. .jpg, .JPG, .JPEG). Multiple types are allowed by concatenation with c().

Details

The function allows to draw one or more ROIs on an image or to load saved ROIs. The function uses locator to locate points, closes the polygon and stores an RData with coordinates. The use of locator is restricted to only some graphic devices. The function attempts to open an X11() device. In Mac OS the polygon is closed by typing ESC key. See locator for details. After package version 2.4, this function allows to build a ROI based on multiple polygons. As from this version of the package the way the roi.data object is structured changes substantially compared to previous versions. The old drawROI() function is no longer present. The new function convertROI allows to convert roi.data objects generated with former DrawROI function (phenopix < 2.4) into the new roi.data structure.

Value

A list containing the following:

mask

A binary mask (a raster object)

polygons

An object of class SpatialPolygons

Additionally, a jpeg image is returned with the ROI(s) drawn. The same object that is returned is saved in the path specified in path_ROIs

Author(s)

Gianluca Filippa <gian.filippa@gmail.com>


phenopix documentation built on Aug. 9, 2023, 5:10 p.m.