Learn R Programming

ProFound (version 1.14.1)

profoundSegimNear: Segment Neighbour IDs

Description

Returns a data.frame of all nearby (default is touching) segments surrounding every segment in a provided segim.

Usage

profoundSegimNear(segim = NULL, offset = 1)

Arguments

segim

Integer matrix; a specified segmentation map of the image (required).

offset

Integer scalar; the distance to offset when searching for nearby segments.

Value

A data.frame of lists giving the segIDs of nearby segments for every segment. This is a slightly unusal structure to see in R, but it allows for a compact manner of storing uneven vectors of touching segmentss. E.g. you might have a massive segment touching 30 other segments and many segments touching none. Padding a normal matrix out to accommodate the larger figure would be quite inefficient.

segID

Segmentation ID, which can be matched against values in segim

nearID

An embedded list of segmentation IDs for nearby segments. I.e. each list element of nearID is a vector (see Examples for clarity).

Nnear

The total number of segments that are considered to be nearby.

Details

This function can be run by the user directly, but usually it is called from within a higher routine in the ProFound suite of objects detection functions.

See Also

profoundProFound, profoundMakeSegim, profoundMakeSegimDilate, profoundMakeSegimExpand, profoundSegimStats, profoundSegimPlot

Examples

Run this code
# NOT RUN {
image=readFITS(system.file("extdata", 'VIKING/mystery_VIKING_Z.fits', package="ProFound"))
profound=profoundProFound(image, skycut=1.5, magzero=30, verbose=TRUE)

#Look for nearby (in this case touching) neighbours

near=profoundSegimNear(profound$segim)

#Look at the first few rows (segIDs 1:5):

near[1:5,]

#To access the embedded vectors you have to use unlist:

unlist(near[3,2])

#We can check to see which segments are touching segID number 3:

profoundSegimPlot(image$imDat, profound$segim)
magimage(profound$segim==3, col=c(NA,'red'), add=TRUE)
magimage(matrix(profound$segim %in% unlist(near[3,2]), dim(profound$segim)[1]),
col=c(NA,'blue'), add=TRUE)
# }

Run the code above in your browser using DataLab