DIPlib Documentation - ©1995-2009 Quantitative Imaging Group, Delft University of Technology.

# PixelQueuePop

Pop item from queue

## SYNOPSIS

`#include "dip_pixelqueue.h"`

dip_Error dip_PixelQueuePop ( queue, coords, pointer, newiteration )

## FUNCTION

Pops the next pixel from the queue. See `PixelQueueNew` for information on the queue data structure. `coords` is a pointer to an array of `dip_int`s, such as that obtained with `dip_IntegerArray->array`. It should have as many elements as the image dimensionality. If the queue was created with `ndims` set to 0, the `coords` pointer is ignored. `coords` and `pointer` can be `NULL` if you are not interested in either those values.

`newiteration`, when not `NULL`, will be set to `DIP_TRUE` if the pixel being popped is the first one in an iteration, or `DIP_FALSE` otherwise. When a new iteration starts, all pixels pushed onto the queue afterwards belong to the next iteration. This is useful in routines that use the queue for propagating boundaries, such as `GrowRegions`. First all boundary pixels are pushed onto the queue. The first iteration will need to process only these pixels, while at the same time push new pixels onto the queue for the second iteration. So after pushing all the initial boundary pixels onto the queue, the first iteration is started by popping the first pixel. All pixels pushed while processing this and the rest of the pixels will be pushed behind the "new iteration" marker. When the first pixel after this marker is popped, the `newiteration` boolean is set, so the program knows that the second iteration is starting. Also, the "new iteration" marker is moved to the end of the queue, so that pixels pushed subsequently will belong to iteration number 3.

## ARGUMENTS

Data type | Name | Description
`dip_PixelQueue` | `queue` | The queue structure
`dip_int *` | `coords` | Receives the coordinates of the popped item
`void **` | `pointer` | Receives the pointer of the popped item
`dip_Boolean *` | `newiteration` | Set to true when the first item from an iteration is popped

## SEE ALSO

`PixelQueueNew`, `PixelHeapNew`, `StablePixelHeapNew`, `PixelQueueFree`, `PixelQueuePush`, `PixelQueueIsEmpty`

DIPlib on-line documentation | Function reference | Global function index