While Mr Tomas Takac answers if the given pixel is a minimum or not it does not answer the question if it is a extrema (It is easily modifiable so I'll mark it as an answer).

I did some extra research on implementations of the paper I reference and I came across this which answers the given question with this implementation.

(The implementation, c++, is copied here for completeness)

highData is the z+1 slice of the 3D array, currData is the z slice and lowData is the z-1 slice. index is the index into the 2D image slice to point (x,y) where w is the width of the image. The |val| >= contr_thr is a contrast check relevant only to this use case and should be omitted if used elsewhere (don't, this code deserves to be featured in r/programminghorror).

```
bool bExtrema =
(val >= contr_thr && val > highData[index - w - 1] &&
val > highData[index - w] &&
val > highData[index - w + 1] &&
val > highData[index - 1] && val > highData[index] &&
val > highData[index + 1] &&
val > highData[index + w - 1] &&
val > highData[index + w] &&
val > highData[index + w + 1] &&
val > currData[index - w - 1] &&
val > currData[index - w] &&
val > currData[index - w + 1] &&
val > currData[index - 1] &&
val > currData[index + 1] &&
val > currData[index + w - 1] &&
val > currData[index + w] &&
val > currData[index + w + 1] &&
val > lowData[index - w - 1] &&
val > lowData[index - w] &&
val > lowData[index - w + 1] &&
val > lowData[index - 1] && val > lowData[index] &&
val > lowData[index + 1] &&
val > lowData[index + w - 1] &&
val > lowData[index + w] &&
val > lowData[index + w + 1]) || // Local min
(val <= -contr_thr && val < highData[index - w - 1] &&
val < highData[index - w] &&
val < highData[index - w + 1] &&
val < highData[index - 1] && val < highData[index] &&
val < highData[index + 1] &&
val < highData[index + w - 1] &&
val < highData[index + w] &&
val < highData[index + w + 1] &&
val < currData[index - w - 1] &&
val < currData[index - w] &&
val < currData[index - w + 1] &&
val < currData[index - 1] &&
val < currData[index + 1] &&
val < currData[index + w - 1] &&
val < currData[index + w] &&
val < currData[index + w + 1] &&
val < lowData[index - w - 1] &&
val < lowData[index - w] &&
val < lowData[index - w + 1] &&
val < lowData[index - 1] && val < lowData[index] &&
val < lowData[index + 1] &&
val < lowData[index + w - 1] &&
val < lowData[index + w] &&
val < lowData[index + w + 1]);
```

It's therefore possible to have 2 adjacent extrema where one is a maximum and the other is a minimum.

There is no weighting attach to extrema (yet, see chapter 4) so all extrema count the same.