spotsInBox: Put spots in boxes

View source: R/helperfunctions.R

spotsInBoxR Documentation

Put spots in boxes

Description

Takes a dataframe containing Mesh x/y coordinates and a dataframe containing Spots/Object x/y coordinates and returns the relative localization of the Spots/Objects inside the meshes, and the relative coordinates of the meshes from the mid-point of each mesh, where the longest axis of the cell is horizontal in the x/y plane.

Usage

spotsInBox(spotdata, meshdata, Xs = "x", Ys = "y", Xm = "X", Ym = "Y", meshInOutput=FALSE)

Arguments

spotdata

dataframe containing spot coordinates. Needs at least the columns $frame, $x and $y.Possible to define x/y column names in the function input arguments Xs and Ys.

meshdata

dataframe containing mesh coordinates. Needs at least the columns $frame, $cell, $x and $y. Possible to define x/y column names in the function input arguments Xm and Ym.

Xs

column in dataframe spotfile containing the x-coordinates of the spots or object points. Default = "x".

Ys

column in dataframe spotfile containing the y-coordinates of the spots or object points. Default = "y".

Xm

column in dataframe MESH containing the x-coordinates of the mesh outline points. Default = "X".

Ym

column in dataframe MESH containing the y-coordinates of the mesh outline points. Default = "Y".

meshInOutput

When TRUE, the 'mesh' (see below) will be part of the output of the spotsInBox function.

Value

A list of two data frames:

spots_relative:

$x

x-coordinate of the spot or object point (same as original dataframe)

$y

y-coordinate of the spot or object point (same as original dataframe)

$cell

identifies the cell the spot/object point belongs to

$frame

frame number of original image stack

$max.width

maximum cell width

$length

length of the cell

$L

relative location of the spot/object point to the length axis of the cell

$D

relative location of the spot/object point to the width axis of the cell

mesh:

$X

x-coordinate of the mesh contour point (same as original dataframe)

$Y

y-coordinate of the mesh contour point (same as original dataframe)

$cell

identifies the cell

$frame

frame number of the original image stack

$max.width

maximum cell width

$length

length of the cell

$X_rot

x-coordinate of the mesh point when the cell is turned with the length axis horizontally, midpoint at coordinate (0,0)

$Y_rot

y-coordinate of the mesh point when the cell is turned with the length axis horizontally, midpoint at coordinate (0,0)

Author(s)

Renske van Raaphorst

Examples

## Not run: 
##get spot data from ISBatch
spots <- bactMAP::extr.ISBatch(file.choose())$spotframe

##get mesh data from Oufti
mesh <- bactMAP::extr.Oufti(file.choose())$mesh

##get relative spot and mesh locations
outlist <- spotsInBox(spots, mesh, Xm="x", Ym="y")

## End(Not run)

vrrenske/shinyspots documentation built on Oct. 28, 2023, 12:26 p.m.