Learn R Programming

mrf2d (version 0.3)

mrfi-class: mrfi: MRF interaction structure

Description

The mrfi S4 class is a representation of the interaction structure for a spatially-stationary Markov Random Field.

The function mrfi() provides an interface for creation mrfi objects. A plot method is also available for visualization, as well as conversion methods like as.list and operators like +.

Usage

# S4 method for mrfi
as.list(x)

Arguments

x

mrfi object.

Value

as.list(): converts the mrfi object to a list of interacting positions (list of length-2 vectors).

Slots

Rmat

A 2-column matrix where each row represents a relative position of interaction.

Details

The interaction structure is defined by the list of relative positions in it. For a specific pixel, conditional to the values of pixels in these relative positions from it, its value is independent of any other pixel in the image.

The relative positions are indentified by two integers rx and ry representing the "shift" in the x-axis and y-axis respectively. As an example: The relative position (1,0) representes the pixel in the immediate right position, while (-1,0) the left one.

Note that the inclusion of a relative position to the dependence also implies its opposite direction is not conditionally independent (commutativeness of dependence), but only one is actually included to the mrfi object.

To illustrate that, a nearest neighbor dependence structure can be specified by:

mrfi(1)

Note that it only includes the positions (1,0) and (0,1), but when visualizing it, for example, mrf2d understands the opposite directions are also conditionally dependent, as in

plot(mrfi(1)).

See Also

A paper with detailed description of the package can be found at https://arxiv.org/abs/2006.00383

Examples

Run this code
# NOT RUN {
plot(mrfi(max_norm = 2, norm_type = "1"))
plot(mrfi(max_norm = 2, norm_type = "m"))
plot(mrfi(max_norm = 2, norm_type = "1", positions = list(c(4,4))))

as.list(mrfi(1))
mrfi(1)[[1]]
mrfi(2)[[1:3]]

# }

Run the code above in your browser using DataLab