# `Monty.Frameworks.Models.Salience.Strategies.Vocus2.Pyramids.Pyramid`
[🔗](https://github.com/d-led/ex.tbp.monty/blob/v0.1.0/packages/ex_tbp_monty_core/lib/monty/frameworks/models/salience/strategies/vocus2/pyramids/pyramid.ex#L1)

An image's scales, by octave and by blur.

Mirrors `tbp/monty/frameworks/models/salience/strategies/vocus2/pyramids.py::Pyramid`,
a two-dimensional array of images: one row per octave (each half the
resolution of the one above) and one column per scale (each more blurred than
the one before). VOCUS2 compares a scale against its neighbours to find
whatever is unlike its surroundings at that size, and a pyramid is how "that
size" becomes an index.

Monty stores the planes in a numpy object array; here an octave is a list of
planes and the pyramid is a list of octaves, so `planes` read
`pyramid.planes |> Enum.at(octave) |> Enum.at(scale)`.

A pyramid with no planes is an error: nothing downstream can tell an empty
pyramid from an image with nothing in it.

# `plane`

```elixir
@type plane() :: [[float()]]
```

# `t`

```elixir
@type t() :: %Monty.Frameworks.Models.Salience.Strategies.Vocus2.Pyramids.Pyramid{
  planes: [[plane()]]
}
```

# `add`

```elixir
@spec add(t(), t()) :: t()
```

Two pyramids added plane by plane.

# `apply`

```elixir
@spec apply(t(), (plane() -&gt; plane())) :: t()
```

The same pyramid with `function` applied to every plane.

# `flat`

```elixir
@spec flat(t()) :: [plane()]
```

Every plane, octave by octave and scale by scale.

# `n_octaves`

```elixir
@spec n_octaves(t()) :: pos_integer()
```

How many octaves the pyramid holds.

# `n_scales`

```elixir
@spec n_scales(t()) :: pos_integer()
```

How many scales each octave holds.

# `new`

```elixir
@spec new([[plane()]]) :: t()
```

A pyramid of `octaves`, each a list of `scales` planes of the same shape.

# `shape`

```elixir
@spec shape(t()) :: {pos_integer(), pos_integer()}
```

How many octaves and how many scales: `{octaves, scales}`.

# `size`

```elixir
@spec size(t()) :: pos_integer()
```

How many planes the pyramid holds.

# `subtract`

```elixir
@spec subtract(t(), t()) :: t()
```

Two pyramids subtracted plane by plane.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
