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

GetRank

Value selection function

SYNOPSIS

#include "dip_sort.h"

dip_Error dip_GetRank ( array, datatype, min, max, rank, value )

FUNCTION

GetRank gets the value at rank rank in the array array. min should be set to the first index of array, max to the last. dip_GetRank will use array for temporary storage, so the values in the array will be changed are this function is ready.

ARGUMENTS

Data typeNameDescription
dip_float *arrayArray to searched in
dip_DataTypedatatype
dip_intminminimal array index
dip_intmaxmaximal array index
dip_intrankRank
dip_float *valueValue of the rank element

EXAMPLE

This example finds the median value for the array.

   dip_float array[ SIZE ], median;
   dip_int rank;

   /* fill the array with values */

   rank = SIZE/2;
   DIPXX( dip_GetRank( array, DIP_DT_FLOAT, 0, (SIZE - 1), rank, &median ));

SEE ALSO

General information about sorting

DistributionSort, DistributionSortIndices, DistributionSortIndices16, InsertionSort, InsertionSortIndices, InsertionSortIndices16, QuickSort, QuickSortIndices, QuickSortIndices16, Sort, ImageSort, SortIndices, SortIndices16, ImageSortIndices

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