[ VIGRA Homepage | Function Index | Class Index | Namespaces | File List | Main Page ]

vigra Namespace Reference

## Namespaces

namespace | acc
| Efficient computation of object statistics.
namespace | EightNeighborhood
namespace | FourNeighborhood
namespace | linalg
| Linear algebra functions.
namespace | metrics
| Define functors for various common metrics.
namespace | multi_math
namespace | Neighborhood3DSix
namespace | Neighborhood3DTwentySix
namespace | rf3
| Random forest version 3.

## Classes

class | AdjacencyListGraph
| undirected adjacency list graph in the LEMON API More...
class | AffineMotionEstimationOptions
| Option object for affine registration functions. More...
class | Any
| Typesafe storage of arbitrary values. More...
class | ArrayOfRegionStatistics
| Calculate statistics for all regions of a labeled image. More...
class | ArrayVector
class | ArrayVectorView
class | BasicImage
| Fundamental class template for images. More...
class | BasicImageIterator
class | BasicImageIteratorBase
class | BasicImageView
| BasicImage using foreign memory. More...
class | BestGiniOfColumn
class | BilinearInterpolatingAccessor
| Bilinear interpolation at non-integer positions. More...
class | BinaryForest
| BinaryForest stores a collection of rooted binary trees. More...
class | BlockwiseConvolutionOptions
class | BlockwiseLabelOptions
class | BlockwiseOptions
class | BlueAccessor
class | Box
| Represent an n-dimensional box as a (begin, end) pair. Depending on the value type, end() is considered to be outside the box (as in the STL, for integer types), or inside (for floating point types). size() will always be end() - begin(). More...
class | BrightnessContrastFunctor
| Adjust brightness and contrast of an image. More...
class | BSpline
class | BSplineBase
class | BucketQueue
| Priority queue implemented using bucket sort. More...
class | CatmullRomSpline
class | ChangeablePriorityQueue
| Heap-based changable priority queue with a maximum number of elemements. More...
class | ChunkedArray
| Interface and base class for chunked arrays. More...
class | ChunkedArrayCompressed
class | ChunkedArrayFull
class | ChunkedArrayHDF5
class | ChunkedArrayLazy
class | ChunkedArrayOptions
| Option object for ChunkedArray construction. More...
struct | ChunkedArrayTag
class | ChunkedArrayTmpFile
class | ClusteringOptions
| Options object for hierarchical clustering. More...
class | ColumnIterator
| Iterator adapter to linearly access columns. More...
class | ConstBasicImageIterator
class | ConstImageIterator
| Standard 2D random access const iterator for images that store the data as a linear array. More...
class | ConstStridedImageIterator
| Const iterator to be used when pixels are to be skipped. More...
class | ConstValueIterator
| Iterator that always returns the constant specified in the constructor. More...
class | ConvexPolytope
class | ConvolutionOptions
| Options class template for convolutions. More...
class | CoordinateConstValueAccessor
| Forward accessor to the value() part of the values an iterator points to. More...
class | CoscotFunction
class | CountingIterator
| Iterator that counts upwards or downwards with a given step size. More...
struct | CoupledArrays
class | CoupledHandle
struct | CoupledIteratorType
class | CoupledScanOrderIterator
| Iterate over multiple images simultaneously in scan order. More...
class | CrackContourCirculator
| Circulator that walks around a given region. More...
class | Diff2D
| Two dimensional difference vector. More...
class | DiffusivityFunctor
| Diffusivity functor for non-linear diffusion. More...
class | Dist2D
struct | DistancePowerFunctor
class | DT_StackEntry
class | EarlyStoppStd
| Standard early stopping criterion. More...
class | Edgel
class | EnhancedFrostFunctor
| This function tries to reduce the speckle noise of an image by applying the Enhanced Frost filter. More...
class | EnhancedLeeFunctor
| This function tries to reduce the speckle noise of an image by applying the Enhanced Lee filter. More...
class | EntropyCriterion
class | FFTWComplex
| Wrapper class for the FFTW complex types '`fftw_complex`'. More...
class | FFTWConvolvePlan
class | FFTWCorrelatePlan
class | FFTWImaginaryAccessor
class | FFTWLogMagnitudeAccessor
class | FFTWMagnitudeAccessor
class | FFTWPhaseAccessor
class | FFTWPlan
class | FFTWRealAccessor
class | FFTWSquaredMagnitudeAccessor
class | FFTWWriteRealAccessor
class | FilterIterator
| This iterator creates a view of another iterator and skips elements that do not fulfill a given predicate. More...
class | FindAverage
| Find the average pixel value in an image or ROI. More...
class | FindAverageAndVariance
| Find the average pixel value and its variance in an image or ROI. More...
class | FindBoundingRectangle
| Calculate the bounding rectangle of an ROI in an image. More...
class | FindMinMax
| Find the minimum and maximum pixel value in an image or ROI. More...
class | FindROISize
| Calculate the size of an ROI in an image. More...
class | FindSum
| Find the sum of the pixel values in an image or ROI. More...
class | FixedPoint
class | FixedPoint16
class | FunctorTraits
| Export associated information for a functor. More...
class | GaborFilterFamily
| Family of gabor filters of different scale and direction. More...
class | GammaFunctor
| Perform gamma correction of an image. More...
class | GammaMAPFunctor
| This function tries to reduce the speckle noise of an image by applying the Gamma Maximum A Posteriori (MAP) filter. More...
class | Gaussian
class | GiniCriterion
class | GrayToRGBAccessor
class | GreenAccessor
class | GridGraph
| Define a grid graph in arbitrary dimensions. More...
class | HDF5DisableErrorOutput
| Temporarily disable HDF5's native error output. More...
class | HDF5File
| Access to HDF5 files. More...
class | HDF5Handle
| Wrapper for unique hid_t objects. More...
class | HDF5HandleShared
| Wrapper for shared hid_t objects. More...
class | HDF5ImportInfo
| Argument object for the function readHDF5(). More...
struct | HierarchicalIteratorType
class | HistogramOptions
| Set histogram options. More...
class | ImageArray
| Fundamental class template for arrays of equal-sized images. More...
class | ImageExportInfo
| Argument object for the function exportImage(). More...
class | ImageImportInfo
| Argument object for the function importImage(). More...
class | ImageIterator
| Standard 2D random access iterator for images that store the data in a linear array. More...
class | ImageIteratorBase
| Base class for 2D random access iterators. More...
class | ImagePyramid
| Class template for logarithmically tapering image pyramids. More...
class | IteratorAdaptor
| Quickly create 1-dimensional iterator adapters. More...
struct | IteratorTraits
| Export associated information for each image iterator. More...
class | Kernel1D
| Generic 1 dimensional convolution kernel. More...
class | Kernel2D
| Generic 2 dimensional convolution kernel. More...
class | KuanFunctor
| This function tries to reduce the speckle noise of an image by applying the Kuan filter. More...
class | Lab2RGBFunctor
| Convert perceptual uniform CIE L*a*b* into linear (raw) RGB. More...
class | Lab2RGBPrimeFunctor
| Convert perceptual uniform CIE L*a*b* into non-linear (gamma corrected) R'G'B'. More...
class | Lab2XYZFunctor
| Convert perceptual uniform CIE L*a*b* into standardized tri-stimulus XYZ. More...
class | LabelOptions
| Option object for labelMultiArray(). More...
class | LastValueFunctor
| Stores and returns the last value it has seen. More...
class | LeeFunctor
| This function tries to reduce the speckle noise of an image by applying the basic Lee filter. More...
class | LineIterator
| Iterator adapter to iterate along an arbitrary line on the image. More...
class | LocalMinmaxOptions
| Options object for localMinima() and localMaxima(). More...
class | Luv2RGBFunctor
| Convert perceptual uniform CIE L*u*v* into linear (raw) RGB. More...
class | Luv2RGBPrimeFunctor
| Convert perceptual uniform CIE L*u*v* into non-linear (gamma corrected) R'G'B'. More...
class | Luv2XYZFunctor
| Convert perceptual uniform CIE L*u*v* into standardized tri-stimulus XYZ. More...
class | MagnitudeFunctor
class | MappedBucketQueue
| Priority queue implemented using bucket sort (STL compatible). More...
class | MergeGraphAdaptor
| undirected graph adaptor for edge contraction and feature merging More...
struct | MeshGridAccessor
class | MultiArray
| Main `MultiArray` class containing the memory management. More...
class | MultiArrayNavigator
| A navigator that provides access to the 1D subranges of an n-dimensional range given by a vigra::MultiIterator and an nD shape. More...
class | MultiArrayShape
class | MultiArrayView
| Base class for, and view to, vigra::MultiArray. More...
class | MultiBlocking
class | MultiCoordinateIterator
| Iterate over a virtual array where each element contains its coordinate. More...
class | MultiCoordinateNavigator
| A navigator that provides access to the 1D subranges of an n-dimensional range given by an nD shape. More...
class | MultiImageAccessor2
| Access two images simultaneously. More...
class | MultiIterator
| A multi-dimensional hierarchical iterator to be used with vigra::MultiArrayView if it is not strided. More...
class | NeighborhoodCirculator
| Circulator that walks around a given location in a given image. More...
class | NeighborOffsetCirculator
| Circulator that walks around a given location. More...
class | Node< e_ConstProbNode >
class | NodeBase
class | NoiseNormalizationOptions
| Pass options to one of the noise normalization functions. More...
class | NonlinearLSQOptions
| Pass options to nonlinearLeastSquares(). More...
class | NormalRandomFunctor
class | NumpyAnyArray
class | NumpyArray
class | ParallelOptions
| Option base class for parallel algorithms. More...
class | PLSAOptions
| Option object for the pLSA algorithm. More...
class | Point2D
| Two dimensional point or position. More...
class | Polygon
class | Polynomial
class | PolynomialView
class | Polytope
| Represent an n-dimensional polytope. More...
class | PriorityQueue
| Heap-based priority queue compatible to BucketQueue. More...
class | ProblemSpec
| problem specification class for the random forest. More...
class | Processor
class | Processor< ClassificationTag, LabelType, T1, C1, T2, C2 >
class | Processor< RegressionTag, LabelType, T1, C1, T2, C2 >
class | PropertyMap
| The PropertyMap is used to store Node or Arc information of graphs. More...
class | PropertyMap< KEYTYPE, MAPPEDTYPE, IndexVectorTag >
| Specialization of PropertyMap that stores the elements in a vector (size = number of stored elements). An additional index vector is needed for bookkeeping (size = max node id of stored elements). More...
class | PropertyMap< KEYTYPE, MAPPEDTYPE, VectorTag >
| Specialization of PropertyMap that stores the elements in a vector (size = max node id of stored elements). More...
class | Quaternion
class | RandomForest
| Random forest version 2 (see also vigra::rf3::RandomForest for version 3) More...
class | RandomForestClassCounter
class | RandomForestOptions
| Options object for the random forest. More...
class | RandomNumberGenerator
class | Rational
class | Rect2D
| Two dimensional rectangle. More...
class | RedAccessor
class | ReduceFunctor
| Apply a functor to reduce the dimensionality of an array. More...
class | RestrictedNeighborhoodCirculator
| Circulator that walks around a given location in a given image, using a restricted neighborhood. More...
class | RGB2LabFunctor
| Convert linear (raw) RGB into perceptual uniform CIE L*a*b*. More...
class | RGB2LuvFunctor
| Convert linear (raw) RGB into perceptual uniform CIE L*u*v*. More...
class | RGB2RGBPrimeFunctor
| Convert linear (raw) RGB into non-linear (gamma corrected) R'G'B'. More...
class | RGB2sRGBFunctor
| Convert linear (raw) RGB into standardized sRGB. More...
class | RGB2XYZFunctor
| Convert linear (raw) RGB into standardized tri-stimulus XYZ. More...
class | RGBAccessor
class | RGBGradientMagnitudeFunctor
class | RGBPrime2LabFunctor
| Convert non-linear (gamma corrected) R'G'B' into perceptual uniform CIE L*a*b*. More...
class | RGBPrime2LuvFunctor
| Convert non-linear (gamma corrected) R'G'B' into perceptual uniform CIE L*u*v*. More...
class | RGBPrime2RGBFunctor
| Convert non-linear (gamma corrected) R'G'B' into non-linear (raw) RGB. More...
class | RGBPrime2XYZFunctor
| Convert non-linear (gamma corrected) R'G'B' into standardized tri-stimulus XYZ. More...
class | RGBPrime2YPrimeCbCrFunctor
| Convert non-linear (gamma corrected) R'G'B' into Y'CbCr color difference components. More...
class | RGBPrime2YPrimeIQFunctor
| Convert non-linear (gamma corrected) R'G'B' into Y'IQ components. More...
class | RGBPrime2YPrimePbPrFunctor
| Convert non-linear (gamma corrected) R'G'B' into Y'PbPr color difference components. More...
class | RGBPrime2YPrimeUVFunctor
| Convert non-linear (gamma corrected) R'G'B' into Y'UV components. More...
class | RGBToGrayAccessor
class | RGBValue
| Class for a single RGB value. More...
class | RowIterator
| Iterator adapter to linearly access row. More...
class | Sampler
| Create random samples from a sequence of indices. More...
class | SamplerOptions
| Options object for the Sampler class. More...
class | SeedOptions
| Options object for generateWatershedSeeds(). More...
class | SeedRgDirectValueFunctor
| Statistics functor to be used for seeded region growing. More...
class | SequenceAccessor
| Accessor for items that are STL compatible sequences. More...
class | ShortestPathDijkstra
| shortest path computer More...
class | SIFImportInfo
| Extracts image properties from an Andor SIF file header. More...
class | Size2D
| Two dimensional size object. More...
struct | SkeletonOptions
| Option object for skeletonizeImage() More...
class | SlantedEdgeMTFOptions
| Pass options to one of the slantedEdgeMTF() functions. More...
struct | SlicOptions
| Options object for slicSuperpixels(). More...
class | SortSamplesByDimensions
class | Splice
class | SplineImageView
| Create a continuous view onto a discrete image using splines. More...
class | SplineImageView0
| Create an image view for nearest-neighbor interpolation. More...
class | SplineImageView1
| Create an image view for bi-linear interpolation. More...
class | SplitBase
class | sRGB2RGBFunctor
| Convert standardized sRGB into non-linear (raw) RGB. More...
class | StandardAccessor
| Encapsulate access to the values an iterator points to. More...
class | StandardConstAccessor
| Encapsulate read access to the values an iterator points to. More...
class | StandardConstValueAccessor
| Encapsulate access to the values an iterator points to. More...
class | StandardValueAccessor
| Encapsulate access to the values an iterator points to. More...
class | StarPolytope
| Specialization of the polytope to polytopes which forms a star domain. More...
class | StaticPolynomial
class | StopAfterTree
class | StopAfterVoteCount
class | StopBase
class | StopIfBinTest
class | StopIfConverging
class | StopIfMargin
class | StopIfProb
struct | StridedArrayTag
class | StridedImageIterator
| Iterator to be used when pixels are to be skipped. More...
class | StridedMultiIterator
| A multi-dimensional hierarchical iterator to be used with vigra::MultiArrayView if it is not strided. More...
class | StridedScanOrderIterator
| Sequential iterator for MultiArrayView. More...
struct | ThinPlateSplineFunctor
class | ThreadPool
| Thread pool class to manage a set of parallel workers. More...
class | Threshold
| Threshold an image. More...
class | ThresholdSplit
class | TinyVector
| Class for fixed size vectors. More...
class | TinyVectorBase
| Base class for fixed size vectors. More...
class | TinyVectorView
| Wrapper for fixed size vectors. More...
class | UniformIntRandomFunctor
class | UniformRandomFunctor
struct | UnstridedArrayTag
class | VectorAccessor
| Accessor for items that are STL compatible vectors. More...
class | VectorComponentAccessor
| Accessor for one component of a vector. More...
class | VectorComponentValueAccessor
| Accessor for one component of a vector. More...
class | VectorElementAccessor
| Accessor for one component of a vector. More...
class | VectorNormFunctor
| A functor for computing the vector norm. More...
class | VectorNormSqFunctor
| A functor for computing the squared vector norm. More...
class | VolumeExportInfo
| Argument object for the function exportVolume(). More...
class | VolumeImportInfo
| Argument object for the function importVolume(). More...
class | WatershedOptions
| Options object for watershed algorithms. More...
class | WignerMatrix
| computation of Wigner D matrix + rotation functions in SH,VH and RÂ³ More...
class | XYZ2LabFunctor
| Convert standardized tri-stimulus XYZ into perceptual uniform CIE L*a*b*. More...
class | XYZ2LuvFunctor
| Convert standardized tri-stimulus XYZ into perceptual uniform CIE L*u*v*. More...
class | XYZ2RGBFunctor
| Convert standardized tri-stimulus XYZ into linear (raw) RGB. More...
class | XYZ2RGBPrimeFunctor
| Convert standardized tri-stimulus XYZ into non-linear (gamma corrected) R'G'B'. More...
class | YPrimeCbCr2RGBPrimeFunctor
| Convert Y'CbCr color difference components into non-linear (gamma corrected) R'G'B'. More...
class | YPrimeIQ2RGBPrimeFunctor
| Convert Y'IQ color components into non-linear (gamma corrected) R'G'B'. More...
class | YPrimePbPr2RGBPrimeFunctor
| Convert Y'PbPr color difference components into non-linear (gamma corrected) R'G'B'. More...
class | YPrimeUV2RGBPrimeFunctor
| Convert Y'UV color components into non-linear (gamma corrected) R'G'B'. More...

## Typedefs

typedef AtImageBorder | AtVolumeBorder
| Encode whether a voxel is near the volume border.
typedef BasicImage< UInt8 > | BImage
typedef BasicImage< RGBValue< UInt8 > > | BRGBImage
typedef Diff2D | CoordinateIterator
| Simulate an image where each pixel contains its coordinate.
typedef vigra::TinyVector< int, 3 > | Diff3D
| 3-dimensional difference vector
typedef BasicImage< double > | DImage
typedef BasicImage< RGBValue< double > > | DRGBImage
typedef BasicImage< TinyVector< double, 2 > > | DVector2Image
typedef BasicImage< TinyVector< double, 3 > > | DVector3Image
typedef BasicImage< TinyVector< double, 4 > > | DVector4Image
typedef EightNeighborhood::NeighborCode | EightNeighborCode
typedef NeighborOffsetCirculator< EightNeighborCode > | EightNeighborOffsetCirculator
typedef BasicImage< FFTWComplex<> > | FFTWComplexImage
typedef BasicImage< fftw_real > | FFTWRealImage
typedef BasicImage< float > | FImage
typedef FourNeighborhood::NeighborCode | FourNeighborCode
typedef NeighborOffsetCirculator< FourNeighborCode > | FourNeighborOffsetCirculator
typedef BasicImage< RGBValue< float > > | FRGBImage
typedef BasicImage< TinyVector< float, 2 > > | FVector2Image
typedef BasicImage< TinyVector< float, 3 > > | FVector3Image
typedef BasicImage< TinyVector< float, 4 > > | FVector4Image
typedef RidgeSplit< BestGiniOfColumn< GiniCriterion > > | GiniRidgeSplit
typedef BasicImage< Int32 > | IImage
typedef detail::SelectIntegerType< 16, detail::SignedIntTypes >::type | Int16
| 16-bit signed int
typedef BasicImage< Int16 > | Int16Image
typedef BasicImage< RGBValue< Int16 > > | Int16RGBImage
typedef detail::SelectIntegerType< 32, detail::SignedIntTypes >::type | Int32
| 32-bit signed int
typedef BasicImage< Int32 > | Int32Image
typedef BasicImage< RGBValue< Int32 > > | Int32RGBImage
typedef detail::SelectIntegerType< 64, detail::SignedIntTypes >::type | Int64
| 64-bit signed int
typedef detail::SelectIntegerType< 8, detail::SignedIntTypes >::type | Int8
| 8-bit signed int
typedef BasicImage< Int8 > | Int8Image
typedef BasicImage< RGBValue< Int8 > > | Int8RGBImage
typedef detail::SelectBiggestIntegerType< detail::SignedIntTypes >::type | IntBiggest
| the biggest signed integer type of the system
typedef BasicImage< RGBValue< Int32 > > | IRGBImage
typedef RandomNumberGenerator< detail::RandomState< detail::MT19937 > > | MersenneTwister
typedef std::ptrdiff_t | MultiArrayIndex
typedef Neighborhood3DSix::NeighborCode3D | NeighborCode3DSix
typedef Neighborhood3DTwentySix::NeighborCode3D | NeighborCode3DTwentySix
typedef RandomNumberGenerator< detail::RandomState< detail::MT19937 > > | RandomMT19937
typedef RandomNumberGenerator< detail::RandomState< detail::TT800 > > | RandomTT800
typedef BasicImage< Int16 > | SImage
typedef BasicImage< RGBValue< Int16 > > | SRGBImage
typedef RandomNumberGenerator< detail::RandomState< detail::TT800 > > | TemperedTwister
typedef detail::SelectIntegerType< 16, detail::UnsignedIntTypes >::type | UInt16
| 16-bit unsigned int
typedef BasicImage< UInt16 > | UInt16Image
typedef BasicImage< RGBValue< UInt16 > > | UInt16RGBImage
typedef detail::SelectIntegerType< 32, detail::UnsignedIntTypes >::type | UInt32
| 32-bit unsigned int
typedef BasicImage< UInt32 > | UInt32Image
typedef BasicImage< RGBValue< UInt32 > > | UInt32RGBImage
typedef detail::SelectIntegerType< 64, detail::UnsignedIntTypes >::type | UInt64
| 64-bit unsigned int
typedef detail::SelectIntegerType< 8, detail::UnsignedIntTypes >::type | UInt8
| 8-bit unsigned int
typedef BasicImage< UInt8 > | UInt8Image
typedef BasicImage< RGBValue< UInt8 > > | UInt8RGBImage
typedef detail::SelectBiggestIntegerType< detail::UnsignedIntTypes >::type | UIntBiggest
| the biggest unsigned integer type of the system

## Enumerations

enum

AtImageBorder {
NotAtBorder = 0 , RightBorder = 1 , LeftBorder = 2 , TopBorder = 4 ,
BottomBorder = 8 , FrontBorder = 16 , RearBorder = 32 , TopRightBorder = TopBorder | RightBorder ,
TopLeftBorder = TopBorder | LeftBorder , TopFrontBorder = TopBorder | FrontBorder , TopRearBorder = TopBorder | RearBorder , BottomLeftBorder = BottomBorder | LeftBorder ,
BottomRightBorder = BottomBorder | RightBorder , BottomFrontBorder = BottomBorder | FrontBorder , BottomRearBorder = BottomBorder | RearBorder , FrontLeftBorder = FrontBorder | LeftBorder ,
FrontRightBorder = FrontBorder | RightBorder , RearLeftBorder = RearBorder | LeftBorder , RearRightBorder = RearBorder | RightBorder , TopRightFrontBorder = TopBorder | RightBorder | FrontBorder ,
TopLeftFrontBorder = TopBorder | LeftBorder | FrontBorder , BottomLeftFrontBorder = BottomBorder | LeftBorder | FrontBorder , BottomRightFrontBorder = BottomBorder | RightBorder | FrontBorder , TopRightRearBorder = TopBorder | RightBorder | RearBorder ,
TopLeftRearBorder = TopBorder | LeftBorder | RearBorder , BottomLeftRearBorder = BottomBorder | LeftBorder | RearBorder , BottomRightRearBorder = BottomBorder | RightBorder | RearBorder
}

| Encode whether a point is near the image border. More...
enum | BoundaryDistanceTag { OuterBoundary , InterpixelBoundary , InnerBoundary }
| Specify which boundary is used for boundaryMultiDistance(). More...
enum | MultiArrayInitializationTag { LinearSequence }
| Initialize a MultiArray in a standard way. More...
enum | NeighborhoodType { DirectNeighborhood =0 , IndirectNeighborhood =1 }
| Choose the neighborhood system in a dimension-independent way. More...
enum | RF_OptionTag
enum | SRGType

## Functions

template<class R >
FFTWComplex< R >::NormType | abs (const FFTWComplex< R > &a)
| absolute value (= magnitude)
template<typename IntType >
Rational< IntType > | abs (const Rational< IntType > &r)
| absolute value
template<int IntBits, FPOverflowHandling OverflowHandling>
FixedPoint16< IntBits, OverflowHandling > | abs (FixedPoint16< IntBits, OverflowHandling > v)
| absolute value.
template<unsigned IntBits, unsigned FracBits>
FixedPoint< IntBits, FracBits > | abs (FixedPoint< IntBits, FracBits > v)
| absolute value.
template<typename Type >
Quaternion< Type >::NormType | abs (Quaternion< Type > const &q)
| norm
template<class T , unsigned int RIDX, unsigned int GIDX, unsigned int BIDX>
RGBValue< T, RIDX, GIDX, BIDX > | abs (RGBValue< T, RIDX, GIDX, BIDX > const &v)
| component-wise absolute value
template<class V , int SIZE, class D1 , class D2 >
TinyVector< V, SIZE > | abs (TinyVectorBase< V, SIZE, D1, D2 > const &v)
| component-wise absolute value
template<int IntBits1, FPOverflowHandling OverflowHandling, int IntBits2, int IntBits3>
FixedPoint16< IntBits3, OverflowHandling > & | add (FixedPoint16< IntBits1, OverflowHandling > l, FixedPoint16< IntBits2, OverflowHandling > r, FixedPoint16< IntBits3, OverflowHandling > &result)
| addition with enforced result type.
template<unsigned IntBits1, unsigned FracBits1, unsigned IntBits2, unsigned FracBits2, unsigned IntBits3, unsigned FracBits3>
void | add (FixedPoint< IntBits1, FracBits1 > l, FixedPoint< IntBits2, FracBits2 > r, FixedPoint< IntBits3, FracBits3 > &result)
| addition with enforced result type.
template<class SrcIterator , class DestIterator >
linalg::TemporaryMatrix< double > | affineMatrix2DFromCorrespondingPoints (SrcIterator s, SrcIterator send, DestIterator d)
| Create homogeneous matrix that maps corresponding points onto each other.
template<... >
void | affineWarpImage (...)
| Warp an image according to an affine transformation.
template<class V1 , int SIZE, class D1 , class D2 , class V2 , class D3 , class D4 >
bool | allGreater (TinyVectorBase< V1, SIZE, D1, D2 > const &l, TinyVectorBase< V2, SIZE, D3, D4 > const &r)
| pointwise greater-than
template<class V1 , int SIZE, class D1 , class D2 , class V2 , class D3 , class D4 >
bool | allGreaterEqual (TinyVectorBase< V1, SIZE, D1, D2 > const &l, TinyVectorBase< V2, SIZE, D3, D4 > const &r)
| pointwise greater-equal
template<class V1 , int SIZE, class D1 , class D2 , class V2 , class D3 , class D4 >
bool | allLess (TinyVectorBase< V1, SIZE, D1, D2 > const &l, TinyVectorBase< V2, SIZE, D3, D4 > const &r)
| pointwise less-than
template<class V1 , int SIZE, class D1 , class D2 , class V2 , class D3 , class D4 >
bool | allLessEqual (TinyVectorBase< V1, SIZE, D1, D2 > const &l, TinyVectorBase< V2, SIZE, D3, D4 > const &r)
| pointwise less-equal
double | angularGaborSigma (int directionCount, double centerFrequency)
| Calculate sensible angular sigma for given parameters.
template<... >
void | anisotropicTotalVariationFilter (...)
| Performs Anisotropic Total Variation Regularization.
template<... >
void | applyFourierFilter (...)
| Apply a filter (defined in the frequency domain) to an image.
template<... >
void | applyFourierFilterFamily (...)
| Apply an array of filters (defined in the frequency domain) to an image.
template<class IndexIterator , class InIterator , class OutIterator >
void | applyPermutation (IndexIterator index_first, IndexIterator index_last, InIterator in, OutIterator out)
| Sort an array according to the given index permutation.
template<... >
void | applyWindowFunction (...)
| Apply a window function to each pixels of a given image.
template<class R >
R | arg (const FFTWComplex< R > &a)
| phase
template<class Iterator >
Iterator | argMax (Iterator first, Iterator last)
| Find the maximum element in a sequence.
template<class Iterator , class UnaryFunctor >
Iterator | argMaxIf (Iterator first, Iterator last, UnaryFunctor condition)
| Find the maximum element in a sequence conforming to a condition.
template<class Iterator >
Iterator | argMin (Iterator first, Iterator last)
| Find the minimum element in a sequence.
template<class Iterator , class UnaryFunctor >
Iterator | argMinIf (Iterator first, Iterator last, UnaryFunctor condition)
| Find the minimum element in a sequence conforming to a condition.
template<class T >
std::string | asString (T t)(...)
template<int IntBits, FPOverflowHandling OverflowHandling>
FixedPoint16< 2, OverflowHandling > | atan2 (FixedPoint16< IntBits, OverflowHandling > y, FixedPoint16< IntBits, OverflowHandling > x)
| Arctangent. Accuracy better than 1/3 degree (9 significant bits).
template<... >
void | beaudetCornerDetector (...)
| Find corners in an image (4).
template<... >
void | beautifyCrackEdgeImage (...)
| Beautify crack edge image for visualization.
double | besselJ (int n, double x)
| Bessel function of the first kind.
double | besselY (int n, double x)
| Bessel function of the second kind.
template<... >
void | boundaryMultiDistance (...)
| Euclidean distance to the implicit boundaries of a multi-dimensional label array.
template<... >
void | boundaryTensor (...)
| Calculate the boundary tensor for a scalar valued image.
template<... >
void | boundaryTensor1 (...)
| Boundary tensor variant.
template<... >
void | boundaryVectorDistance (...)
| Compute the vector distance transform to the implicit boundaries of a multi-dimensional label array.
template<... >
void | cannyEdgeImage (...)
| Detect and mark edges in an edge image using Canny's algorithm.
template<... >
void | cannyEdgeImageFromGradWithThinning (...)
| Detect and mark edges in an edge image using Canny's algorithm.
template<... >
void | cannyEdgeImageWithThinning (...)
| Detect and mark edges in an edge image using Canny's algorithm.
template<... >
void | cannyEdgelList (...)
| Simple implementation of Canny's edge detector.
template<... >
void | cannyEdgelList3x3 (...)
| Improved implementation of Canny's edge detector.
template<... >
void | cannyEdgelList3x3Threshold (...)
| Improved implementation of Canny's edge detector with thresholding.
template<... >
void | cannyEdgelListThreshold (...)
| Canny's edge detector with thresholding.
template<class GRAPH , class EDGE_WEIGHTS , class SEEDS , class LABELS >
void | carvingSegmentation (const GRAPH &g, const EDGE_WEIGHTS &edgeWeights, const SEEDS &seeds, const typename LABELS::Value backgroundLabel, const typename EDGE_WEIGHTS::Value backgroundBias, const typename EDGE_WEIGHTS::Value noPriorBelow, LABELS &labels)
| edge weighted watersheds Segmentataion
template<typename IntType >
Rational< IntType > | ceil (const Rational< IntType > &r)
| smallest integer not smaller than `r`
template<int IntBits, FPOverflowHandling OverflowHandling>
Int32 | ceil (FixedPoint16< IntBits, OverflowHandling > v)
| rounding up.
template<unsigned IntBits, unsigned FracBits>
int | ceil (FixedPoint< IntBits, FracBits > v)
| rounding up.
template<class V , unsigned int RIDX, unsigned int GIDX, unsigned int BIDX>
RGBValue< V, RIDX, GIDX, BIDX > | ceil (RGBValue< V, RIDX, GIDX, BIDX > const &r)
template<class V , int SIZE, class D1 , class D2 >
TinyVector< V, SIZE > | ceil (TinyVectorBase< V, SIZE, D1, D2 > const &v)
UInt32 | ceilPower2 (UInt32 x)
| Round up to the nearest power of 2.
template<int SIZE>
TinyVector< UInt32, SIZE > | ceilPower2 (vigra::TinyVector< UInt32, SIZE > const &t)
| Round up values to the nearest power of 2. Implemented only for UInt32.
UInt32 | checksum (const char *data, unsigned int size)
| Compute the CRC-32 checksum of a byte array.
double | chi2 (unsigned int degreesOfFreedom, double arg, double accuracy=1e-7)
| Chi square distribution.
double | chi2CDF (unsigned int degreesOfFreedom, double arg, double accuracy=1e-7)
| Cumulative chi square distribution.
template<class V , int SIZE>
TinyVector< V, SIZE > | clip (TinyVector< V, SIZE > const &t, const V valLower, const V valUpper)
| Clip values to an interval.
template<class V , int SIZE>
TinyVector< V, SIZE > | clip (TinyVector< V, SIZE > const &t, TinyVector< V, SIZE > const &valLower, TinyVector< V, SIZE > const &valUpper)
| Clip values to a vector of intervals.
template<class V , int SIZE>
TinyVector< V, SIZE > | clipLower (TinyVector< V, SIZE > const &t)
| Clip negative values.
template<class V , int SIZE>
TinyVector< V, SIZE > | clipLower (TinyVector< V, SIZE > const &t, const V val)
| Clip values below a threshold.
template<class V , int SIZE>
TinyVector< V, SIZE > | clipUpper (TinyVector< V, SIZE > const &t, const V val)
| Clip values above a threshold.
template<class T1 , class T2 >
bool | closeAtTolerance (T1 l, T2 r, typename PromoteTraits< T1, T2 >::Promote epsilon)
| Tolerance based floating-point equality.
template<... >
void | closeGapsInCrackEdgeImage (...)
| Close one-pixel wide gaps in a cell grid edge image.
template<... >
void | combineThreeImages (...)
| Combine three source images into destination image.
template<... >
void | combineThreeMultiArrays (...)
| Combine three multi-dimensional arrays into one using a ternary function or functor.
template<... >
void | combineTwoImages (...)
| Combine two source images into destination image.
template<... >
void | combineTwoImagesIf (...)
| Combine ROI of two source images into destination image.
template<... >
void | combineTwoMultiArrays (...)
| Combine two multi-dimensional arrays into one using a binary function or functor.
void | compress (char const *source, std::size_t size, ArrayVector< char > &dest, CompressionMethod method)
UInt32 | concatenateChecksum (UInt32 checksum, const char *data, unsigned int size)
template<class R >
FFTWComplex< R > | conj (const FFTWComplex< R > &a)
| complex conjugate
template<class ValueType >
Quaternion< ValueType > | conj (Quaternion< ValueType > const &q)
| Create conjugate quaternion.
template<class PointArray1 , class PointArray2 >
void | convexHull (const PointArray1 &points, PointArray2 &convex_hull)
| Compute convex hull of a 2D polygon.
template<... >
void | convolveFFT (...)
| Convolve an array with a kernel by means of the Fourier transform.
template<... >
void | convolveFFTComplex (...)
| Convolve a complex-valued array by means of the Fourier transform.
template<... >
void | convolveFFTComplexMany (...)
| Convolve a complex-valued array with a sequence of kernels by means of the Fourier transform.
template<... >
void | convolveFFTMany (...)
| Convolve a real-valued array with a sequence of kernels by means of the Fourier transform.
template<... >
void | convolveImage (...)
| Convolve an image with the given kernel(s).
template<... >
void | convolveImageWithMask (...)
| Deprecated name of 2-dimensional normalized convolution, i.e. convolution with a mask image.
template<... >
void | convolveLine (...)
| Performs a 1-dimensional convolution of the source signal using the given kernel.
template<... >
void | convolveMultiArrayOneDimension (...)
| Convolution along a single dimension of a multi-dimensional arrays.
template<class G , class A , class B >
void | copyEdgeMap (const G &g, const A &a, B &b)
| copy a lemon edge map
template<... >
void | copyImage (...)
| Copy source image into destination image.
template<... >
void | copyImageIf (...)
| Copy source ROI into destination image.
template<... >
void | copyMultiArray (...)
| Copy a multi-dimensional array.
template<class G , class A , class B >
void | copyNodeMap (const G &g, const A &a, B &b)
| copy a lemon node map
template<... >
void | cornerResponseFunction (...)
| Find corners in an image (1).
template<... >
void | correlateFFT (...)
| Correlate an array with a kernel by means of the Fourier transform.
template<class REAL >
REAL | cos_pi (REAL x)
| cos(pi*x).
template<unsigned int N, class T >
ChunkedArray< N, T >::iterator | createCoupledIterator (ChunkedArray< N, T > &m)
template<unsigned int N1, class T1 , class S1 >
CoupledIteratorType< N1, T1 >::type | createCoupledIterator (MultiArrayView< N1, T1, S1 > const &m1)
template<unsigned int N1, class T1 , class S1 , unsigned int N2, class T2 , class S2 >
CoupledIteratorType< N1, T1, T2 >::type | createCoupledIterator (MultiArrayView< N1, T1, S1 > const &m1, MultiArrayView< N2, T2, S2 > const &m2)
template<unsigned int N1, class T1 , class S1 , unsigned int N2, class T2 , class S2 , unsigned int N3, class T3 , class S3 >
CoupledIteratorType< N1, T1, T2, T3 >::type | createCoupledIterator (MultiArrayView< N1, T1, S1 > const &m1, MultiArrayView< N2, T2, S2 > const &m2, MultiArrayView< N3, T3, S3 > const &m3)
template<unsigned int N1, class T1 , class S1 , unsigned int N2, class T2 , class S2 , unsigned int N3, class T3 , class S3 , unsigned int N4, class T4 , class S4 >
CoupledIteratorType< N1, T1, T2, T3, T4 >::type | createCoupledIterator (MultiArrayView< N1, T1, S1 > const &m1, MultiArrayView< N2, T2, S2 > const &m2, MultiArrayView< N3, T3, S3 > const &m3, MultiArrayView< N4, T4, S4 > const &m4)
template<unsigned int N1, class T1 , class S1 , unsigned int N2, class T2 , class S2 , unsigned int N3, class T3 , class S3 , unsigned int N4, class T4 , class S4 , unsigned int N5, class T5 , class S5 >
CoupledIteratorType< N1, T1, T2, T3, T4, T5 >::type | createCoupledIterator (MultiArrayView< N1, T1, S1 > const &m1, MultiArrayView< N2, T2, S2 > const &m2, MultiArrayView< N3, T3, S3 > const &m3, MultiArrayView< N4, T4, S4 > const &m4, MultiArrayView< N5, T5, S5 > const &m5)
template<int N>
CoupledIteratorType< N >::type | createCoupledIterator (TinyVector< MultiArrayIndex, N > const &shape)
template<... >
void | createGaborFilter (...)
| Create a gabor filter in frequency space.
template<unsigned int N1, class T1 , class S1 >
HierarchicalIteratorType< N1, T1 >::type | createHierarchicalIterator (MultiArrayView< N1, T1, S1 > const &m1)
template<unsigned int N1, class T1 , class S1 , unsigned int N2, class T2 , class S2 >
HierarchicalIteratorType< N1, T1, T2 >::type | createHierarchicalIterator (MultiArrayView< N1, T1, S1 > const &m1, MultiArrayView< N2, T2, S2 > const &m2)
template<unsigned int N1, class T1 , class S1 , unsigned int N2, class T2 , class S2 , unsigned int N3, class T3 , class S3 >
HierarchicalIteratorType< N1, T1, T2, T3 >::type | createHierarchicalIterator (MultiArrayView< N1, T1, S1 > const &m1, MultiArrayView< N2, T2, S2 > const &m2, MultiArrayView< N3, T3, S3 > const &m3)
template<unsigned int N1, class T1 , class S1 , unsigned int N2, class T2 , class S2 , unsigned int N3, class T3 , class S3 , unsigned int N4, class T4 , class S4 >
HierarchicalIteratorType< N1, T1, T2, T3, T4 >::type | createHierarchicalIterator (MultiArrayView< N1, T1, S1 > const &m1, MultiArrayView< N2, T2, S2 > const &m2, MultiArrayView< N3, T3, S3 > const &m3, MultiArrayView< N4, T4, S4 > const &m4)
template<unsigned int N1, class T1 , class S1 , unsigned int N2, class T2 , class S2 , unsigned int N3, class T3 , class S3 , unsigned int N4, class T4 , class S4 , unsigned int N5, class T5 , class S5 >
HierarchicalIteratorType< N1, T1, T2, T3, T4, T5 >::type | createHierarchicalIterator (MultiArrayView< N1, T1, S1 > const &m1, MultiArrayView< N2, T2, S2 > const &m2, MultiArrayView< N3, T3, S3 > const &m3, MultiArrayView< N4, T4, S4 > const &m4, MultiArrayView< N5, T5, S5 > const &m5)
template<int N>
HierarchicalIteratorType< N >::type | createHierarchicalIterator (TinyVector< MultiArrayIndex, N > const &shape)
template<... >
void | createRGBTiffImage (...)
| Create a 3-band TiffImage from the given RGB image.
template<... >
void | createScalarTiffImage (...)
| Create a single-band TiffImage from the given scalar image.
template<... >
void | createTiffImage (...)
| Create a TiffImage from the given iterator range.
template<class V1 , unsigned int R, unsigned int G, unsigned int B, class V2 >
PromoteTraits< RGBValue< V1, R, G, B >, RGBValue< V2, R, G, B > >::Promote | cross (RGBValue< V1, R, G, B > const &r1, RGBValue< V2, R, G, B > const &r2)
| cross product
template<class V1 , class D1 , class D2 , class V2 , class D3 , class D4 >
TinyVector< typename PromoteTraits< V1, V2 >::Promote, 3 > | cross (TinyVectorBase< V1, 3, D1, D2 > const &r1, TinyVectorBase< V2, 3, D3, D4 > const &r2)
| cross product
template<... >
void | crossCorrelation (...)
| This function performes a (slow) cross-correlation.
template<class V , int SIZE, class D1 , class D2 >
TinyVector< typename NumericTraits< V >::Promote, SIZE > | cumprod (TinyVectorBase< V, SIZE, D1, D2 > const &l)
| cumulative product of the vector's elements
template<class V , int SIZE, class D1 , class D2 >
TinyVector< typename NumericTraits< V >::Promote, SIZE > | cumsum (TinyVectorBase< V, SIZE, D1, D2 > const &l)
| cumulative sum of the vector's elements
template<... >
void | differenceOfExponentialCrackEdgeImage (...)
| Detect and mark edges in a crack edge image using the Shen/Castan zero-crossing detector.
template<... >
void | differenceOfExponentialEdgeImage (...)
| Detect and mark edges in an edge image using the Shen/Castan zero-crossing detector.
template<... >
void | discDilation (...)
| Apply dilation (maximum) filter with disc of given radius to image.
template<... >
void | discDilationWithMask (...)
| Apply dilation (maximum) filter with disc of given radius to image using a mask.
template<... >
void | discErosion (...)
| Apply erosion (minimum) filter with disc of given radius to image.
template<... >
void | discErosionWithMask (...)
| Apply erosion (minimum) filter with disc of given radius to image using a mask.
template<... >
void | discMedian (...)
| Apply median filter with disc of given radius to image.
template<... >
void | discMedianWithMask (...)
| Apply median filter with disc of given radius to image using a mask.
template<... >
void | discRankOrderFilter (...)
| Apply rank order filter with disc structuring function to the image.
template<... >
void | discRankOrderFilterWithMask (...)
| Apply rank order filter with disc structuring function to the image using a mask.
template<... >
void | distanceTransform (...)
template<int IntBits1, FPOverflowHandling OverflowHandling, int IntBits2, int IntBits3>
FixedPoint16< IntBits3, OverflowHandling > & | div (FixedPoint16< IntBits1, OverflowHandling > l, FixedPoint16< IntBits2, OverflowHandling > r, FixedPoint16< IntBits3, OverflowHandling > &result)
| division with enforced result type.
template<class V , int SIZE, class D1 , class D2 >
TinyVector< V, SIZE > | div (TinyVectorBase< V, SIZE, D1, D2 > const &l, V v)
| component-wise scalar division without type promotion
template<class V1 , unsigned int RIDX1, unsigned int GIDX1, unsigned int BIDX1, class V2 , unsigned int RIDX2, unsigned int GIDX2, unsigned int BIDX2>
PromoteTraits< V1, V2 >::Promote | dot (RGBValue< V1, RIDX1, GIDX1, BIDX1 > const &r1, RGBValue< V2, RIDX2, GIDX2, BIDX2 > const &r2)
| dot product
template<class V1 , int SIZE, class D1 , class D2 , class V2 , class D3 , class D4 >
PromoteTraits< V1, V2 >::Promote | dot (TinyVectorBase< V1, SIZE, D1, D2 > const &l, TinyVectorBase< V2, SIZE, D3, D4 > const &r)
| dot product
| doxygen_overloaded_function (template<... > void separableConvolveBlockwise) template< unsigned int N
| Separated convolution on ChunkedArrays.
template<int IntBits, FPOverflowHandling OverflowHandling>
FixedPoint16< IntBits, OverflowHandling > | dual_frac (FixedPoint16< IntBits, OverflowHandling > v)
| dual fractional part. (1 - frac(v))
template<unsigned IntBits, unsigned FracBits>
FixedPoint< 0, FracBits > | dual_frac (FixedPoint< IntBits, FracBits > v)
| dual fractional part: `1 - frac(v)`.
template<unsigned int N, class T , class S , class Array >
void | eccentricityCenters (const MultiArrayView< N, T, S > &src, Array &centers)
| Find the (approximate) eccentricity center in each region of a labeled image.
template<unsigned int N, class T , class S , class Array >
void | eccentricityTransformOnLabels (MultiArrayView< N, T > const &src, MultiArrayView< N, S > dest, Array &centers)
| Computes the (approximate) eccentricity transform on each region of a labeled image.
template<class GRAPH , class WEIGHTS , class COMPERATOR >
void | edgeSort (const GRAPH &g, const WEIGHTS &weights, const COMPERATOR &comperator, std::vector< typename GRAPH::Edge > &sortedEdges)
| get a vector of Edge descriptors
template<class GRAPH , class EDGE_WEIGHTS , class SEEDS , class LABELS >
void | edgeWeightedWatershedsSegmentation (const GRAPH &g, const EDGE_WEIGHTS &edgeWeights, const SEEDS &seeds, LABELS &labels)
| edge weighted watersheds Segmentataion
template<unsigned int N, class DirectedTag , class T , class EDGEMAP >
void | edgeWeightsFromInterpolatedImage (const GridGraph< N, DirectedTag > &g, const MultiArrayView< N, T > &interpolatedImage, EDGEMAP &edgeWeights, bool euclidean=false)
| create edge weights from an interpolated image
template<unsigned int N, class DirectedTag , class NODEMAP , class EDGEMAP , class FUNCTOR >
void | edgeWeightsFromNodeWeights (const GridGraph< N, DirectedTag > &g, const NODEMAP &nodeWeights, EDGEMAP &edgeWeights, bool euclidean, FUNCTOR const &func)
| create edge weights from node weights
double | ellipticIntegralE (double x, double k)
| The incomplete elliptic integral of the second kind.
double | ellipticIntegralF (double x, double k)
| The incomplete elliptic integral of the first kind.
template<... >
void | estimateAffineTransform (...)
| Estimate the optical flow between two images according to an affine transform model (e.g. translation, rotation, non-uniform scaling, and shearing).
template<... >
void | estimateGlobalRotation (...)
| Estimate the rotation between two images by means of a normalized cross correlation matching of the FFT spectra.
template<... >
void | estimateGlobalRotationTranslation (...)
| Estimate the (global) rotation and translation between two images by means a normalized cross correlation matching.
template<... >
void | estimateGlobalTranslation (...)
| Estimate the translation between two images by means of a normalized cross correlation matching.
template<... >
void | estimateSimilarityTransform (...)
| Estimate the optical flow between two images according to a similarity transform model (e.g. translation, rotation, and uniform scaling).
template<... >
void | estimateTranslation (...)
| Estimate the optical flow between two images according to a translation model.
bool | even (int t)
| Check if an integer is even.
template<... >
void | exportImage (...)
| Write an image to a file.
template<... >
void | exportImageAlpha (...)
| Write the image and its alpha channel to a file.
template<... >
void | exportVolume (...)
| Function for exporting a 3D volume.
template<... >
void | extendedLocalMaxima (...)
| Find local maximal regions in an array.
template<... >
void | extendedLocalMaxima3D (...)
| Find local maximal regions in 3D multi array.
template<... >
void | extendedLocalMinima (...)
| Find local minimal regions (plateaus) in an array.
template<... >
void | extendedLocalMinima3D (...)
| Find local minimal regions in a volume.
template<class T , class S , class PointArray >
void | extractContour (MultiArrayView< 2, T, S > const &label_image, Shape2 const &anchor_point, PointArray &contour_points)
| Create a polygon from the interpixel contour of a labeled region.
template<... >
void | fastCrossCorrelation (...)
| This function performes a fast cross-correlation.
template<... >
void | fastNormalizedCrossCorrelation (...)
| This function performes a fast normalized cross-correlation.
template<class GRAPH , class EDGE_WEIGHTS , class NODE_SIZE , class NODE_LABEL_MAP >
void | felzenszwalbSegmentation (const GRAPH &graph, const EDGE_WEIGHTS &edgeWeights, const NODE_SIZE &nodeSizes, float k, NODE_LABEL_MAP &nodeLabeling, const int nodeNumStopCond=-1)
| edge weighted watersheds Segmentataion
template<class T , int N>
TinyVector< T, N > | fftwCorrespondingShapeR2C (TinyVector< T, N > shape)
| Find frequency domain shape for a R2C Fourier transform.
template<class G , class A , class T >
void | fillEdgeMap (const G &g, A &a, const T &value)
| fill a lemon edge map
template<class G , class A , class T >
void | fillNodeMap (const G &g, A &a, const T &value)
| fill a lemon node map
template<class Point , class T , class S , class Value >
void | fillPolygon (Polygon< Point > const &p, MultiArrayView< 2, T, S > &output_image, Value value)
| Render closed polygon p into the image output_image.
template<class TARGET , int IntBits, FPOverflowHandling OverflowHandling>
TARGET | fixed_point_cast (FixedPoint16< IntBits, OverflowHandling > v)
template<class TARGET , unsigned IntBits, unsigned FracBits>
TARGET | fixed_point_cast (FixedPoint< IntBits, FracBits > v)
template<typename IntType >
Rational< IntType > | floor (const Rational< IntType > &r)
| largest integer not larger than `r`
template<int IntBits, FPOverflowHandling OverflowHandling>
Int32 | floor (FixedPoint16< IntBits, OverflowHandling > v)
| rounding down.
template<unsigned IntBits, unsigned FracBits>
int | floor (FixedPoint< IntBits, FracBits > v)
| rounding down.
template<class V , unsigned int RIDX, unsigned int GIDX, unsigned int BIDX>
RGBValue< V, RIDX, GIDX, BIDX > | floor (RGBValue< V, RIDX, GIDX, BIDX > const &r)
template<class V , int SIZE, class D1 , class D2 >
TinyVector< V, SIZE > | floor (TinyVectorBase< V, SIZE, D1, D2 > const &v)
UInt32 | floorPower2 (UInt32 x)
| Round down to the nearest power of 2.
template<int SIZE>
TinyVector< UInt32, SIZE > | floorPower2 (vigra::TinyVector< UInt32, SIZE > const &t)
| Round down values to the nearest power of 2. Implemented only for UInt32.
template<... >
void | foerstnerCornerDetector (...)
| Find corners in an image (2).
template<typename TPL , typename FUNCTOR >
void | for_each_in_tuple (TPL &&t, FUNCTOR &&f)
template<... >
void | fourierTransform (...)
| Compute forward and inverse Fourier transforms.
template<... >
void | fourierTransformInverse (...)
| Compute inverse Fourier transforms.
template<... >
void | fourierTransformReal (...)
| Real Fourier transforms for even and odd boundary conditions (aka. cosine and sine transforms).
template<int IntBits, FPOverflowHandling OverflowHandling>
FixedPoint16< IntBits, OverflowHandling > | frac (FixedPoint16< IntBits, OverflowHandling > v)
| fractional part. (difference between v and its floor)
template<unsigned IntBits, unsigned FracBits>
FixedPoint< 0, FracBits > | frac (FixedPoint< IntBits, FracBits > v)
| fractional part.
template<... >
void | frostFilter (...)
| This function tries to reduce the speckle noise of an image by applying the basic Frost filter.
double | gamma (double x)
| The gamma function.
template<... >
void | gaussianDivergenceMultiArray (...)
| Calculate the divergence of a vector field using Gaussian derivative filters.
template<... >
void | gaussianGradient (...)
| Calculate the gradient vector by means of a 1st derivatives of Gaussian filter.
template<... >
void | gaussianGradientMagnitude (...)
| Calculate the gradient magnitude by means of a 1st derivatives of Gaussian filter.
template<... >
void | gaussianGradientMultiArray (...)
| Calculate Gaussian gradient of a multi-dimensional arrays.
template<... >
void | gaussianSharpening (...)
| Perform sharpening function with gaussian filter.
template<... >
void | gaussianSmoothing (...)
| Perform isotropic Gaussian convolution.
template<... >
void | gaussianSmoothMultiArray (...)
| Isotropic Gaussian smoothing of a multi-dimensional arrays.
template<typename IntType >
IntType | gcd (IntType n, IntType m)
template<... >
unsigned int | generateSlicSeeds (...)
| Generate seeds for SLIC superpixel computation in arbitrary dimensions.
template<... >
unsigned int | generateWatershedSeeds (...)
| Generate seeds for watershed computation and seeded region growing.
template<unsigned int TARGET_INDEX, class Handle >
CoupledHandleCast< TARGET_INDEX, Handle >::reference | get (Handle &handle)
template<unsigned int TARGET_INDEX, class Handle >
CoupledHandleCast< TARGET_INDEX, Handle >::const_reference | get (Handle const &handle)
template<... >
void | getAnisotropy (...)
| Sets up directional data for anisotropic regularization.
template<... >
void | gradientBasedTransform (...)
| Calculate a function of the image gradient.
template<... >
void | gradientEnergyTensor (...)
| Calculate the gradient energy tensor for a scalar valued image.
template<class GRAPH , class NODE_FEATURES_IN , class EDGE_INDICATOR , class NODE_FEATURES_OUT >
void | graphSmoothing (const GRAPH &g, const NODE_FEATURES_IN &nodeFeaturesIn, const EDGE_INDICATOR &edgeIndicator, const float lambda, const float edgeThreshold, const float scale, NODE_FEATURES_OUT &nodeFeaturesOut)
| smooth node features of a graph
template<class T1 , class T2 >
bool | greaterEqualAtTolerance (T1 l, T2 r, typename PromoteTraits< T1, T2 >::Promote epsilon)
| Tolerance based floating-point greater-or-equal.
template<... >
void | hessianMatrixOfGaussian (...)
| Filter image with the 2nd derivatives of the Gaussian at the given scale to get the Hessian matrix.
template<... >
void | hessianOfGaussianMultiArray (...)
| Calculate Hessian matrix of a N-dimensional arrays using Gaussian derivative filters.
template<... >
void | hierarchicalClustering (...)
| Reduce the number of nodes in a graph by iteratively contracting the cheapest edge.
template<... >
void | hourGlassFilter (...)
| Anisotropic tensor smoothing with the hourglass filter.
template<int IntBits, FPOverflowHandling OverflowHandling>
FixedPoint16< IntBits, OverflowHandling > | hypot (FixedPoint16< IntBits, OverflowHandling > v1, FixedPoint16< IntBits, OverflowHandling > v2)
| Length of hypotenuse.
template<class R >
R | imag (const FFTWComplex< R > &a)
| imaginary part
std::string | impexListExtensions ()
| List the file extension VIGRA understands.
std::string | impexListFormats ()
| List the image formats VIGRA can read and write.
template<... >
void | importImage (...)
| Read an image from a file.
template<... >
void | importImageAlpha (...)
| Read the image specified by the given vigra::ImageImportInfo object including its alpha channel.
template<... >
void | importTiffImage (...)
| Read a given TIFF image.
template<... >
void | importVolume (...)
| Function for importing a 3D volume.
template<class Iterator , class IndexIterator , class Compare >
void | indexSort (Iterator first, Iterator last, IndexIterator index_first, Compare c)
| Return the index permutation that would sort the input array.
template<... >
void | initImage (...)
| Write a value to every pixel in an image or rectangular ROI.
template<... >
void | initImageBorder (...)
| Write value to the specified border pixels in the image.
template<... >
void | initImageIf (...)
| Write value to pixel in the image if mask is true.
template<... >
void | initImageWithFunctor (...)
| Write the result of a functor call to every pixel in an image or rectangular ROI.
template<... >
void | initMultiArray (...)
| Write a value to every element in a multi-dimensional array.
template<... >
void | initMultiArrayBorder (...)
| Write values to the specified border values in the array.
template<... >
void | inspectImage (...)
| Apply read-only functor to every pixel in the image.
template<... >
void | inspectImageIf (...)
| Apply read-only functor to every pixel in the ROI.
template<... >
void | inspectMultiArray (...)
| Call an analyzing functor at every element of a multi-dimensional array.
template<... >
void | inspectSequence (...)
| Call an analyzing functor at every element of a sequence.
template<... >
void | inspectTwoImages (...)
| Apply read-only functor to every pixel of both images.
template<... >
void | inspectTwoImagesIf (...)
| Apply read-only functor to those pixels of both images where the mask image is non-zero.
template<... >
void | inspectTwoMultiArrays (...)
| Call an analyzing functor at all corresponding elements of two multi-dimensional arrays.
template<class InIterator , class OutIterator >
void | inversePermutation (InIterator first, InIterator last, OutIterator out)
| Compute the inverse of a given permutation.
AtImageBorder | isAtImageBorder (int x, int y, int width, int height)
| Find out whether a point is at the image border.
AtVolumeBorder | isAtVolumeBorder (int x, int y, int z, int width, int height, int depth)
| Find out whether a voxel is at the volume border.
AtVolumeBorder | isAtVolumeBorderAntiCausal (int x, int y, int z, int width, int height, int depth)
| Find out whether a voxel is at a scan-order relevant volume border. This function checks if x == 0 or y == 0 or z == 0 and returns the appropriate value of vigra::AtVolumeBorder, or zero when the voxel is not at te volume border. The behavior of the function is undefined if (x,y,z) is not inside the volume.
AtVolumeBorder | isAtVolumeBorderCausal (int x, int y, int z, int width, int height, int)
| Find out whether a voxel is at a scan-order relevant volume border. This function checks if x == 0 or y == 0 or z == 0 and returns the appropriate value of vigra::AtVolumeBorder, or zero when the voxel is not at te volume border. The behavior of the function is undefined if (x,y,z) is not inside the volume.
bool | isHDF5 (char const *filename)
| Check if given filename refers to a HDF5 file.
bool | isImage (char const *filename)
| Test whether a file is an image format known to VIGRA.
bool | isPower2 (UInt32 x)
| Determine whether x is a power of 2 Bit twiddle from https://graphics.stanford.edu/~seander/bithacks.html#DetermineIfPowerOf2.
template<class V >
TinyVector< float, 3 > | lab2Polar (V const &lab)
| Create polar representation form L*a*b*.
template<... >
unsigned int | labelImage (...)
| Find the connected components of a segmented image.
template<... >
unsigned int | labelImageWithBackground (...)
| Find the connected components of a segmented image, excluding the background from labeling.
template<... >
unsigned int | labelMultiArray (...)
| Find the connected components of a MultiArray with arbitrary many dimensions.
template<... >
unsigned int | labelMultiArrayBlockwise (...)
| Connected components labeling for MultiArrays and ChunkedArrays.
template<... >
unsigned int | labelMultiArrayWithBackground (...)
| Find the connected components of a MultiArray with arbitrary many dimensions, excluding the background from labeling.
template<... >
unsigned int | labelVolume (...)
| Find the connected components of a segmented volume.
template<class SrcIterator , class SrcAccessor , class SrcShape , class DestIterator , class DestAccessor >
unsigned int | labelVolumeSix (triple< SrcIterator, SrcShape, SrcAccessor > src, pair< DestIterator, DestAccessor > dest)
| Find the connected components of a segmented volume using the 6-neighborhood.
template<... >
unsigned int | labelVolumeWithBackground (...)
| Find the connected components of a segmented volume, excluding the background from labeling.
template<... >
void | laplacianOfGaussian (...)
| Filter image with the Laplacian of Gaussian operator at the given scale.
template<... >
void | laplacianOfGaussianMultiArray (...)
| Calculate Laplacian of a N-dimensional arrays using Gaussian derivative filters.
template<typename IntType >
IntType | lcm (IntType n, IntType m)
template<class REAL >
REAL | legendre (unsigned int l, int m, REAL x)
| Associated Legendre polynomial.
template<class REAL >
REAL | legendre (unsigned int l, REAL x)
| Legendre polynomial.
template<class T1 , class T2 >
bool | lessEqualAtTolerance (T1 l, T2 r, typename PromoteTraits< T1, T2 >::Promote epsilon)
| Tolerance based floating-point less-or-equal.
template<class Multiplier , class DestValueType >
LinearIntensityTransform< DestValueType, Multiplier > | linearIntensityTransform (Multiplier scale, DestValueType offset)
| Apply a linear transform to the source pixel values.
template<... >
bool | linearNoiseNormalization (...)
| Noise normalization by means of an estimated or given linear noise model.
template<class SrcValueType , class DestValueType >
LinearIntensityTransform< DestValueType, typename NumericTraits< DestValueType >::RealPromote > | linearRangeMapping (SrcValueType src_min, SrcValueType src_max, DestValueType dest_min, DestValueType dest_max)
| Map a source intensity range linearly to a destination range.
template<class Iterator , class Value >
void | linearSequence (Iterator first, Iterator last, Value start, Value step)
| Fill an array with a sequence of numbers.
template<... >
void | localMaxima (...)
| Find local maxima in an image or multi-dimensional array.
template<... >
void | localMaxima3D (...)
| Find local maxima in a 3D multi array.
template<... >
void | localMinima (...)
| Find local minima in an image or multi-dimensional array.
template<... >
void | localMinima3D (...)
| Find local minima in a 3D multi array.
Int32 | log2i (UInt32 x)
| Compute the base-2 logarithm of an integer.
double | loggamma (double x)
| The natural logarithm of the gamma function.
template<class V >
TinyVector< float, 3 > | luv2Polar (V const &luv)
| Create polar representation form L*u*v*.
template<class T >
BasicImageView< T > | makeBasicImageView (MultiArray< 3, T > const &array)
template<class T , class Stride >
BasicImageView< T > | makeBasicImageView (MultiArrayView< 2, T, Stride > const &array)
template<class ArrayLike , class Compare >
detail::IndexCompare< ArrayLike, Compare > | makeIndexComparator (ArrayLike a, Compare c)
| Create a compare functor for indirect sort.
template<class GRAPH_IN , class GRAPH_IN_NODE_LABEL_MAP >
void | makeRegionAdjacencyGraph (GRAPH_IN graphIn, GRAPH_IN_NODE_LABEL_MAP labels, AdjacencyListGraph &rag, typename AdjacencyListGraph::template EdgeMap< std::vector< typename GRAPH_IN::Edge > > &affiliatedEdges, const Int64 ignoreLabel=-1)
| make a region adjacency graph from a graph and labels w.r.t. that graph
template<class T , class Stride >
BasicImageView< RGBValue< T > > | makeRGBImageView (MultiArrayView< 3, T, Stride > const &array)
template<class V , int SIZE, class D1 , class D2 >
V const & | max (TinyVectorBase< V, SIZE, D1, D2 > const &l)
| maximum element
template<class V1 , int SIZE, class D1 , class D2 , class V2 , class D3 , class D4 >
TinyVector< typename PromoteTraits< V1, V2 >::Promote, SIZE > | max (TinyVectorBase< V1, SIZE, D1, D2 > const &l, TinyVectorBase< V2, SIZE, D3, D4 > const &r)
| element-wise maximum
template<... >
void | medianFilter (...)
| This function calculates the median of a window of given size for the complete image.
triple< Diff2D, Diff2D, MeshGridAccessor > | meshGrid (Diff2D upperLeft, Diff2D lowerRight)
template<class V , int SIZE, class D1 , class D2 >
V const & | min (TinyVectorBase< V, SIZE, D1, D2 > const &l)
| minimum element
template<class V1 , int SIZE, class D1 , class D2 , class V2 , class D3 , class D4 >
TinyVector< typename PromoteTraits< V1, V2 >::Promote, SIZE > | min (TinyVectorBase< V1, SIZE, D1, D2 > const &l, TinyVectorBase< V2, SIZE, D3, D4 > const &r)
| element-wise minimum
template<... >
void | moveDCToCenter (...)
| Rearrange the quadrants of a Fourier image so that the origin is in the image center.
template<... >
void | moveDCToUpperLeft (...)
| Rearrange the quadrants of a Fourier image so that the origin is in the image's upper left.
template<class Vector >
double | mtfFitGaussian (Vector const &mtf)
| Fit a Gaussian function to a given MTF.
template<int IntBits1, FPOverflowHandling OverflowHandling, int IntBits2, int IntBits3>
FixedPoint16< IntBits3, OverflowHandling > & | mul (FixedPoint16< IntBits1, OverflowHandling > l, FixedPoint16< IntBits2, OverflowHandling > r, FixedPoint16< IntBits3, OverflowHandling > &result)
| multiplication with enforced result type.
template<unsigned IntBits1, unsigned FracBits1, unsigned IntBits2, unsigned FracBits2, unsigned IntBits3, unsigned FracBits3>
void | mul (FixedPoint< IntBits1, FracBits1 > l, FixedPoint< IntBits2, FracBits2 > r, FixedPoint< IntBits3, FracBits3 > &result)
| multiplication with enforced result type.
template<... >
void | multiBinaryDilation (...)
| Binary dilation on multi-dimensional arrays.
template<... >
void | multiBinaryErosion (...)
| Binary erosion on multi-dimensional arrays.
template<... >
void | multiGrayscaleDilation (...)
| Parabolic grayscale dilation on multi-dimensional arrays.
template<... >
void | multiGrayscaleErosion (...)
| Parabolic grayscale erosion on multi-dimensional arrays.
template<... >
void | noiseVarianceClustering (...)
| Determine the noise variance as a function of the image intensity and cluster the results.
template<... >
void | noiseVarianceEstimation (...)
| Determine the noise variance as a function of the image intensity.
double | noncentralChi2 (unsigned int degreesOfFreedom, double noncentrality, double arg, double accuracy=1e-7)
| Non-central chi square distribution.
double | noncentralChi2CDF (unsigned int degreesOfFreedom, double noncentrality, double arg, double accuracy=1e-7)
| Cumulative non-central chi square distribution.
double | noncentralChi2CDFApprox (unsigned int degreesOfFreedom, double noncentrality, double arg)
| Cumulative non-central chi square distribution (approximate).
template<... >
void | nonlinearDiffusion (...)
| Perform edge-preserving smoothing at the given scale.
template<... >
void | nonlinearDiffusionExplicit (...)
| Perform edge-preserving smoothing at the given scale using an explicit scheme.
template<... >
void | nonlinearLeastSquares (...)
| Fit a non-linear model to given data by minimizing least squares loss.
template<... >
bool | nonparametricNoiseNormalization (...)
| Noise normalization by means of an estimated non-parametric noise model.
template<class R >
FFTWComplex< R >::NormType | norm (const FFTWComplex< R > &a)
| norm (= magnitude)
template<typename IntType >
Rational< IntType > | norm (const Rational< IntType > &r)
| norm (same as `abs(r)`)
template<int IntBits, FPOverflowHandling OverflowHandling>
NormTraits< FixedPoint16< IntBits, OverflowHandling > >::NormType | norm (FixedPoint16< IntBits, OverflowHandling > const &v)
| norm (same as abs).
template<unsigned IntBits, unsigned FracBits>
FixedPoint< IntBits, FracBits > | norm (FixedPoint< IntBits, FracBits > const &v)
| norm (same as abs).
template<class T >
NormTraits< T >::NormType | norm (T const &t)
| The norm of a numerical object.
template<... >
void | normalizedConvolveImage (...)
| Performs a 2-dimensional normalized convolution, i.e. convolution with a mask image.
template<... >
void | normalizedCrossCorrelation (...)
| This function performes a (slow) normalized cross-correlation.
std::string | normalizeString (std::string const &s)
bool | odd (int t)
| Check if an integer is odd.
template<typename IntType1 , typename IntType2 >
bool | operator!= (const Rational< IntType1 > &l, IntType2 const &i)
| inequality with right-hand `IntType2` argument
template<class R >
bool | operator!= (double a, const FFTWComplex< R > &b)
| not equal
template<class R >
bool | operator!= (FFTWComplex< R > const &a, const FFTWComplex< R > &b)
| not equal
template<class R >
bool | operator!= (FFTWComplex< R > const &a, double b)
| not equal
template<int IntBits1, FPOverflowHandling OverflowHandling, int IntBits2>
bool | operator!= (FixedPoint16< IntBits1, OverflowHandling > l, FixedPoint16< IntBits2, OverflowHandling > r)
| not equal
template<unsigned IntBits1, unsigned FracBits1, unsigned IntBits2, unsigned FracBits2>
bool | operator!= (FixedPoint< IntBits1, FracBits1 > l, FixedPoint< IntBits2, FracBits2 > r)
| not equal
template<typename IntType1 , typename IntType2 >
bool | operator!= (IntType1 const &l, Rational< IntType2 > const &r)
| inequality with left-hand `IntType1` argument
template<typename IntType1 , typename IntType2 >
bool | operator!= (Rational< IntType1 > const &l, Rational< IntType2 > const &r)
| inequality
template<class V1 , unsigned int RIDX1, unsigned int GIDX1, unsigned int BIDX1, class V2 , unsigned int RIDX2, unsigned int GIDX2, unsigned int BIDX2>
bool | operator!= (RGBValue< V1, RIDX1, GIDX1, BIDX1 > const &l, RGBValue< V2, RIDX2, GIDX2, BIDX2 > const &r)
| component-wise not equal
template<class V1 , int SIZE, class D1 , class D2 , class V2 , class D3 , class D4 >
bool | operator!= (TinyVectorBase< V1, SIZE, D1, D2 > const &l, TinyVectorBase< V2, SIZE, D3, D4 > const &r)
| component-wise not equal
template<class V1 , int SIZE, class D1 , class D2 , class V2 , class D3 , class D4 >
PromoteTraits< TinyVector< V1, SIZE >, TinyVector< V2, SIZE > >::Promote | operator% (TinyVectorBase< V1, SIZE, D1, D2 > const &l, TinyVectorBase< V2, SIZE, D3, D4 > const &r)
| component-wise modulo
template<typename Type >
Quaternion< Type > | operator* (const Quaternion< Type > &t1, const Quaternion< Type > &t2)
| Multiplication.
template<typename Type >
Quaternion< Type > | operator* (const Quaternion< Type > &t1, double t2)
| Multiplication with a scalar on the right.
template<class R >
FFTWComplex< R > | operator* (double a, FFTWComplex< R > b)
| left multiplication with scalar double
template<typename Type >
Quaternion< Type > | operator* (double t1, const Quaternion< Type > &t2)
| Multiplication with a scalar on the left.
template<class V , unsigned int R, unsigned int G, unsigned int B>
NumericTraits< RGBValue< V, R, G, B > >::RealPromote | operator* (double v, RGBValue< V, R, G, B > const &r)
| component-wise left scalar multiplication
template<class V , int SIZE, class D1 , class D2 >
NumericTraits< TinyVector< V, SIZE > >::RealPromote | operator* (double v, TinyVectorBase< V, SIZE, D1, D2 > const &r)
| component-wise left scalar multiplication
template<class R >
FFTWComplex< R > | operator* (FFTWComplex< R > a, const FFTWComplex< R > &b)
| multiplication
template<class R >
FFTWComplex< R > | operator* (FFTWComplex< R > a, double b)
| right multiplication with scalar double
template<int IntBits1, FPOverflowHandling OverflowHandling, int IntBits2>
PromoteTraits< FixedPoint16< IntBits1, OverflowHandling >, FixedPoint16< IntBits2, OverflowHandling > >::Promote | operator* (FixedPoint16< IntBits1, OverflowHandling > l, FixedPoint16< IntBits2, OverflowHandling > r)
| multiplication with automatic determination of the appropriate result type.
template<unsigned IntBits1, unsigned FracBits1, unsigned IntBits2, unsigned FracBits2>
FixedPointTraits< FixedPoint< IntBits1, FracBits1 >, FixedPoint< IntBits2, FracBits2 > >::MultipliesType | operator* (FixedPoint< IntBits1, FracBits1 > l, FixedPoint< IntBits2, FracBits2 > r)
| multiplication with automatic determination of the appropriate result type.
template<typename IntType >
Rational< IntType > | operator* (Rational< IntType > l, Rational< IntType > const &r)
| multiplication
template<typename IntType >
Rational< IntType > | operator* (Rational< IntType > l, typename Rational< IntType >::param_type r)
| multiplication with right-hand `IntType` argument
template<class V , unsigned int R, unsigned int G, unsigned int B>
NumericTraits< RGBValue< V, R, G, B > >::RealPromote | operator* (RGBValue< V, R, G, B > const &r, double v)
| component-wise right scalar multiplication
template<class V1 , unsigned int R, unsigned int G, unsigned int B, class V2 >
PromoteTraits< RGBValue< V1, R, G, B >, RGBValue< V2, R, G, B > >::Promote | operator* (RGBValue< V1, R, G, B > const &r1, RGBValue< V2, R, G, B > const &r2)
| component-wise multiplication
template<class V , int SIZE, class D1 , class D2 >
NumericTraits< TinyVector< V, SIZE > >::RealPromote | operator* (TinyVectorBase< V, SIZE, D1, D2 > const &l, double v)
| component-wise right scalar multiplication
template<class V1 , int SIZE, class D1 , class D2 , class V2 , class D3 , class D4 >
PromoteTraits< TinyVector< V1, SIZE >, TinyVector< V2, SIZE > >::Promote | operator* (TinyVectorBase< V1, SIZE, D1, D2 > const &l, TinyVectorBase< V2, SIZE, D3, D4 > const &r)
| component-wise multiplication
template<typename IntType >
Rational< IntType > | operator* (typename Rational< IntType >::param_type l, Rational< IntType > r)
| multiplication with left-hand `IntType` argument
template<class R >
FFTWComplex< R > & | operator*= (FFTWComplex< R > &a, const FFTWComplex< R > &b)
| multiply-assignment
template<class R >
FFTWComplex< R > & | operator*= (FFTWComplex< R > &a, double b)
| multiply-assignment with scalar double
template<class V , unsigned int RIDX, unsigned int GIDX, unsigned int BIDX>
RGBValue< V, RIDX, GIDX, BIDX > & | operator*= (RGBValue< V, RIDX, GIDX, BIDX > &l, double r)
| componentwise scalar multiply-assignment
template<class V1 , unsigned int RIDX1, unsigned int GIDX1, unsigned int BIDX1, class V2 , unsigned int RIDX2, unsigned int GIDX2, unsigned int BIDX2>
RGBValue< V1, RIDX1, GIDX1, BIDX1 > & | operator*= (RGBValue< V1, RIDX1, GIDX1, BIDX1 > &l, RGBValue< V2, RIDX2, GIDX2, BIDX2 > const &r)
| componentwise multiply-assignment
template<typename Type >
Quaternion< Type > | operator+ (const Quaternion< Type > &t1, const Quaternion< Type > &t2)
| Addition.
template<typename Type >
Quaternion< Type > | operator+ (const Quaternion< Type > &t1, const Type &t2)
| Addition of a scalar on the right.
template<typename IntType >
Rational< IntType > | operator+ (const Rational< IntType > &r)
| unary plus
template<typename Type >
Quaternion< Type > | operator+ (const Type &t1, const Quaternion< Type > &t2)
| Addition of a scalar on the left.
Diff2D | operator+ (Diff2D const &a, Diff2D const &b)
template<class R >
FFTWComplex< R > | operator+ (double a, FFTWComplex< R > b)
| left addition with scalar double
template<class V , int SIZE, class D1 , class D2 >
NumericTraits< TinyVector< V, SIZE > >::RealPromote | operator+ (double v, TinyVectorBase< V, SIZE, D1, D2 > const &r)
| component-wise left scalar addition
template<class R >
FFTWComplex< R > | operator+ (FFTWComplex< R > a, const FFTWComplex< R > &b)
| addition
template<class R >
FFTWComplex< R > | operator+ (FFTWComplex< R > a, double b)
| right addition with scalar double
template<int IntBits1, FPOverflowHandling OverflowHandling, int IntBits2>
PromoteTraits< FixedPoint16< IntBits1, OverflowHandling >, FixedPoint16< IntBits2, OverflowHandling > >::Promote | operator+ (FixedPoint16< IntBits1, OverflowHandling > l, FixedPoint16< IntBits2, OverflowHandling > r)
| addition with automatic determination of the appropriate result type.
template<unsigned IntBits1, unsigned FracBits1, unsigned IntBits2, unsigned FracBits2>
FixedPointTraits< FixedPoint< IntBits1, FracBits1 >, FixedPoint< IntBits2, FracBits2 > >::PlusType | operator+ (FixedPoint< IntBits1, FracBits1 > l, FixedPoint< IntBits2, FracBits2 > r)
| addition with automatic determination of the appropriate result type.
Point2D | operator+ (Point2D const &a, Diff2D const &b)
template<typename IntType >
Rational< IntType > | operator+ (Rational< IntType > l, Rational< IntType > const &r)
| addition
template<typename IntType >
Rational< IntType > | operator+ (Rational< IntType > l, typename Rational< IntType >::param_type r)
| addition of right-hand `IntType` argument
template<class V1 , unsigned int R, unsigned int G, unsigned int B, class V2 >
PromoteTraits< RGBValue< V1, R, G, B >, RGBValue< V2, R, G, B > >::Promote | operator+ (RGBValue< V1, R, G, B > const &r1, RGBValue< V2, R, G, B > const &r2)
| component-wise addition
Size2D | operator+ (Size2D const &a, Diff2D const &b)
Point2D | operator+ (Size2D const &s, Point2D const &p)
template<class V , int SIZE, class D1 , class D2 >
NumericTraits< TinyVector< V, SIZE > >::RealPromote | operator+ (TinyVectorBase< V, SIZE, D1, D2 > const &l, double v)
| component-wise right scalar addition
template<class V1 , int SIZE, class D1 , class D2 , class V2 , class D3 , class D4 >
PromoteTraits< TinyVector< V1, SIZE >, TinyVector< V2, SIZE > >::Promote | operator+ (TinyVectorBase< V1, SIZE, D1, D2 > const &l, TinyVectorBase< V2, SIZE, D3, D4 > const &r)
| component-wise addition
template<typename IntType >
Rational< IntType > | operator+ (typename Rational< IntType >::param_type l, Rational< IntType > r)
| addition of left-hand `IntType` argument
template<class R >
FFTWComplex< R > & | operator+= (FFTWComplex< R > &a, const FFTWComplex< R > &b)
| add-assignment
template<class R >
FFTWComplex< R > & | operator+= (FFTWComplex< R > &a, double b)
| add-assignment with scalar double
template<class V1 , unsigned int RIDX1, unsigned int GIDX1, unsigned int BIDX1, class V2 , unsigned int RIDX2, unsigned int GIDX2, unsigned int BIDX2>
RGBValue< V1, RIDX1, GIDX1, BIDX1 > & | operator+= (RGBValue< V1, RIDX1, GIDX1, BIDX1 > &l, RGBValue< V2, RIDX2, GIDX2, BIDX2 > const &r)
| componentwise add-assignment
template<typename Type >
Quaternion< Type > | operator- (const Quaternion< Type > &t1, const Quaternion< Type > &t2)
| Subtraction.
template<typename Type >
Quaternion< Type > | operator- (const Quaternion< Type > &t1, const Type &t2)
| Subtraction of a scalar on the right.
template<typename IntType >
Rational< IntType > | operator- (const Rational< IntType > &r)
| unary minus (negation)
template<typename Type >
Quaternion< Type > | operator- (const Type &t1, const Quaternion< Type > &t2)
| Subtraction of a scalar on the left.
Diff2D | operator- (Diff2D const &a, Diff2D const &b)
template<class R >
FFTWComplex< R > | operator- (double a, FFTWComplex< R > const &b)
| left subtraction with scalar double
template<class V , int SIZE, class D1 , class D2 >
NumericTraits< TinyVector< V, SIZE > >::RealPromote | operator- (double v, TinyVectorBase< V, SIZE, D1, D2 > const &r)
| component-wise left scalar subtraction
template<class R >
FFTWComplex< R > | operator- (FFTWComplex< R > a, const FFTWComplex< R > &b)
| subtraction
template<class R >
FFTWComplex< R > | operator- (FFTWComplex< R > a, double b)
| right subtraction with scalar double
template<int IntBits1, FPOverflowHandling OverflowHandling, int IntBits2>
PromoteTraits< FixedPoint16< IntBits1, OverflowHandling >, FixedPoint16< IntBits2, OverflowHandling > >::Promote | operator- (FixedPoint16< IntBits1, OverflowHandling > l, FixedPoint16< IntBits2, OverflowHandling > r)
| subtraction with automatic determination of the appropriate result type.
template<unsigned IntBits1, unsigned FracBits1, unsigned IntBits2, unsigned FracBits2>
FixedPointTraits< FixedPoint< IntBits1, FracBits1 >, FixedPoint< IntBits2, FracBits2 > >::MinusType | operator- (FixedPoint< IntBits1, FracBits1 > l, FixedPoint< IntBits2, FracBits2 > r)
| subtraction with automatic determination of the appropriate result type.
Point2D | operator- (Point2D const &s, Diff2D const &offset)
Size2D | operator- (Point2D const &s, Point2D const &p)
template<typename IntType >
Rational< IntType > | operator- (Rational< IntType > l, Rational< IntType > const &r)
| subtraction
template<typename IntType >
Rational< IntType > | operator- (Rational< IntType > l, typename Rational< IntType >::param_type r)
| subtraction of right-hand `IntType` argument
template<class V1 , unsigned int R, unsigned int G, unsigned int B, class V2 >
PromoteTraits< RGBValue< V1, R, G, B >, RGBValue< V2, R, G, B > >::Promote | operator- (RGBValue< V1, R, G, B > const &r1, RGBValue< V2, R, G, B > const &r2)
| component-wise subtraction
Size2D | operator- (Size2D const &s, Diff2D const &offset)
template<class V , int SIZE, class D1 , class D2 >
NumericTraits< TinyVector< V, SIZE > >::RealPromote | operator- (TinyVectorBase< V, SIZE, D1, D2 > const &l, double v)
| component-wise right scalar subtraction
template<class V , int SIZE, class D1 , class D2 >
TinyVector< V, SIZE > | operator- (TinyVectorBase< V, SIZE, D1, D2 > const &v)
template<class V1 , int SIZE, class D1 , class D2 , class V2 , class D3 , class D4 >
PromoteTraits< TinyVector< V1, SIZE >, TinyVector< V2, SIZE > >::Promote | operator- (TinyVectorBase< V1, SIZE, D1, D2 > const &l, TinyVectorBase< V2, SIZE, D3, D4 > const &r)
| component-wise subtraction
template<typename IntType >
Rational< IntType > | operator- (typename Rational< IntType >::param_type l, Rational< IntType > const &r)
| subtraction from left-hand `IntType` argument
template<class R >
FFTWComplex< R > & | operator-= (FFTWComplex< R > &a, const FFTWComplex< R > &b)
| subtract-assignment
template<class R >
FFTWComplex< R > & | operator-= (FFTWComplex< R > &a, double b)
| subtract-assignment with scalar double
template<class V1 , unsigned int RIDX1, unsigned int GIDX1, unsigned int BIDX1, class V2 , unsigned int RIDX2, unsigned int GIDX2, unsigned int BIDX2>
RGBValue< V1, RIDX1, GIDX1, BIDX1 > & | operator-= (RGBValue< V1, RIDX1, GIDX1, BIDX1 > &l, RGBValue< V2, RIDX2, GIDX2, BIDX2 > const &r)
| componentwise subtract-assignment
template<typename Type >
Quaternion< Type > | operator/ (const Quaternion< Type > &t1, const Quaternion< Type > &t2)
| Division.
template<typename Type >
Quaternion< Type > | operator/ (const Quaternion< Type > &t1, double t2)
| Division by a scalar.
template<typename Type >
Quaternion< Type > | operator/ (double t1, const Quaternion< Type > &t2)
| Division of a scalar by a Quaternion.
template<class V , int SIZE, class D1 , class D2 >
NumericTraits< TinyVector< V, SIZE > >::RealPromote | operator/ (double v, TinyVectorBase< V, SIZE, D1, D2 > const &r)
| component-wise left scalar division
template<class R >
FFTWComplex< R > | operator/ (FFTWComplex< R > a, const FFTWComplex< R > &b)
| division
template<class R >
FFTWComplex< R > | operator/ (FFTWComplex< R > a, double b)
| right division with scalar double
template<int IntBits1, FPOverflowHandling OverflowHandling, int IntBits2>
PromoteTraits< FixedPoint16< IntBits1, OverflowHandling >, FixedPoint16< IntBits2, OverflowHandling > >::Promote | operator/ (FixedPoint16< IntBits1, OverflowHandling > l, FixedPoint16< IntBits2, OverflowHandling > r)
| division with automatic determination of the appropriate result type.
template<typename IntType >
Rational< IntType > | operator/ (Rational< IntType > l, Rational< IntType > const &r)
| division
template<typename IntType >
Rational< IntType > | operator/ (Rational< IntType > l, typename Rational< IntType >::param_type r)
| division by right-hand `IntType` argument
template<class V , unsigned int R, unsigned int G, unsigned int B>
NumericTraits< RGBValue< V, R, G, B > >::RealPromote | operator/ (RGBValue< V, R, G, B > const &r, double v)
| component-wise scalar division
template<class V1 , unsigned int R, unsigned int G, unsigned int B, class V2 >
PromoteTraits< RGBValue< V1, R, G, B >, RGBValue< V2, R, G, B > >::Promote | operator/ (RGBValue< V1, R, G, B > const &r1, RGBValue< V2, R, G, B > const &r2)
| component-wise division
template<class V , int SIZE, class D1 , class D2 >
NumericTraits< TinyVector< V, SIZE > >::RealPromote | operator/ (TinyVectorBase< V, SIZE, D1, D2 > const &l, double v)
| component-wise right scalar division
template<class V1 , int SIZE, class D1 , class D2 , class V2 , class D3 , class D4 >
PromoteTraits< TinyVector< V1, SIZE >, TinyVector< V2, SIZE > >::Promote | operator/ (TinyVectorBase< V1, SIZE, D1, D2 > const &l, TinyVectorBase< V2, SIZE, D3, D4 > const &r)
| component-wise division
template<typename IntType >
Rational< IntType > | operator/ (typename Rational< IntType >::param_type l, Rational< IntType > const &r)
| division of left-hand `IntType` argument
template<class R >
FFTWComplex< R > & | operator/= (FFTWComplex< R > &a, const FFTWComplex< R > &b)
| divide-assignment
template<class R >
FFTWComplex< R > & | operator/= (FFTWComplex< R > &a, double b)
| divide-assignment with scalar double
template<class V , unsigned int RIDX, unsigned int GIDX, unsigned int BIDX>
RGBValue< V, RIDX, GIDX, BIDX > & | operator/= (RGBValue< V, RIDX, GIDX, BIDX > &l, double r)
| componentwise scalar divide-assignment
template<class V1 , unsigned int RIDX1, unsigned int GIDX1, unsigned int BIDX1, class V2 , unsigned int RIDX2, unsigned int GIDX2, unsigned int BIDX2>
RGBValue< V1, RIDX1, GIDX1, BIDX1 > & | operator/= (RGBValue< V1, RIDX1, GIDX1, BIDX1 > &l, RGBValue< V2, RIDX2, GIDX2, BIDX2 > const &r)
| componentwise divide-assignment
template<typename IntType1 , typename IntType2 >
bool | operator< (const Rational< IntType1 > &l, const Rational< IntType2 > &r)
| less-than
template<typename IntType1 , typename IntType2 >
bool | operator< (const Rational< IntType1 > &l, IntType2 const &i)
| less-than with right-hand `IntType2` argument
template<int IntBits1, FPOverflowHandling OverflowHandling, int IntBits2>
bool | operator< (FixedPoint16< IntBits1, OverflowHandling > l, FixedPoint16< IntBits2, OverflowHandling > r)
| less than
template<unsigned IntBits1, unsigned FracBits1, unsigned IntBits2, unsigned FracBits2>
bool | operator< (FixedPoint< IntBits1, FracBits1 > l, FixedPoint< IntBits2, FracBits2 > r)
| less than
template<typename IntType1 , typename IntType2 >
bool | operator< (IntType1 const &l, Rational< IntType2 > const &r)
| less-than with left-hand `IntType1` argument
template<class V1 , int SIZE, class D1 , class D2 , class V2 , class D3 , class D4 >
bool | operator< (TinyVectorBase< V1, SIZE, D1, D2 > const &l, TinyVectorBase< V2, SIZE, D3, D4 > const &r)
| lexicographical comparison
std::ostream & | operator<< (std::ostream &os, const SIFImportInfo &info)
template<class V1 , int SIZE, class DATA , class DERIVED >
std::ostream & | operator<< (std::ostream &out, TinyVectorBase< V1, SIZE, DATA, DERIVED > const &l)
| stream output
template<int IntBits1, FPOverflowHandling OverflowHandling, int IntBits2>
bool | operator<= (FixedPoint16< IntBits1, OverflowHandling > l, FixedPoint16< IntBits2, OverflowHandling > r)
| less or equal
template<unsigned IntBits1, unsigned FracBits1, unsigned IntBits2, unsigned FracBits2>
bool | operator<= (FixedPoint< IntBits1, FracBits1 > l, FixedPoint< IntBits2, FracBits2 > r)
| less or equal
template<typename IntType1 , typename IntType2 >
bool | operator<= (IntType1 const &l, Rational< IntType2 > const &r)
| less-equal with left-hand `IntType1` argument
template<typename IntType1 , typename IntType2 >
bool | operator<= (Rational< IntType1 > const &l, IntType2 const &r)
| less-equal with right-hand `IntType2` argument
template<typename IntType1 , typename IntType2 >
bool | operator<= (Rational< IntType1 > const &l, Rational< IntType2 > const &r)
| less-equal
template<typename IntType1 , typename IntType2 >
bool | operator== (const Rational< IntType1 > &l, const Rational< IntType2 > &r)
| equality
template<typename IntType1 , typename IntType2 >
bool | operator== (const Rational< IntType1 > &l, IntType2 const &i)
| equality with right-hand `IntType2` argument
template<class R >
bool | operator== (FFTWComplex< R > const &a, const FFTWComplex< R > &b)
| equal
template<int IntBits1, FPOverflowHandling OverflowHandling, int IntBits2>
bool | operator== (FixedPoint16< IntBits1, OverflowHandling > l, FixedPoint16< IntBits2, OverflowHandling > r)
| equal
template<unsigned IntBits1, unsigned FracBits1, unsigned IntBits2, unsigned FracBits2>
bool | operator== (FixedPoint< IntBits1, FracBits1 > l, FixedPoint< IntBits2, FracBits2 > r)
| equal
template<typename IntType1 , typename IntType2 >
bool | operator== (IntType1 const &l, Rational< IntType2 > const &r)
| equality with left-hand `IntType1` argument
template<class V1 , unsigned int RIDX1, unsigned int GIDX1, unsigned int BIDX1, class V2 , unsigned int RIDX2, unsigned int GIDX2, unsigned int BIDX2>
bool | operator== (RGBValue< V1, RIDX1, GIDX1, BIDX1 > const &l, RGBValue< V2, RIDX2, GIDX2, BIDX2 > const &r)
| component-wise equal
template<class V1 , int SIZE, class D1 , class D2 , class V2 , class D3 , class D4 >
bool | operator== (TinyVectorBase< V1, SIZE, D1, D2 > const &l, TinyVectorBase< V2, SIZE, D3, D4 > const &r)
| component-wise equal
template<typename IntType1 , typename IntType2 >
bool | operator> (const Rational< IntType1 > &l, IntType2 const &i)
| greater-than with right-hand `IntType2` argument
template<int IntBits1, FPOverflowHandling OverflowHandling, int IntBits2>
bool | operator> (FixedPoint16< IntBits1, OverflowHandling > l, FixedPoint16< IntBits2, OverflowHandling > r)
| greater
template<unsigned IntBits1, unsigned FracBits1, unsigned IntBits2, unsigned FracBits2>
bool | operator> (FixedPoint< IntBits1, FracBits1 > l, FixedPoint< IntBits2, FracBits2 > r)
| greater
template<typename IntType1 , typename IntType2 >
bool | operator> (IntType1 const &l, Rational< IntType2 > const &r)
| greater-than with left-hand `IntType1` argument
template<typename IntType1 , typename IntType2 >
bool | operator> (Rational< IntType1 > const &l, Rational< IntType2 > const &r)
| greater-than
template<int IntBits1, FPOverflowHandling OverflowHandling, int IntBits2>
bool | operator>= (FixedPoint16< IntBits1, OverflowHandling > l, FixedPoint16< IntBits2, OverflowHandling > r)
| greater or equal
template<unsigned IntBits1, unsigned FracBits1, unsigned IntBits2, unsigned FracBits2>
bool | operator>= (FixedPoint< IntBits1, FracBits1 > l, FixedPoint< IntBits2, FracBits2 > r)
| greater or equal
template<typename IntType1 , typename IntType2 >
bool | operator>= (IntType1 const &l, Rational< IntType2 > const &r)
| greater-equal with left-hand `IntType1` argument
template<typename IntType1 , typename IntType2 >
bool | operator>= (Rational< IntType1 > const &l, IntType2 const &r)
| greater-equal with right-hand `IntType2` argument
template<typename IntType1 , typename IntType2 >
bool | operator>= (Rational< IntType1 > const &l, Rational< IntType2 > const &r)
| greater-equal
template<... >
void | parallel_foreach (...)
| Apply a functor to all items in a range in parallel.
template<class NODE , class PREDECESSORS >
size_t | pathLength (const NODE source, const NODE target, const PREDECESSORS &predecessors)
| get the length in node units of a path
template<... >
void | pLSA (...)
| Decompose a matrix according to the pLSA algorithm.
TinyVector< float, 3 > | polar2Lab (double color, double brightness, double saturation)
| Init L*a*b* color triple from polar representation.
TinyVector< float, 3 > | polar2Luv (double color, double brightness, double saturation)
| Init L*u*v* color triple from polar representation.
TinyVector< float, 3 > | polar2YPrimeCbCr (double color, double brightness, double saturation)
| Init Y'CbCr color triple from polar representation.
TinyVector< float, 3 > | polar2YPrimeIQ (double color, double brightness, double saturation)
| Init Y'IQ color triple from polar representation.
TinyVector< float, 3 > | polar2YPrimePbPr (double color, double brightness, double saturation)
| Init Y'PbPr color triple from polar representation.
TinyVector< float, 3 > | polar2YPrimeUV (double color, double brightness, double saturation)
| Init Y'UV color triple from polar representation.
template<int PolynomOrder, class SrcPointIterator , class DestPointIterator >
linalg::TemporaryMatrix< double > | polynomialMatrix2DFromCorrespondingPoints (SrcPointIterator s, SrcPointIterator s_end, DestPointIterator d)
| Create polynomial matrix of a certain degree that maps corresponding points onto each other.
template<class POLYNOMIAL , class VECTOR >
bool | polynomialRealRoots (POLYNOMIAL const &p, VECTOR &roots, bool polishRoots)
template<class POLYNOMIAL , class VECTOR >
bool | polynomialRoots (POLYNOMIAL const &poriginal, VECTOR &roots, bool polishRoots)
template<... >
void | polynomialWarpImage (...)
| Warp an image according to an polynomial transformation.
std::vector< double > | polynomialWarpWeights (double x, double y, unsigned int polynom_order)
template<typename IntType >
Rational< IntType > | pow (const Rational< IntType > &r, int n)
template<class V , int SIZE, class D1 , class D2 , class E >
TinyVector< V, SIZE > | pow (TinyVectorBase< V, SIZE, D1, D2 > const &v, E exponent)
template<unsigned n, class V >
V | power (const V &x)
| Exponentiation to a positive integer power by squaring.
template<class T , class C1 , class C2 , class C3 >
void | principalComponents (MultiArrayView< 2, T, C1 > const &features, MultiArrayView< 2, T, C2 > fz, MultiArrayView< 2, T, C3 > zv)
| Decompose a matrix according to the PCA algorithm.
template<class V , int SIZE, class D1 , class D2 >
NumericTraits< V >::Promote | prod (TinyVectorBase< V, SIZE, D1, D2 > const &l)
| product of the vector's elements
template<class BASE_GRAPH , class BASE_GRAPH_LABELS , class RAG_FEATURES , class BASE_GRAPH_FEATURES >
void | projectBack (const AdjacencyListGraph &rag, const BASE_GRAPH &bg, const Int64 ignoreLabel, const BASE_GRAPH_LABELS bgLabels, const RAG_FEATURES &ragFeatures, BASE_GRAPH_FEATURES &bgFeatures)
template<class RAG , class BASE_GRAPH , class BASE_GRAPH_RAG_LABELS , class BASE_GRAPH_GT , class RAG_GT , class RAG_GT_QT >
void | projectGroundTruth (const RAG &rag, const BASE_GRAPH &baseGraph, const BASE_GRAPH_RAG_LABELS &baseGraphRagLabels, const BASE_GRAPH_GT &baseGraphGt, RAG_GT &ragGt, RAG_GT_QT &)
template<class SrcPointIterator , class DestPointIterator >
linalg::TemporaryMatrix< double > | projectiveMatrix2DFromCorrespondingPoints (SrcPointIterator s, SrcPointIterator send, DestPointIterator d)
| Create homogeneous matrix that maps corresponding points onto each other.
template<... >
void | projectiveWarpImage (...)
| Warp an image according to an projective transformation.
template<... >
void | pyramidExpandBurtFilter (...)
| Two-fold up-sampling for image pyramid reconstruction.
template<class Image , class Alloc >
void | pyramidExpandBurtLaplacian (ImagePyramid< Image, Alloc > &pyramid, int fromLevel, int toLevel, double centerValue=0.4)
| Reconstruct a Laplacian pyramid.
template<... >
void | pyramidReduceBurtFilter (...)
| Two-fold down-sampling for image pyramid construction.
template<class Image , class Alloc >
void | pyramidReduceBurtLaplacian (ImagePyramid< Image, Alloc > &pyramid, int fromLevel, int toLevel, double centerValue=0.4)
| Create a Laplacian pyramid.
template<... >
bool | quadraticNoiseNormalization (...)
| Noise normalization by means of an estimated or given quadratic noise model.
template<... >
unsigned int | quadraticProgramming (...)
double | radialGaborSigma (double centerFrequency)
| Calculate sensible radial sigma for given parameters.
template<... >
void | radialSymmetryTransform (...)
| Find centers of radial symmetry in an image.
template<class RAGGRAPH , class GRAPH , class RAGEDGES , unsigned int N, class T >
MultiArray< 2, MultiArrayIndex > | ragFindEdges (const RAGGRAPH &rag, const GRAPH &graph, const RAGEDGES &affiliatedEdges, MultiArrayView< N, T > labelsArray, const typename RAGGRAPH::Node &node)
| Find indices of points on the edges.
RandomMT19937 & | randomMT19937 ()
RandomTT800 & | randomTT800 ()
template<typename T , typename IntType >
T | rational_cast (const Rational< IntType > &src)
template<class RadialBasisFunctor , class SrcPointIterator , class DestPointIterator >
linalg::TemporaryMatrix< double > | rbfMatrix2DFromCorrespondingPoints (SrcPointIterator s, SrcPointIterator s_end, DestPointIterator d, RadialBasisFunctor const &rbf)
| Create a matrix that maps corresponding points onto each other using a given RBF.
template<int ORDER, class T , class DestIterator , class DestAccessor , class DestPointIterator , class C , class RadialBasisFunctor >
void | rbfWarpImage (SplineImageView< ORDER, T > const &src, DestIterator dul, DestIterator dlr, DestAccessor dest, DestPointIterator d, DestPointIterator d_end, MultiArrayView< 2, double, C > const &W, RadialBasisFunctor rbf)
| Warp an image according to an radial basis function based transformation.
template<... >
void | readHDF5 (...)
| Read the data specified by the given vigra::HDF5ImportInfo object and write the into the given 'array'.
void | readSIF (const SIFImportInfo &info, MultiArrayView< 3, float > array)
| Read the image data specified by the given vigra::SIFImportInfo object and write them into the given 'array'.
void | readSIFBlock (const SIFImportInfo &info, Shape3 offset, Shape3 shape, MultiArrayView< 3, float > array)
| Read parts of the image data from an Andor SIF file specified with an SIFImportInfo object and write them into the MultiArray array.
template<class R >
R | real (const FFTWComplex< R > &a)
| real part
template<... >
void | recursiveFilterLine (...)
| Performs a 1-dimensional recursive convolution of the source signal.
template<... >
void | recursiveFilterX (...)
| Performs 1 dimensional recursive filtering (1st and 2nd order) in x direction.
template<... >
void | recursiveFilterY (...)
| Performs 1 dimensional recursive filtering (1st and 2nd order) in y direction.
template<... >
void | recursiveFirstDerivativeLine (...)
| Performs a 1 dimensional recursive convolution of the source signal.
template<... >
void | recursiveFirstDerivativeX (...)
| Recursively calculates the 1 dimensional first derivative in x direction.
template<... >
void | recursiveFirstDerivativeY (...)
| Recursively calculates the 1 dimensional first derivative in y direction.
template<... >
void | recursiveGaussianFilterLine (...)
| Compute a 1-dimensional recursive approximation of Gaussian smoothing.
template<... >
void | recursiveGaussianFilterX (...)
| Compute 1 dimensional recursive approximation of Gaussian smoothing in y direction.
template<... >
void | recursiveGaussianFilterY (...)
| Compute 1 dimensional recursive approximation of Gaussian smoothing in y direction.
template<class GRAPH , class NODE_FEATURES_IN , class EDGE_INDICATOR , class NODE_FEATURES_OUT >
void | recursiveGraphSmoothing (const GRAPH &g, const NODE_FEATURES_IN &nodeFeaturesIn, const EDGE_INDICATOR &edgeIndicator, const float lambda, const float edgeThreshold, const float scale, size_t iterations, NODE_FEATURES_OUT &nodeFeaturesBuffer, NODE_FEATURES_OUT &nodeFeaturesOut)
| smooth node features of a graph
template<... >
void | recursiveSecondDerivativeLine (...)
| Performs a 1 dimensional recursive convolution of the source signal.
template<... >
void | recursiveSecondDerivativeX (...)
| Recursively calculates the 1 dimensional second derivative in x direction.
template<... >
void | recursiveSecondDerivativeY (...)
| Recursively calculates the 1 dimensional second derivative in y direction.
template<... >
void | recursiveSmoothLine (...)
| Convolves the image with a 1-dimensional exponential filter.
template<... >
void | recursiveSmoothX (...)
| Performs 1 dimensional recursive smoothing in x direction.
template<... >
void | recursiveSmoothY (...)
| Performs 1 dimensional recursive smoothing in y direction.
template<... >
void | reflectImage (...)
| Reflect image horizontally or vertically.
template<... >
void | regionImageToCrackEdgeImage (...)
| Transform a labeled image into a crack edge (interpixel edge) image.
template<... >
void | regionImageToEdgeImage (...)
| Transform a labeled image into an edge image.
template<... >
void | removeShortEdges (...)
| Remove short edges from an edge image.
template<... >
void | resampleImage (...)
| Resample image by a given factor.
template<... >
void | resamplingConvolveImage (...)
| Apply two separable resampling filters successively, the first in x-direction, the second in y-direction.
template<... >
void | resamplingConvolveLine (...)
| Performs a 1-dimensional resampling convolution of the source signal using the given set of kernels.
template<... >
void | resamplingConvolveX (...)
| Apply a resampling filter in the x-direction.
template<... >
void | resamplingConvolveY (...)
| Apply a resampling filter in the y-direction.
template<... >
void | resizeImageCatmullRomInterpolation (...)
| Resize image using the Catmull/Rom interpolation function.
template<... >
void | resizeImageCoscotInterpolation (...)
| Resize image using the Coscot interpolation function.
template<... >
void | resizeImageLinearInterpolation (...)
| Resize image using linear interpolation.
template<... >
void | resizeImageNoInterpolation (...)
| Resize image by repeating the nearest pixel values.
template<... >
void | resizeImageSplineInterpolation (...)
| Resize image using B-spline interpolation.
template<... >
void | resizeMultiArraySplineInterpolation (...)
| Resize MultiArray using B-spline interpolation.
template<class V , int SIZE>
TinyVector< V, SIZE > | reverse (TinyVector< V, SIZE > const &t)
| reversed copy
detail::RF_DEFAULT & | rf_default ()
| factory function to return a RF_DEFAULT tag
template<class T , class Tag >
void | rf_export_HDF5 (const RandomForest< T, Tag > &rf, const std::string &filename, const std::string &pathname="")
| Save a random forest to a named HDF5 file into a specified HDF5 group.
template<class T , class Tag >
void | rf_export_HDF5 (const RandomForest< T, Tag > &rf, HDF5File &h5context, const std::string &pathname="")
| Save a random forest to an HDF5File object into a specified HDF5 group.
template<class T , class Tag >
void | rf_export_HDF5 (const RandomForest< T, Tag > &rf, hid_t outf_id, const std::string &pathname="")
| Save a random forest to an HDF5 file specified by its id.
template<class T , class Tag >
bool | rf_import_HDF5 (RandomForest< T, Tag > &rf, const std::string &filename, const std::string &pathname="")
| Read a random forest from a named HDF5 file's specified group.
template<class T , class Tag >
bool | rf_import_HDF5 (RandomForest< T, Tag > &rf, HDF5File &h5context, const std::string &pathname="")
| Read a random forest from an HDF5File object's specified group.
template<class T , class Tag >
bool | rf_import_HDF5 (RandomForest< T, Tag > &rf, hid_t inf_id, const std::string &pathname="")
| Read a random forest from an HDF5 file specified by its id.
template<... >
void | rieszTransformOfLOG (...)
| Calculate Riesz transforms of the Laplacian of Gaussian.
template<... >
void | rohrCornerDetector (...)
| Find corners in an image (3).
template<... >
void | rotateImage (...)
| Rotate an image by a multiple of 90 degrees or by an arbitrary angle.
linalg::TemporaryMatrix< double > | rotationMatrix2DDegrees (double angle)
| Create homogeneous matrix representing a 2D rotation about the coordinate origin.
linalg::TemporaryMatrix< double > | rotationMatrix2DDegrees (double angle, TinyVector< double, 2 > const &center)
| Create homogeneous matrix representing a 2D rotation about the given point.
linalg::TemporaryMatrix< double > | rotationMatrix2DRadians (double angle)
| Create homogeneous matrix representing a 2D rotation about the coordinate origin.
linalg::TemporaryMatrix< double > | rotationMatrix2DRadians (double angle, TinyVector< double, 2 > const &center)
| Create homogeneous matrix representing a 2D rotation about the given point.
template<int IntBits, FPOverflowHandling OverflowHandling>
Int32 | round (FixedPoint16< IntBits, OverflowHandling > v)
| rounding to the nearest integer.
template<unsigned IntBits, unsigned FracBits>
int | round (FixedPoint< IntBits, FracBits > v)
| rounding to the nearest integer.
REAL | round (REAL v)
| The rounding function.
template<class V , int SIZE, class D1 , class D2 >
TinyVector< V, SIZE > | round (TinyVectorBase< V, SIZE, D1, D2 > const &v)
long long | roundi (double t)
| Round and cast to integer.
template<int IntBits, FPOverflowHandling OverflowHandling>
Int32 | roundi (FixedPoint16< IntBits, OverflowHandling > v)
| rounding to the nearest integer.
template<class V , int SIZE, class D1 , class D2 >
TinyVector< std::ptrdiff_t, SIZE > | roundi (TinyVectorBase< V, SIZE, D1, D2 > const &v)
linalg::TemporaryMatrix< double > | scalingMatrix2D (double scalingFactor)
| Create homogeneous matrix representing a 2D uniform scaling about the coordinate origin.
linalg::TemporaryMatrix< double > | scalingMatrix2D (double sx, double sy)
| Create homogeneous matrix representing a 2D non-uniform scaling about the coordinate origin.
template<... >
void | secondOrderTotalVariationFilter (...)
| Performs Anisotropic Total Variation Regularization.
template<... >
void | seededRegionGrowing (...)
| Region Segmentation by means of Seeded Region Growing.
template<... >
void | seededRegionGrowing3D (...)
| Three-dimensional Region Segmentation by means of Seeded Region Growing.
template<... >
void | separableConvolveMultiArray (...)
| Separated convolution on multi-dimensional arrays.
template<... >
void | separableConvolveX (...)
| Performs a 1 dimensional convolution in x direction.
template<... >
void | separableConvolveY (...)
| Performs a 1 dimensional convolution in y direction.
template<... >
void | separableMultiDistance (...)
| Euclidean distance on multi-dimensional arrays.
template<... >
void | separableMultiDistSquared (...)
| Euclidean distance squared on multi-dimensional arrays.
template<... >
void | separableVectorDistance (...)
| Compute the vector distance transform of a N-dimensional binary array.
linalg::TemporaryMatrix< double > | shearMatrix2D (double s01, double s10)
| Create homogeneous matrix representing a 2D shearing.
template<class GRAPH , class WEIGHTS , class PREDECESSORS , class DISTANCE , class HEURSTIC >
void | shortestPathAStar (const GRAPH &graph, const typename GRAPH::Node &source, const typename GRAPH::Node &target, const WEIGHTS &weights, PREDECESSORS &predecessors, DISTANCE &distance, const HEURSTIC &heuristic)
| Astar Shortest path search.
template<class T >
T | sign (T t)
| The sign function.
template<class T1 , class T2 >
T1 | sign (T1 t1, T2 t2)
| The binary sign function.
template<class T >
int | signi (T t)
| The integer sign function.
template<... >
void | simpleSharpening (...)
| Perform simple sharpening function.
template<class REAL >
REAL | sin_pi (REAL x)
| sin(pi*x).
template<... >
void | skeletonizeImage (...)
| Skeletonization of all regions in a labeled 2D image.
template<... >
void | slantedEdgeMTF (...)
| Determine the magnitude transfer function of the camera.
template<... >
unsigned int | slicSuperpixels (...)
| Compute SLIC superpixels in arbitrary dimensions.
template<class T >
NumericTraits< T >::Promote | sq (T t)
| The square function.
template<int IntBits, FPOverflowHandling OverflowHandling>
SquareRootTraits< FixedPoint16< IntBits, OverflowHandling > >::SquareRootResult | sqrt (FixedPoint16< IntBits, OverflowHandling > v)
| square root.
template<unsigned IntBits, unsigned FracBits>
SquareRootTraits< FixedPoint< IntBits, FracBits > >::SquareRootResult | sqrt (FixedPoint< IntBits, FracBits > v)
| square root.
template<class V , int SIZE, class D1 , class D2 >
TinyVector< V, SIZE > | sqrt (TinyVectorBase< V, SIZE, D1, D2 > const &v)
Int32 | sqrti (Int32 v)
| Signed integer square root.
template<class R >
FFTWComplex< R >::SquaredNormType | squaredNorm (const FFTWComplex< R > &a)
| squared norm (= squared magnitude)
template<typename IntType >
NormTraits< Rational< IntType > >::SquaredNormType | squaredNorm (const Rational< IntType > &r)
| squared norm
template<int IntBits, FPOverflowHandling OverflowHandling>
NormTraits< FixedPoint16< IntBits, OverflowHandling > >::SquaredNormType | squaredNorm (FixedPoint16< IntBits, OverflowHandling > v)
| squared norm (same as v*v).
template<unsigned IntBits, unsigned FracBits>
FixedPointTraits< FixedPoint< IntBits, FracBits >, FixedPoint< IntBits, FracBits > >::MultipliesType | squaredNorm (FixedPoint< IntBits, FracBits > v)
| squared norm (same as v*v).
template<typename Type >
Quaternion< Type >::SquaredNormType | squaredNorm (Quaternion< Type > const &q)
| squared norm
NormTraits< T >::SquaredNormType | squaredNorm (T const &t)
| The squared norm of a numerical object.
template<class V , int SIZE>
TinyVector< V, SIZE >::SquaredNormType | squaredNorm (TinyVector< V, SIZE > const &t)
| squared norm
template<class V1 , int SIZE, class D1 , class D2 >
TinyVectorBase< V1, SIZE, D1, D2 >::SquaredNormType | squaredNorm (TinyVectorBase< V1, SIZE, D1, D2 > const &t)
| squared norm
template<... >
void | structureTensor (...)
| Calculate the Structure Tensor for each pixel of and image, using Gaussian (derivative) filters.
template<... >
void | structureTensorMultiArray (...)
| Calculate the structure tensor of a multi-dimensional arrays.
template<int IntBits1, FPOverflowHandling OverflowHandling, int IntBits2, int IntBits3>
FixedPoint16< IntBits3, OverflowHandling > & | sub (FixedPoint16< IntBits1, OverflowHandling > l, FixedPoint16< IntBits2, OverflowHandling > r, FixedPoint16< IntBits3, OverflowHandling > &result)
| subtraction with enforced result type.
template<unsigned IntBits1, unsigned FracBits1, unsigned IntBits2, unsigned FracBits2, unsigned IntBits3, unsigned FracBits3>
void | sub (FixedPoint< IntBits1, FracBits1 > l, FixedPoint< IntBits2, FracBits2 > r, FixedPoint< IntBits3, FracBits3 > &result)
| subtraction with enforced result type.
template<class V , int SIZE, class D1 , class D2 >
NumericTraits< V >::Promote | sum (TinyVectorBase< V, SIZE, D1, D2 > const &l)
| sum of the vector's elements
template<class T >
void | symmetric2x2Eigenvalues (T a00, T a01, T a11, T *r0, T *r1)
| Compute the eigenvalues of a 2x2 real symmetric matrix.
template<class T >
void | symmetric3x3Eigenvalues (T a00, T a01, T a02, T a11, T a12, T a22, T *r0, T *r1, T *r2)
| Compute the eigenvalues of a 3x3 real symmetric matrix.
template<... >
void | symmetricGradientMultiArray (...)
| Calculate gradient of a multi-dimensional arrays using symmetric difference filters.
template<... >
void | tensorDeterminantMultiArray (...)
| Calculate the tensor determinant for every element of a ND tensor array.
template<... >
void | tensorEigenRepresentation (...)
| Calculate eigen representation of a symmetric 2x2 tensor.
template<... >
void | tensorEigenvaluesMultiArray (...)
| Calculate the tensor eigenvalues for every element of a N-D tensor array.
template<... >
void | tensorToEdgeCorner (...)
| Decompose a symmetric 2x2 tensor into its edge and corner parts.
template<... >
void | tensorTrace (...)
| Calculate the trace of a 2x2 tensor.
template<... >
void | tensorTraceMultiArray (...)
| Calculate the tensor trace for every element of a N-D tensor array.
template<... >
void | tiffToRGBImage (...)
| Import a RGB (3-band or color-mapped) TiffImage into a RGB image.
template<... >
void | tiffToScalarImage (...)
| Convert single-band TiffImage to scalar image.
std::string | tolower (std::string s)
template<... >
void | totalVariationFilter (...)
| Performs standard Total Variation Regularization.
template<... >
void | transformImage (...)
| Apply unary point transformation to each pixel.
template<... >
void | transformImageIf (...)
| Apply unary point transformation to each pixel within the ROI (i.e., where the mask is non-zero).
template<... >
void | transformMultiArray (...)
| Transform a multi-dimensional array with a unary function or functor.
template<class SplineImage , class DestIterator , class DestAccessor >
void | transformToPolarCoordinates (SplineImage const &src, DestIterator d_ul, DestIterator d_lr, DestAccessor d_acc)
| Transforms a given image to its (image-centered) polar coordinates representation.
linalg::TemporaryMatrix< double > | translationMatrix2D (TinyVector< double, 2 > const &shift)
| Create homogeneous matrix representing a 2D translation.
template<class V , int SIZE, class T >
TinyVector< V, SIZE > | transpose (TinyVector< V, SIZE > const &t, TinyVector< T, SIZE > const &permutation)
| transposed copy
template<... >
void | transposeImage (...)
| Transpose an image over the major or minor diagonal.
void | uncompress (char const *source, std::size_t srcSize, char *dest, std::size_t destSize, CompressionMethod method)
template<... >
unsigned int | unionFindWatershedsBlockwise (...)
| Blockwise union-find watersheds transform for MultiArrays and ChunkedArrays.
template<... >
void | upwindImage (...)
| This function calculates discrete upwinding scheme proposed by J. Weickert (2002) in Coherence-Enhancing Show Filters.
template<... >
void | vectorToTensor (...)
| Calculate the tensor (outer) product of a 2D vector with itself.
template<... >
void | vectorToTensorMultiArray (...)
| Calculate the tensor (outer) product of a N-D vector with itself.
template<... >
unsigned int | watersheds3D (...)
| Region Segmentation by means of the watershed algorithm.
template<... >
Label | watershedsMultiArray (...)
| Watershed segmentation of an arbitrary-dimensional array.
template<... >
unsigned int | watershedsRegionGrowing (...)
| Region segmentation by means of a flooding-based watershed algorithm.
template<... >
unsigned int | watershedsUnionFind (...)
| Region segmentation by means of the union-find watershed algorithm.
template<... >
void | writeHDF5 (...)
| Store array data in an HDF5 file.
template<class T >
void | writeHDF5Attr (hid_t loc, const char *name, ArrayVectorView< T > &array)
template<size_t N, class C >
void | writeHDF5Attr (hid_t loc, const char *name, MultiArrayView< N, std::string, C > const &array)
template<size_t N, class T , class C >
void | writeHDF5Attr (hid_t loc, const char *name, MultiArrayView< N, T, C > const &array)
template<class Arr >
void | writeHDF5Attr (std::string filePath, std::string pathInFile, Arr &ar)
template<class V >
TinyVector< float, 3 > | yPrimeCbCr2Polar (V const &ycbcr)
| Create polar representation form Y'CbCr.
template<class V >
TinyVector< float, 3 > | yPrimeIQ2Polar (V const &yiq)
| Create polar representation form Y'IQ.
template<class V >
TinyVector< float, 3 > | yPrimePbPr2Polar (V const &ypbpr)
| Create polar representation form Y'PbPr.
template<class V >
TinyVector< float, 3 > | yPrimeUV2Polar (V const &yuv)
| Create polar representation form Y'UV.

## Detailed Description

all VIGRA functionality is located in namespace vigra

This header provides definitions of graph-related algorithms

This header provides definitions of graph-related types and optionally provides a gateway to popular graph libraries (for now, BGL is supported).

## Typedef Documentation

## ◆ FFTWRealImage

typedef BasicImage<fftw_real> FFTWRealImage

Float (`fftw_real`) image.

The type `fftw_real` is defined as `double` (in FFTW 2 it used to be either `float` or `double`, as specified during compilation of FFTW). FFTWRealImage uses vigra::BasicImageIterator and vigra::StandardAccessor and their const counterparts to access the data.

#include <vigra/fftw3.hxx> (for FFTW 3) or
#include <vigra/fftw.hxx> (for deprecated FFTW 2)
Namespace: vigra

## ◆ FFTWComplexImage

typedef BasicImage<FFTWComplex<> > FFTWComplexImage

Complex (FFTWComplex) image. It uses vigra::BasicImageIterator and vigra::StandardAccessor and their const counterparts to access the data.

#include <vigra/fftw3.hxx> (for FFTW 3) or
#include <vigra/fftw.hxx> (for deprecated FFTW 2)
Namespace: vigra

## ◆ CoordinateIterator

typedef Diff2D CoordinateIterator

Simulate an image where each pixel contains its coordinate.

CoordinateIterator used to be a separate class, but has now become an alias for vigra::Diff2D. This is possible because Diff2D now provides all the necessary functionality.

CoordinateIterator behaves like a read-only vigra::ImageIterator for an image in which each pixel contains its coordinate. This is useful for algorithms that need access to the current pixel's location. For example, you can use CoordinateIterator/Diff2D to find the center of mass of an image region. To implement this, we first need a functor for center-of-mass calculations:

struct CenterOfMassFunctor
{
CenterOfMassFunctor()
: x(0.0), y(0.0), size(0)
{}
void operator()(Diff2d const& diff)
{
++size;
x += diff.x;
y += diff.y;
}
float xCenter() const
{ return x / size; }
float yCenter() const
{ return y / size; }
float x;
float y;
int size;
};
vigra::RGBValue
Class for a single RGB value.
Definition rgbvalue.hxx:128
vigra::RGBValue::RGBValue
RGBValue()
Definition rgbvalue.hxx:209
vigra::TinyVectorBase::size
size_type size() const
Definition tinyvector.hxx:913

Using this functor, we find the center of mass like so:

vigra::BImage img(w,h);
... // mark a region in the image with '1', background with '0'
CenterOfMassFunctor center;
vigra::inspectImageIf(
srcIterRange(Diff2D(), Diff2D() + img.size()),
srcImage(img),
center);
std::cout << "Center of mass: " << center.xCenter() <<
", " << center.yCenter() << std::endl;
vigra::Diff2D
Two dimensional difference vector.
Definition diff2d.hxx:186
vigra::inspectImageIf
void inspectImageIf(...)
Apply read-only functor to every pixel in the ROI.

#include <vigra/imageiterator.hxx>
Namespace: vigra

## ◆ MultiArrayIndex

typedef std::ptrdiff_t MultiArrayIndex

Index type for a single dimension of a MultiArrayView or MultiArray.

## ◆ FourNeighborCode

typedef FourNeighborhood::NeighborCode FourNeighborCode

Export vigra::FourNeighborhood::NeighborCode into the scope of namespace vigra.

## ◆ EightNeighborCode

typedef EightNeighborhood::NeighborCode EightNeighborCode

Export vigra::EightNeighborhood::NeighborCode into the scope of namespace vigra.

## ◆ EightNeighborOffsetCirculator

typedef NeighborOffsetCirculator<EightNeighborCode> EightNeighborOffsetCirculator

Specialization of NeighborOffsetCirculator for 8-neighborhood.

## ◆ FourNeighborOffsetCirculator

typedef NeighborOffsetCirculator<FourNeighborCode> FourNeighborOffsetCirculator

Specialization of NeighborOffsetCirculator for 4-neighborhood.

## ◆ RandomTT800

typedef RandomNumberGenerator<detail::RandomState<detail::TT800> > RandomTT800

Shorthand for the TT800 random number generator class.

## ◆ TemperedTwister

typedef RandomNumberGenerator<detail::RandomState<detail::TT800> > TemperedTwister

Shorthand for the TT800 random number generator class (same as RandomTT800).

## ◆ RandomMT19937

typedef RandomNumberGenerator<detail::RandomState<detail::MT19937> > RandomMT19937

Shorthand for the MT19937 random number generator class.

## ◆ MersenneTwister

typedef RandomNumberGenerator<detail::RandomState<detail::MT19937> > MersenneTwister

Shorthand for the MT19937 random number generator class (same as RandomMT19937).

## ◆ GiniRidgeSplit

typedef RidgeSplit<BestGiniOfColumn<GiniCriterion> > GiniRidgeSplit

Standard ridge regression split

## ◆ BImage

typedef BasicImage<UInt8> BImage

Byte (8-bit unsigned) image. It uses vigra::BasicImageIterator and vigra::StandardAccessor and their const counterparts to access the data.

#include <vigra/stdimage.hxx>
Namespace: vigra

## ◆ UInt8Image

typedef BasicImage<UInt8> UInt8Image

Byte (8-bit unsigned) image. It uses vigra::BasicImageIterator and vigra::StandardAccessor and their const counterparts to access the data.

#include <vigra/stdimage.hxx>
Namespace: vigra

## ◆ Int8Image

typedef BasicImage<Int8> Int8Image

Signed byte (8-bit signed) image. It uses vigra::BasicImageIterator and vigra::StandardAccessor and their const counterparts to access the data.

#include <vigra/stdimage.hxx>
Namespace: vigra

## ◆ SImage

typedef BasicImage<Int16> SImage

Short integer (16-bit signed) image. It uses vigra::BasicImageIterator and vigra::StandardAccessor and their const counterparts to access the data.

#include <vigra/stdimage.hxx>
Namespace: vigra

## ◆ UInt16Image

typedef BasicImage<UInt16> UInt16Image

Short integer (16-bit unsigned) image. It uses vigra::BasicImageIterator and vigra::StandardAccessor and their const counterparts to access the data.

#include <vigra/stdimage.hxx>
Namespace: vigra

## ◆ Int16Image

typedef BasicImage<Int16> Int16Image

Short integer (16-bit signed) image. It uses vigra::BasicImageIterator and vigra::StandardAccessor and their const counterparts to access the data.

#include <vigra/stdimage.hxx>
Namespace: vigra

## ◆ IImage

typedef BasicImage<Int32> IImage

Integer (32-bit signed) image. It uses vigra::BasicImageIterator and vigra::StandardAccessor and their const counterparts to access the data.

#include <vigra/stdimage.hxx>
Namespace: vigra

## ◆ UInt32Image

typedef BasicImage<UInt32> UInt32Image

Integer (32-bit unsigned) image. It uses vigra::BasicImageIterator and vigra::StandardAccessor and their const counterparts to access the data.

#include <vigra/stdimage.hxx>
Namespace: vigra

## ◆ Int32Image

typedef BasicImage<Int32> Int32Image

Integer (32-bit signed) image. It uses vigra::BasicImageIterator and vigra::StandardAccessor and their const counterparts to access the data.

#include <vigra/stdimage.hxx>
Namespace: vigra

## ◆ FImage

typedef BasicImage<float> FImage

Float (float) image. It uses vigra::BasicImageIterator and vigra::StandardAccessor and their const counterparts to access the data.

#include <vigra/stdimage.hxx>
Namespace: vigra

## ◆ DImage

typedef BasicImage<double> DImage

Double (double) image. It uses vigra::BasicImageIterator and vigra::StandardAccessor and their const counterparts to access the data.

#include <vigra/stdimage.hxx>
Namespace: vigra

## ◆ BRGBImage

typedef BasicImage<RGBValue<UInt8> > BRGBImage

Byte (3x 8-bit unsigned) RGB image. The pixel type is vigra::RGBValue<vigra::UInt8>. It uses vigra::BasicImageIterator and vigra::RGBAccessor and their const counterparts to access the data.

#include <vigra/stdimage.hxx>
Namespace: vigra

## ◆ UInt8RGBImage

typedef BasicImage<RGBValue<UInt8> > UInt8RGBImage

Byte (3x 8-bit unsigned) RGB image. The pixel type is vigra::RGBValue<vigra::UInt8>. It uses vigra::BasicImageIterator and vigra::RGBAccessor and their const counterparts to access the data.

#include <vigra/stdimage.hxx>
Namespace: vigra

## ◆ Int8RGBImage

typedef BasicImage<RGBValue<Int8> > Int8RGBImage

Byte (3x 8-bit signed) RGB image. The pixel type is vigra::RGBValue<vigra::UInt8>. It uses vigra::BasicImageIterator and vigra::RGBAccessor and their const counterparts to access the data.

#include <vigra/stdimage.hxx>
Namespace: vigra

## ◆ SRGBImage

typedef BasicImage<RGBValue<Int16> > SRGBImage

Short (3x 16-bit signed) RGB image. The pixel type is vigra::RGBValue<vigra::Int16>. It uses vigra::BasicImageIterator and vigra::RGBAccessor and their const counterparts to access the data.

#include <vigra/stdimage.hxx>
Namespace: vigra

## ◆ UInt16RGBImage

typedef BasicImage<RGBValue<UInt16> > UInt16RGBImage

Short (3x 16-bit unsigned) RGB image. The pixel type is vigra::RGBValue<vigra::Int16>. It uses vigra::BasicImageIterator and vigra::RGBAccessor and their const counterparts to access the data.

#include <vigra/stdimage.hxx>
Namespace: vigra

## ◆ Int16RGBImage

typedef BasicImage<RGBValue<Int16> > Int16RGBImage

Short (3x 16-bit signed) RGB image. The pixel type is vigra::RGBValue<vigra::Int16>. It uses vigra::BasicImageIterator and vigra::RGBAccessor and their const counterparts to access the data.

#include <vigra/stdimage.hxx>
Namespace: vigra

## ◆ IRGBImage

typedef BasicImage<RGBValue<Int32> > IRGBImage

Integer (3x 32-bit signed) RGB image. The pixel type is vigra::RGBValue<vigra::Int32>. It uses vigra::BasicImageIterator and vigra::RGBAccessor and their const counterparts to access the data.

#include <vigra/stdimage.hxx>
Namespace: vigra

## ◆ UInt32RGBImage

typedef BasicImage<RGBValue<UInt32> > UInt32RGBImage

Integer (3x 32-bit unsigned) RGB image. The pixel type is vigra::RGBValue<vigra::Int32>. It uses vigra::BasicImageIterator and vigra::RGBAccessor and their const counterparts to access the data.

#include <vigra/stdimage.hxx>
Namespace: vigra

## ◆ Int32RGBImage

typedef BasicImage<RGBValue<Int32> > Int32RGBImage

Integer (3x 32-bit signed) RGB image. The pixel type is vigra::RGBValue<vigra::Int32>. It uses vigra::BasicImageIterator and vigra::RGBAccessor and their const counterparts to access the data.

#include <vigra/stdimage.hxx>
Namespace: vigra

## ◆ FRGBImage

typedef BasicImage<RGBValue<float> > FRGBImage

Floating-point (3x float) RGB image. The pixel type is vigra::RGBValue<float>. It uses vigra::BasicImageIterator and vigra::RGBAccessor and their const counterparts to access the data.

#include <vigra/stdimage.hxx>
Namespace: vigra

## ◆ DRGBImage

typedef BasicImage<RGBValue<double> > DRGBImage

Double-precision floating-point (3x double) RGB image. The pixel type is vigra::RGBValue<double>. It uses vigra::BasicImageIterator and vigra::RGBAccessor and their const counterparts to access the data.

#include <vigra/stdimage.hxx>
Namespace: vigra

## ◆ FVector2Image

typedef BasicImage<TinyVector<float, 2> > FVector2Image

Floating-point TinyVector image. The pixel type is vigra::TinyVector<float, 2>. It uses vigra::BasicImageIterator and vigra::VectorAccessor and their const counterparts to access the data.

#include <vigra/stdimage.hxx>
Namespace: vigra

## ◆ FVector3Image

typedef BasicImage<TinyVector<float, 3> > FVector3Image

Floating-point TinyVector image. The pixel type is vigra::TinyVector<float, 3>. It uses vigra::BasicImageIterator and vigra::VectorAccessor and their const counterparts to access the data.

#include <vigra/stdimage.hxx>
Namespace: vigra

## ◆ FVector4Image

typedef BasicImage<TinyVector<float, 4> > FVector4Image

Floating-point TinyVector image. The pixel type is vigra::TinyVector<float, 4>. It uses vigra::BasicImageIterator and vigra::VectorAccessor and their const counterparts to access the data.

#include <vigra/stdimage.hxx>
Namespace: vigra

## ◆ DVector2Image

typedef BasicImage<TinyVector<double, 2> > DVector2Image

Floating-point TinyVector image. The pixel type is vigra::TinyVector<double, 2>. It uses vigra::BasicImageIterator and vigra::VectorAccessor and their const counterparts to access the data.

#include <vigra/stdimage.hxx>
Namespace: vigra

## ◆ DVector3Image

typedef BasicImage<TinyVector<double, 3> > DVector3Image

Floating-point TinyVector image. The pixel type is vigra::TinyVector<double, 3>. It uses vigra::BasicImageIterator and vigra::VectorAccessor and their const counterparts to access the data.

#include <vigra/stdimage.hxx>
Namespace: vigra

## ◆ DVector4Image

typedef BasicImage<TinyVector<double, 4> > DVector4Image

Floating-point TinyVector image. The pixel type is vigra::TinyVector<double, 4>. It uses vigra::BasicImageIterator and vigra::VectorAccessor and their const counterparts to access the data.

#include <vigra/stdimage.hxx>
Namespace: vigra

## ◆ AtVolumeBorder

typedef AtImageBorder AtVolumeBorder

Encode whether a voxel is near the volume border.

This enum is used with isAtVolumeBorder() and vigra::RestrictedNeighborhoodCirculator.

#include <vigra/voxelneighborhood.hxx>
Namespace: vigra

## ◆ NeighborCode3DSix

typedef Neighborhood3DSix::NeighborCode3D NeighborCode3DSix

Export vigra::Neighborhood3DSix::NeighborCode3D into the scope of namespace vigra.

## ◆ NeighborCode3DTwentySix

typedef Neighborhood3DTwentySix::NeighborCode3D NeighborCode3DTwentySix

Export vigra::Neighborhood3DTwentySix::NeighborCode3D into the scope of namespace vigra.

## Enumeration Type Documentation

## ◆ BoundaryDistanceTag

enum BoundaryDistanceTag

Specify which boundary is used for boundaryMultiDistance().

Enumerator
OuterBoundary | Pixels just outside of each region.
InterpixelBoundary | Half-integer points between pixels of different labels.
InnerBoundary | Pixels just inside of each region.

## ◆ MultiArrayInitializationTag

enum MultiArrayInitializationTag

Initialize a MultiArray in a standard way.

Enumerator
LinearSequence | Initialize array by a linear sequence in scan order.

## ◆ NeighborhoodType

enum NeighborhoodType

Choose the neighborhood system in a dimension-independent way.

DirectNeighborhood corresponds to 4-neighborhood in 2D and 6-neighborhood in 3D, whereas IndirectNeighborhood means 8-neighborhood in 2D and 26-neighborhood in 3D. The general formula for N dimensions are 2*N for direct neighborhood and 3^N-1 for indirect neighborhood.

Enumerator
DirectNeighborhood | use only direct neighbors
IndirectNeighborhood | use direct and indirect neighbors

## ◆ AtImageBorder

enum AtImageBorder

Encode whether a point is near the image border.

This enum is used with isAtImageBorder() and vigra::RestrictedNeighborhoodCirculator.

#include <vigra/pixelneighborhood.hxx>
Namespace: vigra

Enumerator
NotAtBorder |
RightBorder |
LeftBorder |
TopBorder |
BottomBorder |
FrontBorder |

## ◆ RF_OptionTag

enum RF_OptionTag

tags used with the RandomForestOptions class

See also
  RF_Traits::Option_t

## ◆ SRGType

enum SRGType

Choose between different types of Region Growing

## Function Documentation

## ◆ affineMatrix2DFromCorrespondingPoints()

template<class SrcIterator , class DestIterator >

linalg::TemporaryMatrix< double > affineMatrix2DFromCorrespondingPoints | ( | SrcIterator | s,
|  | SrcIterator | send,
|  | DestIterator | d
| ) |  |

Create homogeneous matrix that maps corresponding points onto each other.

For use with affineWarpImage(). When only two corresponding points are given, the matrix will only represent a similarity transform (translation, rotation, and uniform scaling). When only one point pair is given, the result will be a pure translation.

## ◆ estimateTranslation()

template<... >

void estimateTranslation | ( |  | ... | ) |

Estimate the optical flow between two images according to a translation model.

This function applies the same algorithm as estimateAffineTransform() with the additional constraint that the motion model must be a translation rather than affine.

Declarations:

#include <vigra/affine_registration.hxx>
Namespace: vigra

pass 2D array views:

namespace vigra {
template <class T1, class S1,
class T2, class S2,
int SPLINEORDER>
void
estimateTranslation(MultiArrayView<2, T1, S1> const & src,
MultiArrayView<2, T2, S2> dest,
Matrix<double> & affineMatrix,
AffineMotionEstimationOptions<SPLINEORDER> const & options = AffineMotionEstimationOptions<SPLINEORDER>());
}
vigra
vigra::estimateTranslation
void estimateTranslation(...)
Estimate the optical flow between two images according to a translation model.

show deprecated declarations

pass Image Iterators and Data Accessors :
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor,
int SPLINEORDER = 2>
void
estimateTranslation(SrcIterator sul, SrcIterator slr, SrcAccessor src,
DestIterator dul, DestIterator dlr, DestAccessor dest,
Matrix<double> & affineMatrix,
AffineMotionEstimationOptions<SPLINEORDER> const & options =
AffineMotionEstimationOptions<>())
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor,
int SPLINEORDER = 2>
void
estimateTranslation(triple<SrcIterator, SrcIterator, SrcAccessor> src,
triple<DestIterator, DestIterator, DestAccessor> dest,
Matrix<double> & affineMatrix,
AffineMotionEstimationOptions<SPLINEORDER> const & options =
AffineMotionEstimationOptions<>())
}

## ◆ estimateSimilarityTransform()

template<... >

void estimateSimilarityTransform | ( |  | ... | ) |

Estimate the optical flow between two images according to a similarity transform model (e.g. translation, rotation, and uniform scaling).

This function applies the same algorithm as estimateAffineTransform() with the additional constraint that the motion model must be a similarity transform rather than affine.

Declarations:

#include <vigra/affine_registration.hxx>
Namespace: vigra

pass 2D array views:

namespace vigra {
template <class T1, class S1,
class T2, class S2,
int SPLINEORDER>
void
estimateSimilarityTransform(MultiArrayView<2, T1, S1> const & src,
MultiArrayView<2, T2, S2> dest,
Matrix<double> & affineMatrix,
AffineMotionEstimationOptions<SPLINEORDER> const & options =
AffineMotionEstimationOptions<SPLINEORDER>());
}
vigra::estimateSimilarityTransform
void estimateSimilarityTransform(...)
Estimate the optical flow between two images according to a similarity transform model (e....

show deprecated declarations

pass Image Iterators and Data Accessors :
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor,
int SPLINEORDER = 2>
void
estimateSimilarityTransform(SrcIterator sul, SrcIterator slr, SrcAccessor src,
DestIterator dul, DestIterator dlr, DestAccessor dest,
Matrix<double> & affineMatrix,
AffineMotionEstimationOptions<SPLINEORDER> const & options =
AffineMotionEstimationOptions<>())
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor,
int SPLINEORDER = 2>
void
estimateSimilarityTransform(triple<SrcIterator, SrcIterator, SrcAccessor> src,
triple<DestIterator, DestIterator, DestAccessor> dest,
Matrix<double> & affineMatrix,
AffineMotionEstimationOptions<SPLINEORDER> const & options =
AffineMotionEstimationOptions<>())
}

## ◆ estimateAffineTransform()

template<... >

void estimateAffineTransform | ( |  | ... | ) |

Estimate the optical flow between two images according to an affine transform model (e.g. translation, rotation, non-uniform scaling, and shearing).

This function implements the algorithm described in

J.R. Bergen, P. Anandan, K.J. Hanna, R. Hingorani: "Hierarchical model-based motion estimation", ECCV 1992

Specifically, it minimizes the squared loss between the images I at two consecutive time points t-1 and t:

where are the pixel coordinates and is an affine motion model parameterized by . Since the objective is non-linear, it is linearized by first-order Taylor expansion w.r.t. , and a local optimum is determined iteratively by the Gauss-Newton method. To handle larger displacements, the algorithm employs a coarse-to-fine strategy, where the motion is first estimated on downsampled versions of the images and then refined at consecutively higher resolutions.

The algorithm's parameters can be controlled by the option object vigra::AffineMotionEstimationOptions. In particular, one can determine if

- I in the objective refers to the original images (default) or their second derivatives (`options.useLaplacianPyramid()` – makes motion estimation invariant against additive intensity offsets);
- the highest pyramid level to be used (`options.highestPyramidLevel(h)` – images are downsampled to 2-h times their original size, default: h=4);
- the number of Gauss-Newton iterations per resolution level (`options.iterationsPerLevel(i)`, default: i=4);
- the interpolation order to compute subpixel intensities (default: 2)

The resulting affine model is stored in parameter `affineMatrix`, which can be used by affineWarpImage() to apply the transformation to time frame t-1. See documentation there for the precise meaning of the matrix elements.

Declarations:

#include <vigra/affine_registration.hxx>
Namespace: vigra

pass 2D array views:

namespace vigra {
template <class T1, class S1,
class T2, class S2,
int SPLINEORDER>
void
estimateAffineTransform(MultiArrayView<2, T1, S1> const & src,
MultiArrayView<2, T2, S2> dest,
Matrix<double> & affineMatrix,
AffineMotionEstimationOptions<SPLINEORDER> const & options =
AffineMotionEstimationOptions<SPLINEORDER>());
}
vigra::estimateAffineTransform
void estimateAffineTransform(...)
Estimate the optical flow between two images according to an affine transform model (e....

show deprecated declarations

pass Image Iterators and Data Accessors :
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor,
int SPLINEORDER = 2>
void
estimateAffineTransform(SrcIterator sul, SrcIterator slr, SrcAccessor src,
DestIterator dul, DestIterator dlr, DestAccessor dest,
Matrix<double> & affineMatrix,
AffineMotionEstimationOptions<SPLINEORDER> const & options =
AffineMotionEstimationOptions<>())
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor,
int SPLINEORDER = 2>
void
estimateAffineTransform(triple<SrcIterator, SrcIterator, SrcAccessor> src,
triple<DestIterator, DestIterator, DestAccessor> dest,
Matrix<double> & affineMatrix,
AffineMotionEstimationOptions<SPLINEORDER> const & options =
AffineMotionEstimationOptions<>())
}

## ◆ transformToPolarCoordinates()

template<class SplineImage , class DestIterator , class DestAccessor >

void transformToPolarCoordinates | ( | SplineImage const & | src,
|  | DestIterator | d_ul,
|  | DestIterator | d_lr,
|  | DestAccessor | d_acc
| ) |  |

Transforms a given image to its (image-centered) polar coordinates representation.

This algorithm transforms a given image (by means of an spline image view) to its image-centered polar coordinates reprensentation. The sampling of the polar coordinate system is determined by the shape of the dest. image.

Declarations:

#include <vigra/affine_registration_fft.hxx>
Namespace: vigra

pass 2D array views:

namespace vigra {
template <class SplineImage,
class T1, class S1>
void
transformToPolarCoordinates(SplineImage const & src,
MultiArrayView<2, T1, S1> dest);
}
vigra::transformToPolarCoordinates
void transformToPolarCoordinates(SplineImage const &src, DestIterator d_ul, DestIterator d_lr, DestAccessor d_acc)
Transforms a given image to its (image-centered) polar coordinates representation.
Definition affine_registration_fft.hxx:112

show deprecated declarations

pass Image Iterators and Data Accessors :
namespace vigra {
template <class SplineImage,
class DestIterator, class DestAccessor>
void
transformToPolarCoordinates(SplineImage const & src,
DestIterator dul, DestIterator dlr, DestAccessor dest)
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
template <class SplineImage,
class DestIterator, class DestAccessor>
void
transformToPolarCoordinates(SplineImage const & src,
triple<DestIterator, DestIterator, DestAccessor> dest)
}

## ◆ estimateGlobalRotation()

template<... >

void estimateGlobalRotation | ( |  | ... | ) |

Estimate the rotation between two images by means of a normalized cross correlation matching of the FFT spectra.

This algorithm uses the fast normalized cross correlation to determine a global rotation between two images (from image2 to image1). To derive the rotation, the algorithm performs the following steps:

1. Transforming both images to the frequency domain using FFTW
2. Create LogAbs PolarCoordinate representations for each spectrum.
3. Determining the final Rotation by performing a fast normalized cross correlation based on the polar representations.

The images are cropped to the corresponding images center-squared before the estimation takes place.

Declarations:

#include <vigra/affine_registration_fft.hxx>
Namespace: vigra

pass 2D array views:

namespace vigra {
template <class T1, class S1,
class T2, class S2>
void
estimateGlobalRotation(MultiArrayView<2, T1, S1> const & src,
MultiArrayView<2, T2, S2> dest,
Matrix<double> & affineMatrix,
double & correlation_coefficent);
}
vigra::estimateGlobalRotation
void estimateGlobalRotation(...)
Estimate the rotation between two images by means of a normalized cross correlation matching of the F...

show deprecated declarations

pass Image Iterators and Data Accessors :
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor>
void
estimateGlobalRotation(SrcIterator sul, SrcIterator slr, SrcAccessor src,
DestIterator dul, DestIterator dlr, DestAccessor dest,
Matrix<double> & affineMatrix,
double & correlation_coefficent)
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor>
void
estimateGlobalRotation(triple<SrcIterator, SrcIterator, SrcAccessor> src,
triple<DestIterator, DestIterator, DestAccessor> dest,
Matrix<double> & affineMatrix,
double & correlation_coefficent)
}

## ◆ estimateGlobalTranslation()

template<... >

void estimateGlobalTranslation | ( |  | ... | ) |

Estimate the translation between two images by means of a normalized cross correlation matching.

This algorithm uses the fast normalized cross correlation to determine a global translation between two images (from image2 to image1). To derive the translation, the algorithm consists of differents steps:

1. Separation of the second image
   The second image (the one, for which the translation shall be determined) is cut into five subregions: UpperLeft, UpperRight, Center, LowerLeft and LowerRight, each of 1/4 the size of the original image. Using a border > 0 results in (all) overlapping regions.
2. Cross-Correlation of the subimages to the first image
   The subimages are normalized cross-correlated to the (complete) first image. The resulting maximum-likelihood translations and the correlation coefficients are stored for the next step.
3. Determining the final Translation by voting
   Each correlation vector gets one vote at the beginning. For each equality of derived motion vectors, the voting to these vectors is incremented. If the maximum number of votes is larger than 1, the vector with the most votes is chosen. If the maximum number of votes is 1, the vector with the maximum likelihood is choosen.

Declarations:

#include <vigra/affine_registration_fft.hxx>
Namespace: vigra

pass 2D array views:

namespace vigra {
template <class T1, class S1,
class T2, class S2>
void
estimateGlobalTranslation(MultiArrayView<2, T1, S1> const & src,
MultiArrayView<2, T2, S2> dest,
Matrix<double> & affineMatrix,
double & correlation_coefficent,
Diff2D border = Diff2D(0,0));
}
vigra::estimateGlobalTranslation
void estimateGlobalTranslation(...)
Estimate the translation between two images by means of a normalized cross correlation matching.

show deprecated declarations

pass Image Iterators and Data Accessors :
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor>
void
estimateGlobalTranslation(SrcIterator sul, SrcIterator slr, SrcAccessor src,
DestIterator dul, DestIterator dlr, DestAccessor dest,
Matrix<double> & affineMatrix,
double & correlation_coefficent,
Diff2D border = Diff2D(0,0))
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor>
void
estimateGlobalTranslation(triple<SrcIterator, SrcIterator, SrcAccessor> src,
triple<DestIterator, DestIterator, DestAccessor> dest,
Matrix<double> & affineMatrix,
double & correlation_coefficent,
Diff2D border = Diff2D(0,0))
}

## ◆ estimateGlobalRotationTranslation()

template<... >

void estimateGlobalRotationTranslation | ( |  | ... | ) |

Estimate the (global) rotation and translation between two images by means a normalized cross correlation matching.

This algorithm use the functions estimateGlobalRotation() and estimateGlobalTranslation() to estimate a matrix which describes the global rotation and translation from the second to the first image.

Declarations:

#include <vigra/affine_registration_fft.hxx>
Namespace: vigra

pass 2D array views:

namespace vigra {
template <class T1, class S1,
class T2, class S2>
void
estimateGlobalRotationTranslation(MultiArrayView<2, T1, S1> const & src,
MultiArrayView<2, T2, S2> dest,
Matrix<double> & affineMatrix,
double & rotation_correlation,
double & translation_correlation,
Diff2D border = Diff2D(0,0));
}
vigra::estimateGlobalRotationTranslation
void estimateGlobalRotationTranslation(...)
Estimate the (global) rotation and translation between two images by means a normalized cross correla...

show deprecated declarations

pass Image Iterators and Data Accessors :
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor>
void
estimateGlobalRotationTranslation(SrcIterator sul, SrcIterator slr, SrcAccessor src,
DestIterator dul, DestIterator dlr, DestAccessor dest,
Matrix<double> & affineMatrix,
double & rotation_correlation,
double & translation_correlation,
Diff2D border = Diff2D(0,0))
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor>
void
estimateGlobalRotationTranslation(triple<SrcIterator, SrcIterator, SrcAccessor> src,
triple<DestIterator, DestIterator, DestAccessor> dest,
Matrix<double> & affineMatrix,
double & rotation_correlation,
double & translation_correlation,
Diff2D border = Diff2D(0,0))
}

## ◆ translationMatrix2D()

linalg::TemporaryMatrix< double > translationMatrix2D | ( | TinyVector< double, 2 > const & | shift | ) |

Create homogeneous matrix representing a 2D translation.

For use with affineWarpImage().

## ◆ scalingMatrix2D() [1/2]

linalg::TemporaryMatrix< double > scalingMatrix2D | ( | double | scalingFactor | ) |

Create homogeneous matrix representing a 2D uniform scaling about the coordinate origin.

For use with affineWarpImage().

## ◆ scalingMatrix2D() [2/2]

linalg::TemporaryMatrix< double > scalingMatrix2D | ( | double | sx,
|  | double | sy
| ) |  |

Create homogeneous matrix representing a 2D non-uniform scaling about the coordinate origin.

For use with affineWarpImage().

## ◆ shearMatrix2D()

linalg::TemporaryMatrix< double > shearMatrix2D | ( | double | s01,
|  | double | s10
| ) |  |

Create homogeneous matrix representing a 2D shearing.

For use with affineWarpImage().

## ◆ rotationMatrix2DRadians() [1/2]

linalg::TemporaryMatrix< double > rotationMatrix2DRadians | ( | double | angle | ) |

Create homogeneous matrix representing a 2D rotation about the coordinate origin.

For use with affineWarpImage(). Angle must be in radians.

## ◆ rotationMatrix2DDegrees() [1/2]

linalg::TemporaryMatrix< double > rotationMatrix2DDegrees | ( | double | angle | ) |

Create homogeneous matrix representing a 2D rotation about the coordinate origin.

For use with affineWarpImage(). Angle must be in degrees.

## ◆ rotationMatrix2DRadians() [2/2]

linalg::TemporaryMatrix< double > rotationMatrix2DRadians | ( | double | angle,
|  | TinyVector< double, 2 > const & | center
| ) |  |

Create homogeneous matrix representing a 2D rotation about the given point.

For use with affineWarpImage(). Angle must be in radians.

## ◆ rotationMatrix2DDegrees() [2/2]

linalg::TemporaryMatrix< double > rotationMatrix2DDegrees | ( | double | angle,
|  | TinyVector< double, 2 > const & | center
| ) |  |

Create homogeneous matrix representing a 2D rotation about the given point.

For use with affineWarpImage(). Angle must be in degrees.

## ◆ affineWarpImage()

template<... >

void affineWarpImage | ( |  | ... | ) |

Warp an image according to an affine transformation.

Declarations:

pass 2D array views:

namespace vigra {
template <int ORDER, class T,
class T2, class S2,
class C>
void
affineWarpImage(SplineImageView<ORDER, T> const & src,
MultiArrayView<2, T2, S2> dest,
MultiArrayView<2, double, C> const & affineMatrix);
}
vigra::affineWarpImage
void affineWarpImage(...)
Warp an image according to an affine transformation.

show deprecated declarations

pass Image Iterators and Data Accessors :
namespace vigra {
template <int ORDER, class T,
class DestIterator, class DestAccessor,
class C>
void affineWarpImage(SplineImageView<ORDER, T> const & src,
DestIterator dul, DestIterator dlr, DestAccessor dest,
MultiArrayView<2, double, C> const & affineMatrix);
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
template <int ORDER, class T,
class DestIterator, class DestAccessor,
class C>
void affineWarpImage(SplineImageView<ORDER, T> const & src,
triple<DestIterator, DestIterator, DestAccessor> dest,
MultiArrayView<2, double, C> const & affineMatrix);
}

The algorithm applies the given affineMatrix to the destination coordinates and copies the image value from the resulting source coordinates, using the given SplineImageView src for interpolation. If the resulting coordinate is outside the source image, nothing will be written at that destination point.

for all dest pixels:
currentSrcCoordinate = affineMatrix * currentDestCoordinate;
if src.isInside(currentSrcCoordinate):
dest[currentDestCoordinate] = src[currentSrcCoordinate]; // copy an interpolated value

The matrix represents a 2-dimensional affine transform by means of homogeneous coordinates, i.e. it must be a 3x3 matrix whose last row is (0,0,1).

Usage:

#include <vigra/affinegeometry.hxx>
Namespace: vigra

MultiArray<2, float> src(width, height);
SplineImageView<3, float> spline(src);
MultiArray<2, float> dest1(src.shape());
// equivalent (up to round-off errors) to
// rotateImage(spline, dest1, 45.0);
TinyVector<double, 2> center((width-1.0)/2.0, (height-1.0)/2.0);
affineWarpImage(spline, dest1, rotationMatrix2DDegrees(45.0, center));
MultiArray<2, float> dest2(2*width-1, 2*height-1);
// equivalent (up to round-off errors) to
// resizeImageSplineInterpolation(img, dest2);
// note that scaleFactor = 0.5, because we must pass the transformation from destination to source
affineWarpImage(spline, dest2, scalingMatrix2D(0.5));
vigra::scalingMatrix2D
linalg::TemporaryMatrix< double > scalingMatrix2D(double scalingFactor)
Create homogeneous matrix representing a 2D uniform scaling about the coordinate origin.
Definition affinegeometry.hxx:77
vigra::rotationMatrix2DDegrees
linalg::TemporaryMatrix< double > rotationMatrix2DDegrees(double angle)
Create homogeneous matrix representing a 2D rotation about the coordinate origin.
Definition affinegeometry.hxx:133

show deprecated examples

FImage src(width, height);
SplineImageView<3, Image::value_type> spline(srcImageRange(src));
FImage dest1(width, height);
// equivalent (up to round-off errors) with
// rotateImage(spline, destImage(dest1), 45.0);
TinyVector<double, 2> center((width-1.0)/2.0, (height-1.0)/2.0);
affineWarpImage(spline, destImageRange(dest1), rotationMatrix2DDegrees(45.0, center));
FImage dest2(2*width-1, 2*height-1);
// equivalent (up to round-off errors) with
// resizeImageSplineInterpolation(srcImageRange(img), destImageRange(dest2));
// note that scaleFactor = 0.5, because we must pass the transformation from destination to source
affineWarpImage(spline, destImageRange(dest2), scalingMatrix2D(0.5));
vigra::BasicImage< float >
Required Interface:
DestImageIterator dest_upperleft;
double x = ..., y = ...;
if (spline.isInside(x,y))
dest_accessor.set(spline(x, y), dest_upperleft);

See also: Functions to specify affine transformation: translationMatrix2D(), scalingMatrix2D(), shearMatrix2D(), rotationMatrix2DRadians(), rotationMatrix2DDegrees()

## ◆ argMin()

template<class Iterator >

Iterator argMin | ( | Iterator | first,
|  | Iterator | last
| ) |  |

Find the minimum element in a sequence.

The function returns the iterator referring to the minimum element. This is identical to the function `std::min_element()`.

Required Interface:

Iterator is a standard forward iterator.
bool f = *first < NumericTraits<typename std::iterator_traits<Iterator>::value_type>::max();

#include <vigra/algorithm.hxx>
Namespace: vigra

## ◆ argMax()

template<class Iterator >

Iterator argMax | ( | Iterator | first,
|  | Iterator | last
| ) |  |

Find the maximum element in a sequence.

The function returns the iterator referring to the maximum element. This is identical to the function `std::max_element()`.

Required Interface:

Iterator is a standard forward iterator.
bool f = NumericTraits<typename std::iterator_traits<Iterator>::value_type>::min() < *first;

#include <vigra/algorithm.hxx>
Namespace: vigra

## ◆ argMinIf()

template<class Iterator , class UnaryFunctor >

Iterator argMinIf | ( | Iterator | first,
|  | Iterator | last,
|  | UnaryFunctor | condition
| ) |  |

Find the minimum element in a sequence conforming to a condition.

The function returns the iterator referring to the minimum element, where only elements conforming to the condition (i.e. where `condition(*iterator)` evaluates to `true`) are considered. If no element conforms to the condition, or the sequence is empty, the end iterator last is returned.

Required Interface:

Iterator is a standard forward iterator.
bool c = condition(*first);
bool f = *first < NumericTraits<typename std::iterator_traits<Iterator>::value_type>::max();

#include <vigra/algorithm.hxx>
Namespace: vigra

## ◆ argMaxIf()

template<class Iterator , class UnaryFunctor >

Iterator argMaxIf | ( | Iterator | first,
|  | Iterator | last,
|  | UnaryFunctor | condition
| ) |  |

Find the maximum element in a sequence conforming to a condition.

The function returns the iterator referring to the maximum element, where only elements conforming to the condition (i.e. where `condition(*iterator)` evaluates to `true`) are considered. If no element conforms to the condition, or the sequence is empty, the end iterator last is returned.

Required Interface:

Iterator is a standard forward iterator.
bool c = condition(*first);
bool f = NumericTraits<typename std::iterator_traits<Iterator>::value_type>::min() < *first;

#include <vigra/algorithm.hxx>
Namespace: vigra

## ◆ linearSequence()

template<class Iterator , class Value >

void linearSequence | ( | Iterator | first,
|  | Iterator | last,
|  | Value | start,
|  | Value | step
| ) |  |

Fill an array with a sequence of numbers.

The sequence starts at start and is incremented with step. Default start and stepsize are 0 and 1 respectively. This is a generalization of function `std::iota()` in C++11.

Declaration:

namespace vigra {
template <class Iterator, class Value>
void linearSequence(Iterator first, Iterator last,
Value const & start = 0, Value const & step = 1);
}
vigra::linearSequence
void linearSequence(Iterator first, Iterator last, Value start, Value step)
Fill an array with a sequence of numbers.
Definition algorithm.hxx:208

Required Interface:

Iterator is a standard forward iterator.
*first = start;
start += step;

#include <vigra/algorithm.hxx>
Namespace: vigra

## ◆ inspectSequence()

template<... >

void inspectSequence | ( |  | ... | ) |

Call an analyzing functor at every element of a sequence.

This function can be used to collect statistics of the sequence `[first, last)` defined by these two input interators. The results must be stored in the functor, which serves as a return value.

Declarations:

namespace vigra {
template <class InputIterator, class Functor>
void
inspectSequence(InputIterator first, InputIterator last, Functor & f);
}
vigra::inspectSequence
void inspectSequence(...)
Call an analyzing functor at every element of a sequence.

Usage:

#include <vigra/algorithm.hxx>
Namespace: vigra

std::vector array(100);
// init functor
vigra::FindMinMax<int> minmax;
vigra::inspectSequence(array.begin(), array.end(), minmax);
cout << "Min: " << minmax.min << " Max: " << minmax.max;

## ◆ makeIndexComparator()

template<class ArrayLike , class Compare >

detail::IndexCompare< ArrayLike, Compare > makeIndexComparator | ( | ArrayLike | a,
|  | Compare | c
| ) |  |

Create a compare functor for indirect sort.

Indirect sorting refers to the situation where you have an array holding data and another array holding indices referencing the first array, and you want to sort the index array according to some property of the data array without changing the data array itself. The factory function `makeIndexComparator()` creates a sorting predicate for this task, given a sorting predicate for the data array.

See also
  vigra::indexSort(), vigra::applyPermutation()

Usage:

#include <vigra/algorithm.hxx>
Namespace: vigra

const std:vector<double> data(...); // data is immutable
std::vector<int> index(data.size());
std::iota(index.begin(), index.end());
// sort the indices such that data[index[k]] is an ascending sequence in k
std::sort(index.begin(), index.end(), makeIndexComparator(data));
vigra::makeIndexComparator
detail::IndexCompare< ArrayLike, Compare > makeIndexComparator(ArrayLike a, Compare c)
Create a compare functor for indirect sort.
Definition algorithm.hxx:356

Declarations:

namespace vigra {
// compare using std::less
template <class ArrayLike>
auto makeIndexComparator(ArrayLike a);
// compare using functor Compare
template <class ArrayLike, class Compare>
auto makeIndexComparator(ArrayLike a, Compare c);
}

## ◆ indexSort()

template<class Iterator , class IndexIterator , class Compare >

void indexSort | ( | Iterator | first,
|  | Iterator | last,
|  | IndexIterator | index_first,
|  | Compare | c
| ) |  |

Return the index permutation that would sort the input array.

To actually sort an array according to the ordering thus determined, use applyPermutation().

Usage:

#include <vigra/algorithm.hxx>
Namespace: vigra

const std:vector<double> data(...); // data is immutable
std::vector<int> index(data.size());
// arrange indices such that data[index[k]] is an ascending sequence in k
indexSort(data.begin(), data.end(), index.begin());
vigra::indexSort
void indexSort(Iterator first, Iterator last, IndexIterator index_first, Compare c)
Return the index permutation that would sort the input array.
Definition algorithm.hxx:414

Declarations:

namespace vigra {
// compare using std::less
template <class Iterator, class IndexIterator>
void indexSort(Iterator first, Iterator last, IndexIterator index_first);
// compare using functor Compare
template <class Iterator, class IndexIterator, class Compare>
void indexSort(Iterator first, Iterator last, IndexIterator index_first, Compare compare);
}

Required Interface:

Iterator and IndexIterators are random access iterators.
bool res = compare(first[*index_first], first[*index_first]);

#include <vigra/algorithm.hxx>
Namespace: vigra

## ◆ applyPermutation()

template<class IndexIterator , class InIterator , class OutIterator >

void applyPermutation | ( | IndexIterator | index_first,
|  | IndexIterator | index_last,
|  | InIterator | in,
|  | OutIterator | out
| ) |  |

Sort an array according to the given index permutation.

The iterators in and out may not refer to the same array, as this would overwrite the input prematurely.

Declaration:

namespace vigra {
template <class IndexIterator, class InIterator, class OutIterator>
void applyPermutation(IndexIterator index_first, IndexIterator index_last,
InIterator in, OutIterator out);
}
vigra::applyPermutation
void applyPermutation(IndexIterator index_first, IndexIterator index_last, InIterator in, OutIterator out)
Sort an array according to the given index permutation.
Definition algorithm.hxx:456

Required Interface:

OutIterator and IndexIterators are forward iterators.
InIterator is a random access iterator.
*out = in[*index_first];

#include <vigra/algorithm.hxx>
Namespace: vigra

## ◆ inversePermutation()

template<class InIterator , class OutIterator >

void inversePermutation | ( | InIterator | first,
|  | InIterator | last,
|  | OutIterator | out
| ) |  |

Compute the inverse of a given permutation.

This is just another name for indexSort(), referring to another semantics.

Declaration:

namespace vigra {
template <class InIterator, class OutIterator>
void inversePermutation(InIterator first, InIterator last,
OutIterator out);
}
vigra::inversePermutation
void inversePermutation(InIterator first, InIterator last, OutIterator out)
Compute the inverse of a given permutation.
Definition algorithm.hxx:491

Required Interface:

InIterator and OutIterator are random access iterators.
*out = in[*index_first];

#include <vigra/algorithm.hxx>
Namespace: vigra

## ◆ checksum()

UInt32 checksum | ( | const char * | data,
|  | unsigned int | size
| ) |  |

Compute the CRC-32 checksum of a byte array.

Implementation note: This function is slower on big-endian machines because the "4 bytes at a time" optimization is only implemented for little-endian.

## ◆ concatenateChecksum()

UInt32 concatenateChecksum | ( | UInt32 | checksum,
|  | const char * | data,
|  | unsigned int | size
| ) |  |

Concatenate a byte array to an existing CRC-32 checksum.

## ◆ applyWindowFunction()

template<... >

void applyWindowFunction | ( |  | ... | ) |

Apply a window function to each pixels of a given image.

This function calculates the results for a window function (given as a functor) when applied to the complete image. Also allows a correct border handling! See medianFilter() for an example of a quite basic window function and its application.

If you pass a functor to this function, which implements the two functions:

1. Diff2D windowShape() const
   to return the filter window size, which has to be odd in each dimension and
2. void operator()(SrcIterator s, SrcAccessor s_acc, DestIterator d, DestAccessor d_acc)
   to compute the results of the current window,

this function calculates the results for the complete image.

All border treatment modes (except BORDER_TREATMENT_CLIP) are supported.

The input pixel type `T1` must be a linear space over the window functions' value_type `T`, i.e. addition of source values, multiplication with functions' values, and NumericTraits must be defined. The filters' value_type must be an algebraic field, i.e. the arithmetic operations (+, -, *, /) and NumericTraits must be defined.

Declarations:

pass 2D array views:

namespace vigra {
template <class T1, class S1,
class T2, class S2,
class ProcessingFunctor>
void
applyWindowFunction(MultiArrayView<2, T1, S1> const & src,
MultiArrayView<2, T2, S2> dest,
ProcessingFunctor func,
BorderTreatmentMode border = BORDER_TREATMENT_REPEAT);
}
vigra::applyWindowFunction
void applyWindowFunction(...)
Apply a window function to each pixels of a given image.

show deprecated declarations

pass Image Iterators and Data Accessors :
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor,
class ProcessingFunctor>
void applyWindowFunction(SrcIterator supperleft,
SrcIterator slowerright, SrcAccessor sa,
DestIterator dupperleft, DestAccessor da,
ProcessingFunctor func,
BorderTreatmentMode border = BORDER_TREATMENT_REPEAT);
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor,
class ProcessingFunctor>
void
applyWindowFunction(triple<SrcIterator, SrcIterator, SrcAccessor> src,
pair<DestIterator, DestAccessor> dest,
ProcessingFunctor func,
BorderTreatmentMode border = BORDER_TREATMENT_REPEAT);
}

Usage:

#include <vigra/applywindowfunction.hxx>
Namespace: vigra

unsigned int w=1000, h=1000;
MultiArray<2, float> src(w,h), dest(w,h);
...
template<class VALUETYPE>
class AvgFunctor
{
public:
MedianFunctor(Diff2D window_shape)
: m_window_shape(window_shape)
{
}
template <class SrcIterator, class SrcAccessor, class DestIterator, class DestAccessor>
void operator()(SrcIterator s, SrcAccessor s_acc, DestIterator d, DestAccessor d_acc)
{
SrcIterator s_ul = s - m_window_shape/2,
s_lr = s_ul + m_window_shape;
VALUETYPE result = NumericTraits<float>::zero();
SrcIterator ys = s_ul;
SrcIterator xs = ys;
for( ; ys.y != s_lr.y; ys.y++)
{
for(xs = ys; xs.x != s_lr.x; xs.x++, iter++)
{
res += s_acc(xs);
}
}
d_acc.set(res/(m_window_shape.x*m_window_shape.y),d);
}
Diff2D windowShape() const
{
return m_window_shape;
}
private:
Diff2D m_window_shape;
};
// create an AverageFilter function for a 5x5 filter
AvgFunctor func(Diff2D(5,5));
// apply the filter function to the input image
applyWindowFunction(src, dest, func);

Preconditions:

The image must be larger than the window size.

## ◆ rotateImage()

template<... >

void rotateImage | ( |  | ... | ) |

Rotate an image by a multiple of 90 degrees or by an arbitrary angle.

If you specify the angle as an integer which is a multiple of 90 degrees, rotateImage() just copies the pixels in the appropriate new order. It expects the destination image to have the correct shape for the desired rotation. That is, when the rotation is a multiple of 180 degrees, source and destination must have the same shape, otherwise destination must have the transposed shape of the source.

If you want to rotate by an arbitrary angle and around an arbitrary center point, you must specify the source image as a vigra::SplineImageView, which is used for interpolation at the required subpixel positions. If no center point is provided, the image center is used by default. The destination image must have the same size as the source SplineImageView.

Positive angles refer to counter-clockwise rotation, negative ones to clockwise rotation. All angles must be given in degrees.

Declarations:

pass 2D array views:

namespace vigra {
// rotate by a multiple of 90 degrees
template <class T1, class S1,
class T2, class S2>
void
rotateImage(MultiArrayView<2, T1, S1> const & src,
MultiArrayView<2, T2, S2> dest,
int rotation);
// rotate by an arbitrary angle around the given center point
template <int ORDER, class T,
class T2, class S2>
void
rotateImage(SplineImageView<ORDER, T> const & src,
MultiArrayView<2, T2, S2> dest,
double angleInDegree,
TinyVector<double, 2> const & center = (src.shape() - Shape2(1)) / 2.0);
}

show deprecated declarations

pass Image Iterators and Data Accessors :
namespace vigra {
// rotate by a multiple of 90 degrees
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor>
void
rotateImage(SrcIterator is, SrcIterator end, SrcAccessor as,
DestIterator id, DestAccessor ad, int rotation);
// rotate by an arbitrary angle around the given center point
template <int ORDER, class T,
class DestIterator, class DestAccessor>
void rotateImage(SplineImageView<ORDER, T> const & src,
DestIterator id, DestAccessor dest,
double angleInDegree, TinyVector<double, 2> const & center = (src.shape() - Shape2(1)) / 2.0);
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
// rotate by a multiple of 90 degrees
template <class SrcImageIterator, class SrcAccessor,
class DestImageIterator, class DestAccessor>
void
rotateImage(triple<SrcImageIterator, SrcImageIterator, SrcAccessor> src,
pair<DestImageIterator, DestAccessor> dest, int rotation);
// rotate by an arbitrary angle around the given center point
template <int ORDER, class T,
class DestIterator, class DestAccessor>
void
rotateImage(SplineImageView<ORDER, T> const & src,
pair<DestImageIterator, DestAccessor> dest,
double angleInDegree, TinyVector<double, 2> const & center = (src.shape() - Shape2(1)) / 2.0);
}

Usage:

#include <vigra/basicgeometry.hxx>
Namespace: vigra

// rotate counter-clockwise by 90 degrees (no interpolation required)
MultiArray<2, float> src(width, height),
dest(height, width); // note that width and height are exchanged
... // fill src
rotateImage(src, dest, 90);
// rotate clockwise by 38.5 degrees, using a SplieImageView for cubic interpolation
SplineImageView<3, float> spline(srcImageRange(src));
MultiArray<2, float> dest2(src.shape());
vigra::rotateImage(spline, dest2, -38.5);

show deprecated examples

// rotate counter-clockwise by 90 degrees (no interpolation required)
BImage src(width, height),
dest(height, width); // note that width and height are exchanged
... // fill src
rotateImage(srcImageRange(src), destImage(dest), 90);
// rotate clockwise by 38.5 degrees, using a SplieImageView for cubic interpolation
SplineImageView<3, float> spline(srcImageRange(src));
FImage dest2(width, height);
rotateImage(spline, destImage(dest), -38.5);
Required Interface:
SrcImageIterator src_upperleft, src_lowerright;
DestImageIterator dest_upperleft;
SrcAccessor src_accessor;
dest_accessor.set(src_accessor(src_upperleft), dest_upperleft);

Preconditions:

src.shape(0) > 1 && src.shape(1) > 1

## ◆ reflectImage()

template<... >

void reflectImage | ( |  | ... | ) |

Reflect image horizontally or vertically.

The reflection direction refers to the reflection axis, i.e. horizontal reflection turns the image upside down, vertical reflection changes left for right. The directions are selected by the enum values `vigra::horizontal` and `vigra::vertical`. The two directions can also be "or"ed together to perform both reflections simultaneously (see example below) – this is the same as a 180 degree rotation.

Declarations:

pass 2D array views:

namespace vigra {
template <class T1, class S1,
class T2, class S2>
void
reflectImage(MultiArrayView<2, T1, S1> const & src,
MultiArrayView<2, T2, S2> dest, Reflect reflect);
}
vigra::reflectImage
void reflectImage(...)
Reflect image horizontally or vertically.

show deprecated declarations

pass Image Iterators and Data Accessors :
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor>
void
reflectImage(SrcIterator is, SrcIterator end, SrcAccessor as,
DestIterator id, DestAccessor ad, Reflect axis);
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
template <class SrcImageIterator, class SrcAccessor,
class DestImageIterator, class DestAccessor>
void
reflectImage(triple<SrcImageIterator, SrcImageIterator, SrcAccessor> src,
pair<DestImageIterator, DestAccessor> dest, Reflect axis);
}

Usage:

#include <vigra/basicgeometry.hxx>
Namespace: vigra

MultiArray<2, float> src(width, height),
dest(width, height);
... // fill src
// reflect about both dimensions
vigra::reflectImage(src, dest, vigra::horizontal | vigra::vertical);

show deprecated examples

BImage src(width, height),
dest(width, height);
... // fill src
vigra::reflectImage(srcImageRange(src), destImage(dest), vigra::horizontal | vigra::vertical);
Required Interface:
SrcImageIterator src_upperleft, src_lowerright;
DestImageIterator dest_upperleft;
SrcAccessor src_accessor;
dest_accessor.set(src_accessor(src_upperleft), dest_upperleft);

Preconditions:

src.shape(0) > 1 && src.shape(1) > 1

## ◆ transposeImage()

template<... >

void transposeImage | ( |  | ... | ) |

Transpose an image over the major or minor diagonal.

The transposition direction refers to the axis, i.e. major transposition turns the upper right corner into the lower left one, whereas minor transposition changes the upper left corner into the lower right one. The directions are selected by the enum values `vigra::major` and `vigra::minor`. The two directions can also be "or"ed together to perform both reflections simultaneously (see example below) – this is the same as a 180 degree rotation. (Caution: When doing multi-platform development, you should be aware that some <sys/types.h> define major/minor, too. Do not omit the vigra namespace prefix.)

Note that a similar effect can be chieved by MultiArrayView::transpose(). However, the latter can only transpose about the major diagonal, and it doesn't rearrange the data

- it just creates a view with transposed axis ordering. It depends on the context which function is more appropriate.

Declarations:

pass 2D array views:

namespace vigra {
template <class T1, class S1,
class T2, class S2>
void
transposeImage(MultiArrayView<2, T1, S1> const & src,
MultiArrayView<2, T2, S2> dest, Transpose axis);
}
vigra::transposeImage
void transposeImage(...)
Transpose an image over the major or minor diagonal.

show deprecated declarations

pass Image Iterators and Data Accessors :
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor>
void
transposeImage(SrcIterator is, SrcIterator end, SrcAccessor as,
DestIterator id, DestAccessor ad, Transpose axis);
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
template <class SrcImageIterator, class SrcAccessor,
class DestImageIterator, class DestAccessor>
void
transposeImage(triple<SrcImageIterator, SrcImageIterator, SrcAccessor> src,
pair<DestImageIterator, DestAccessor> dest, Transpose axis);
}

Usage:

#include <vigra/basicgeometry.hxx>
Namespace: vigra

MultiArray<2, float> src(width, height),
dest(height, width); // note that dimensions are transposed
... // fill src
// transpose about the major diagonal
vigra::transposeImage(src, dest, vigra::major);
// this produces the same data as transposing the view
assert(dest == src.transpose());
// transposition about the minor diagonal has no correspondence in MultiArrayView
vigra::transposeImage(src, dest, vigra::minor);

show deprecated examples

BImage src(width, height),
dest(width, height);
... // fill src
// transpose about both diagonals simultaneously
vigra::transposeImage(srcImageRange(src), destImage(dest), vigra::major | vigra::minor);
Required Interface:
SrcImageIterator src_upperleft, src_lowerright;
DestImageIterator dest_upperleft;
SrcAccessor src_accessor;
dest_accessor.set(src_accessor(src_upperleft), dest_upperleft);

Preconditions:

src.shape(0) > 1 && src.shape(1) > 1

## ◆ resampleImage()

template<... >

void resampleImage | ( |  | ... | ) |

Resample image by a given factor.

This algorithm is very fast and does not require any arithmetic on the pixel types. The input image must have a size of at least 2x2. Destiniation pixels are directly copied from the appropriate source pixels. The size of the result image is the product of `factor` and the original size, where we round up if `factor < 1.0` and down otherwise. This size calculation is the main difference to the convention used in the similar function resizeImageNoInterpolation(): there, the result size is calculated as `n*(old_width-1)+1` and `n*(old_height-1)+1`. This is because resizeImageNoInterpolation() does not replicate the last pixel of every row/column in order to make it compatible with the other functions of the `resizeImage...` family.

The function can be called with different resampling factors for x and y, or with a single factor to be used for both directions.

It should also be noted that resampleImage() is implemented so that an enlargement followed by the corresponding shrinking reproduces the original image.

Declarations:

pass 2D array views:

namespace vigra {
template <class T1, class S1,
class T2, class S2>
void
resampleImage(MultiArrayView<2, T1, S1> const & src,
MultiArrayView<2, T2, S2> dest, double factor);
template <class T1, class S1,
class T2, class S2>
void
resampleImage(MultiArrayView<2, T1, S1> const & src,
MultiArrayView<2, T2, S2> dest, double xfactor, double yfactor);
}
vigra::resampleImage
void resampleImage(...)
Resample image by a given factor.

show deprecated declarations

pass Image Iterators and Data Accessors :
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor>
void
resampleImage(SrcIterator is, SrcIterator iend, SrcAccessor sa,
DestIterator id, DestAccessor ad, double factor);
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor>
void
resampleImage(SrcIterator is, SrcIterator iend, SrcAccessor sa,
DestIterator id, DestAccessor ad, double xfactor, double yfactor);
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
template <class SrcImageIterator, class SrcAccessor,
class DestImageIterator, class DestAccessor>
void
resampleImage(triple<SrcImageIterator, SrcImageIterator, SrcAccessor> src,
pair<DestImageIterator, DestAccessor> dest, double factor);
template <class SrcImageIterator, class SrcAccessor,
class DestImageIterator, class DestAccessor>
void
resampleImage(triple<SrcImageIterator, SrcImageIterator, SrcAccessor> src,
pair<DestImageIterator, DestAccessor> dest, double xfactor, double yfactor);
}

Usage:

#include <vigra/basicgeometry.hxx>
Namespace: vigra

double factor = 2.0;
MultiArray<2, float> src(width, height),
dest((int)(factor*width), (int)(factor*height)); // enlarge image by factor
... // fill src
resampleImage(src, dest, factor);

show deprecated examples

// use old API
vigra::resampleImage(srcImageRange(src), destImage(dest), factor);
Required Interface:
SrcImageIterator src_upperleft, src_lowerright;
DestImageIterator dest_upperleft;
SrcAccessor src_accessor;
dest_accessor.set(src_accessor(src_upperleft), dest_upperleft);

Preconditions:

src.shape(0) > 1 && src.shape(1) > 1

## ◆ besselJ()

double besselJ | ( | int | n,
|  | double | x
| ) |  |

Bessel function of the first kind.

Computes the value of BesselJ of integer order `n` and argument `x`. Negative `x` are unsupported and will result in a `std::domain_error`.

This function wraps a number of existing implementations and falls back to a rather slow algorithm if none of them is available. In particular, it uses boost::math when `HasBoostMath` is #defined, or native implementations on gcc and MSVC otherwise.

#include <vigra/bessel.hxx>
Namespace: vigra

## ◆ besselY()

double besselY | ( | int | n,
|  | double | x
| ) |  |

Bessel function of the second kind.

Computes the value of BesselY of integer order `n` and argument `x`. Negative `x` are unsupported and will result in a `std::domain_error`.

This function wraps a number of existing implementations and falls back to a rather slow algorithm if none of them is available. In particular, it uses boost::math when `HasBoostMath` is #defined, or native implementations on gcc and MSVC otherwise.

#include <vigra/bessel.hxx>
Namespace: vigra

## ◆ doxygen_overloaded_function()

doxygen_overloaded_function | ( | template<... > void | separableConvolveBlockwise | ) |

Separated convolution on ChunkedArrays.

Declarations:

namespace vigra {
// apply each kernel from the sequence 'kernels' in turn
template <unsigned int N, class T1, class T2, class KernelIterator>
void separableConvolveBlockwise(const ChunkedArra<N, T1>& source, ChunkedArray<N, T2>& destination, KernelIterator kernels);
// apply the same kernel to all dimensions
template <unsigned int N, class T1, class T2, class T3>
void separableConvolveBlockwise(const ChunkedArra<N, T1>& source, ChunkedArray<N, T2>& destination, Kernel1D<T3> const & kernel);
}

This function computes a separated convolution for a given ChunkedArray. For infinite precision T1, this is equivalent to separableConvolveMultiArray. In practice, floating point inaccuracies will make the result differ slightly.

## ◆ labelMultiArrayBlockwise()

template<... >

unsigned int labelMultiArrayBlockwise | ( |  | ... | ) |

Connected components labeling for MultiArrays and ChunkedArrays.

Declarations:

namespace vigra {
// assign local labels and generate mapping (local labels) -> (global labels) for each chunk
template <unsigned int N, class Data, class S1,
class Label, class S2,
class Equal, class S3>
Label labelMultiArrayBlockwise(const MultiArrayView<N, Data, S1>& data,
MultiArrayView<N, Label, S2> labels,
const BlockwiseLabelOptions& options,
Equal equal,
MultiArrayView<N, std::vector<Label>, S3>& mapping);
// assign local labels and generate mapping (local labels) -> (global labels) for each chunk
template <unsigned int N, class T, class S1,
class Label, class S2,
class EqualityFunctor>
Label labelMultiArrayBlockwise(const ChunkedArray<N, Data>& data,
ChunkedArray<N, Label>& labels,
const BlockwiseLabelOptions& options,
Equal equal,
MultiArrayView<N, std::vector<Label>, S3>& mapping);
// assign global labels
template <unsigned int N, class Data, class S1,
class Label, class S2,
class Equal>
Label labelMultiArrayBlockwise(const MultiArrayView<N, Data, S1>& data,
MultiArrayView<N, Label, S2> labels,
const BlockwiseLabelOptions& options,
Equal equal);
// assign global labels
template <unsigned int N, class T, class S1,
class Label, class S2,
class EqualityFunctor = std::equal_to<T> >
Label labelMultiArrayBlockwise(const ChunkedArray<N, Data>& data,
ChunkedArray<N, Label>& labels,
const BlockwiseLabelOptions& options = BlockwiseLabelOptions(),
Equal equal = std::equal_to<T>());
}
vigra::BlockwiseLabelOptions
Definition blockwise_labeling.hxx:69
vigra::MultiArrayView
Base class for, and view to, vigra::MultiArray.
Definition multi_array.hxx:705
vigra::labelMultiArrayBlockwise
unsigned int labelMultiArrayBlockwise(...)
Connected components labeling for MultiArrays and ChunkedArrays.

The resulting labeling is equivalent to a labeling by labelMultiArray, that is, the connected components are the same but may have different ids. NeighborhoodType and background value (if any) can be specified with the LabelOptions object. If the mapping parameter is provided, each chunk is labeled seperately and contiguously (starting at one, zero for background), with mapping containing a mapping of local labels to global labels for each chunk. Thus, the shape of 'mapping' has to be large enough to hold each chunk coordinate.

Return: the number of regions found (=largest global region label)

Usage:

#include <vigra/blockwise_labeling.hxx>
Namespace: vigra

Shape3 shape = Shape3(10);
Shape3 chunk_shape = Shape3(4);
ChunkedArrayLazy<3, int> data(shape, chunk_shape);
// fill data ...
ChunkedArrayLazy<3, size_t> labels(shape, chunk_shape);
MultiArray<3, std::vector<size_t> > mapping(Shape3(3)); // there are 3 chunks in each dimension
labelMultiArrayBlockwise(data, labels, LabelOptions().neighborhood(DirectNeighborhood).background(0),
std::equal_to<int>(), mapping);
// check out chunk in the middle
MultiArray<3, size_t> middle_chunk(Shape3(4));
labels.checkoutSubarray(Shape3(4), middle_chunk);
// print number of non-background labels assigned in middle_chunk
cout << mapping[Shape3(1)].size() << endl;
// get local label for voxel
// this may be the same value assigned to different component in another chunk
size_t local_label = middle_chunk[Shape3(2)];
// get global label for voxel
// if another voxel has the same label, they are in the same connected component albeit they may be in different chunks
size_t global_label = mapping[Shape3(1)][local_label
vigra::LabelOptions
Option object for labelMultiArray().
Definition multi_labeling.hxx:310
vigra::TinyVector
Class for fixed size vectors.
Definition tinyvector.hxx:1008
vigra::DirectNeighborhood
@ DirectNeighborhood
use only direct neighbors
Definition multi_fwd.hxx:187

## ◆ unionFindWatershedsBlockwise()

template<... >

unsigned int unionFindWatershedsBlockwise | ( |  | ... | ) |

Blockwise union-find watersheds transform for MultiArrays and ChunkedArrays.

Declaration:

namespace vigra { namespace blockwise {
template <unsigned int N, class Data, class S1,
class Label, class S2>
Label
unionFindWatershedsBlockwise(MultiArrayView<N, Data, S1> data,
MultiArrayView<N, Label, S2> labels,
BlockwiseLabelOptions const & options);
template <unsigned int N, class Data, class Label>
Label
unionFindWatershedsBlockwise(const ChunkedArray<N, Data>& data,
ChunkedArray<N, Label>& labels,
BlockwiseLabelOptions const & options = BlockwiseLabelOptions());
// provide temporary directions storage
template <unsigned int N, class Data, class Label>
Label
unionFindWatershedsBlockwise(const ChunkedArray<N, Data>& data,
ChunkedArray<N, Label>& labels,
BlockwiseLabelOptions const & options,
ChunkedArray<N, unsigned short>& temporary_storage);
}}
vigra::unionFindWatershedsBlockwise
unsigned int unionFindWatershedsBlockwise(...)
Blockwise union-find watersheds transform for MultiArrays and ChunkedArrays.

The resulting labeling is equivalent to a labeling by watershedsUnionFind, that is, the components are the same but may have different ids. If temporary_storage is provided, this array is used for intermediate result storage. Otherwise, a newly created vigra::ChunkedArrayLazy is used.

Return: the number of labels assigned (=largest label, because labels start at one)

Usage:

#include <vigra/blockwise_watersheds.hxx>
Namespace: vigra

Shape3 shape = Shape3(10);
Shape3 chunk_shape = Shape3(4);
ChunkedArrayLazy<3, int> data(shape, chunk_shape);
// fill data ...
ChunkedArrayLazy<3, size_t> labels(shape, chunk_shape);
unionFindWatershedsBlockwise(data, labels, IndirectNeighborhood);
vigra::IndirectNeighborhood
@ IndirectNeighborhood
use direct and indirect neighbors
Definition multi_fwd.hxx:188

## ◆ rieszTransformOfLOG()

template<... >

void rieszTransformOfLOG | ( |  | ... | ) |

Calculate Riesz transforms of the Laplacian of Gaussian.

The Riesz transforms of the Laplacian of Gaussian have the following transfer functions (defined in a polar coordinate representation of the frequency domain):

where n = `xorder` and m = `yorder` determine th e order of the transform, and `sigma > 0` is the scale of the Laplacian of Gaussian. This function computes a good spatial domain approximation of these transforms for `xorder + yorder <= 2`. The filter responses may be used to calculate the monogenic signal or the boundary tensor.

Declarations:

pass 2D array views:

namespace vigra {
template <class T1, class S1,
class T2, class S2>
void
rieszTransformOfLOG(MultiArrayView<2, T1, S1> const & src,
MultiArrayView<2, T2, S2> dest,
double scale, unsigned int xorder, unsigned int yorder);
}
vigra::rieszTransformOfLOG
void rieszTransformOfLOG(...)
Calculate Riesz transforms of the Laplacian of Gaussian.

show deprecated declarations

pass Image Iterators and Data Accessors :
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor>
void rieszTransformOfLOG(SrcIterator supperleft, SrcIterator slowerright, SrcAccessor src,
DestIterator dupperleft, DestAccessor dest,
double scale, unsigned int xorder, unsigned int yorder);
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor>
void rieszTransformOfLOG(triple<SrcIterator, SrcIterator, SrcAccessor> src,
pair<DestIterator, DestAccessor> dest,
double scale, unsigned int xorder, unsigned int yorder);
}

Usage:

#include <vigra/boundarytensor.hxx>
Namespace: vigra

MultiArrayView<2, double> impulse(17,17), res(17, 17);
impulse(8,8) = 1.0;
// calculate the impulse response of the first order Riesz transform in x-direction
rieszTransformOfLOG(impulse, res, 2.0, 1, 0);

## ◆ boundaryTensor()

template<... >

void boundaryTensor | ( |  | ... | ) |

Calculate the boundary tensor for a scalar valued image.

These functions calculate a spatial domain approximation of the boundary tensor as described in

U. Köthe: "Integrated Edge and Junction Detection with the Boundary Tensor", in: ICCV 03, Proc. of 9th Intl. Conf. on Computer Vision, Nice 2003, vol. 1, pp. 424-431, Los Alamitos: IEEE Computer Society, 2003

with the Laplacian of Gaussian as the underlying bandpass filter (see rieszTransformOfLOG()). The output image must have 3 bands which will hold the tensor components in the order t11, t12 (== t21), t22. The function boundaryTensor1() with the same interface implements a variant of the boundary tensor where the 0th-order Riesz transform has been dropped, so that the tensor is no longer sensitive to blobs.

Declarations:

pass 2D array views:

namespace vigra {
template <class T1, class S1,
class T2, class S2>
void
boundaryTensor(MultiArrayView<2, T1, S1> const & src,
MultiArrayView<2, T2, S2> dest,
double scale);
}
vigra::boundaryTensor
void boundaryTensor(...)
Calculate the boundary tensor for a scalar valued image.

show deprecated declarations

pass Image Iterators and Data Accessors :
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor>
void boundaryTensor(SrcIterator supperleft, SrcIterator slowerright, SrcAccessor src,
DestIterator dupperleft, DestAccessor dest,
double scale);
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor>
void boundaryTensor(triple<SrcIterator, SrcIterator, SrcAccessor> src,
pair<DestIterator, DestAccessor> dest,
double scale);
}

Usage:

#include <vigra/boundarytensor.hxx>
Namespace: vigra

MultiArray<2, float> img(w,h);
MultiArray<2, TinyVector<float, 3> bt(w,h);
...
boundaryTensor(img, bt, 2.0);

## ◆ boundaryTensor1()

template<... >

void boundaryTensor1 | ( |  | ... | ) |

Boundary tensor variant.

This function implements a variant of the boundary tensor where the 0th-order Riesz transform has been dropped, so that the tensor is no longer sensitive to blobs. See boundaryTensor() for more detailed documentation.

Declarations:

#include <vigra/boundarytensor.hxx>
Namespace: vigra

pass 2D array views:

namespace vigra {
template <class T1, class S1,
class T2, class S2>
void
boundaryTensor1(MultiArrayView<2, T1, S1> const & src,
MultiArrayView<2, T2, S2> dest,
double scale);
}
vigra::boundaryTensor1
void boundaryTensor1(...)
Boundary tensor variant.

show deprecated declarations

pass Image Iterators and Data Accessors :
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor>
void boundaryTensor1(SrcIterator supperleft, SrcIterator slowerright, SrcAccessor src,
DestIterator dupperleft, DestAccessor dest,
double scale);
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor>
void boundaryTensor1(triple<SrcIterator, SrcIterator, SrcAccessor> src,
pair<DestIterator, DestAccessor> dest,
double scale);
}

## ◆ polar2Lab()

TinyVector< float, 3 > polar2Lab | ( | double | color,
|  | double | brightness,
|  | double | saturation
| ) |  |

Init L*a*b* color triple from polar representation.

#include <vigra/colorconversions.hxx>
Namespace: vigra

Declarations:

TinyVector<float, 3>
polar2Lab(double color, double brightness, double saturation);
TinyVector<float, 3>
polar2Lab(TinyVector<float, 3> const & polar);
vigra::polar2Lab
TinyVector< float, 3 > polar2Lab(double color, double brightness, double saturation)
Init L*a*b* color triple from polar representation.
Definition colorconversions.hxx:2937

- color - the color angle in degrees
- brightness - between 0 and 1
- saturation - between 0 and 1

L*a*b* polar coordinates of some important colors:

black = [*, 0, 0] * - arbitrary
white = [*, 1, 0] * - arbitrary
red = [ 0, 0.532406, 0.781353]
yellow = [62.8531, 0.971395, 0.724189]
green = [96.0184, 0.877351, 0.895108]
cyan = [156.378, 0.911133, 0.374577]
blue = [266.287, 0.322957, 0.999997]
magenta = [288.237, 0.603235, 0.863482]

## ◆ lab2Polar()

template<class V >

TinyVector< float, 3 > lab2Polar | ( | V const & | lab | ) |

Create polar representation form L*a*b*.

Declaration:

namespace vigra {
TinyVector<float, 3> lab2Polar(TinyVector<float, 3> const & lab);
}
vigra::lab2Polar
TinyVector< float, 3 > lab2Polar(V const &lab)
Create polar representation form L*a*b*.
Definition colorconversions.hxx:2975

#include <vigra/colorconversions.hxx>
Namespace: vigra

This realizes the inverse of the transformation described in polar2Lab().

## ◆ polar2Luv()

TinyVector< float, 3 > polar2Luv | ( | double | color,
|  | double | brightness,
|  | double | saturation
| ) |  |

Init L*u*v* color triple from polar representation.

#include <vigra/colorconversions.hxx>
Namespace: vigra

Declarations:

TinyVector<float, 3>
polar2Luv(double color, double brightness, double saturation);
TinyVector<float, 3>
polar2Luv(TinyVector<float, 3> const & polar);
vigra::polar2Luv
TinyVector< float, 3 > polar2Luv(double color, double brightness, double saturation)
Init L*u*v* color triple from polar representation.
Definition colorconversions.hxx:3023

- color - the color angle in degrees
- brightness - between 0 and 1
- saturation - between 0 and 1

L*u*v* polar coordinates of some important colors:

black = [*, 0, 0] * - arbitrary
white = [*, 1, 0] * - arbitrary
red = [ 0, 0.532406, 1]
yellow = [ 73.7, 0.971395, 0.597953]
green = [115.552, 0.877351, 0.758352]
cyan = [ 180.0, 0.911133, 0.402694]
blue = [ 253.7, 0.322957, 0.729883]
magenta = [295.553, 0.603235, 0.767457]

## ◆ luv2Polar()

template<class V >

TinyVector< float, 3 > luv2Polar | ( | V const & | luv | ) |

Create polar representation form L*u*v*.

Declaration:

namespace vigra {
TinyVector<float, 3> luv2Polar(TinyVector<float, 3> const & luv);
}
vigra::luv2Polar
TinyVector< float, 3 > luv2Polar(V const &luv)
Create polar representation form L*u*v*.
Definition colorconversions.hxx:3060

#include <vigra/colorconversions.hxx>
Namespace: vigra

This realizes the inverse of the transformation described in polar2Luv().

## ◆ polar2YPrimePbPr()

TinyVector< float, 3 > polar2YPrimePbPr | ( | double | color,
|  | double | brightness,
|  | double | saturation
| ) |  |

Init Y'PbPr color triple from polar representation.

#include <vigra/colorconversions.hxx>
Namespace: vigra

Declarations:

TinyVector<float, 3>
polar2YPrimePbPr(double color, double brightness, double saturation);
TinyVector<float, 3>
polar2YPrimePbPr(TinyVector<float, 3> const & polar);
vigra::polar2YPrimePbPr
TinyVector< float, 3 > polar2YPrimePbPr(double color, double brightness, double saturation)
Init Y'PbPr color triple from polar representation.
Definition colorconversions.hxx:3108

- color - the color angle in degrees
- brightness - between 0 and 1
- saturation - between 0 and 1

Y'PbPr polar coordinates of some important colors:

black = [*, 0, 0] * - arbitrary
white = [*, 1, 0] * - arbitrary
red = [ 0, 0.299, 0.988419]
yellow = [62.1151, 0.886, 0.948831]
green = [123.001, 0.587, 1]
cyan = [ 180.0, 0.701, 0.988419]
blue = [242.115, 0.114, 0.948831]
magenta = [303.001, 0.413, 1]

## ◆ yPrimePbPr2Polar()

template<class V >

TinyVector< float, 3 > yPrimePbPr2Polar | ( | V const & | ypbpr | ) |

Create polar representation form Y'PbPr.

Declaration:

namespace vigra {
TinyVector<float, 3> yPrimePbPr2Polar(TinyVector<float, 3> const & ypbpr);
}
vigra::yPrimePbPr2Polar
TinyVector< float, 3 > yPrimePbPr2Polar(V const &ypbpr)
Create polar representation form Y'PbPr.
Definition colorconversions.hxx:3145

#include <vigra/colorconversions.hxx>
Namespace: vigra

This realizes the inverse of the transformation described in polar2YPrimePbPr().

## ◆ polar2YPrimeCbCr()

TinyVector< float, 3 > polar2YPrimeCbCr | ( | double | color,
|  | double | brightness,
|  | double | saturation
| ) |  |

Init Y'CbCr color triple from polar representation.

#include <vigra/colorconversions.hxx>
Namespace: vigra

Declarations:

TinyVector<float, 3>
polar2YPrimeCbCr(double color, double brightness, double saturation);
TinyVector<float, 3>
polar2YPrimeCbCr(TinyVector<float, 3> const & polar);
vigra::polar2YPrimeCbCr
TinyVector< float, 3 > polar2YPrimeCbCr(double color, double brightness, double saturation)
Init Y'CbCr color triple from polar representation.
Definition colorconversions.hxx:3193

- color - the color angle in degrees
- brightness - between 0 and 1
- saturation - between 0 and 1

Y'CbCr polar coordinates of some important colors:

black = [*, 0, 0] * - arbitrary
white = [*, 1, 0] * - arbitrary
red = [ 0, 0.299, 0.988419]
yellow = [62.1151, 0.886, 0.948831]
green = [123.001, 0.587, 1]
cyan = [ 180.0, 0.701, 0.988419]
blue = [242.115, 0.114, 0.948831]
magenta = [303.001, 0.413, 1]

## ◆ yPrimeCbCr2Polar()

template<class V >

TinyVector< float, 3 > yPrimeCbCr2Polar | ( | V const & | ycbcr | ) |

Create polar representation form Y'CbCr.

Declaration:

namespace vigra {
TinyVector<float, 3> yPrimeCbCr2Polar(TinyVector<float, 3> const & ycbcr);
}
vigra::yPrimeCbCr2Polar
TinyVector< float, 3 > yPrimeCbCr2Polar(V const &ycbcr)
Create polar representation form Y'CbCr.
Definition colorconversions.hxx:3230

#include <vigra/colorconversions.hxx>
Namespace: vigra

This realizes the inverse of the transformation described in polar2YPrimeCbCr().

## ◆ polar2YPrimeIQ()

TinyVector< float, 3 > polar2YPrimeIQ | ( | double | color,
|  | double | brightness,
|  | double | saturation
| ) |  |

Init Y'IQ color triple from polar representation.

#include <vigra/colorconversions.hxx>
Namespace: vigra

Declarations:

TinyVector<float, 3>
polar2YPrimeIQ(double color, double brightness, double saturation);
TinyVector<float, 3>
polar2YPrimeIQ(TinyVector<float, 3> const & polar);
vigra::polar2YPrimeIQ
TinyVector< float, 3 > polar2YPrimeIQ(double color, double brightness, double saturation)
Init Y'IQ color triple from polar representation.
Definition colorconversions.hxx:3280

- color - the color angle in degrees
- brightness - between 0 and 1
- saturation - between 0 and 1

Y'IQ polar coordinates of some important colors:

black = [*, 0, 0] * - arbitrary
white = [*, 1, 0] * - arbitrary
red = [ 0, 0.299, 1]
yellow = [63.5851, 0.886, 0.707681]
green = [137.231, 0.587, 0.933362]
cyan = [ 180.0, 0.701, 1]
blue = [243.585, 0.114, 0.707681]
magenta = [317.231, 0.413, 0.933362]

## ◆ yPrimeIQ2Polar()

template<class V >

TinyVector< float, 3 > yPrimeIQ2Polar | ( | V const & | yiq | ) |

Create polar representation form Y'IQ.

Declaration:

namespace vigra {
TinyVector<float, 3> yPrimeIQ2Polar(TinyVector<float, 3> const & yiq);
}
vigra::yPrimeIQ2Polar
TinyVector< float, 3 > yPrimeIQ2Polar(V const &yiq)
Create polar representation form Y'IQ.
Definition colorconversions.hxx:3317

#include <vigra/colorconversions.hxx>
Namespace: vigra

This realizes the inverse of the transformation described in polar2YPrimeIQ().

## ◆ polar2YPrimeUV()

TinyVector< float, 3 > polar2YPrimeUV | ( | double | color,
|  | double | brightness,
|  | double | saturation
| ) |  |

Init Y'UV color triple from polar representation.

#include <vigra/colorconversions.hxx>
Namespace: vigra

Declarations:

TinyVector<float, 3>
polar2YPrimeUV(double color, double brightness, double saturation);
TinyVector<float, 3>
polar2YPrimeUV(TinyVector<float, 3> const & polar);
vigra::polar2YPrimeUV
TinyVector< float, 3 > polar2YPrimeUV(double color, double brightness, double saturation)
Init Y'UV color triple from polar representation.
Definition colorconversions.hxx:3365

- color - the color angle in degrees
- brightness - between 0 and 1
- saturation - between 0 and 1

Y'UV polar coordinates of some important colors:

black = [*, 0, 0] * - arbitrary
white = [*, 1, 0] * - arbitrary
red = [ 0, 0.299, 1]
yellow = [63.5851, 0.886, 0.707681]
green = [137.231, 0.587, 0.933362]
cyan = [ 180.0, 0.701, 1]
blue = [243.585, 0.114, 0.707681]
magenta = [317.231, 0.413, 0.933362]

## ◆ yPrimeUV2Polar()

template<class V >

TinyVector< float, 3 > yPrimeUV2Polar | ( | V const & | yuv | ) |

Create polar representation form Y'UV.

Declaration:

namespace vigra {
TinyVector<float, 3> yPrimeUV2Polar(TinyVector<float, 3> const & yuv);
}
vigra::yPrimeUV2Polar
TinyVector< float, 3 > yPrimeUV2Polar(V const &yuv)
Create polar representation form Y'UV.
Definition colorconversions.hxx:3402

#include <vigra/colorconversions.hxx>
Namespace: vigra

This realizes the inverse of the transformation described in polar2YPrimeUV().

## ◆ combineTwoImages()

template<... >

void combineTwoImages | ( |  | ... | ) |

Combine two source images into destination image.

After the introduction of arithmetic and algebraic array expressions, this function is rarely needed. Moreover, combineTwoMultiArrays() provides the same functionality for arbitrary dimensional arrays.

The transformation given by the functor is applied to the source pixels and the result written into the corresponding destination pixel. This is typically used for operations like add and subtract. Note that the binary functors of the STL can be used in addition to the functors specifically defined in Functors to Combine Images. Creation of new functors is easiest by using Functor Expressions
.

Declarations:

pass 2D array views:

namespace vigra {
template <class T11, class S11,
class T12, class S12,
class T2, class S2,
class Functor>
void
combineTwoImages(MultiArrayView<2, T11, S11> const & src1,
MultiArrayView<2, T12, S12> const & src2,
MultiArrayView<2, T2, S2> dest,
Functor const & f);
}
vigra::combineTwoImages
void combineTwoImages(...)
Combine two source images into destination image.

show deprecated declarations

pass Image Iterators and Data Accessors :
namespace vigra {
template <class SrcImageIterator1, class SrcAccessor1,
class SrcImageIterator2, class SrcAccessor2,
class DestImageIterator, class DestAccessor,
class Functor>
void
combineTwoImages(SrcImageIterator1 src1_upperleft,
SrcImageIterator1 src1_lowerright, SrcAccessor1 sa1,
SrcImageIterator2 src2_upperleft, SrcAccessor2 sa2,
DestImageIterator dest_upperleft, DestAccessor da,
Functor const & f)
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
template <class SrcImageIterator1, class SrcAccessor1,
class SrcImageIterator2, class SrcAccessor2,
class DestImageIterator, class DestAccessor,
class Functor>
void
combineTwoImages(triple<SrcImageIterator1, SrcImageIterator1, SrcAccessor1> src1,
pair<SrcImageIterator2, SrcAccessor2> src2,
pair<DestImageIterator, DestAccessor> dest,
Functor const & f)
}

Usage:

#include <vigra/combineimages.hxx>
Namespace: vigra

#include <functional> // for plus
MultiArray<2, float> src1(width, height), src2(width, height),
dest(width, height);
... // fill source images
combineTwoImages(src1, src2, dest,
std::plus<float>());

show deprecated examples

#include <functional> // for plus
FImage src1(width, height), src2(width, height),
dest(width, height);
... // fill source images
vigra::combineTwoImages(
srcIterRange(src1.upperLeft(), src1.lowerRight()),
srcIter(src2.upperLeft()),
destIter(dest.upperLeft()),
std::plus<float>());
Required Interface:
SrcImageIterator1 src1_upperleft, src1_lowerright;
SrcImageIterator2 src2_upperleft;
DestImageIterator dest_upperleft;
SrcImageIterator1::row_iterator sx1 = src1_upperleft.rowIterator();
SrcImageIterator2::row_iterator sx2 = src2_upperleft.rowIterator();
DestImageIterator::row_iterator dx = dest_upperleft.rowIterator();
SrcAccessor1 src1_accessor;
SrcAccessor2 src2_accessor;
DestAccessor dest_accessor;
Functor functor;
dest_accessor.set(
functor(src1_accessor(sx1), src2_accessor(sx2)),
dx);

See also
  Functors to Transform Images, vigra::multi_math, Functor Expressions

## ◆ combineTwoImagesIf()

template<... >

void combineTwoImagesIf | ( |  | ... | ) |

Combine ROI of two source images into destination image.

The transformation given by the functor is applied to all source pixels in the ROI (i.e. whenever the corresponding value of the mask array is non-zero) and the result written into the corresponding destination pixel. This is typically used for operations like add and subtract. Note that the binary functors of the STL can be used in addition to the functors specifically defined in Functors to Combine Images. Creation of new functors is easiest by using Functor Expressions
.

Declarations:

pass 2D array views:

namespace vigra {
template <class T11, class S11,
class T12, class S12,
class TM, class SM,
class T2, class S2,
class Functor>
void
combineTwoImagesIf(MultiArrayView<2, T11, S11> const & src1,
MultiArrayView<2, T12, S12> const & src2,
MultiArrayView<2, TM, SM> const & mask,
MultiArrayView<2, T2, S2> dest,
Functor const & f);
}
vigra::combineTwoImagesIf
void combineTwoImagesIf(...)
Combine ROI of two source images into destination image.

show deprecated declarations

pass Image Iterators and Data Accessors :
namespace vigra {
template <class SrcImageIterator1, class SrcAccessor1,
class SrcImageIterator2, class SrcAccessor2,
class MaskImageIterator, class MaskAccessor,
class DestImageIterator, clas DestAccessor,
class Functor>
void
combineTwoImagesIf(SrcImageIterator1 src1_upperleft,
SrcImageIterator1 src1_lowerright, SrcAccessor1 sa1,
SrcImageIterator2 src2_upperleft, SrcAccessor2 sa2,
MaskImageIterator mask_upperleft, MaskAccessor ma,
DestImageIterator dest_upperleft, DestAccessor da,
Functor const & f)
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
template <class SrcImageIterator1, class SrcAccessor1,
class SrcImageIterator2, class SrcAccessor2,
class MaskImageIterator, class MaskAccessor,
class DestImageIterator, clas DestAccessor,
class Functor>
void
combineTwoImagesIf(triple<SrcImageIterator1, SrcImageIterator1, SrcAccessor1> src1,
pair<SrcImageIterator2, SrcAccessor2> src2,
pair<MaskImageIterator, MaskAccessor> mask,
pair<DestImageIterator, DestAccessor> dest,
Functor const & f)
}

Usage:

#include <vigra/combineimages.hxx>
Namespace: vigra

#include <functional> // for plus
MultiArray<2, float> src1(width, height), src2(width, height), mask(width, height),
dest(width, height);
... // fill source and mask images
combineTwoImagesIf(src1, src2, mask, dest,
std::plus<float>());

show deprecated examples

#include <functional> // for plus
FImage src1(width, height), src2(width, height), mask(width, height),
dest(width, height);
... // fill source and mask images
vigra::combineTwoImagesIf(
srcIterRange(src1.upperLeft(), src1.lowerRight()),
srcIter(src2.upperLeft()),
maskIter(mask.upperLeft()),
destIter(dest.upperLeft()),
std::plus<SrcValueType>());
Required Interface:
SrcImageIterator1 src1_upperleft, src1_lowerright;
SrcImageIterator2 src2_upperleft;
MaskImageIterator mask_upperleft;
DestImageIterator dest_upperleft;
SrcImageIterator1::row_iterator sx1 = src1_upperleft.rowIterator();
SrcImageIterator2::row_iterator sx2 = src2_upperleft.rowIterator();
MaskImageIterator::row_iterator mx = mask_upperleft.rowIterator();
DestImageIterator::row_iterator dx = dest_upperleft.rowIterator();
SrcAccessor1 src1_accessor;
SrcAccessor2 src2_accessor;
MaskAccessor mask_accessor;
DestAccessor dest_accessor;
Functor functor;
if(mask_accessor(mx))
dest_accessor.set(
functor(src1_accessor(sx1), src2_accessor(sx2)),
dx);

See also
  Functors to Transform Images, vigra::multi_math, Functor Expressions

## ◆ combineThreeImages()

template<... >

void combineThreeImages | ( |  | ... | ) |

Combine three source images into destination image.

After the introduction of arithmetic and algebraic array expressions, this function is rarely needed. Moreover, combineThreeMultiArrays() provides the same functionality for arbitrary dimensional arrays.

The transformation given by the functor is applied to the source pixels and the result written into the corresponding destination pixel. Creation of new functors is easiest by using Functor Expressions
.

Declarations:

pass 2D array views:

namespace vigra {
template <class T11, class S11,
class T12, class S12,
class T13, class S13,
class T2, class S2,
class Functor>
void
combineThreeImages(MultiArrayView<2, T11, S11> const & src1,
MultiArrayView<2, T12, S12> const & src2,
MultiArrayView<2, T13, S13> const & src3,
MultiArrayView<2, T2, S2> dest,
Functor const & f);
}
vigra::combineThreeImages
void combineThreeImages(...)
Combine three source images into destination image.

show deprecated declarations

pass Image Iterators and Data Accessors :
namespace vigra {
template <class SrcImageIterator1, class SrcAccessor1,
class SrcImageIterator2, class SrcAccessor2,
class SrcImageIterator3, class SrcAccessor3,
class DestImageIterator, class DestAccessor,
class Functor>
void
combineThreeImages(SrcImageIterator1 src1_upperleft,
SrcImageIterator1 src1_lowerright, SrcAccessor1 sa1,
SrcImageIterator2 src2_upperleft, SrcAccessor2 sa2,
SrcImageIterator3 src2_upperleft, SrcAccessor3 sa3,
DestImageIterator dest_upperleft, DestAccessor da,
Functor const & f)
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
template <class SrcImageIterator1, class SrcAccessor1,
class SrcImageIterator2, class SrcAccessor2,
class SrcImageIterator3, class SrcAccessor3,
class DestImageIterator, class DestAccessor,
class Functor>
void
combineThreeImages(triple<SrcImageIterator1, SrcImageIterator1, SrcAccessor1> src1,
pair<SrcImageIterator2, SrcAccessor2> src2,
pair<SrcImageIterator3, SrcAccessor3> src3,
pair<DestImageIterator, DestAccessor> dest,
Functor const & f)
}

Usage:

#include <vigra/combineimages.hxx>
Namespace: vigra

#include <vigra/functorexpression.hxx>
MultiArray<2, float> src1(width, height), src2(width, height), src3(width, height),
dest(width, height);
... // fill source images
using namespace vigra::functor; // activate VIGRA's lambda library
combineThreeImages(src1, src2, src3, dest,
Arg1()*exp(-abs(Arg2()-Arg3())));

show deprecated examples

FImage src1(width, height), src2(width, height), src3(width, height),
dest(width, height);
... // fill source images
vigra::combineThreeImages(
srcIterRange(src1.upperLeft(), src1.lowerRight()),
srcIter(src2.upperLeft()),
srcIter(src3.upperLeft()),
destIter(dest.upperLeft()),
SomeThreeArgumentFunctor());
Required Interface:
SrcImageIterator1 src1_upperleft, src1_lowerright;
SrcImageIterator2 src2_upperleft;
SrcImageIterator3 src3_upperleft;
DestImageIterator dest_upperleft;
SrcImageIterator1::row_iterator sx1 = src1_upperleft.rowIterator();
SrcImageIterator2::row_iterator sx2 = src2_upperleft.rowIterator();
SrcImageIterator3::row_iterator sx3 = src3_upperleft.rowIterator();
DestImageIterator::row_iterator dx = dest_upperleft.rowIterator();
SrcAccessor1 src1_accessor;
SrcAccessor2 src2_accessor;
SrcAccessor3 src3_accessor;
DestAccessor dest_accessor;
Functor functor;
dest_accessor.set(
functor(src1_accessor(sx1),
src2_accessor(sx2),
src3_accessor(sx3)),
dx);

See also
  Functors to Transform Images, vigra::multi_math, Functor Expressions

## ◆ compress()

void compress | ( | char const * | source,
|  | std::size_t | size,
|  | ArrayVector< char > & | dest,
|  | CompressionMethod | method
| ) |  |

Compress the source buffer.

The destination array will be resized as required.

## ◆ uncompress()

void uncompress | ( | char const * | source,
|  | std::size_t | srcSize,
|  | char * | dest,
|  | std::size_t | destSize,
|  | CompressionMethod | method
| ) |  |

Uncompress the source buffer when the uncompressed size is known.

The destination buffer must be allocated to the correct size.

## ◆ convolveImage()

template<... >

void convolveImage | ( |  | ... | ) |

Convolve an image with the given kernel(s).

If you pass vigra::Kernel2D to this function, it will perform an explicit 2-dimensional convolution. If you pass a single vigra::Kernel1D, it performs a separable convolution, i.e. it concatenates two 1D convolutions (along the x-axis and along the y-axis) with the same kernel via internal calls to separableConvolveX() and separableConvolveY(). If two 1D kernels are specified, separable convolution uses different kernels for the x- and y-axis.

All border treatment modes are supported.

The input pixel type `T1` must be a linear space over the kernel's value_type `T`, i.e. addition of source values, multiplication with kernel values, and NumericTraits must be defined. The kernel's value_type must be an algebraic field, i.e. the arithmetic operations (+, -, *, /) and NumericTraits must be defined. Typically, you will use `double` for the kernel type.

Declarations:

pass 2D array views:

namespace vigra {
// use the same 1D kernel for all axes
template <class T1, class S1,
class T2, class S2,
class T>
void
convolveImage(MultiArrayView<2, T1, S1> const & src,
MultiArrayView<2, T2, S2> dest,
Kernel1D<T> const & k);
// use a different kernel for each axis
template <class T1, class S1,
class T2, class S2,
class T>
void
convolveImage(MultiArrayView<2, T1, S1> const & src,
MultiArrayView<2, T2, S2> dest,
Kernel1D<T> const & kx, Kernel1D<T> const & ky);
// use a non-separable 2D kernel
template <class T1, class S1,
class T2, class S2,
class T3>
void
convolveImage(MultiArrayView<2, T1, S1> const & src,
MultiArrayView<2, T2, S2> dest,
Kernel2D<T3> const & kernel);
}
vigra::convolveImage
void convolveImage(...)
Convolve an image with the given kernel(s).

show deprecated declarations

pass Image Iterators and Data Accessors :
namespace vigra {
// use a different kernel for each axis
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor,
class T>
void convolveImage(SrcIterator supperleft,
SrcIterator slowerright, SrcAccessor sa,
DestIterator dupperleft, DestAccessor da,
Kernel1D<T> const & kx, Kernel1D<T> const & ky);
// use a non-separable 2D kernel
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor,
class KernelIterator, class KernelAccessor>
void convolveImage(SrcIterator src_ul, SrcIterator src_lr, SrcAccessor src_acc,
DestIterator dest_ul, DestAccessor dest_acc,
KernelIterator ki, KernelAccessor ak,
Diff2D kul, Diff2D klr, BorderTreatmentMode border);
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
// use a different kernel for each axis
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor,
class T>
void
convolveImage(triple<SrcIterator, SrcIterator, SrcAccessor> src,
pair<DestIterator, DestAccessor> dest,
Kernel1D<T> const & kx, Kernel1D<T> const & ky);
// use a non-separable 2D kernel
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor,
class KernelIterator, class KernelAccessor>
void convolveImage(triple<SrcIterator, SrcIterator, SrcAccessor> src,
pair<DestIterator, DestAccessor> dest,
tuple5<KernelIterator, KernelAccessor, Diff2D, Diff2D,
BorderTreatmentMode> kernel);
}

Usage:

#include <vigra/convolution.hxx>
Namespace: vigra

MultiArray<2, float> src(w,h), dest1(w,h), dest2(w,h);
...
// create horizontal sobel filter (symmetric difference in x-direction, smoothing in y direction)
Kernel1D<double> kx, ky;
kx.initSymmetricDifference();
ky.initBinomial(1);
// calls separable convolution with the two 1D kernels
convolveImage(src, dest1, kx, ky);
// create a 3x3 Laplacian filter
Kernel2D<double> laplace;
laplace.initExplicitly(Diff2D(-1,-1), Diff2D(1,1)) =
0.375, 0.25, 0.375,
0.25, -2.5, 0.25,
0.375, 0.25, 0.375;
// calls 2D convolution
convolveImage(src, dest2, laplace);

show deprecated examples

vigra::FImage src(w,h), dest(w,h);
...
// create horizontal sobel filter (symmetric difference in x-direction, smoothing in y direction)
Kernel1D<double> kx, ky;
kx.initSymmetricDifference();
ky.initBinomial(1);
// calls separable convolution with the two 1D kernels
vigra::convolveImage(srcImageRange(src), destImage(dest), kx, ky);
// create a 3x3 Laplacian filter
Kernel2D<double> laplace;
laplace.initExplicitly(Diff2D(-1,-1), Diff2D(1,1)) =
0.375, 0.25, 0.375,
0.25, -2.5, 0.25,
0.375, 0.25, 0.375;
// calls 2D convolution
vigra::convolveImage(srcImageRange(src), destImage(dest), kernel2d(laplace));

Preconditions:

The image must be larger than the kernel radius.

- For 1D kernels, `w > std::max(xkernel.right(), -xkernel.keft())` and `h > std::max(ykernel.right(), -ykernel.left())` are required.
- For 2D kernels, `w > std::max(kernel.lowerRight().x, -kernel.upperLeft().x)` and `h > std::max(kernel.lowerRight().y, -kernel.upperLeft().y)` are required.

If `BORDER_TREATMENT_CLIP` is requested: the sum of kernel elements must be != 0.

## ◆ simpleSharpening()

template<... >

void simpleSharpening | ( |  | ... | ) |

Perform simple sharpening function.

This function uses convolveImage() with the following 3x3 filter:

-sharpening_factor/16.0, -sharpening_factor/8.0, -sharpening_factor/16.0,
-sharpening_factor/8.0, 1.0+sharpening_factor*0.75, -sharpening_factor/8.0,
-sharpening_factor/16.0, -sharpening_factor/8.0, -sharpening_factor/16.0;

and uses `BORDER_TREATMENT_REFLECT` as border treatment mode.

Preconditions:

1. sharpening_factor >= 0
2. scale >= 0

Declarations:

pass 2D array views:

namespace vigra {
template <class T1, class S1,
class T2, class S2>
void
simpleSharpening(MultiArrayView<2, T1, S1> const & src,
MultiArrayView<2, T2, S2> dest,
double sharpening_factor);
}
vigra::simpleSharpening
void simpleSharpening(...)
Perform simple sharpening function.

show deprecated declarations

pass Image Iterators and Data Accessors :
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor>
void simpleSharpening(SrcIterator src_ul, SrcIterator src_lr, SrcAccessor src_acc,
DestIterator dest_ul, DestAccessor dest_acc, double sharpening_factor);
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor>
void simpleSharpening(triple<SrcIterator, SrcIterator, SrcAccessor> src,
pair<DestIterator, DestAccessor> dest, double sharpening_factor);
}

Usage:

#include <vigra/convolution.hxx>
Namespace: vigra

MultiArray<2, float> src(w,h), dest(w,h);
...
// sharpening with sharpening_factor = 0.1
vigra::simpleSharpening(src, dest, 0.1);

show deprecated examples

vigra::FImage src(w,h), dest(w,h);
...
// sharpening with sharpening_factor = 0.1
vigra::simpleSharpening(srcImageRange(src), destImage(dest), 0.1);

## ◆ gaussianSharpening()

template<... >

void gaussianSharpening | ( |  | ... | ) |

Perform sharpening function with gaussian filter.

This function uses gaussianSmoothing() at the given scale to create a temporary image 'smooth' and than blends the original and smoothed image according to the formula

dest = (1 + sharpening_factor)*src - sharpening_factor*smooth

Preconditions:

1. sharpening_factor >= 0
2. scale >= 0

Declarations:

pass 2D array views:

namespace vigra {
template <class T1, class S1,
class T2, class S2>
void
gaussianSharpening(MultiArrayView<2, T1, S1> const & src,
MultiArrayView<2, T2, S2> dest,
double sharpening_factor,
double scale);
}
vigra::gaussianSharpening
void gaussianSharpening(...)
Perform sharpening function with gaussian filter.

show deprecated declarations

pass Image Iterators and Data Accessors :
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor>
void gaussianSharpening(SrcIterator src_ul, SrcIterator src_lr, SrcAccessor src_acc,
DestIterator dest_ul, DestAccessor dest_acc,
double sharpening_factor, double scale)
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor>
void gaussianSharpening(triple<SrcIterator, SrcIterator, SrcAccessor> src,
pair<DestIterator, DestAccessor> dest,
double sharpening_factor, double scale)
}

Usage:

#include <vigra/convolution.hxx>
Namespace: vigra

MultiArray<2, float> src(w,h), dest(w,h);
...
// sharpening with sharpening_factor = 3.0
// smoothing with scale = 0.5
gaussianSharpening(src, dest, 3.0, 0.5);

show deprecated examples

vigra::FImage src(w,h), dest(w,h);
...
// sharpening with sharpening_factor = 3.0
// smoothing with scale = 0.5
vigra::gaussianSharpening(srcImageRange(src), destImage(dest), 3.0, 0.5);

## ◆ gaussianSmoothing()

template<... >

void gaussianSmoothing | ( |  | ... | ) |

Perform isotropic Gaussian convolution.

This function is a shorthand for the concatenation of a call to separableConvolveX() and separableConvolveY() with a Gaussian kernel of the given scale. If two scales are provided, smoothing in x and y direction will have different strength. The function uses `BORDER_TREATMENT_REFLECT`.

Function gaussianSmoothMultiArray() performs the same filter operation on arbitrary dimensional arrays.

Declarations:

pass 2D array views:

namespace vigra {
template <class T1, class S1,
class T2, class S2>
void
gaussianSmoothing(MultiArrayView<2, T1, S1> const & src,
MultiArrayView<2, T2, S2> dest,
double scale_x, double scale_y = scale_x);
}
vigra::gaussianSmoothing
void gaussianSmoothing(...)
Perform isotropic Gaussian convolution.

show deprecated declarations

pass Image Iterators and Data Accessors :
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor>
void gaussianSmoothing(SrcIterator supperleft,
SrcIterator slowerright, SrcAccessor sa,
DestIterator dupperleft, DestAccessor da,
double scale_x, double scale_y = scale_x);
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor>
void
gaussianSmoothing(triple<SrcIterator, SrcIterator, SrcAccessor> src,
pair<DestIterator, DestAccessor> dest,
double scale_x, double scale_y = scale_x);
}

Usage:

#include <vigra/convolution.hxx>
Namespace: vigra

MultiArray<2, float> src(w,h), dest(w,h);
...
// smooth with scale = 3.0
gaussianSmoothing(src, dest, 3.0);

show deprecated examples

vigra::FImage src(w,h), dest(w,h);
...
// smooth with scale = 3.0
vigra::gaussianSmoothing(srcImageRange(src), destImage(dest), 3.0);

## ◆ gaussianGradient()

template<... >

void gaussianGradient | ( |  | ... | ) |

Calculate the gradient vector by means of a 1st derivatives of Gaussian filter.

This function is a shorthand for the concatenation of a call to separableConvolveX() and separableConvolveY() with the appropriate kernels at the given scale. Note that this function can either produce two separate result images for the x- and y-components of the gradient, or write into a vector valued image (with at least two components).

Function gaussianGradientMultiArray() performs the same filter operation on arbitrary dimensional arrays.

Declarations:

pass 2D array views:

namespace vigra {
// write x and y component of the gradient into separate images
template <class T1, class S1,
class T2X, class S2X,
class T2Y, class S2Y>
void
gaussianGradient(MultiArrayView<2, T1, S1> const & src,
MultiArrayView<2, T2X, S2X> destx,
MultiArrayView<2, T2Y, S2Y> desty,
double scale);
// write x and y component of the gradient into a vector-valued image
template <class T1, class S1,
class T2, class S2>
void
gaussianGradient(MultiArrayView<2, T1, S1> const & src,
MultiArrayView<2, TinyVector<T2, 2>, S2> dest,
double scale);
}
vigra::gaussianGradient
void gaussianGradient(...)
Calculate the gradient vector by means of a 1st derivatives of Gaussian filter.

show deprecated declarations

pass Image Iterators and Data Accessors :
namespace vigra {
// write x and y component of the gradient into separate images
template <class SrcIterator, class SrcAccessor,
class DestIteratorX, class DestAccessorX,
class DestIteratorY, class DestAccessorY>
void gaussianGradient(SrcIterator supperleft,
SrcIterator slowerright, SrcAccessor sa,
DestIteratorX dupperleftx, DestAccessorX dax,
DestIteratorY dupperlefty, DestAccessorY day,
double scale);
// write x and y component of the gradient into a vector-valued image
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor>
void gaussianGradient(SrcIterator supperleft,
SrcIterator slowerright, SrcAccessor src,
DestIterator dupperleft, DestAccessor dest,
double scale);
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
// write x and y component of the gradient into separate images
template <class SrcIterator, class SrcAccessor,
class DestIteratorX, class DestAccessorX,
class DestIteratorY, class DestAccessorY>
void
gaussianGradient(triple<SrcIterator, SrcIterator, SrcAccessor> src,
pair<DestIteratorX, DestAccessorX> destx,
pair<DestIteratorY, DestAccessorY> desty,
double scale);
// write x and y component of the gradient into a vector-valued image
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor>
void
gaussianGradient(triple<SrcIterator, SrcIterator, SrcAccessor> src,
pair<DestIterator, DestAccessor> dest,
double scale);
}

Usage:

#include <vigra/convolution.hxx>
Namespace: vigra

MultiArray<2, float> src(w,h), gradx(w,h), grady(w,h);
...
// calculate gradient vector at scale = 3.0
gaussianGradient(src, gradx, grady, 3.0);
// likewise, but use a vector image to store the gradient
MultiArray<2, TinyVector<float, 2> > dest(w,h);
gaussianGradient(src, dest, 3.0);

show deprecated examples

vigra::FImage src(w,h), gradx(w,h), grady(w,h);
...
// calculate gradient vector at scale = 3.0
vigra::gaussianGradient(srcImageRange(src),
destImage(gradx), destImage(grady), 3.0);

## ◆ gaussianGradientMagnitude()

template<... >

void gaussianGradientMagnitude | ( |  | ... | ) |

Calculate the gradient magnitude by means of a 1st derivatives of Gaussian filter.

This function calls gaussianGradient() and returns the pixel-wise magnitude of the resulting gradient vectors. If the original image has multiple bands, the squared gradient magnitude is computed for each band separately, and the return value is the square root of the sum of these squared magnitudes.

Anisotropic data should be provided with appropriate vigra::ConvolutionOptions to adjust the filter sizes for the resolution of each axis. Otherwise, the parameter `opt` is optional unless the parameter `sigma` is omitted.

If you pass vigra::BlockwiseConvolutionOptions instead, the algorithm will be executed in parallel on data blocks of a certain size. The block size can be customized via `BlockwiseConvolutionOptions::blockShape()`, but the defaults usually work reasonably. By default, the number of threads equals the capabilities of your hardware, but you can change this via `BlockwiseConvolutionOptions::numThreads()`.

Declarations:

use arbitrary-dimensional arrays:

namespace vigra {
// pass filter scale explicitly
template <unsigned int N, class T1, class S1,
class T2, class S2>
void
gaussianGradientMagnitude(MultiArrayView<N, T1, S1> const & src,
MultiArrayView<N, T2, S2> dest,
double sigma,
ConvolutionOptions<N> opt = ConvolutionOptions<N>());
// likewise, but sum the contributions of each band
template <unsigned int N, class MT, class S1,
class T2, class S2>
void
gaussianGradientMagnitude(MultiArrayView<N+1, Multiband<MT>, S1> const & src,
MultiArrayView<N, T2, S2> dest,
double sigma,
ConvolutionOptions<N> opt = ConvolutionOptions<N>());
// pass filter scale(s) in option object
template <unsigned int N, class T1, class S1,
class T2, class S2>
void
gaussianGradientMagnitude(MultiArrayView<N, T1, S1> const & src,
MultiArrayView<N, T2, S2> dest,
ConvolutionOptions<N> const & opt);
// likewise, but execute algorithm in parallel
template <unsigned int N, class T1, class S1,
class T2, class S2>
void
gaussianGradientMagnitude(MultiArrayView<N, T1, S1> const & src,
MultiArrayView<N, T2, S2> dest,
BlockwiseConvolutionOptions<N> const & opt);
// pass filter scale(s) in option object and sum the contributions of each band
template <unsigned int N, class MT, class S1,
class T2, class S2>
void
gaussianGradientMagnitude(MultiArrayView<N+1, Multiband<MT>, S1> const & src,
MultiArrayView<N, T2, S2> dest,
ConvolutionOptions<N> const & opt);
}
vigra::gaussianGradientMagnitude
void gaussianGradientMagnitude(...)
Calculate the gradient magnitude by means of a 1st derivatives of Gaussian filter.

Here, the input element types `T1` and `MT` can be arbitrary scalar types, and `T1` may also be `TinyVector` or `RGBValue`. The output element type `T2` should be the corresponding norm type (see NormTraits). In the `Multiband<MT>`-version, the input array's right-most dimension is interpreted as a channel axis, therefore it must have one dimension more than the output array.

show deprecated declarations

pass Image Iterators and Data Accessors :
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor>
void gaussianGradientMagnitude(SrcIterator sul,
SrcIterator slr, SrcAccessor src,
DestIterator dupperleft, DestAccessor dest,
double scale);
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor>
void
gaussianGradientMagnitude(triple<SrcIterator, SrcIterator, SrcAccessor> src,
pair<DestIterator, DestAccessor> dest,
double scale);
}

Usage:

#include <vigra/multi_convolution.hxx> (sequential version)
#include <vigra/multi_blockwise.hxx> (parallel version)
#include <vigra/convolution.hxx> (deprecated API version)
Namespace: vigra

// example 1
{
// use a 3-dimensional float array
MultiArray<3, float> volume(Shape3(w, h, d)), grad(volume.shape());
...
// calculate gradient magnitude at scale = 3.0
gaussianGradientMagnitude(volume, grad, 3.0);
}
// example 2
{
// use a 2-dimensional RGB array
MultiArray<2, RGBValue<float> > rgb(Shape2(w, h));
MultiArray<2, float> grad(rgb.shape());
...
// calculate the color gradient magnitude at scale = 3.0
gaussianGradientMagnitude(rgb, grad, 3.0);
}
// example 3
{
// use a 3-dimensional array whose right-most axis is interpreted as
// a multi-spectral axis with arbitrary many channels
MultiArray<3, Multiband<float> > spectral(Shape3(w, h, channelCount));
MultiArray<2, float> grad(Shape2(w, h));
...
// calculate the multi-channel gradient magnitude at scale = 3.0
// (note that the template parameter N (number of spatial dimensions)
// must be provided explicitly as gaussianGradientMagnitude<2>(...) )
MultiArrayView<3, Multiband<float> > view(spectral);
gaussianGradientMagnitude<2>(view, grad, 3.0);
}

show deprecated examples

// use a traditional float or RGB image
FImage image(w, h), grad(w, h);
FRGBImage rgb(w, h);
...
// calculate gradient magnitude at scale = 3.0
gaussianGradientMagnitude(srcImageRange(image), destImage(grad), 3.0);
// calculate color gradient magnitude at scale = 3.0
gaussianGradientMagnitude(srcImageRange(rgb), destImage(grad), 3.0);

## ◆ laplacianOfGaussian()

template<... >

void laplacianOfGaussian | ( |  | ... | ) |

Filter image with the Laplacian of Gaussian operator at the given scale.

This function calls separableConvolveX() and separableConvolveY() with the appropriate 2nd derivative of Gaussian kernels in x- and y-direction and then sums the results to get the Laplacian.

Function laplacianOfGaussianMultiArray() performs the same filter operation on arbitrary dimensional arrays.

Declarations:

pass 2D array views:

namespace vigra {
template <class T1, class S1,
class T2, class S2>
void
laplacianOfGaussian(MultiArrayView<2, T1, S1> const & src,
MultiArrayView<2, T2, S2> dest,
double scale);
}
vigra::laplacianOfGaussian
void laplacianOfGaussian(...)
Filter image with the Laplacian of Gaussian operator at the given scale.

show deprecated declarations

pass Image Iterators and Data Accessors :
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor>
void laplacianOfGaussian(SrcIterator supperleft,
SrcIterator slowerright, SrcAccessor sa,
DestIterator dupperleft, DestAccessor da,
double scale);
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor>
void
laplacianOfGaussian(triple<SrcIterator, SrcIterator, SrcAccessor> src,
pair<DestIterator, DestAccessor> dest,
double scale);
}

Usage:

#include <vigra/convolution.hxx>
Namespace: vigra

MultiArray<2, float> src(w,h), dest(w,h);
...
// calculate Laplacian of Gaussian at scale = 3.0
laplacianOfGaussian(src, dest, 3.0);

show deprecated examples

vigra::FImage src(w,h), dest(w,h);
...
// calculate Laplacian of Gaussian at scale = 3.0
vigra::laplacianOfGaussian(srcImageRange(src), destImage(dest), 3.0);

## ◆ hessianMatrixOfGaussian()

template<... >

void hessianMatrixOfGaussian | ( |  | ... | ) |

Filter image with the 2nd derivatives of the Gaussian at the given scale to get the Hessian matrix.

The Hessian matrix is a symmetric matrix defined as:

where denote 2nd derivatives of Gaussians at the given scale, and is the convolution symbol. This function calls separableConvolveX() and separableConvolveY() with the appropriate 2nd derivative of Gaussian kernels and puts the results in the three destination images. The first destination image will contain the second derivative in x-direction, the second one the mixed derivative, and the third one holds the derivative in y-direction.

Function hessianOfGaussianMultiArray() performs the same filter operation on arbitrary dimensional arrays.

Declarations:

pass 2D array views:

namespace vigra {
template <class T1, class S1,
class T2, class S2>
void
hessianMatrixOfGaussian(MultiArrayView<2, T1, S1> const & src,
MultiArrayView<2, TinyVector<T2, 3>, S2> dest,
double scale);
}
vigra::hessianMatrixOfGaussian
void hessianMatrixOfGaussian(...)
Filter image with the 2nd derivatives of the Gaussian at the given scale to get the Hessian matrix.

show deprecated declarations

pass Image Iterators and Data Accessors :
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class DestIteratorX, class DestAccessorX,
class DestIteratorXY, class DestAccessorXY,
class DestIteratorY, class DestAccessorY>
void hessianMatrixOfGaussian(SrcIterator supperleft,
SrcIterator slowerright, SrcAccessor sa,
DestIteratorX dupperleftx, DestAccessorX dax,
DestIteratorXY dupperleftxy, DestAccessorXY daxy,
DestIteratorY dupperlefty, DestAccessorY day,
double scale);
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class DestIteratorX, class DestAccessorX,
class DestIteratorXY, class DestAccessorXY,
class DestIteratorY, class DestAccessorY>
void
hessianMatrixOfGaussian(triple<SrcIterator, SrcIterator, SrcAccessor> src,
pair<DestIteratorX, DestAccessorX> destx,
pair<DestIteratorXY, DestAccessorXY> destxy,
pair<DestIteratorY, DestAccessorY> desty,
double scale);
}

Usage:

#include <vigra/convolution.hxx>
Namespace: vigra

MultiArray<2, float> src(w,h);
MultiArray<2, TinyVector<float, 3> > hessian(w,h); // will hold the three components of the Hessian
...
// calculate Hessian of Gaussian at scale = 3.0, use a 3-band output image
hessianMatrixOfGaussian(src, hessian, 3.0);

show deprecated examples

vigra::FImage src(w,h),
hxx(w,h), hxy(w,h), hyy(w,h); // use a separate image for each component of the Hessian
...
// calculate Hessian of Gaussian at scale = 3.0, use 3 single.band output images
vigra::hessianMatrixOfGaussian(srcImageRange(src),
destImage(hxx), destImage(hxy), destImage(hyy), 3.0);

## ◆ structureTensor()

template<... >

void structureTensor | ( |  | ... | ) |

Calculate the Structure Tensor for each pixel of and image, using Gaussian (derivative) filters.

The Structure Tensor is is a smoothed version of the Euclidean product of the gradient vector with itself. I.e. it's a symmetric matrix defined as:

where denotes Gaussian smoothing at the outer scale, are the gradient components taken at the inner scale, is the convolution symbol, and etc. are pixelwise products of the 1st derivative images. This function calls separableConvolveX() and separableConvolveY() with the appropriate Gaussian kernels and puts the results in the three separate destination images (where the first one will contain , the second one , and the third one holds ), or into a single 3-band image (where the bands hold the result in the same order as above). The latter form is also applicable when the source image is a multi-band image (e.g. RGB). In this case, tensors are first computed for each band separately, and then summed up to get a single result tensor.

Function structureTensorMultiArray() performs the same filter operation on arbitrary dimensional arrays.

Declarations:

pass 2D array views:

namespace vigra {
// create three separate destination images
template <class T, class S,
class TX, class SX,
class TXY, class SXY,
class TY, class SY>
void
structureTensor(MultiArrayView<2, S, T> const & src,
MultiArrayView<2, TX, SX> destx,
MultiArrayView<2, TXY, SXY> destxy,
MultiArrayView<2, TY, SY> desty,
double inner_scale, double outer_scale);
// create a single 3-band destination image
template <class T1, class S1,
class T2, class S2>
void
structureTensor(MultiArrayView<2, T1, S1> const & src,
MultiArrayView<2, TinyVector<T2, 3>, S2> dest,
double inner_scale, double outer_scale);
}
vigra::structureTensor
void structureTensor(...)
Calculate the Structure Tensor for each pixel of and image, using Gaussian (derivative) filters.

show deprecated declarations

pass Image Iterators and Data Accessors :
namespace vigra {
// create three separate destination images
template <class SrcIterator, class SrcAccessor,
class DestIteratorX, class DestAccessorX,
class DestIteratorXY, class DestAccessorXY,
class DestIteratorY, class DestAccessorY>
void structureTensor(SrcIterator supperleft,
SrcIterator slowerright, SrcAccessor sa,
DestIteratorX dupperleftx, DestAccessorX dax,
DestIteratorXY dupperleftxy, DestAccessorXY daxy,
DestIteratorY dupperlefty, DestAccessorY day,
double inner_scale, double outer_scale);
// create a single 3-band destination image
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor>
void structureTensor(SrcIterator supperleft,
SrcIterator slowerright, SrcAccessor sa,
DestIterator dupperleft, DestAccessor da,
double inner_scale, double outer_scale);
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
// create three separate destination images
template <class SrcIterator, class SrcAccessor,
class DestIteratorX, class DestAccessorX,
class DestIteratorXY, class DestAccessorXY,
class DestIteratorY, class DestAccessorY>
void
structureTensor(triple<SrcIterator, SrcIterator, SrcAccessor> src,
pair<DestIteratorX, DestAccessorX> destx,
pair<DestIteratorXY, DestAccessorXY> destxy,
pair<DestIteratorY, DestAccessorY> desty,
double nner_scale, double outer_scale);
// create a single 3-band destination image
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor>
void
structureTensor(triple<SrcIterator, SrcIterator, SrcAccessor> src,
pair<DestIterator, DestAccessor> dest,
double nner_scale, double outer_scale);
}

Usage:

#include <vigra/convolution.hxx>
Namespace: vigra

MultiArray<2, flost> src(w,h),
stxx(w,h), stxy(w,h), styy(w,h); // use a separate image for each component
...
// calculate Structure Tensor at inner scale = 1.0 and outer scale = 3.0
structureTensor(src, stxx, stxy, styy, 1.0, 3.0);
// likwise with a single 3-band destination image
MultiArray<2, TinyVector<float, 3> > st(w,h);
structureTensor(src, st, 1.0, 3.0);

show deprecated examples

vigra::FImage src(w,h),
stxx(w,h), stxy(w,h), styy(w,h);
vigra::BasicImage<TinyVector<float, 3> > st(w,h);
...
vigra::structureTensor(srcImageRange(src),
destImage(stxx), destImage(stxy), destImage(styy), 1.0, 3.0);
vigra::structureTensor(srcImageRange(src), destImage(st), 1.0, 3.0);

## ◆ copyImage()

template<... >

void copyImage | ( |  | ... | ) |

Copy source image into destination image.

If necessary, type conversion takes place. Some variants of this function use accessors to access the pixel data.

See copyMultiArray() for a dimension-independent version of this algorithm.

Declarations:

pass 2D array views:

namespace vigra {
template <class T1, class S1,
class T2, class S2>
void
copyImage(MultiArrayView<2, T1, S1> const & src,
MultiArrayView<2, T2, S2> dest);
}
vigra::copyImage
void copyImage(...)
Copy source image into destination image.

pass Image Iterators and Data Accessors :

namespace vigra {
template <class SrcImageIterator, class SrcAccessor,
class DestImageIterator, class DestAccessor>
void
copyImage(SrcImageIterator src_upperleft, SrcImageIterator src_lowerright, SrcAccessor sa,
DestImageIterator dest_upperleft, DestAccessor da)
}

use argument objects in conjunction with Argument Object Factories :

namespace vigra {
template <class SrcImageIterator, class SrcAccessor,
class DestImageIterator, class DestAccessor>
void
copyImage(triple<SrcImageIterator, SrcImageIterator, SrcAccessor> src,
pair<DestImageIterator, DestAccessor> dest)
}

Usage:

#include <vigra/copyimage.hxx>
Namespace: vigra

Use MultiArrayView API:

MultiArray<2, int> src(Shape2(100, 200)),
dest(Shape2(100, 200));
...
copyImage(src, dest);
// equivalent to
dest = src;

Use iterator-based API with accessor:

MultiArray<2, RGBValue<unsigned char> > src(Shape2(100, 200)),
MultiArray<2, float> dest(Shape2(100, 200));
// convert RGB to gray values in the fly
copyImage(srcImageRange(src, RGBToGrayAccessor<RGBValue<unsigned char> >()),
destImage(dest));
vigra::RGBToGrayAccessor
Definition rgbvalue.hxx:1270

Required Interface:

SrcImageIterator src_upperleft, src_lowerright;
DestImageIterator dest_upperleft;
SrcImageIterator::row_iterator sx = src_upperleft.rowIterator();
DestImageIterator::row_iterator dx = dest_upperleft.rowIterator();
SrcAccessor src_accessor;
DestAccessor dest_accessor;
dest_accessor.set(src_accessor(sx), dx);

## ◆ copyImageIf()

template<... >

void copyImageIf | ( |  | ... | ) |

Copy source ROI into destination image.

Pixel values are copied whenever the return value of the mask's accessor is not zero. If necessary, type conversion takes place. Some variants of this function use accessors to access the pixel data.

Declarations:

pass 2D array views:

namespace vigra {
template <class T1, class S1,
class TM, class SM,
class T2, class S2>
void
copyImageIf(MultiArrayView<2, T1, S1> const & src,
MultiArrayView<2, TM, SM> const & mask,
MultiArrayView<2, T2, S2> dest);
}
vigra::copyImageIf
void copyImageIf(...)
Copy source ROI into destination image.

pass Image Iterators and Data Accessors :

namespace vigra {
template <class SrcImageIterator, class SrcAccessor,
class MaskImageIterator, class MaskAccessor,
class DestImageIterator, clas DestAccessor>
void
copyImageIf(SrcImageIterator src_upperleft,
SrcImageIterator src_lowerright, SrcAccessor sa,
MaskImageIterator mask_upperleft, MaskAccessor ma,
DestImageIterator dest_upperleft, DestAccessor da)
}

use argument objects in conjunction with Argument Object Factories :

namespace vigra {
template <class SrcImageIterator, class SrcAccessor,
class MaskImageIterator, class MaskAccessor,
class DestImageIterator, clas DestAccessor>
void
copyImageIf(triple<SrcImageIterator, SrcImageIterator, SrcAccessor> src,
pair<MaskImageIterator, MaskAccessor> mask,
pair<DestImageIterator, DestAccessor> dest)
}

Usage:

#include <vigra/copyimage.hxx>
Namespace: vigra

Use MultiArrayView API:

MultiArray<2, int> src(Shape2(100, 200)),
mask(Shape2(100, 200)),
dest(Shape2(100, 200));
...
copyImageIf(src, mask, dest);

Use iterator-based API with accessor:

MultiArray<2, RGBValue<unsigned char> > src(Shape2(100, 200)),
MultiArray<2, unsigned char> mask(Shape2(100, 200));
MultiArray<2, float> dest(Shape2(100, 200));
// convert RGB to gray values in the fly
copyImageIf(srcImageRange(src, RGBToGrayAccessor<RGBValue<unsigned char> >()),
maskImage(mask), destImage(dest));

Required Interface:

SrcImageIterator src_upperleft, src_lowerright;
DestImageIterator dest_upperleft;
MaskImageIterator mask_upperleft;
SrcImageIterator::row_iterator sx = src_upperleft.rowIterator();
MaskImageIterator::row_iterator mx = mask_upperleft.rowIterator();
DestImageIterator::row_iterator dx = dest_upperleft.rowIterator();
SrcAccessor src_accessor;
DestAccessor dest_accessor;
MaskAccessor mask_accessor;
Functor functor;
if(mask_accessor(mx))
dest_accessor.set(src_accessor(sx), dx);

## ◆ cornerResponseFunction()

template<... >

void cornerResponseFunction | ( |  | ... | ) |

Find corners in an image (1).

This algorithm implements the so called 'corner response function' to measure the 'cornerness' of each pixel in the image, according to [C.G. Harris and M.J. Stevens: "A Combined Corner and Edge Detector", Proc. of 4th Alvey Vision Conference, 1988]. Several studies have found this to be a very robust corner detector, although it moves the corners somewhat into one region, depending on the scale.

The algorithm first determines the structure tensor at each pixel by calling structureTensor(). Then the entries of the structure tensor are combined as

The local maxima of the corner response denote the corners in the gray level image.

The source value type must be a linear algebra, i.e. addition, subtraction, and multiplication with itself, multiplication with doubles and NumericTraits must be defined.

Declarations:

pass 2D array views:

namespace vigra {
template <class T1, class S1,
class T2, class S2>
void
cornerResponseFunction(MultiArrayView<2, T1, S1> const & src,
MultiArrayView<2, T2, S2> dest,
double scale);
}
vigra::cornerResponseFunction
void cornerResponseFunction(...)
Find corners in an image (1).

show deprecated declarations

pass Image Iterators and Data Accessors :
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor>
void
cornerResponseFunction(SrcIterator sul, SrcIterator slr, SrcAccessor as,
DestIterator dul, DestAccessor ad,
double scale)
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor>
void cornerResponseFunction(
triple<SrcIterator, SrcIterator, SrcAccessor> src,
pair<DestIterator, DestAccessor> dest,
double scale)
}

Usage:

#include <vigra/cornerdetection.hxx>
Namespace: vigra

MultiArray<2, unsigned char> src(w,h), corners(w,h);
MultiArray<2, float> corner_response(w,h);
...
// find corner response at scale 1.0
cornerResponseFunction(src, corner_response, 1.0);
// find local maxima of corner response, mark with 1
localMaxima(corner_response, corners);
// threshold corner response to keep only strong corners (above 400.0)
transformImage(corner_response, corner_response,
Threshold<double, double>(400.0, std::numeric_limits<double>::max(), 0.0, 1.0));
// combine thresholding and local maxima
combineTwoImages(corners, corner_response,
corners, std::multiplies<float>());
vigra::transformImage
void transformImage(...)
Apply unary point transformation to each pixel.
vigra::localMaxima
void localMaxima(...)
Find local maxima in an image or multi-dimensional array.

show deprecated examples

vigra::BImage src(w,h), corners(w,h);
vigra::FImage corner_response(w,h);
// empty corner image
corners.init(0.0);
...
// find corner response at scale 1.0
vigra::cornerResponseFunction(srcImageRange(src), destImage(corner_response),
1.0);
// find local maxima of corner response, mark with 1
vigra::localMaxima(srcImageRange(corner_response), destImage(corners));
// threshold corner response to keep only strong corners (above 400.0)
transformImage(srcImageRange(corner_response), destImage(corner_response),
vigra::Threshold<double, double>(
400.0, std::numeric_limits<double>::max(), 0.0, 1.0));
// combine thresholding and local maxima
vigra::combineTwoImages(srcImageRange(corners), srcImage(corner_response),
destImage(corners), std::multiplies<float>());
vigra::TinyVectorBase::init
void init(Iterator i, Iterator end)
Definition tinyvector.hxx:708
Required Interface:
SrcImageIterator src_upperleft, src_lowerright;
DestImageIterator dest_upperleft;
SrcAccessor src_accessor;
DestAccessor dest_accessor;
SrcAccessor::value_type u = src_accessor(src_upperleft);
double d;
u = u + u
u = u - u
u = u * u
u = d * u
dest_accessor.set(u, dest_upperleft);

## ◆ foerstnerCornerDetector()

template<... >

void foerstnerCornerDetector | ( |  | ... | ) |

Find corners in an image (2).

This algorithm implements the so called 'Foerstner Corner Detector' to measure the 'cornerness' of each pixel in the image, according to [W. Förstner: "A feature based correspondence algorithms for image matching", Intl. Arch. Photogrammetry and Remote Sensing, vol. 24, pp 160-166, 1986]. It is also known as the "Plessey Detector" by Harris. However, it should not be confused with the "\link cornerResponseFunction Corner Response Function\endlink ", another detector invented by Harris.

The algorithm first determines the structure tensor at each pixel by calling structureTensor(), where the given scale is used for both the inner and outer scales. Then the entries of the structure tensor are combined as

The local maxima of the corner strength denote the corners in the gray level image. Its performance is similar to the cornerResponseFunction().

The source value type must be a division algebra, i.e. addition, subtraction, multiplication, and division with itself, multiplication with doubles and NumericTraits must be defined.

Declarations:

pass 2D array views:

namespace vigra {
template <class T1, class S1,
class T2, class S2>
void
foerstnerCornerDetector(MultiArrayView<2, T1, S1> const & src,
MultiArrayView<2, T2, S2> dest,
double scale);
}
vigra::foerstnerCornerDetector
void foerstnerCornerDetector(...)
Find corners in an image (2).

show deprecated declarations

pass Image Iterators and Data Accessors :
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor>
void
foerstnerCornerDetector(SrcIterator sul, SrcIterator slr, SrcAccessor as,
DestIterator dul, DestAccessor ad,
double scale)
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor>
void foerstnerCornerDetector(
triple<SrcIterator, SrcIterator, SrcAccessor> src,
pair<DestIterator, DestAccessor> dest,
double scale)
}

Usage:

#include <vigra/cornerdetection.hxx>
Namespace: vigra

MultiArray<2, unsigned char> src(w,h), corners(w,h);
MultiArray<2, float> foerstner_corner_strength(w,h);
...
// find corner response at scale 1.0
foerstnerCornerDetector(src, foerstner_corner_strength, 1.0);
// find local maxima of corner response, mark with 1
localMaxima(foerstner_corner_strength, corners);

show deprecated examples

vigra::BImage src(w,h), corners(w,h);
vigra::FImage foerstner_corner_strength(w,h);
// empty corner image
corners.init(0.0);
...
// find corner response at scale 1.0
vigra::foerstnerCornerDetector(srcImageRange(src), destImage(foerstner_corner_strength),
1.0);
// find local maxima of corner response, mark with 1
vigra::localMaxima(srcImageRange(foerstner_corner_strength), destImage(corners));
Required Interface:
SrcImageIterator src_upperleft, src_lowerright;
DestImageIterator dest_upperleft;
SrcAccessor src_accessor;
DestAccessor dest_accessor;
SrcAccessor::value_type u = src_accessor(src_upperleft);
double d;
u = u + u
u = u - u
u = u * u
u = u / u
u = d * u
dest_accessor.set(u, dest_upperleft);

## ◆ rohrCornerDetector()

template<... >

void rohrCornerDetector | ( |  | ... | ) |

Find corners in an image (3).

This algorithm implements yet another structure tensor-based corner detector, according to [K. Rohr: "Untersuchung von grauwertabh&auml;ngigen Transformationen zur Ermittlung der optischen Flusses in Bildfolgen", Diploma thesis, Inst. für Nachrichtensysteme, Univ. Karlsruhe, 1987, see also K. Rohr: "Modelling and Identification of Characteristic Intensity Variations", Image and Vision Computing 10:2 (1992) 66-76 and K. Rohr: "Localization Properties of Direct Corner Detectors", J. of Mathematical Imaging and Vision 4:2 (1994) 139-150].

The algorithm first determines the structure tensor at each pixel by calling structureTensor(), where the given scale is used for both the inner and outer scales. Then the entries of the structure tensor are combined as

The local maxima of the corner strength denote the corners in the gray level image. Its performance is similar to the cornerResponseFunction().

The source value type must be a linear algebra, i.e. addition, subtraction, and multiplication with itself, multiplication with doubles and NumericTraits must be defined.

Declarations:

pass 2D array views:

namespace vigra {
template <class T1, class S1,
class T2, class S2>
void
rohrCornerDetector(MultiArrayView<2, T1, S1> const & src,
MultiArrayView<2, T2, S2> dest,
double scale);
}
vigra::rohrCornerDetector
void rohrCornerDetector(...)
Find corners in an image (3).

show deprecated declarations

pass Image Iterators and Data Accessors :
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor>
void
rohrCornerDetector(SrcIterator sul, SrcIterator slr, SrcAccessor as,
DestIterator dul, DestAccessor ad,
double scale)
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor>
void rohrCornerDetector(
triple<SrcIterator, SrcIterator, SrcAccessor> src,
pair<DestIterator, DestAccessor> dest,
double scale)
}

Usage:

#include <vigra/cornerdetection.hxx>
Namespace: vigra

MultiArray<2, unsigned char> src(w,h), corners(w,h);
MultiArray<2, float> rohr_corner_strength(w,h);
...
// find corner response at scale 1.0
rohrCornerDetector(src, rohr_corner_strength, 1.0);
// find local maxima of corner response, mark with 1
localMaxima(rohr_corner_strength, corners);

show deprecated examples

vigra::BImage src(w,h), corners(w,h);
vigra::FImage rohr_corner_strength(w,h);
// empty corner image
corners.init(0.0);
...
// find corner response at scale 1.0
vigra::rohrCornerDetector(srcImageRange(src), destImage(rohr_corner_strength),
1.0);
// find local maxima of corner response, mark with 1
vigra::localMaxima(srcImageRange(rohr_corner_strength), destImage(corners));
Required Interface:
SrcImageIterator src_upperleft, src_lowerright;
DestImageIterator dest_upperleft;
SrcAccessor src_accessor;
DestAccessor dest_accessor;
SrcAccessor::value_type u = src_accessor(src_upperleft);
double d;
u = u + u
u = u - u
u = u * u
u = d * u
dest_accessor.set(u, dest_upperleft);

## ◆ beaudetCornerDetector()

template<... >

void beaudetCornerDetector | ( |  | ... | ) |

Find corners in an image (4).

This algorithm implements a corner detector
according to [P.R. Beaudet: "Rotationally Invariant Image Operators", Proc. Intl. Joint Conf. on Pattern Recognition, Kyoto, Japan, 1978, pp. 579-583].

The algorithm calculates the corner strength as the negative determinant of the Hessian Matrix. The local maxima of the corner strength denote the corners in the gray level image.

The source value type must be a linear algebra, i.e. addition, subtraction, and multiplication with itself, multiplication with doubles and NumericTraits must be defined.

Declarations:

pass 2D array views:

namespace vigra {
template <class T1, class S1,
class T2, class S2>
void
beaudetCornerDetector(MultiArrayView<2, T1, S1> const & src,
MultiArrayView<2, T2, S2> dest,
double scale);
}
vigra::beaudetCornerDetector
void beaudetCornerDetector(...)
Find corners in an image (4).

show deprecated declarations

pass Image Iterators and Data Accessors :
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor>
void
beaudetCornerDetector(SrcIterator sul, SrcIterator slr, SrcAccessor as,
DestIterator dul, DestAccessor ad,
double scale)
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor>
void beaudetCornerDetector(
triple<SrcIterator, SrcIterator, SrcAccessor> src,
pair<DestIterator, DestAccessor> dest,
double scale)
}

Usage:

#include <vigra/cornerdetection.hxx>
Namespace: vigra

MultiArray<2, unsigned char> src(w,h), corners(w,h);
MultiArray<2, float> beaudet_corner_strength(w,h);
...
// find corner response at scale 1.0
beaudetCornerDetector(src, beaudet_corner_strength, 1.0);
// find local maxima of corner response, mark with 1
localMaxima(beaudet_corner_strength, corners);

show deprecated examples

vigra::BImage src(w,h), corners(w,h);
vigra::FImage beaudet_corner_strength(w,h);
// empty corner image
corners.init(0.0);
...
// find corner response at scale 1.0
vigra::beaudetCornerDetector(srcImageRange(src), destImage(beaudet_corner_strength),
1.0);
// find local maxima of corner response, mark with 1
vigra::localMaxima(srcImageRange(beaudet_corner_strength), destImage(corners));
Required Interface:
SrcImageIterator src_upperleft, src_lowerright;
DestImageIterator dest_upperleft;
SrcAccessor src_accessor;
DestAccessor dest_accessor;
SrcAccessor::value_type u = src_accessor(src_upperleft);
double d;
u = u + u
u = u - u
u = u * u
u = d * u
dest_accessor.set(u, dest_upperleft);

## ◆ fastCrossCorrelation()

template<... >

void fastCrossCorrelation | ( |  | ... | ) |

This function performes a fast cross-correlation.

This function performes a fast cross-correlation using the Fast Fourier Transform and the dependency of the convolution and the correlation in Fourier space.

The input pixel type `T1` must be a linear space over the window functions' value_type `T`, i.e. addition of source values, multiplication with functions' values, and NumericTraits must be defined. The mask's value_type must be an algebraic field, i.e. the arithmetic operations (+, -, *, /) and NumericTraits must be defined.

By default, the borders are filled with zeros. Use the clearBorders switch to change that behavior if you need to.

Declarations:

pass 2D array views:

namespace vigra {
template <class T1, class S1,
class T2, class S2,
class T3, class S3,
unsigned int N>
void
fastCrossCorrelation(MultiArrayView<N, T1, S1> const & in,
MultiArrayView<N, T2, S2> const & mask,
MultiArrayView<N, T3, S3> out,
bool clearBorders=true);
}
vigra::fastCrossCorrelation
void fastCrossCorrelation(...)
This function performes a fast cross-correlation.

Usage:

#include <vigra/correlation.hxx>
Namespace: vigra

unsigned int m_w=51, m_h=51;
unsigned int w=1000, h=1000;
MultiArray<2, float> mask(m_w,m_h), src(w,h), dest(w,h);
...
//compute fast cross correlation of mask and image -> dest
fastCrossCorrelation(mask, src, dest);

Preconditions:

The image must be larger than the size of the mask.

## ◆ fastNormalizedCrossCorrelation()

template<... >

void fastNormalizedCrossCorrelation | ( |  | ... | ) |

This function performes a fast normalized cross-correlation.

To compute the normalized cross correlation in a fast way, it is using the Fast Fourier Transform and sum-image look-up-tables as it is suggested by J.P.Lewis (1995): "Fast Normalized Cross-Correlation".

The input pixel type `T1` must be a linear space over the window functions' value_type `T`, i.e. addition of source values, multiplication with functions' values, and NumericTraits must be defined. The mask's value_type must be an algebraic field, i.e. the arithmetic operations (+, -, *, /) and NumericTraits must be defined.

By default, the borders are filled with zeros. Use the clearBorders switch to change that behavior if you need to.

Declarations:

pass 2D array views:

namespace vigra {
template <class T1, class S1,
class T2, class S2,
class T3, class S3>
void
fastNormalizedCrossCorrelation(MultiArrayView<2, T1, S1> const & in,
MultiArrayView<2, T2, S2> const & mask,
MultiArrayView<2, T3, S3> out,
bool clearBorders=true);
}
vigra::fastNormalizedCrossCorrelation
void fastNormalizedCrossCorrelation(...)
This function performes a fast normalized cross-correlation.

Usage:

#include <vigra/correlation.hxx>
Namespace: vigra

unsigned int m_w=51, m_h=51;
unsigned int w=1000, h=1000;
MultiArray<2, float> mask(m_w,m_h), src(w,h), dest(w,h);
...
//compute normalized cross correlation of mask and image -> dest
fastNormalizedCrossCorrelation(mask, src, dest);

Preconditions:

The image must be larger than the size of the mask.

## ◆ crossCorrelation()

template<... >

void crossCorrelation | ( |  | ... | ) |

This function performes a (slow) cross-correlation.

This function performes a (slow) cross-correlation using the window function environment and comparison of the mask with the underlying image part for each pixel. This may however be faster for very few comparisons.

The input pixel type `T1` must be a linear space over the window functions' value_type `T`, i.e. addition of source values, multiplication with functions' values, and NumericTraits must be defined. The mask's value_type must be an algebraic field, i.e. the arithmetic operations (+, -, *, /) and NumericTraits must be defined.

Declarations:

pass 2D array views:

namespace vigra {
template <class T1, class S1,
class T2, class S2,
class T3, class S3>
void
crossCorrelation(MultiArrayView<2, T1, S1> const & in,
MultiArrayView<2, T2, S2> const & mask,
MultiArrayView<2, T3, S3> out);
}
vigra::crossCorrelation
void crossCorrelation(...)
This function performes a (slow) cross-correlation.

show deprecated declarations

pass Image Iterators and Data Accessors :
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class MaskIterator, class MaskAccessor,
class DestIterator, class DestAccessor>
void crossCorrelation(SrcIterator s_ul, SrcIterator s_lr, SrcAccessor s_acc,
MaskIterator m_ul, MaskIterator m_lr, MaskAccessor m_acc,
DestIterator d_ul, DestAccessor d_acc);
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class MaskIterator, class MaskAccessor,
class DestIterator, class DestAccessor>
void
crossCorrelation(triple<MaskIterator, MaskIterator, MaskAccessor> src,
triple<SrcIterator, SrcIterator, SrcAccessor> mask,
pair<DestIterator, DestAccessor> dest);
}

Usage:

#include <vigra/correlation.hxx>
Namespace: vigra

unsigned int m_w=51, m_h=51;
unsigned int w=1000, h=1000;
MultiArray<2, float> mask(m_w,m_h), src(w,h), dest(w,h);
...
//compute (slow) cross correlation of mask and image -> dest
crossCorrelation(mask, src, dest);

Preconditions:

The image must be larger than the size of the mask.

## ◆ normalizedCrossCorrelation()

template<... >

void normalizedCrossCorrelation | ( |  | ... | ) |

This function performes a (slow) normalized cross-correlation.

This function performes a (slow) normalized cross-correlation using the window function environment and comparison of the mask with the underlying image part for each pixel. This may however be faster for very few comparisons.

The input pixel type `T1` must be a linear space over the window functions' value_type `T`, i.e. addition of source values, multiplication with functions' values, and NumericTraits must be defined. The mask's value_type must be an algebraic field, i.e. the arithmetic operations (+, -, *, /) and NumericTraits must be defined.

Declarations:

pass 2D array views:

namespace vigra {
template <class T1, class S1,
class T2, class S2,
class T3, class S3>
void
normalizedCrossCorrelation(MultiArrayView<2, T1, S1> const & in,
MultiArrayView<2, T2, S2> const & mask,
MultiArrayView<2, T3, S3> out);
}
vigra::normalizedCrossCorrelation
void normalizedCrossCorrelation(...)
This function performes a (slow) normalized cross-correlation.

show deprecated declarations

pass Image Iterators and Data Accessors :
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class MaskIterator, class MaskAccessor,
class DestIterator, class DestAccessor>
void normalizedCrossCorrelation(SrcIterator s_ul, SrcIterator s_lr, SrcAccessor s_acc,
MaskIterator m_ul, MaskIterator m_lr, MaskAccessor m_acc,
DestIterator d_ul, DestAccessor d_acc);
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class MaskIterator, class MaskAccessor,
class DestIterator, class DestAccessor>
void
normalizedCrossCorrelation(triple<SrcIterator, SrcIterator, SrcAccessor> src,
triple<MaskIterator, MaskIterator, MaskAccessor> mask,
pair<DestIterator, DestAccessor> dest);
}

Usage:

#include <vigra/correlation.hxx>
Namespace: vigra

unsigned int m_w=51, m_h=51;
unsigned int w=1000, h=1000;
MultiArray<2, float> mask(m_w,m_h), src(w,h), dest(w,h);
...
//compute (slow) normalized cross correlation of mask and image -> dest
normalizedCrossCorrelation(mask, src, dest);

Preconditions:

The image must be larger than the size of the mask.

## ◆ operator-() [1/5]

Diff2D operator- | ( | Diff2D const & | a,
|  | Diff2D const & | b
| ) |  |

Create vector by subtracting specified offset.

## ◆ operator-() [2/5]

Size2D operator- | ( | Size2D const & | s,
|  | Diff2D const & | offset
| ) |  |

Create size by subtracting specified offset.

## ◆ operator-() [3/5]

Point2D operator- | ( | Point2D const & | s,
|  | Diff2D const & | offset
| ) |  |

Calculate size of rect between two points.

## ◆ operator-() [4/5]

Size2D operator- | ( | Point2D const & | s,
|  | Point2D const & | p
| ) |  |

The difference of two points is a size

## ◆ operator+() [1/4]

Diff2D operator+ | ( | Diff2D const & | a,
|  | Diff2D const & | b
| ) |  |

Create vector by adding specified offset.

## ◆ operator+() [2/4]

Size2D operator+ | ( | Size2D const & | a,
|  | Diff2D const & | b
| ) |  |

Create size by adding specified offset.

## ◆ operator+() [3/4]

Point2D operator+ | ( | Point2D const & | a,
|  | Diff2D const & | b
| ) |  |

Create point by adding specified offset.

## ◆ operator+() [4/4]

Point2D operator+ | ( | Size2D const & | s,
|  | Point2D const & | p
| ) |  |

Add size and point

## ◆ distanceTransform()

template<... >

void distanceTransform | ( |  | ... | ) |

For all background pixels, calculate the distance to the nearest object or contour. The label of the pixels to be considered background in the source image is passed in the parameter 'background'. Source pixels with other labels will be considered objects. In the destination image, all pixels corresponding to background will be assigned the their distance value, all pixels corresponding to objects will be assigned 0.

The parameter 'norm' gives the distance norm to be used:

- norm == 0: use chessboard distance (L-infinity norm)
- norm == 1: use Manhattan distance (L1 norm)

- norm == 2: use Euclidean distance (L2 norm)

If you use the L2 norm, the destination pixels must be real valued to give correct results.

Declarations:

pass 2D array views:

namespace vigra {
template <class T1, class S1,
class T2, class S2,
class ValueType>
void
distanceTransform(MultiArrayView<2, T1, S1> const & src,
MultiArrayView<2, T2, S2> dest,
ValueType background, int norm);
}
vigra::norm
FFTWComplex< R >::NormType norm(const FFTWComplex< R > &a)
norm (= magnitude)
Definition fftw3.hxx:1037
vigra::distanceTransform
void distanceTransform(...)

show deprecated declarations

pass Image Iterators and Data Accessors :
namespace vigra {
template <class SrcImageIterator, class SrcAccessor,
class DestImageIterator, class DestAccessor,
class ValueType>
void distanceTransform(SrcImageIterator src_upperleft,
SrcImageIterator src_lowerright, SrcAccessor sa,
DestImageIterator dest_upperleft, DestAccessor da,
ValueType background, int norm);
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
template <class SrcImageIterator, class SrcAccessor,
class DestImageIterator, class DestAccessor,
class ValueType>
void distanceTransform(triple<SrcImageIterator, SrcImageIterator, SrcAccessor> src,
pair<DestImageIterator, DestAccessor> dest,
ValueType background, int norm);
}

Usage:

#include <vigra/distancetransform.hxx>
Namespace: vigra

MultiArray<2, unsigned char> src(w,h), edges(w,h);
MultiArray<2, float> distance(w, h);
...
// detect edges in src image (edges will be marked 1, background 0)
differenceOfExponentialEdgeImage(src, edges, 0.8, 4.0);
// find distance of all pixels from nearest edge
distanceTransform(edges, distance, 0, 2);
// ^ background label ^ norm (Euclidean)

show deprecated examples

vigra::BImage src(w,h), edges(w,h);
vigra::FImage distance(w, h);
// empty edge image
edges = 0;
...
// detect edges in src image (edges will be marked 1, background 0)
vigra::differenceOfExponentialEdgeImage(srcImageRange(src), destImage(edges),
0.8, 4.0);
// find distance of all pixels from nearest edge
vigra::distanceTransform(srcImageRange(edges), destImage(distance),
0, 2);
// ^ background label ^ norm (Euclidean)
Required Interface:
SrcImageIterator src_upperleft, src_lowerright;
DestImageIterator dest_upperleft;
SrcAccessor sa;
DestAccessor da;
ValueType background;
float distance;
sa(src_upperleft) != background;
da(dest_upperleft) < distance;
da.set(distance, dest_upperleft);

## ◆ eccentricityCenters()

template<unsigned int N, class T , class S , class Array >

void eccentricityCenters | ( | const MultiArrayView< N, T, S > & | src,
|  | Array & | centers
| ) |  |

Find the (approximate) eccentricity center in each region of a labeled image.

Declarations:

pass arbitrary-dimensional array views:

namespace vigra {
template <unsigned int N, class T, class S, class Array>
void
eccentricityCenters(MultiArrayView<N, T, S> const & src,
Array & centers);
}
vigra::eccentricityCenters
void eccentricityCenters(const MultiArrayView< N, T, S > &src, Array &centers)
Find the (approximate) eccentricity center in each region of a labeled image.
Definition eccentricitytransform.hxx:174

Parameters

  [in] | src | : labeled array
  [out] | centers | : list of eccentricity centers (required interface: `centers[k] = TinyVector<int, N>()` must be supported)

Usage:

#include <vigra/eccentricitytransform.hxx>
Namespace: vigra

Shape3 shape(width, height, depth);
MultiArray<3, UInt32> labels(shape);
ArrayVector<TinyVector<Int32, N> > centers;
...
eccentricityCenters(labels, centers);

## ◆ eccentricityTransformOnLabels()

template<unsigned int N, class T , class S , class Array >

void eccentricityTransformOnLabels | ( | MultiArrayView< N, T > const & | src,
|  | MultiArrayView< N, S > | dest,
|  | Array & | centers
| ) |  |

Computes the (approximate) eccentricity transform on each region of a labeled image.

Declarations:

pass arbitrary-dimensional array views:

namespace vigra {
// compute only the accentricity transform
template <unsigned int N, class T, class S>
void
eccentricityTransformOnLabels(MultiArrayView<N, T> const & src,
MultiArrayView<N, S> dest);
// also return the eccentricity center of each region
template <unsigned int N, class T, class S, class Array>
void
eccentricityTransformOnLabels(MultiArrayView<N, T> const & src,
MultiArrayView<N, S> dest,
Array & centers);
}
vigra::eccentricityTransformOnLabels
void eccentricityTransformOnLabels(MultiArrayView< N, T > const &src, MultiArrayView< N, S > dest, Array &centers)
Computes the (approximate) eccentricity transform on each region of a labeled image.
Definition eccentricitytransform.hxx:236

Parameters

  [in] | src | : labeled array
  [out] | dest | : eccentricity transform of src
  [out] | centers | : (optional) list of eccentricity centers (required interface: `centers[k] = TinyVector<int, N>()` must be supported)

Usage:

#include <vigra/eccentricitytransform.hxx>
Namespace: vigra

Shape3 shape(width, height, depth);
MultiArray<3, UInt32> labels(shape);
MultiArray<3, float> dest(shape);
ArrayVector<TinyVector<Int32, N> > centers;
...
eccentricityTransformOnLabels(labels, dest, centers);

## ◆ differenceOfExponentialEdgeImage()

template<... >

void differenceOfExponentialEdgeImage | ( |  | ... | ) |

Detect and mark edges in an edge image using the Shen/Castan zero-crossing detector.

This operator applies an exponential filter to the source image at the given `scale` and subtracts the result from the original image. Zero crossings are detected in the resulting difference image. Whenever the gradient at a zero crossing is greater than the given `gradient_threshold`, an edge point is marked (using `edge_marker`) in the destination image on the darker side of the zero crossing (note that zero crossings occur between pixels). For example:

sign of difference image resulting edge points (*)
+ - - * * .
+ + - => . * *
+ + + . . .
vigra::sign
T sign(T t)
The sign function.
Definition mathutil.hxx:591

Non-edge pixels (`.`) remain untouched in the destination image. The result can be improved by the post-processing operation removeShortEdges(). A more accurate edge placement can be achieved with the function differenceOfExponentialCrackEdgeImage().

The source value type (`SrcAccessor::value_type`) must be a linear algebra, i.e. addition, subtraction and multiplication of the type with itself, and multiplication with double and NumericTraits must be defined. In addition, this type must be less-comparable.

Declarations:

pass 2D array views:

namespace vigra {
template <class T1, class S1,
class T2, class S2,
class GradValue, class DestValue>
void
differenceOfExponentialEdgeImage(MultiArrayView<2, T1, S1> const & src,
MultiArrayView<2, T2, S2> dest,
double scale,
GradValue gradient_threshold,
DestValue edge_marker = NumericTraits<DestValue>::one());
}
vigra::differenceOfExponentialEdgeImage
void differenceOfExponentialEdgeImage(...)
Detect and mark edges in an edge image using the Shen/Castan zero-crossing detector.

show deprecated declarations

pass Image Iterators and Data Accessors :
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor,
class GradValue,
class DestValue = DestAccessor::value_type>
void differenceOfExponentialEdgeImage(
SrcIterator sul, SrcIterator slr, SrcAccessor sa,
DestIterator dul, DestAccessor da,
double scale, GradValue gradient_threshold,
DestValue edge_marker = NumericTraits<DestValue>::one())
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor,
class GradValue,
class DestValue = DestAccessor::value_type>
void differenceOfExponentialEdgeImage(
triple<SrcIterator, SrcIterator, SrcAccessor> src,
pair<DestIterator, DestAccessor> dest,
double scale, GradValue gradient_threshold,
DestValue edge_marker = NumericTraits<DestValue>::one())
}

Usage:

#include <vigra/edgedetection.hxx>
Namespace: vigra

MultiArray<2, unsigned char> src(w,h), edges(w,h);
...
// find edges at scale 0.8 with gradient larger than 4.0, mark with 1
differenceOfExponentialEdgeImage(src, edges,
0.8, 4.0, 1);

show deprecated examples

vigra::BImage src(w,h), edges(w,h);
// empty edge image
edges = 0;
...
// find edges at scale 0.8 with gradient larger than 4.0, mark with 1
vigra::differenceOfExponentialEdgeImage(srcImageRange(src), destImage(edges),
0.8, 4.0, 1);
Required Interface:
SrcImageIterator src_upperleft, src_lowerright;
DestImageIterator dest_upperleft;
SrcAccessor src_accessor;
DestAccessor dest_accessor;
SrcAccessor::value_type u = src_accessor(src_upperleft);
double d;
GradValue gradient_threshold;
u = u + u
u = u - u
u = u * u
u = d * u
u < gradient_threshold
DestValue edge_marker;
dest_accessor.set(edge_marker, dest_upperleft);

Preconditions:

scale > 0
gradient_threshold > 0

## ◆ differenceOfExponentialCrackEdgeImage()

template<... >

void differenceOfExponentialCrackEdgeImage | ( |  | ... | ) |

Detect and mark edges in a crack edge image using the Shen/Castan zero-crossing detector.

This operator applies an exponential filter to the source image at the given `scale` and subtracts the result from the original image. Zero crossings are detected in the resulting difference image. Whenever the gradient at a zero crossing is greater than the given `gradient_threshold`, an edge point is marked (using `edge_marker`) in the destination image between the corresponding original pixels. Topologically, this means we must insert additional pixels between the original ones to represent the boundaries between the pixels (the so called zero- and one-cells, with the original pixels being two-cells). Within VIGRA, such an image is called Crack Edge Image. To allow insertion of the zero- and one-cells, the destination image must have twice the size of the original (precisely, `(2*w-1)` by `(2*h-1)` pixels). Then the algorithm proceeds as follows:

sign of difference image insert zero- and one-cells resulting edge points (*)
+ . - . - . * . . .
+ - - . . . . . . * * * .
+ + - => + . + . - => . . . * .
+ + + . . . . . . . . * *
+ . + . + . . . . .

Thus the edge points are marked where they actually are - in between the pixels. An important property of the resulting edge image is that it conforms to the notion of well-composedness as defined by Latecki et al., i.e. connected regions and edges obtained by a subsequent Connected Components Labeling do not depend on whether 4- or 8-connectivity is used. The non-edge pixels (`.`) in the destination image remain unchanged. The result conforms to the requirements of a Crack Edge Image. It can be further improved by the post-processing operations removeShortEdges() and closeGapsInCrackEdgeImage().

The source value type (`SrcAccessor::value_type`) must be a linear algebra, i.e. addition, subtraction and multiplication of the type with itself, and multiplication with double and NumericTraits must be defined. In addition, this type must be less-comparable.

Declarations:

pass 2D array views:

namespace vigra {
template <class T1, class S1,
class T2, class S2,
class GradValue, class DestValue>
void
differenceOfExponentialCrackEdgeImage(MultiArrayView<2, T1, S1> const & src,
MultiArrayView<2, T2, S2> dest,
double scale,
GradValue gradient_threshold,
DestValue edge_marker = NumericTraits<DestValue>::one());
}
vigra::differenceOfExponentialCrackEdgeImage
void differenceOfExponentialCrackEdgeImage(...)
Detect and mark edges in a crack edge image using the Shen/Castan zero-crossing detector.

show deprecated declarations

pass Image Iterators and Data Accessors :
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor,
class GradValue,
class DestValue = DestAccessor::value_type>
void differenceOfExponentialCrackEdgeImage(
SrcIterator sul, SrcIterator slr, SrcAccessor sa,
DestIterator dul, DestAccessor da,
double scale, GradValue gradient_threshold,
DestValue edge_marker = NumericTraits<DestValue>::one())
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor,
class GradValue,
class DestValue = DestAccessor::value_type>
void differenceOfExponentialCrackEdgeImage(
triple<SrcIterator, SrcIterator, SrcAccessor> src,
pair<DestIterator, DestAccessor> dest,
double scale, GradValue gradient_threshold,
DestValue edge_marker = NumericTraits<DestValue>::one())
}

Usage:

#include <vigra/edgedetection.hxx>
Namespace: vigra

MultiArray<2, unsigned char> src(w,h), edges(2*w-1,2*h-1);
...
// find edges at scale 0.8 with gradient larger than 4.0, mark with 1
differenceOfExponentialCrackEdgeImage(src, edges,
0.8, 4.0, 1);

show deprecated examples

vigra::BImage src(w,h), edges(2*w-1,2*h-1);
// empty edge image
edges = 0;
...
// find edges at scale 0.8 with gradient larger than 4.0, mark with 1
vigra::differenceOfExponentialCrackEdgeImage(srcImageRange(src), destImage(edges),
0.8, 4.0, 1);
Required Interface:
SrcImageIterator src_upperleft, src_lowerright;
DestImageIterator dest_upperleft;
SrcAccessor src_accessor;
DestAccessor dest_accessor;
SrcAccessor::value_type u = src_accessor(src_upperleft);
double d;
GradValue gradient_threshold;
u = u + u
u = u - u
u = u * u
u = d * u
u < gradient_threshold
DestValue edge_marker;
dest_accessor.set(edge_marker, dest_upperleft);

Preconditions:

scale > 0
gradient_threshold > 0

The destination image must have twice the size of the source:

w_dest = 2 * w_src - 1
h_dest = 2 * h_src - 1

## ◆ removeShortEdges()

template<... >

void removeShortEdges | ( |  | ... | ) |

Remove short edges from an edge image.

This algorithm can be applied as a post-processing operation of differenceOfExponentialEdgeImage() and differenceOfExponentialCrackEdgeImage(). It removes all edges that are shorter than `min_edge_length`. The corresponding pixels are set to the `non_edge_marker`. The idea behind this algorithms is that very short edges are probably caused by noise and don't represent interesting image structure. Technically, the algorithms executes a connected components labeling, so the image's value type must be equality comparable.

If the source image fulfills the requirements of a Crack Edge Image, it will still do so after application of this algorithm.

Note that this algorithm, unlike most other algorithms in VIGRA, operates in-place, i.e. on only one image. Also, the algorithm assumes that all non-edges pixels are already marked with the given `non_edge_marker` value.

Declarations:

pass 2D array views:

namespace vigra {
template <class T, class S, class Value>
void
removeShortEdges(MultiArrayView<2, T, S> image,
unsigned int min_edge_length, Value non_edge_marker);
}
vigra::removeShortEdges
void removeShortEdges(...)
Remove short edges from an edge image.

show deprecated declarations

pass Image Iterators and Data Accessors :
namespace vigra {
template <class Iterator, class Accessor, class SrcValue>
void removeShortEdges(
Iterator sul, Iterator slr, Accessor sa,
int min_edge_length, SrcValue non_edge_marker)
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
template <class Iterator, class Accessor, class SrcValue>
void removeShortEdges(
triple<Iterator, Iterator, Accessor> src,
int min_edge_length, SrcValue non_edge_marker)
}

Usage:

#include <vigra/edgedetection.hxx>
Namespace: vigra

MultiArray<2, unsigned char> src(w,h), edges(w,h);
...
// find edges at scale 0.8 with gradient larger than 4.0, mark with 1
differenceOfExponentialEdgeImage(src, edges,
0.8, 4.0, 1);
// zero edges shorter than 10 pixels
removeShortEdges(edges, 10, 0);

show deprecated examples

vigra::BImage src(w,h), edges(w,h);
// empty edge image
edges = 0;
...
// find edges at scale 0.8 with gradient larger than 4.0, mark with 1
vigra::differenceOfExponentialEdgeImage(srcImageRange(src), destImage(edges),
0.8, 4.0, 1);
// zero edges shorter than 10 pixels
vigra::removeShortEdges(srcImageRange(edges), 10, 0);
Required Interface:
SrcImageIterator src_upperleft, src_lowerright;
DestImageIterator dest_upperleft;
SrcAccessor src_accessor;
DestAccessor dest_accessor;
SrcAccessor::value_type u = src_accessor(src_upperleft);
u == u
SrcValue non_edge_marker;
src_accessor.set(non_edge_marker, src_upperleft);

## ◆ closeGapsInCrackEdgeImage()

template<... >

void closeGapsInCrackEdgeImage | ( |  | ... | ) |

Close one-pixel wide gaps in a cell grid edge image.

This algorithm is typically applied as a post-processing operation of differenceOfExponentialCrackEdgeImage(). The source image must fulfill the requirements of a Crack Edge Image, and will still do so after application of this algorithm.

It closes one pixel wide gaps in the edges resulting from this algorithm. Since these gaps are usually caused by zero crossing slightly below the gradient threshold used in edge detection, this algorithms acts like a weak hysteresis thresholding. The newly found edge pixels are marked with the given `edge_marker`. The image's value type must be equality comparable.

Note that this algorithm, unlike most other algorithms in VIGRA, operates in-place, i.e. on only one image.

Declarations:

pass 2D array views:

namespace vigra {
template <class T, class S, class Value>
void
closeGapsInCrackEdgeImage(MultiArrayView<2, T, S> image, Value edge_marker);
}
vigra::closeGapsInCrackEdgeImage
void closeGapsInCrackEdgeImage(...)
Close one-pixel wide gaps in a cell grid edge image.

show deprecated declarations

pass Image Iterators and Data Accessors :
namespace vigra {
template <class SrcIterator, class SrcAccessor, class SrcValue>
void closeGapsInCrackEdgeImage(
SrcIterator sul, SrcIterator slr, SrcAccessor sa,
SrcValue edge_marker)
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
template <class SrcIterator, class SrcAccessor, class SrcValue>
void closeGapsInCrackEdgeImage(
triple<SrcIterator, SrcIterator, SrcAccessor> src,
SrcValue edge_marker)
}

Usage:

#include <vigra/edgedetection.hxx>
Namespace: vigra

MultiArray<2, unsigned char> src(w,h), edges(2*w-1, 2*h-1);
...
// find edges at scale 0.8 with gradient larger than 4.0, mark with 1
differenceOfExponentialCrackEdgeImage(src, edges,
0.8, 4.0, 1);
// close gaps, mark with 1
closeGapsInCrackEdgeImage(edges, 1);
// zero edges shorter than 20 pixels
removeShortEdges(edges, 10, 0);

show deprecated examples

vigra::BImage src(w,h), edges(2*w-1, 2*h-1);
// empty edge image
edges = 0;
...
// find edges at scale 0.8 with gradient larger than 4.0, mark with 1
vigra::differenceOfExponentialCrackEdgeImage(srcImageRange(src), destImage(edges),
0.8, 4.0, 1);
// close gaps, mark with 1
vigra::closeGapsInCrackEdgeImage(srcImageRange(edges), 1);
// zero edges shorter than 20 pixels
vigra::removeShortEdges(srcImageRange(edges), 10, 0);
Required Interface:
SrcImageIterator src_upperleft, src_lowerright;
SrcAccessor src_accessor;
DestAccessor dest_accessor;
SrcAccessor::value_type u = src_accessor(src_upperleft);
u == u
u != u
SrcValue edge_marker;
src_accessor.set(edge_marker, src_upperleft);

## ◆ beautifyCrackEdgeImage()

template<... >

void beautifyCrackEdgeImage | ( |  | ... | ) |

Beautify crack edge image for visualization.

This algorithm is applied as a post-processing operation of differenceOfExponentialCrackEdgeImage(). The source image must fulfill the requirements of a Crack Edge Image, but will not do so after application of this algorithm. In particular, the algorithm removes zero-cells marked as edges to avoid staircase effects on diagonal lines like this:

original edge points (*) resulting edge points
. * . . . . * . . .
. * * * . . . * . .
. . . * . => . . . * .
. . . * * . . . . *
. . . . . . . . . .

Therefore, this algorithm should only be applied as a visualization aid, i.e. for human inspection. The algorithm assumes that edges are marked with `edge_marker`, and background pixels with `background_marker`. The image's value type must be equality comparable.

Note that this algorithm, unlike most other algorithms in VIGRA, operates in-place, i.e. on only one image.

Declarations:

pass 2D array views:

namespace vigra {
template <class T, class S, class Value>
void
beautifyCrackEdgeImage(MultiArrayView<2, T, S> image,
Value edge_marker, Value background_marker);
}
vigra::beautifyCrackEdgeImage
void beautifyCrackEdgeImage(...)
Beautify crack edge image for visualization.

show deprecated declarations

pass Image Iterators and Data Accessors :
namespace vigra {
template <class SrcIterator, class SrcAccessor, class SrcValue>
void beautifyCrackEdgeImage(
SrcIterator sul, SrcIterator slr, SrcAccessor sa,
SrcValue edge_marker, SrcValue background_marker)
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
template <class SrcIterator, class SrcAccessor, class SrcValue>
void beautifyCrackEdgeImage(
triple<SrcIterator, SrcIterator, SrcAccessor> src,
SrcValue edge_marker, SrcValue background_marker)
}

Usage:

#include <vigra/edgedetection.hxx>
Namespace: vigra

MultiArray<2, unsigned char> src(w,h), edges(2*w-1, 2*h-1);
...
// find edges at scale 0.8 with gradient larger than 4.0, mark with 1
differenceOfExponentialCrackEdgeImage(src, edges,
0.8, 4.0, 1);
// beautify edge image for visualization
beautifyCrackEdgeImage(edges, 1, 0);
// show to the user ('window' is an unspecified GUI widget to display VIGRA images)
window.open(edges);

show deprecated examples

vigra::BImage src(w,h), edges(2*w-1, 2*h-1);
// empty edge image
edges = 0;
...
// find edges at scale 0.8 with gradient larger than 4.0, mark with 1
vigra::differenceOfExponentialCrackEdgeImage(srcImageRange(src), destImage(edges),
0.8, 4.0, 1);
// beautify edge image for visualization
vigra::beautifyCrackEdgeImage(destImageRange(edges), 1, 0);
// show to the user
window.open(edges);
Required Interface:
SrcImageIterator src_upperleft, src_lowerright;
SrcAccessor src_accessor;
DestAccessor dest_accessor;
SrcAccessor::value_type u = src_accessor(src_upperleft);
u == u
u != u
SrcValue background_marker;
src_accessor.set(background_marker, src_upperleft);

## ◆ cannyEdgelList()

template<... >

void cannyEdgelList | ( |  | ... | ) |

Simple implementation of Canny's edge detector.

The function can be called in two modes: If you pass a 'scale', it is assumed that the original image is scalar, and the Gaussian gradient is internally computed at the given 'scale'. If the function is called without scale parameter, it is assumed that the given image already contains the gradient (i.e. its value_type must be a vector of length 2).

On the basis of the gradient image, a simple non-maxima suppression is performed: for each 3x3 neighborhood, it is determined whether the center pixel has larger gradient magnitude than its two neighbors in gradient direction (where the direction is rounded into octants). If this is the case, a new Edgel is appended to the given vector of `edgels`. The subpixel edgel position is determined by fitting a parabola to the three gradient magnitude values mentioned above. The sub-pixel location of the parabola's tip and the gradient magnitude and direction (from the pixel center) are written in the newly created edgel.

Declarations:

pass 2D array views:

namespace vigra {
// compute edgels from a scalar image (determine gradient internally at 'scale')
template <class T, class S, class BackInsertable>
void
cannyEdgelList(MultiArrayView<2, T, S> const & src,
BackInsertable & edgels,
double scale);
// compute edgels from a pre-computed gradient image
template <class T, class S, class BackInsertable>
void
cannyEdgelList(MultiArrayView<2, TinyVector<T, 2>, S> const & src,
BackInsertable & edgels);
}
vigra::cannyEdgelList
void cannyEdgelList(...)
Simple implementation of Canny's edge detector.

show deprecated declarations

pass Image Iterators and Data Accessors :
namespace vigra {
// compute edgels from a gradient image
template <class SrcIterator, class SrcAccessor, class BackInsertable>
void
cannyEdgelList(SrcIterator ul, SrcIterator lr, SrcAccessor src,
BackInsertable & edgels);
// compute edgels from a scalar image (determine gradient internally at 'scale')
template <class SrcIterator, class SrcAccessor, class BackInsertable>
void
cannyEdgelList(SrcIterator ul, SrcIterator lr, SrcAccessor src,
BackInsertable & edgels, double scale);
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
// compute edgels from a gradient image
template <class SrcIterator, class SrcAccessor, class BackInsertable>
void
cannyEdgelList(triple<SrcIterator, SrcIterator, SrcAccessor> src,
BackInsertable & edgels);
// compute edgels from a scalar image (determine gradient internally at 'scale')
template <class SrcIterator, class SrcAccessor, class BackInsertable>
void
cannyEdgelList(triple<SrcIterator, SrcIterator, SrcAccessor> src,
BackInsertable & edgels, double scale);
}

Usage:

#include <vigra/edgedetection.hxx>
Namespace: vigra

MultiArray<2, unsigned char> src(w,h);
// create empty edgel list
std::vector<vigra::Edgel> edgels;
...
// find edgels at scale 0.8
cannyEdgelList(src, edgels, 0.8);

show deprecated examples

vigra::BImage src(w,h);
// empty edgel list
std::vector<vigra::Edgel> edgels;
...
// find edgels at scale 0.8
vigra::cannyEdgelList(srcImageRange(src), edgels, 0.8);
Required Interface:
SrcImageIterator src_upperleft;
SrcAccessor src_accessor;
src_accessor(src_upperleft);
BackInsertable edgels;
edgels.push_back(Edgel());
vigra::Edgel
Definition edgedetection.hxx:1344
SrcAccessor::value_type must be a type convertible to float

Preconditions:

scale > 0

## ◆ cannyEdgelListThreshold()

template<... >

void cannyEdgelListThreshold | ( |  | ... | ) |

Canny's edge detector with thresholding.

This function works exactly like cannyEdgelList(), but you also pass a threshold for the minimal gradient magnitude, so that edgels whose strength is below the threshold are not inserted into the edgel list.

Declarations:

pass 2D array views:

namespace vigra {
// compute edgels from a scalar image (determine gradient internally at 'scale')
template <class T, class S,
class BackInsertable, class GradValue>
void
cannyEdgelListThreshold(MultiArrayView<2, T, S> const & src,
BackInsertable & edgels,
double scale,
GradValue grad_threshold);
// compute edgels from a pre-computed gradient image
template <class T, class S,
class BackInsertable, class GradValue>
void
cannyEdgelListThreshold(MultiArrayView<2, TinyVector<T, 2>, S> const & src,
BackInsertable & edgels,
GradValue grad_threshold);
}
vigra::cannyEdgelListThreshold
void cannyEdgelListThreshold(...)
Canny's edge detector with thresholding.

show deprecated declarations

pass Image Iterators and Data Accessors :
namespace vigra {
// compute edgels from a gradient image
template <class SrcIterator, class SrcAccessor,
class BackInsertable, class GradValue>
void
cannyEdgelListThreshold(SrcIterator ul, SrcIterator lr, SrcAccessor src,
BackInsertable & edgels, GradValue grad_threshold);
// compute edgels from a scalar image (determine gradient internally at 'scale')
template <class SrcIterator, class SrcAccessor,
class BackInsertable, class GradValue>
void
cannyEdgelListThreshold(SrcIterator ul, SrcIterator lr, SrcAccessor src,
BackInsertable & edgels, double scale, GradValue grad_threshold);
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
// compute edgels from a gradient image
template <class SrcIterator, class SrcAccessor,
class BackInsertable, class GradValue>
void
cannyEdgelListThreshold(triple<SrcIterator, SrcIterator, SrcAccessor> src,
BackInsertable & edgels, GradValue grad_threshold);
// compute edgels from a scalar image (determine gradient internally at 'scale')
template <class SrcIterator, class SrcAccessor,
class BackInsertable, class GradValue>
void
cannyEdgelListThreshold(triple<SrcIterator, SrcIterator, SrcAccessor> src,
BackInsertable & edgels, double scale, GradValue grad_threshold);
}

Usage:

#include <vigra/edgedetection.hxx>
Namespace: vigra

MultiArray<2, unsigned char> src(w,h);
// create empty edgel list
std::vector<vigra::Edgel> edgels;
...
// find edgels at scale 0.8, only considering gradient magnitudes above 2.0
cannyEdgelListThreshold(src, edgels, 0.8, 2.0);

show deprecated examples

vigra::BImage src(w,h);
// empty edgel list
std::vector<vigra::Edgel> edgels;
...
// find edgels at scale 0.8, only considering gradient above 2.0
vigra::cannyEdgelListThreshold(srcImageRange(src), edgels, 0.8, 2.0);
Required Interface:
SrcImageIterator src_upperleft;
SrcAccessor src_accessor;
src_accessor(src_upperleft);
BackInsertable edgels;
edgels.push_back(Edgel());
SrcAccessor::value_type must be a type convertible to float

Preconditions:

scale > 0

## ◆ cannyEdgeImage()

template<... >

void cannyEdgeImage | ( |  | ... | ) |

Detect and mark edges in an edge image using Canny's algorithm.

This operator first calls cannyEdgelList() with the given scale to generate an edgel list for the given image. Then it scans this list and selects edgels whose strength is above the given `gradient_threshold`. For each of these edgels, the edgel's location is rounded to the nearest pixel, and that pixel marked with the given `edge_marker`.

Declarations:

pass 2D array views:

namespace vigra {
template <class T1, class S1,
class T2, class S2,
class GradValue, class DestValue>
void
cannyEdgeImage(MultiArrayView<2, T1, S1> const & src,
MultiArrayView<2, T2, S2> dest,
double scale,
GradValue gradient_threshold,
DestValue edge_marker);
}
vigra::cannyEdgeImage
void cannyEdgeImage(...)
Detect and mark edges in an edge image using Canny's algorithm.

show deprecated declarations

pass Image Iterators and Data Accessors :
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor,
class GradValue, class DestValue>
void cannyEdgeImage(
SrcIterator sul, SrcIterator slr, SrcAccessor sa,
DestIterator dul, DestAccessor da,
double scale, GradValue gradient_threshold, DestValue edge_marker);
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor,
class GradValue, class DestValue>
void cannyEdgeImage(
triple<SrcIterator, SrcIterator, SrcAccessor> src,
pair<DestIterator, DestAccessor> dest,
double scale, GradValue gradient_threshold, DestValue edge_marker);
}

Usage:

#include <vigra/edgedetection.hxx>
Namespace: vigra

MultiArray<2, unsigned char> src(w,h), edges(w,h);
...
// find edges at scale 0.8 with gradient larger than 4.0, mark with 1
cannyEdgeImage(src, edges, 0.8, 4.0, 1);

show deprecated examples

vigra::BImage src(w,h), edges(w,h);
// empty edge image
edges = 0;
...
// find edges at scale 0.8 with gradient larger than 4.0, mark with 1
vigra::cannyEdgeImage(srcImageRange(src), destImage(edges),
0.8, 4.0, 1);
Required Interface: see also: cannyEdgelList().
DestImageIterator dest_upperleft;
DestAccessor dest_accessor;
DestValue edge_marker;
dest_accessor.set(edge_marker, dest_upperleft, vigra::Diff2D(1,1));

Preconditions:

scale > 0
gradient_threshold > 0

## ◆ cannyEdgeImageFromGradWithThinning()

template<... >

void cannyEdgeImageFromGradWithThinning | ( |  | ... | ) |

Detect and mark edges in an edge image using Canny's algorithm.

The input pixels of this algorithm must be vectors of length 2 (see Required Interface below). It first searches for all pixels whose gradient magnitude is larger than the given `gradient_threshold` and larger than the magnitude of its two neighbors in gradient direction (where these neighbors are determined by nearest neighbor interpolation, i.e. according to the octant where the gradient points into). The resulting edge pixel candidates are then subjected to topological thinning so that the remaining edge pixels can be linked into edgel chains with a provable, non-heuristic algorithm. Thinning is performed so that the pixels with highest gradient magnitude survive. Optionally, the outermost pixels are marked as edge pixels as well when `addBorder` is true. The remaining pixels will be marked in the destination image with the value of `edge_marker` (all non-edge pixels remain untouched).

Declarations:

pass 2D array views:

namespace vigra {
template <class T1, class S1,
class T2, class S2,
class GradValue, class DestValue>
void
cannyEdgeImageFromGradWithThinning(MultiArrayView<2, TinyVector<T1, 2>, S1> const & src,
MultiArrayView<2, T2, S2> dest,
GradValue gradient_threshold,
DestValue edge_marker,
bool addBorder = true);
}
vigra::cannyEdgeImageFromGradWithThinning
void cannyEdgeImageFromGradWithThinning(...)
Detect and mark edges in an edge image using Canny's algorithm.

show deprecated declarations

pass Image Iterators and Data Accessors :
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor,
class GradValue, class DestValue>
void cannyEdgeImageFromGradWithThinning(
SrcIterator sul, SrcIterator slr, SrcAccessor sa,
DestIterator dul, DestAccessor da,
GradValue gradient_threshold,
DestValue edge_marker, bool addBorder = true);
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor,
class GradValue, class DestValue>
void cannyEdgeImageFromGradWithThinning(
triple<SrcIterator, SrcIterator, SrcAccessor> src,
pair<DestIterator, DestAccessor> dest,
GradValue gradient_threshold,
DestValue edge_marker, bool addBorder = true);
}

Usage:

#include <vigra/edgedetection.hxx>
Namespace: vigra

MultiArray<2, unsigned char> src(w,h), edges(w,h);
MultiArray<2, TinyVector<float, 2> > grad(w,h);
// compute the image gradient at scale 0.8
gaussianGradient(src, grad, 0.8);
// find edges with gradient larger than 4.0, mark with 1, and add border
cannyEdgeImageFromGradWithThinning(grad, edges, 4.0, 1, true);

show deprecated examples

vigra::BImage src(w,h), edges(w,h);
vigra::FVector2Image grad(w,h);
// compute the image gradient at scale 0.8
vigra::gaussianGradient(srcImageRange(src), destImage(grad), 0.8);
// empty edge image
edges = 0;
// find edges gradient larger than 4.0, mark with 1, and add border
vigra::cannyEdgeImageFromGradWithThinning(srcImageRange(grad), destImage(edges),
4.0, 1, true);
Required Interface:
// the input pixel type must be a vector with two elements
SrcImageIterator src_upperleft;
SrcAccessor src_accessor;
typedef SrcAccessor::value_type SrcPixel;
typedef NormTraits<SrcPixel>::SquaredNormType SrcSquaredNormType;
SrcPixel g = src_accessor(src_upperleft);
SrcPixel::value_type g0 = g[0];
SrcSquaredNormType gn = squaredNorm(g);
DestImageIterator dest_upperleft;
DestAccessor dest_accessor;
DestValue edge_marker;
dest_accessor.set(edge_marker, dest_upperleft, vigra::Diff2D(1,1));
vigra::squaredNorm
FFTWComplex< R >::SquaredNormType squaredNorm(const FFTWComplex< R > &a)
squared norm (= squared magnitude)
Definition fftw3.hxx:1044

Preconditions:

gradient_threshold > 0

## ◆ cannyEdgeImageWithThinning()

template<... >

void cannyEdgeImageWithThinning | ( |  | ... | ) |

Detect and mark edges in an edge image using Canny's algorithm.

This operator first calls gaussianGradient() to compute the gradient of the input image, ad then cannyEdgeImageFromGradWithThinning() to generate an edge image. See there for more detailed documentation.

Declarations:

pass 2D array views:

namespace vigra {
template <class T1, class S1,
class T2, class S2,
class GradValue, class DestValue>
void
cannyEdgeImageWithThinning(MultiArrayView<2, T1, S1> const & src,
MultiArrayView<2, T2, S2> dest,
double scale,
GradValue gradient_threshold,
DestValue edge_marker,
bool addBorder = true);
}
vigra::cannyEdgeImageWithThinning
void cannyEdgeImageWithThinning(...)
Detect and mark edges in an edge image using Canny's algorithm.

show deprecated declarations

pass Image Iterators and Data Accessors :
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor,
class GradValue, class DestValue>
void cannyEdgeImageWithThinning(
SrcIterator sul, SrcIterator slr, SrcAccessor sa,
DestIterator dul, DestAccessor da,
double scale, GradValue gradient_threshold,
DestValue edge_marker, bool addBorder = true);
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor,
class GradValue, class DestValue>
void cannyEdgeImageWithThinning(
triple<SrcIterator, SrcIterator, SrcAccessor> src,
pair<DestIterator, DestAccessor> dest,
double scale, GradValue gradient_threshold,
DestValue edge_marker, bool addBorder = true);
}

Usage:

#include <vigra/edgedetection.hxx>
Namespace: vigra

MultiArray<2, unsigned char> src(w,h), edges(w,h);
...
// find edges at scale 0.8 with gradient larger than 4.0, mark with 1, and add border
cannyEdgeImageWithThinning(src, edges, 0.8, 4.0, 1, true);

show deprecated examples

vigra::BImage src(w,h), edges(w,h);
// empty edge image
edges = 0;
...
// find edges at scale 0.8 with gradient larger than 4.0, mark with 1, annd add border
vigra::cannyEdgeImageWithThinning(srcImageRange(src), destImage(edges),
0.8, 4.0, 1, true);
Required Interface: see also: cannyEdgelList().
DestImageIterator dest_upperleft;
DestAccessor dest_accessor;
DestValue edge_marker;
dest_accessor.set(edge_marker, dest_upperleft, vigra::Diff2D(1,1));

Preconditions:

scale > 0
gradient_threshold > 0

## ◆ cannyEdgelList3x3()

template<... >

void cannyEdgelList3x3 | ( |  | ... | ) |

Improved implementation of Canny's edge detector.

This operator first computes pixels which are crossed by the edge using cannyEdgeImageWithThinning(). The gradient magnitudes in the 3x3 neighborhood of these pixels are then projected onto the normal of the edge (as determined by the gradient direction). The edgel's subpixel location is found by fitting a parabola through the 9 gradient values and determining the parabola's tip. A new Edgel is appended to the given vector of `edgels`. Since the parabola is fitted to 9 points rather than 3 points as in cannyEdgelList(), the accuracy is higher.

The function can be called in two modes: If you pass a 'scale', it is assumed that the original image is scalar, and the Gaussian gradient is internally computed at the given 'scale'. If the function is called without scale parameter, it is assumed that the given image already contains the gradient (i.e. its value_type must be a vector of length 2).

Declarations:

pass 2D array views:

namespace vigra {
// compute edgels from a scalar image (determine gradient internally at 'scale')
template <class T, class S, class BackInsertable>
void
cannyEdgelList3x3(MultiArrayView<2, T, S> const & src,
BackInsertable & edgels,
double scale);
// compute edgels from a pre-computed gradient image
template <class T, class S, class BackInsertable>
void
cannyEdgelList3x3(MultiArrayView<2, TinyVector<T, 2>, S> const & src,
BackInsertable & edgels);
}
vigra::cannyEdgelList3x3
void cannyEdgelList3x3(...)
Improved implementation of Canny's edge detector.

show deprecated declarations

pass Image Iterators and Data Accessors :
namespace vigra {
// compute edgels from a gradient image
template <class SrcIterator, class SrcAccessor, class BackInsertable>
void cannyEdgelList3x3(SrcIterator ul, SrcIterator lr, SrcAccessor src,
BackInsertable & edgels);
// compute edgels from a scalar image (determine gradient internally at 'scale')
template <class SrcIterator, class SrcAccessor, class BackInsertable>
void cannyEdgelList3x3(SrcIterator ul, SrcIterator lr, SrcAccessor src,
BackInsertable & edgels, double scale);
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
// compute edgels from a gradient image
template <class SrcIterator, class SrcAccessor, class BackInsertable>
void
cannyEdgelList3x3(triple<SrcIterator, SrcIterator, SrcAccessor> src,
BackInsertable & edgels);
// compute edgels from a scalar image (determine gradient internally at 'scale')
template <class SrcIterator, class SrcAccessor, class BackInsertable>
void
cannyEdgelList3x3(triple<SrcIterator, SrcIterator, SrcAccessor> src,
BackInsertable & edgels, double scale);
}

Usage:

#include <vigra/edgedetection.hxx>
Namespace: vigra

MultiArray<2, unsigned char> src(w,h);
// create empty edgel list
std::vector<vigra::Edgel> edgels;
...
// find edgels at scale 0.8
cannyEdgelList3x3(src, edgels, 0.8);

show deprecated examples

vigra::BImage src(w,h);
// empty edgel list
std::vector<vigra::Edgel> edgels;
...
// find edgels at scale 0.8
vigra::cannyEdgelList3x3(srcImageRange(src), edgels, 0.8);
Required Interface:
SrcImageIterator src_upperleft;
SrcAccessor src_accessor;
src_accessor(src_upperleft);
BackInsertable edgels;
edgels.push_back(Edgel());
SrcAccessor::value_type must be a type convertible to float

Preconditions:

scale > 0

## ◆ cannyEdgelList3x3Threshold()

template<... >

void cannyEdgelList3x3Threshold | ( |  | ... | ) |

Improved implementation of Canny's edge detector with thresholding.

This function works exactly like cannyEdgelList3x3(), but you also pass a threshold for the minimal gradient magnitude, so that edgels whose strength is below the threshold are not inserted into the edgel list.

Declarations:

pass 2D array views:

namespace vigra {
// compute edgels from a gradient image
template <class SrcIterator, class SrcAccessor,
class BackInsertable, class GradValue>
void
cannyEdgelList3x3Threshold(SrcIterator ul, SrcIterator lr, SrcAccessor src,
BackInsertable & edgels, GradValue grad_thresh);
// compute edgels from a scalar image (determine gradient internally at 'scale')
template <class SrcIterator, class SrcAccessor,
class BackInsertable, class GradValue>
void
cannyEdgelList3x3Threshold(SrcIterator ul, SrcIterator lr, SrcAccessor src,
BackInsertable & edgels, double scale, GradValue grad_thresh);
}
vigra::cannyEdgelList3x3Threshold
void cannyEdgelList3x3Threshold(...)
Improved implementation of Canny's edge detector with thresholding.

show deprecated declarations

pass Image Iterators and Data Accessors :
namespace vigra {
// compute edgels from a gradient image
template <class SrcIterator, class SrcAccessor,
class BackInsertable, class GradValue>
void
cannyEdgelList3x3Threshold(SrcIterator ul, SrcIterator lr, SrcAccessor src,
BackInsertable & edgels, GradValue grad_thresh);
// compute edgels from a scalar image (determine gradient internally at 'scale')
template <class SrcIterator, class SrcAccessor,
class BackInsertable, class GradValue>
void
cannyEdgelList3x3Threshold(SrcIterator ul, SrcIterator lr, SrcAccessor src,
BackInsertable & edgels, double scale, GradValue grad_thresh);
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
// compute edgels from a gradient image
template <class SrcIterator, class SrcAccessor,
class BackInsertable, class GradValue>
void
cannyEdgelList3x3Threshold(triple<SrcIterator, SrcIterator, SrcAccessor> src,
BackInsertable & edgels, GradValue grad_thresh);
// compute edgels from a scalar image (determine gradient internally at 'scale')
template <class SrcIterator, class SrcAccessor,
class BackInsertable, class GradValue>
void
cannyEdgelList3x3Threshold(triple<SrcIterator, SrcIterator, SrcAccessor> src,
BackInsertable & edgels, double scale, GradValue grad_thresh);
}

Usage:

#include <vigra/edgedetection.hxx>
Namespace: vigra

MultiArray<2, unsigned char> src(w,h);
// create empty edgel list
std::vector<vigra::Edgel> edgels;
...
// find edgels at scale 0.8 whose gradient is at least 4.0
cannyEdgelList3x3Threshold(src, edgels, 0.8, 4.0);

show deprecated examples

vigra::BImage src(w,h);
// empty edgel list
std::vector<vigra::Edgel> edgels;
...
// find edgels at scale 0.8 whose gradient is at least 4.0
vigra::cannyEdgelList3x3Threshold(srcImageRange(src), edgels, 0.8, 4.0);
Required Interface:
SrcImageIterator src_upperleft;
SrcAccessor src_accessor;
src_accessor(src_upperleft);
BackInsertable edgels;
edgels.push_back(Edgel());
SrcAccessor::value_type must be a type convertible to float

Preconditions:

scale > 0

## ◆ moveDCToCenter()

template<... >

void moveDCToCenter | ( |  | ... | ) |

Rearrange the quadrants of a Fourier image so that the origin is in the image center.

FFTW produces fourier images where the DC component (origin of fourier space) is located in the upper left corner of the image. The quadrants are placed like this (using a 4x4 image for example):

DC 4 3 3
4 4 3 3
1 1 2 2
1 1 2 2

After applying the function, the quadrants are at their usual places:

2 2 1 1
2 2 1 1
3 3 DC 4
3 3 4 4

This transformation can be reversed by moveDCToUpperLeft(). Note that the 2D versions of this transformation must not be executed in place - input and output images must be different. In contrast, the nD version (with MultiArrayView argument) always works in-place.

Declarations:

use MultiArrayView (this works in-place, with arbitrary dimension N):

namespace vigra {
template <unsigned int N, class T, class Stride>
void moveDCToCenter(MultiArrayView<N, T, Stride> a);
}
vigra::moveDCToCenter
void moveDCToCenter(...)
Rearrange the quadrants of a Fourier image so that the origin is in the image center.

pass iterators explicitly (2D only, not in-place):

namespace vigra {
template <class SrcImageIterator, class SrcAccessor,
class DestImageIterator, class DestAccessor>
void moveDCToCenter(SrcImageIterator src_upperleft,
SrcImageIterator src_lowerright, SrcAccessor sa,
DestImageIterator dest_upperleft, DestAccessor da);
}

use argument objects in conjunction with Argument Object Factories (2D only, not in-place):

namespace vigra {
template <class SrcImageIterator, class SrcAccessor,
class DestImageIterator, class DestAccessor>
void moveDCToCenter(
triple<SrcImageIterator, SrcImageIterator, SrcAccessor> src,
pair<DestImageIterator, DestAccessor> dest);
}

Usage:

#include <vigra/fftw3.hxx> (for 2D variants)
#include <vigra/multi_fft.hxx> (for nD variants)
Namespace: vigra

vigra::FFTWComplexImage spatial(width,height), fourier(width,height);
... // fill image with data
// create a plan with estimated performance optimization
fftw_plan forwardPlan = fftw_plan_dft_2d(height, width,
(fftw_complex *)spatial.begin(), (fftw_complex *)fourier.begin(),
FFTW_FORWARD, FFTW_ESTIMATE );
// calculate FFT
fftw_execute(forwardPlan);
vigra::FFTWComplexImage rearrangedFourier(width, height);
moveDCToCenter(srcImageRange(fourier), destImage(rearrangedFourier));
// delete the plan
fftw_destroy_plan(forwardPlan);
vigra::TinyVectorBase::begin
iterator begin()
Definition tinyvector.hxx:861

## ◆ moveDCToUpperLeft()

template<... >

void moveDCToUpperLeft | ( |  | ... | ) |

Rearrange the quadrants of a Fourier image so that the origin is in the image's upper left.

This function is the inversion of moveDCToCenter(). See there for a detailed description and usage examples.

Declarations:

use MultiArrayView (this works in-place, with arbitrary dimension N):

namespace vigra {
template <unsigned int N, class T, class Stride>
void moveDCToUpperLeft(MultiArrayView<N, T, Stride> a);
}
vigra::moveDCToUpperLeft
void moveDCToUpperLeft(...)
Rearrange the quadrants of a Fourier image so that the origin is in the image's upper left.

pass iterators explicitly (2D only, not in-place):

namespace vigra {
template <class SrcImageIterator, class SrcAccessor,
class DestImageIterator, class DestAccessor>
void moveDCToUpperLeft(SrcImageIterator src_upperleft,
SrcImageIterator src_lowerright, SrcAccessor sa,
DestImageIterator dest_upperleft, DestAccessor da);
}

use argument objects in conjunction with Argument Object Factories (2D only, not in-place):

namespace vigra {
template <class SrcImageIterator, class SrcAccessor,
class DestImageIterator, class DestAccessor>
void moveDCToUpperLeft(
triple<SrcImageIterator, SrcImageIterator, SrcAccessor> src,
pair<DestImageIterator, DestAccessor> dest);
}

## ◆ fourierTransform()

template<... >

void fourierTransform | ( |  | ... | ) |

Compute forward and inverse Fourier transforms.

The array referring to the spatial domain (i.e. the input in a forward transform, and the output in an inverse transform) may be scalar or complex. The array representing the frequency domain (i.e. output for forward transform, input for inverse transform) must always be complex.

The new implementations (those using MultiArrayView arguments) perform a normalized transform, whereas the old ones (using 2D iterators or argument objects) perform an un-normalized transform (i.e. the result of the inverse transform is scaled by the number of pixels).

In general, input and output arrays must have the same shape, with the exception of the special R2C and C2R modes defined by FFTW.

The R2C transform reduces the redundancy in the Fourier representation of a real-valued signal: Since the Fourier representation of a real signal is symmetric, about half of the Fourier coefficients can simply be dropped. By convention, this reduction is applied to the first (innermost) dimension, such that `fourier.shape(0) == spatial.shape(0)/2 + 1` holds. The correct frequency domain shape can be conveniently computed by means of the function fftwCorrespondingShapeR2C().

Note that your program must always link against `libfftw3`. If you want to compute Fourier transforms for `float` or `long double` arrays, you must additionally link against `libfftw3f` and `libfftw3l` respectively. (Old-style functions only support `double`).

The Fourier transform functions internally create FFTW plans which control the algorithm details. The plans are creates with the flag `FFTW_ESTIMATE`, i.e. optimal settings are guessed or read from saved "wisdom" files. If you need more control over planning, you can use the class FFTWPlan.

Declarations:

use complex-valued MultiArrayView arguments (this works for arbitrary dimension N):

namespace vigra {
template <unsigned int N, class Real, class C1, class C2>
void
fourierTransform(MultiArrayView<N, FFTWComplex<Real>, C1> in,
MultiArrayView<N, FFTWComplex<Real>, C2> out);
template <unsigned int N, class Real, class C1, class C2>
void
fourierTransformInverse(MultiArrayView<N, FFTWComplex<Real>, C1> in,
MultiArrayView<N, FFTWComplex<Real>, C2> out);
}
vigra::fourierTransform
void fourierTransform(...)
Compute forward and inverse Fourier transforms.
vigra::fourierTransformInverse
void fourierTransformInverse(...)
Compute inverse Fourier transforms.

use real-valued MultiArrayView in the spatial domain, complex-valued MultiArrayView in the frequency domain (this works for arbitrary dimension N, and also supports the R2C and C2R transform, depending on the array shape in the frequency domain):

namespace vigra {
template <unsigned int N, class Real, class C1, class C2>
void
fourierTransform(MultiArrayView<N, Real, C1> in,
MultiArrayView<N, FFTWComplex<Real>, C2> out);
template <unsigned int N, class Real, class C1, class C2>
void
fourierTransformInverse(MultiArrayView<N, FFTWComplex<Real>, C1> in,
MultiArrayView<N, Real, C2> out);
}

pass iterators explicitly (2D only, double only):

namespace vigra {
template <class SrcImageIterator, class SrcAccessor>
void fourierTransform(SrcImageIterator srcUpperLeft,
SrcImageIterator srcLowerRight, SrcAccessor src,
FFTWComplexImage::traverser destUpperLeft, FFTWComplexImage::Accessor dest);
void
fourierTransformInverse(FFTWComplexImage::const_traverser sul,
FFTWComplexImage::const_traverser slr, FFTWComplexImage::ConstAccessor src,
FFTWComplexImage::traverser dul, FFTWComplexImage::Accessor dest)
}

use argument objects in conjunction with Argument Object Factories (2D only, double only):

namespace vigra {
template <class SrcImageIterator, class SrcAccessor>
void fourierTransform(triple<SrcImageIterator, SrcImageIterator, SrcAccessor> src,
pair<FFTWComplexImage::traverser, FFTWComplexImage::Accessor> dest);
void
fourierTransformInverse(triple<FFTWComplexImage::const_traverser,
FFTWComplexImage::const_traverser, FFTWComplexImage::ConstAccessor> src,
pair<FFTWComplexImage::traverser, FFTWComplexImage::Accessor> dest);
}

Usage:

#include <vigra/fftw3.hxx> (old-style 2D variants)
#include <vigra/multi_fft.hxx> (new-style nD variants)
Namespace: vigra

old-style example (using FFTWComplexImage):

// compute complex Fourier transform of a real image, old-style implementation
vigra::DImage src(w, h);
vigra::FFTWComplexImage fourier(w, h);
fourierTransform(srcImageRange(src), destImage(fourier));
// compute inverse Fourier transform
// note that both source and destination image must be of type vigra::FFTWComplexImage
vigra::FFTWComplexImage inverseFourier(w, h);
fourierTransformInverse(srcImageRange(fourier), destImage(inverseFourier));

new-style examples (using MultiArray):

// compute Fourier transform of a real array, using the R2C algorithm
MultiArray<2, double> src(Shape2(w, h));
MultiArray<2, FFTWComplex<double> > fourier(fftwCorrespondingShapeR2C(src.shape()));
fourierTransform(src, fourier);
// compute inverse Fourier transform, using the C2R algorithm
MultiArray<2, double> dest(src.shape());
fourierTransformInverse(fourier, dest);
vigra::fftwCorrespondingShapeR2C
TinyVector< T, N > fftwCorrespondingShapeR2C(TinyVector< T, N > shape)
Find frequency domain shape for a R2C Fourier transform.
Definition multi_fft.hxx:802
// compute Fourier transform of a real array with standard algorithm
MultiArray<2, double> src(Shape2(w, h));
MultiArray<2, FFTWComplex<double> > fourier(src.shape());
fourierTransform(src, fourier);
// compute inverse Fourier transform, using the C2R algorithm
MultiArray<2, double> dest(src.shape());
fourierTransformInverse(fourier, dest);

Complex input arrays are handled in the same way.

## ◆ fourierTransformInverse()

template<... >

void fourierTransformInverse | ( |  | ... | ) |

Compute inverse Fourier transforms.

See fourierTransform() for details.

## ◆ applyFourierFilter()

template<... >

void applyFourierFilter | ( |  | ... | ) |

Apply a filter (defined in the frequency domain) to an image.

After transferring the image into the frequency domain, it is multiplied pixel-wise with the filter and transformed back. The result is put into the given destination image which must have the right size. The result will be normalized to compensate for the two FFTs.

If the destination image is scalar, only the real part of the result image is retained. In this case, you are responsible for choosing a filter image which ensures a zero imaginary part of the result (e.g. use a real, even symmetric filter image, or a purely imaginary, odd symmetric one).

The DC entry of the filter must be in the upper left, which is the position where FFTW expects it (see moveDCToUpperLeft()).

See also convolveFFT() for corresponding functionality on the basis of the MultiArrayView interface.

Declarations:

pass 2D array views:

namespace vigra {
template <class SrcImageIterator, class SrcAccessor,
class FilterImageIterator, class FilterAccessor,
class DestImageIterator, class DestAccessor>
void applyFourierFilter(SrcImageIterator srcUpperLeft,
SrcImageIterator srcLowerRight, SrcAccessor sa,
FilterImageIterator filterUpperLeft, FilterAccessor fa,
DestImageIterator destUpperLeft, DestAccessor da);
}
vigra::applyFourierFilter
void applyFourierFilter(...)
Apply a filter (defined in the frequency domain) to an image.

pass Image Iterators and Data Accessors :

namespace vigra {
template <class SrcImageIterator, class SrcAccessor,
class FilterImageIterator, class FilterAccessor,
class DestImageIterator, class DestAccessor>
void applyFourierFilter(SrcImageIterator srcUpperLeft,
SrcImageIterator srcLowerRight, SrcAccessor sa,
FilterImageIterator filterUpperLeft, FilterAccessor fa,
DestImageIterator destUpperLeft, DestAccessor da);
}

use argument objects in conjunction with Argument Object Factories :

namespace vigra {
template <class SrcImageIterator, class SrcAccessor,
class FilterImageIterator, class FilterAccessor,
class DestImageIterator, class DestAccessor>
void applyFourierFilter(triple<SrcImageIterator, SrcImageIterator, SrcAccessor> src,
pair<FilterImageIterator, FilterAccessor> filter,
pair<DestImageIterator, DestAccessor> dest);
}

Usage:

#include <vigra/fftw3.hxx>
Namespace: vigra

// create a Gaussian filter in Fourier space
vigra::FImage gaussFilter(w, h), filter(w, h);
for(int y=0; y<h; ++y)
for(int x=0; x<w; ++x)
{
xx = float(x - w / 2) / w;
yy = float(y - h / 2) / h;
gaussFilter(x,y) = std::exp(-(xx*xx + yy*yy) / 2.0 * scale);
}
// applyFourierFilter() expects the filter's DC in the upper left
moveDCToUpperLeft(srcImageRange(gaussFilter), destImage(filter));
vigra::FFTWComplexImage result(w, h);
vigra::applyFourierFilter(srcImageRange(image), srcImage(filter), result);

For inspection of the result, FFTWMagnitudeAccessor might be useful. If you want to apply the same filter repeatedly, it may be more efficient to use the FFTW functions directly with FFTW plans optimized for good performance.

## ◆ applyFourierFilterFamily()

template<... >

void applyFourierFilterFamily | ( |  | ... | ) |

Apply an array of filters (defined in the frequency domain) to an image.

This provides the same functionality as applyFourierFilter(), but applying several filters at once allows to avoid repeated Fourier transforms of the source image.

Filters and result images must be stored in vigra::ImageArray data structures. In contrast to applyFourierFilter(), this function adjusts the size of the result images and the the length of the array.

Declarations:

pass 2D array views:

namespace vigra {
template <class SrcImageIterator, class SrcAccessor, class FilterType>
void applyFourierFilterFamily(SrcImageIterator srcUpperLeft,
SrcImageIterator srcLowerRight, SrcAccessor sa,
const ImageArray<FilterType> &filters,
ImageArray<FFTWComplexImage> &results)
}
vigra::applyFourierFilterFamily
void applyFourierFilterFamily(...)
Apply an array of filters (defined in the frequency domain) to an image.

pass Image Iterators and Data Accessors :

namespace vigra {
template <class SrcImageIterator, class SrcAccessor, class FilterType>
void applyFourierFilterFamily(SrcImageIterator srcUpperLeft,
SrcImageIterator srcLowerRight, SrcAccessor sa,
const ImageArray<FilterType> &filters,
ImageArray<FFTWComplexImage> &results)
}

use argument objects in conjunction with Argument Object Factories :

namespace vigra {
template <class SrcImageIterator, class SrcAccessor, class FilterType>
void applyFourierFilterFamily(triple<SrcImageIterator, SrcImageIterator, SrcAccessor> src,
const ImageArray<FilterType> &filters,
ImageArray<FFTWComplexImage> &results)
}

Usage:

#include <vigra/fftw3.hxx>
Namespace: vigra

// assuming the presence of a real-valued image named "image" to
// be filtered in this example
vigra::ImageArray<vigra::FImage> filters(16, image.size());
for (int i=0; i<filters.size(); i++)
// create some meaningful filters here
createMyFilterOfScale(i, destImage(filters[i]));
vigra::ImageArray<vigra::FFTWComplexImage> results();
vigra::applyFourierFilterFamily(srcImageRange(image), filters, results);

## ◆ fourierTransformReal()

template<... >

void fourierTransformReal | ( |  | ... | ) |

Real Fourier transforms for even and odd boundary conditions (aka. cosine and sine transforms).

If the image is real and has even symmetry, its Fourier transform is also real and has even symmetry. The Fourier transform of a real image with odd symmetry is imaginary and has odd symmetry. In either case, only about a quarter of the pixels need to be stored because the rest can be calculated from the symmetry properties. This is especially useful, if the original image is implicitly assumed to have reflective or anti-reflective boundary conditions. Then the "negative" pixel locations are defined as

even (reflective boundary conditions): f[-x] = f[x] (x = 1,...,N-1)
odd (anti-reflective boundary conditions): f[-1] = 0
f[-x] = -f[x-2] (x = 2,...,N-1)
vigra::even
bool even(int t)
Check if an integer is even.
vigra::odd
bool odd(int t)
Check if an integer is odd.

end similar at the other boundary (see the FFTW documentation for details). This has the advantage that more efficient Fourier transforms that use only real numbers can be implemented. These are also known as cosine and sine transforms respectively.

If you use the odd transform it is important to note that in the Fourier domain, the DC component is always zero and is therefore dropped from the data structure. This means that index 0 in an odd symmetric Fourier domain image refers to the first harmonic. This is especially important if an image is first cosine transformed (even symmetry), then in the Fourier domain multiplied with an odd symmetric filter (e.g. a first derivative) and finally transformed back to the spatial domain with a sine transform (odd symmetric). For this to work properly the image must be shifted left or up by one pixel (depending on whether the x- or y-axis is odd symmetric) before the inverse transform can be applied. (see example below).

The real Fourier transform functions are named `fourierTransformReal??` where the questions marks stand for either `E` or `O` indicating whether the x- and y-axis is to be transformed using even or odd symmetry. The same functions can be used for both the forward and inverse transforms, only the normalization changes. For signal processing, the following normalization factors are most appropriate:

forward inverse
------------------------------------------------------------
X even, Y even 1.0 4.0 * (w-1) * (h-1)
X even, Y odd -1.0 -4.0 * (w-1) * (h+1)
X odd, Y even -1.0 -4.0 * (w+1) * (h-1)
X odd, Y odd 1.0 4.0 * (w+1) * (h+1)

where `w` and `h` denote the image width and height.

Declarations:

pass 2D array views:

namespace vigra {
template <class SrcTraverser, class SrcAccessor,
class DestTraverser, class DestAccessor>
void
fourierTransformRealEE(SrcTraverser sul, SrcTraverser slr, SrcAccessor src,
DestTraverser dul, DestAccessor dest, fftw_real norm);
fourierTransformRealEO, fourierTransformRealOE, fourierTransformRealOO likewise
}

pass Image Iterators and Data Accessors :

namespace vigra {
template <class SrcTraverser, class SrcAccessor,
class DestTraverser, class DestAccessor>
void
fourierTransformRealEE(SrcTraverser sul, SrcTraverser slr, SrcAccessor src,
DestTraverser dul, DestAccessor dest, fftw_real norm);
fourierTransformRealEO, fourierTransformRealOE, fourierTransformRealOO likewise
}

use argument objects in conjunction with Argument Object Factories :

namespace vigra {
template <class SrcTraverser, class SrcAccessor,
class DestTraverser, class DestAccessor>
void
fourierTransformRealEE(triple<SrcTraverser, SrcTraverser, SrcAccessor> src,
pair<DestTraverser, DestAccessor> dest, fftw_real norm);
fourierTransformRealEO, fourierTransformRealOE, fourierTransformRealOO likewise
}

Usage:

#include <vigra/fftw3.hxx>
Namespace: vigra

vigra::FImage spatial(width,height), fourier(width,height);
... // fill image with data
// forward cosine transform == reflective boundary conditions
fourierTransformRealEE(srcImageRange(spatial), destImage(fourier), (fftw_real)1.0);
// multiply with a first derivative of Gaussian in x-direction
for(int y = 0; y < height; ++y)
{
for(int x = 1; x < width; ++x)
{
double dx = x * M_PI / (width - 1);
double dy = y * M_PI / (height - 1);
fourier(x-1, y) = fourier(x, y) * dx * std::exp(-(dx*dx + dy*dy) * scale*scale / 2.0);
}
fourier(width-1, y) = 0.0;
}
// inverse transform -- odd symmetry in x-direction, even in y,
// due to symmetry of the filter
fourierTransformRealOE(srcImageRange(fourier), destImage(spatial),
(fftw_real)-4.0 * (width+1) * (height-1));

## ◆ fixed_point_cast() [1/2]

template<class TARGET , unsigned IntBits, unsigned FracBits>

TARGET fixed_point_cast | ( | FixedPoint< IntBits, FracBits > | v | ) |

Convert a FixedPoint to a built-in type. If the target is integral, the value is rounded.
Usage:

FixedPoint<16,15> fp(...);
double d = fixed_point_cast<double>(fp);

## ◆ fixed_point_cast() [2/2]

template<class TARGET , int IntBits, FPOverflowHandling OverflowHandling>

TARGET fixed_point_cast | ( | FixedPoint16< IntBits, OverflowHandling > | v | ) |

Convert a FixedPoint16 to a built-in type. If the target is integral, the value is rounded.
Usage:

FixedPoint16<16,15> fp(...);
double d = fixed_point_cast<double>(fp);

## ◆ discRankOrderFilter()

template<... >

void discRankOrderFilter | ( |  | ... | ) |

Apply rank order filter with disc structuring function to the image.

The pixel values of the source image must be in the range 0...255. Radius must be >= 0. Rank must be in the range 0.0 <= rank <= 1.0. The filter acts as a minimum filter if rank = 0.0, as a median if rank = 0.5, and as a maximum filter if rank = 1.0. Accessor are used to access the pixel data.

Declarations:

pass 2D array views:

namespace vigra {
template <class T1, class S1,
class T2, class S2>
void
discRankOrderFilter(MultiArrayView<2, T1, S1> const & src,
MultiArrayView<2, T2, S2> dest,
int radius, float rank);
}
vigra::discRankOrderFilter
void discRankOrderFilter(...)
Apply rank order filter with disc structuring function to the image.

show deprecated declarations

pass Image Iterators and Data Accessors :
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor>
void
discRankOrderFilter(SrcIterator upperleft1,
SrcIterator lowerright1, SrcAccessor sa,
DestIterator upperleft2, DestAccessor da,
int radius, float rank)
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor>
void
discRankOrderFilter(triple<SrcIterator, SrcIterator, SrcAccessor> src,
pair<DestIterator, DestAccessor> dest,
int radius, float rank)
}

Usage:

#include <vigra/flatmorphology.hxx>
Namespace: vigra

MultiArray<2, unsigned char> src(w, h), dest(w, h);
// do median filtering (because rank=0.5) in a cricle with radius 10
discRankOrderFilter(src, dest, 10, 0.5);

show deprecated examples

vigra::CImage src, dest;
// do median filtering
vigra::discRankOrderFilter(srcImageRange(src), destImage(dest), 10, 0.5);
Required Interface:
SrcIterator src_upperleft;
DestIterator dest_upperleft;
int x, y;
unsigned char value;
SrcAccessor src_accessor;
DestAccessor dest_accessor;
// value_type of accessor must be convertible to unsigned char
value = src_accessor(src_upperleft, x, y);
dest_accessor.set(value, dest_upperleft, x, y);

Preconditions:

for all source pixels: 0 <= value <= 255
(rank >= 0.0) && (rank <= 1.0)
radius >= 0

## ◆ discErosion()

template<... >

void discErosion | ( |  | ... | ) |

Apply erosion (minimum) filter with disc of given radius to image.

This is an abbreviation for the rank order filter with rank = 0.0. See discRankOrderFilter() for more information.

Declarations:

pass 2D array views:

namespace vigra {
template <class T1, class S1,
class T2, class S2>
void
discErosion(MultiArrayView<2, T1, S1> const & src,
MultiArrayView<2, T2, S2> dest,
int radius);
}
vigra::discErosion
void discErosion(...)
Apply erosion (minimum) filter with disc of given radius to image.

show deprecated declarations

pass Image Iterators and Data Accessors :
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor>
void
discErosion(SrcIterator upperleft1,
SrcIterator lowerright1, SrcAccessor sa,
DestIterator upperleft2, DestAccessor da,
int radius)
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor>
void
discErosion(triple<SrcIterator, SrcIterator, SrcAccessor> src,
pair<DestIterator, DestAccessor> dest,
int radius)
}

## ◆ discDilation()

template<... >

void discDilation | ( |  | ... | ) |

Apply dilation (maximum) filter with disc of given radius to image.

This is an abbreviation for the rank order filter with rank = 1.0. See discRankOrderFilter() for more information.

Declarations:

pass 2D array views:

namespace vigra {
template <class T1, class S1,
class T2, class S2>
void
discDilation(MultiArrayView<2, T1, S1> const & src,
MultiArrayView<2, T2, S2> dest,
int radius);
}
vigra::discDilation
void discDilation(...)
Apply dilation (maximum) filter with disc of given radius to image.

show deprecated declarations

pass Image Iterators and Data Accessors :
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor>
void
discDilation(SrcIterator upperleft1,
SrcIterator lowerright1, SrcAccessor sa,
DestIterator upperleft2, DestAccessor da,
int radius)
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor>
void
discDilation(triple<SrcIterator, SrcIterator, SrcAccessor> src,
pair<DestIterator, DestAccessor> dest,
int radius)
}

## ◆ discMedian()

template<... >

void discMedian | ( |  | ... | ) |

Apply median filter with disc of given radius to image.

This is an abbreviation for the rank order filter with rank = 0.5. See discRankOrderFilter() for more information.

Declarations:

pass 2D array views:

namespace vigra {
template <class T1, class S1,
class T2, class S2>
void
discMedian(MultiArrayView<2, T1, S1> const & src,
MultiArrayView<2, T2, S2> dest,
int radius);
}
vigra::discMedian
void discMedian(...)
Apply median filter with disc of given radius to image.

show deprecated declarations

pass Image Iterators and Data Accessors :
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor>
void
discMedian(SrcIterator upperleft1,
SrcIterator lowerright1, SrcAccessor sa,
DestIterator upperleft2, DestAccessor da,
int radius)
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor>
void
discMedian(triple<SrcIterator, SrcIterator, SrcAccessor> src,
pair<DestIterator, DestAccessor> dest,
int radius)
}

## ◆ discRankOrderFilterWithMask()

template<... >

void discRankOrderFilterWithMask | ( |  | ... | ) |

Apply rank order filter with disc structuring function to the image using a mask.

The pixel values of the source image must be in the range 0...255. Radius must be >= 0. Rank must be in the range 0.0 <= rank <= 1.0. The filter acts as a minimum filter if rank = 0.0, as a median if rank = 0.5, and as a maximum filter if rank = 1.0. Accessor are used to access the pixel data.

The mask is only applied to th input image, i.e. the function generates an output wherever the current disc contains at least one pixel with mask value 'true'. Source pixels with mask value 'false' are ignored during the calculation of the rank order.

Declarations:

pass 2D array views:

namespace vigra {
template <class T1, class S1,
class TM, class SM,
class T2, class S2>
void
discRankOrderFilterWithMask(MultiArrayView<2, T1, S1> const & src,
MultiArrayView<2, TM, SM> const & mask,
MultiArrayView<2, T2, S2> dest,
int radius, float rank);
}
vigra::discRankOrderFilterWithMask
void discRankOrderFilterWithMask(...)
Apply rank order filter with disc structuring function to the image using a mask.

show deprecated declarations

pass Image Iterators and Data Accessors :
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class MaskIterator, class MaskAccessor,
class DestIterator, class DestAccessor>
void
discRankOrderFilterWithMask(SrcIterator upperleft1,
SrcIterator lowerright1, SrcAccessor sa,
MaskIterator upperleftm, MaskAccessor mask,
DestIterator upperleft2, DestAccessor da,
int radius, float rank)
}
group arguments (use in conjunction with Argument Object Factories):
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class MaskIterator, class MaskAccessor,
class DestIterator, class DestAccessor>
void
discRankOrderFilterWithMask(triple<SrcIterator, SrcIterator, SrcAccessor> src,
pair<MaskIterator, MaskAccessor> mask,
pair<DestIterator, DestAccessor> dest,
int radius, float rank)
}

Usage:

#include <vigra/flatmorphology.hxx>
Namespace: vigra

MultiArray<2, unsigned char> src(w, h), dest(w, h), mask(w, h);
...
// do median filtering (since rank=0.5) in a circle with radius 10
// but change only the pixels under the mask
discRankOrderFilterWithMask(src, mask, dest, 10, 0.5);

show deprecated examples

vigra::CImage src, dest, mask;
// do median filtering
vigra::discRankOrderFilterWithMask(srcImageRange(src),
maskImage(mask), destImage(dest), 10, 0.5);
Required Interface:
SrcIterator src_upperleft;
DestIterator dest_upperleft;
MaskIterator mask_upperleft;
int x, y;
unsigned char value;
SrcAccessor src_accessor;
DestAccessor dest_accessor;
MaskAccessor mask_accessor;
mask_accessor(mask_upperleft, x, y) // convertible to bool
// value_type of accessor must be convertible to unsigned char
value = src_accessor(src_upperleft, x, y);
dest_accessor.set(value, dest_upperleft, x, y);

Preconditions:

for all source pixels: 0 <= value <= 255
(rank >= 0.0) && (rank <= 1.0)
radius >= 0

## ◆ discErosionWithMask()

template<... >

void discErosionWithMask | ( |  | ... | ) |

Apply erosion (minimum) filter with disc of given radius to image using a mask.

This is an abbreviation for the masked rank order filter with rank = 0.0. See discRankOrderFilterWithMask() for more information.

Declarations:

pass 2D array views:

namespace vigra {
template <class T1, class S1,
class TM, class SM,
class T2, class S2>
void
discErosionWithMask(MultiArrayView<2, T1, S1> const & src,
MultiArrayView<2, TM, SM> const & mask,
MultiArrayView<2, T2, S2> dest,
int radius);
}
vigra::discErosionWithMask
void discErosionWithMask(...)
Apply erosion (minimum) filter with disc of given radius to image using a mask.

show deprecated declarations

pass Image Iterators and Data Accessors :
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class MaskIterator, class MaskAccessor,
class DestIterator, class DestAccessor>
void
discErosionWithMask(SrcIterator upperleft1,
SrcIterator lowerright1, SrcAccessor sa,
MaskIterator upperleftm, MaskAccessor mask,
DestIterator upperleft2, DestAccessor da,
int radius)
}
group arguments (use in conjunction with Argument Object Factories):
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class MaskIterator, class MaskAccessor,
class DestIterator, class DestAccessor>
void
discErosionWithMask(triple<SrcIterator, SrcIterator, SrcAccessor> src,
pair<MaskIterator, MaskAccessor> mask,
pair<DestIterator, DestAccessor> dest,
int radius)
}

## ◆ discDilationWithMask()

template<... >

void discDilationWithMask | ( |  | ... | ) |

Apply dilation (maximum) filter with disc of given radius to image using a mask.

This is an abbreviation for the masked rank order filter with rank = 1.0. See discRankOrderFilterWithMask() for more information.

Declarations:

pass 2D array views:

namespace vigra {
template <class T1, class S1,
class TM, class SM,
class T2, class S2>
void
discDilationWithMask(MultiArrayView<2, T1, S1> const & src,
MultiArrayView<2, TM, SM> const & mask,
MultiArrayView<2, T2, S2> dest,
int radius);
}
vigra::discDilationWithMask
void discDilationWithMask(...)
Apply dilation (maximum) filter with disc of given radius to image using a mask.

show deprecated declarations

pass Image Iterators and Data Accessors :
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class MaskIterator, class MaskAccessor,
class DestIterator, class DestAccessor>
void
discDilationWithMask(SrcIterator upperleft1,
SrcIterator lowerright1, SrcAccessor sa,
MaskIterator upperleftm, MaskAccessor mask,
DestIterator upperleft2, DestAccessor da,
int radius)
}
group arguments (use in conjunction with Argument Object Factories):
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class MaskIterator, class MaskAccessor,
class DestIterator, class DestAccessor>
void
discDilationWithMask(triple<SrcIterator, SrcIterator, SrcAccessor> src,
pair<MaskIterator, MaskAccessor> mask,
pair<DestIterator, DestAccessor> dest,
int radius)
}

## ◆ discMedianWithMask()

template<... >

void discMedianWithMask | ( |  | ... | ) |

Apply median filter with disc of given radius to image using a mask.

This is an abbreviation for the masked rank order filter with rank = 0.5. See discRankOrderFilterWithMask() for more information.

Declarations:

pass 2D array views:

namespace vigra {
template <class T1, class S1,
class TM, class SM,
class T2, class S2>
void
discMedianWithMask(MultiArrayView<2, T1, S1> const & src,
MultiArrayView<2, TM, SM> const & mask,
MultiArrayView<2, T2, S2> dest,
int radius);
}
vigra::discMedianWithMask
void discMedianWithMask(...)
Apply median filter with disc of given radius to image using a mask.

show deprecated declarations

pass Image Iterators and Data Accessors :
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class MaskIterator, class MaskAccessor,
class DestIterator, class DestAccessor>
void
discMedianWithMask(SrcIterator upperleft1,
SrcIterator lowerright1, SrcAccessor sa,
MaskIterator upperleftm, MaskAccessor mask,
DestIterator upperleft2, DestAccessor da,
int radius)
}
group arguments (use in conjunction with Argument Object Factories):
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class MaskIterator, class MaskAccessor,
class DestIterator, class DestAccessor>
void
discMedianWithMask(triple<SrcIterator, SrcIterator, SrcAccessor> src,
pair<MaskIterator, MaskAccessor> mask,
pair<DestIterator, DestAccessor> dest,
int radius)
}

## ◆ createGaborFilter()

template<... >

void createGaborFilter | ( |  | ... | ) |

Create a gabor filter in frequency space.

The orientation is given in radians, the other parameters are the center frequency (for example 0.375 or smaller) and the two angular and radial sigmas of the gabor filter. (See angularGaborSigma() for an explanation of possible values.)

The energy of the filter is explicitly normalized to 1.0.

Declarations:

pass 2D array views:

namespace vigra {
template <class T, class S>
void
createGaborFilter(MultiArrayView<2, T, S> dest,
double orientation, double centerFrequency,
double angularSigma, double radialSigma);
}
vigra::createGaborFilter
void createGaborFilter(...)
Create a gabor filter in frequency space.

show deprecated declarations

pass Image Iterators and Data Accessors :
namespace vigra {
template <class DestImageIterator, class DestAccessor>
void createGaborFilter(DestImageIterator destUpperLeft,
DestImageIterator destLowerRight,
DestAccessor da,
double orientation, double centerFrequency,
double angularSigma, double radialSigma)
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
template <class DestImageIterator, class DestAccessor>
void createGaborFilter(triple<DestImageIterator,
DestImageIterator,
DestAccessor> dest,
double orientation, double centerFrequency,
double angularSigma, double radialSigma)
}

Usage:

#include <vigra/gaborfilter.hxx>
Namespace: vigra

MultiArray<2, float> gabor(w,h);
createGaborFilter(gabor, orient, freq,
angularGaborSigma(directionCount, freq),
radialGaborSigma(freq));
vigra::angularGaborSigma
double angularGaborSigma(int directionCount, double centerFrequency)
Calculate sensible angular sigma for given parameters.
Definition gaborfilter.hxx:287
vigra::radialGaborSigma
double radialGaborSigma(double centerFrequency)
Calculate sensible radial sigma for given parameters.
Definition gaborfilter.hxx:244

show deprecated examples

vigra::FImage gabor(w,h);
vigra::createGaborFilter(destImageRange(gabor), orient, freq,
angularGaborSigma(directionCount, freq),
radialGaborSigma(freq));

## ◆ radialGaborSigma()

double radialGaborSigma | ( | double | centerFrequency | ) |

Calculate sensible radial sigma for given parameters.

For a brief introduction what is meant with "sensible" sigmas, see angularGaborSigma().

Declaration:

namespace vigra {
double radialGaborSigma(double centerFrequency)
}

## ◆ angularGaborSigma()

double angularGaborSigma | ( | int | directionCount,
|  | double | centerFrequency
| ) |  |

Calculate sensible angular sigma for given parameters.

"Sensible" means: If you use a range of gabor filters for feature detection, you are interested in minimal redundancy. This is hard to define but one possible try is to arrange the filters in frequency space, so that the half-peak-magnitude ellipses touch each other.

To do so, you must know the number of directions (first parameter for the angular sigma function) and the center frequency of the filter you want to calculate the sigmas for.

The exact formulas are:

sigma_radial= 1/sqrt(ln(4)) * centerFrequency/3
sigma_angular= 1/sqrt(ln(4)) * tan(pi/(directions*2))
sqrt(8/9) * centerFrequency

Declaration:

namespace vigra {
double angularGaborSigma(int directionCount, double centerFrequency)
}

## ◆ gradientEnergyTensor()

template<... >

void gradientEnergyTensor | ( |  | ... | ) |

Calculate the gradient energy tensor for a scalar valued image.

These function calculates the gradient energy tensor (GET operator) as described in

M. Felsberg, U. Köthe: "GET: The Connection Between Monogenic Scale-Space and Gaussian Derivatives", in: R. Kimmel, N. Sochen, J. Weickert (Eds.): Scale Space and PDE Methods in Computer Vision, Proc. of Scale-Space 2005, Lecture Notes in Computer Science 3459, pp. 192-203, Heidelberg: Springer, 2005.

U. Köthe, M. Felsberg: "Riesz-Transforms Versus Derivatives: On the Relationship Between the Boundary Tensor and the Energy Tensor", in: ditto, pp. 179-191.

with the given filters: The derivative filter derivKernel is applied to the appropriate image dimensions in turn (see the papers above for details), and the other dimension is smoothed with smoothKernel. The kernels can be as small as 3x1, e.g. [0.5, 0, -0.5] and [3.0/16.0, 10.0/16.0, 3.0/16.0] respectively.
The output image must have 3 bands which will hold the tensor components in the order t11, t12 (== t21), t22. The signs of the output are adjusted for a right-handed coordinate system. Thus, orientations derived from the tensor will be in counter-clockwise (mathematically positive) order, with the x-axis at zero degrees (this is the standard in all VIGRA functions that deal with orientation).

Declarations:

pass 2D array views:

namespace vigra {
template <class T1, class S1,
class T2, class S2>
void
gradientEnergyTensor(MultiArrayView<2, T1, S1> const & src,
MultiArrayView<2, T2, S2> dest,
Kernel1D<double> const & derivKernel, Kernel1D<double> const & smoothKernel);
}
vigra::gradientEnergyTensor
void gradientEnergyTensor(...)
Calculate the gradient energy tensor for a scalar valued image.

show deprecated declarations

pass Image Iterators and Data Accessors :
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor>
void gradientEnergyTensor(SrcIterator supperleft, SrcIterator slowerright, SrcAccessor src,
DestIterator dupperleft, DestAccessor dest,
Kernel1D<double> const & derivKernel, Kernel1D<double> const & smoothKernel);
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor>
void gradientEnergyTensor(triple<SrcIterator, SrcIterator, SrcAccessor> src,
pair<DestIterator, DestAccessor> dest,
Kernel1D<double> const & derivKernel, Kernel1D<double> const & smoothKernel);
}

Usage:

#include <vigra/gradient_energy_tensor.hxx>
Namespace: vigra

MultiArray<2, float> img(w,h);
MultiArray<2, TinyVector<float, 3> > get(w,h);
Kernel1D<double> grad, smooth;
grad.initGaussianDerivative(0.7, 1);
smooth.initGaussian(0.7);
...
gradientEnergyTensor(img, get, grad, smooth);

show deprecated examples

FImage img(w,h);
FVector3Image get(w,h);
Kernel1D<double> grad, smooth;
grad.initGaussianDerivative(0.7, 1);
smooth.initGaussian(0.7);
...
gradientEnergyTensor(srcImageRange(img), destImage(get), grad, smooth);

## ◆ edgeSort()

template<class GRAPH , class WEIGHTS , class COMPERATOR >

void edgeSort | ( | const GRAPH & | g,
|  | const WEIGHTS & | weights,
|  | const COMPERATOR & | comperator,
|  | std::vector< typename GRAPH::Edge > & | sortedEdges
| ) |  |

get a vector of Edge descriptors

Sort the Edge descriptors given weights and a comperator

## ◆ makeRegionAdjacencyGraph()

template<class GRAPH_IN , class GRAPH_IN_NODE_LABEL_MAP >

void makeRegionAdjacencyGraph | ( | GRAPH_IN | graphIn,
|  | GRAPH_IN_NODE_LABEL_MAP | labels,
|  | AdjacencyListGraph & | rag,
|  | typename AdjacencyListGraph::template EdgeMap< std::vector< typename GRAPH_IN::Edge > > & | affiliatedEdges,
|  | const Int64 | ignoreLabel = `-1`
| ) |  |

make a region adjacency graph from a graph and labels w.r.t. that graph

Parameters

  | graphIn | : input graph
  | labels | : labels w.r.t. graphIn
  [out] | rag | : region adjacency graph
  [out] | affiliatedEdges | : a vector of edges of graphIn for each edge in rag
  | ignoreLabel | : optional label to ignore (default: -1 means no label will be ignored)

## ◆ edgeWeightedWatershedsSegmentation()

template<class GRAPH , class EDGE_WEIGHTS , class SEEDS , class LABELS >

void edgeWeightedWatershedsSegmentation | ( | const GRAPH & | g,
|  | const EDGE_WEIGHTS & | edgeWeights,
|  | const SEEDS & | seeds,
|  | LABELS & | labels
| ) |  |

edge weighted watersheds Segmentataion

Parameters

  | g | input graph
  | edgeWeights | : edge weights / edge indicator
  | seeds | : seed must be non empty!
  [out] | labels | : resulting nodeLabeling (not necessarily dense)

## ◆ carvingSegmentation()

template<class GRAPH , class EDGE_WEIGHTS , class SEEDS , class LABELS >

void carvingSegmentation | ( | const GRAPH & | g,
|  | const EDGE_WEIGHTS & | edgeWeights,
|  | const SEEDS & | seeds,
|  | const typename LABELS::Value | backgroundLabel,
|  | const typename EDGE_WEIGHTS::Value | backgroundBias,
|  | const typename EDGE_WEIGHTS::Value | noPriorBelow,
|  | LABELS & | labels
| ) |  |

edge weighted watersheds Segmentataion

Parameters

  | g | input graph
  | edgeWeights | : edge weights / edge indicator
  | seeds | : seed must be non empty!
  | backgroundLabel | : which label is background
  | backgroundBias | : bias for background
  | noPriorBelow | : don't bias the background if edge indicator is below this value
  [out] | labels | : resulting nodeLabeling (not necessarily dense)

## ◆ felzenszwalbSegmentation()

template<class GRAPH , class EDGE_WEIGHTS , class NODE_SIZE , class NODE_LABEL_MAP >

void felzenszwalbSegmentation | ( | const GRAPH & | graph,
|  | const EDGE_WEIGHTS & | edgeWeights,
|  | const NODE_SIZE & | nodeSizes,
|  | float | k,
|  | NODE_LABEL_MAP & | nodeLabeling,
|  | const int | nodeNumStopCond = `-1`
| ) |  |

edge weighted watersheds Segmentataion

Parameters

  | graph | input graph
  | edgeWeights | : edge weights / edge indicator
  | nodeSizes | : size of each node
  | k | : free parameter of felzenszwalb algorithm
  [out] | nodeLabeling | : nodeLabeling (not necessarily dense)
  | nodeNumStopCond | : optional stopping condition

## ◆ graphSmoothing()

template<class GRAPH , class NODE_FEATURES_IN , class EDGE_INDICATOR , class NODE_FEATURES_OUT >

void graphSmoothing | ( | const GRAPH & | g,
|  | const NODE_FEATURES_IN & | nodeFeaturesIn,
|  | const EDGE_INDICATOR & | edgeIndicator,
|  | const float | lambda,
|  | const float | edgeThreshold,
|  | const float | scale,
|  | NODE_FEATURES_OUT & | nodeFeaturesOut
| ) |  |

smooth node features of a graph

Parameters

  | g | : input graph
  | nodeFeaturesIn | : input node features which should be smoothed
  | edgeIndicator | : edge indicator to indicate over which edges one should smooth
  | lambda | : scale edge indicator by lambda before taking negative exponent
  | edgeThreshold | : edge threshold
  | scale | : how much smoothing should be applied
  [out] | nodeFeaturesOut | : smoothed node features

## ◆ recursiveGraphSmoothing()

template<class GRAPH , class NODE_FEATURES_IN , class EDGE_INDICATOR , class NODE_FEATURES_OUT >

void recursiveGraphSmoothing | ( | const GRAPH & | g,
|  | const NODE_FEATURES_IN & | nodeFeaturesIn,
|  | const EDGE_INDICATOR & | edgeIndicator,
|  | const float | lambda,
|  | const float | edgeThreshold,
|  | const float | scale,
|  | size_t | iterations,
|  | NODE_FEATURES_OUT & | nodeFeaturesBuffer,
|  | NODE_FEATURES_OUT & | nodeFeaturesOut
| ) |  |

smooth node features of a graph

Parameters

  | g | : input graph
  | nodeFeaturesIn | : input node features which should be smoothed
  | edgeIndicator | : edge indicator to indicate over which edges one should smooth
  | lambda | : scale edge indicator by lambda before taking negative exponent
  | edgeThreshold | : edge threshold
  | scale | : how much smoothing should be applied
  | iterations | : how often should this algorithm be called recursively
  [out] | nodeFeaturesBuffer | : preallocated(!) buffer to store node features temp.
  [out] | nodeFeaturesOut | : smoothed node features

## ◆ projectGroundTruth()

template<class RAG , class BASE_GRAPH , class BASE_GRAPH_RAG_LABELS , class BASE_GRAPH_GT , class RAG_GT , class RAG_GT_QT >

void projectGroundTruth | ( | const RAG & | rag,
|  | const BASE_GRAPH & | baseGraph,
|  | const BASE_GRAPH_RAG_LABELS & | baseGraphRagLabels,
|  | const BASE_GRAPH_GT & | baseGraphGt,
|  | RAG_GT & | ragGt,
|  | RAG_GT_QT & |
| ) |  |

project ground truth from a base graph, to a region adjacency graph.

## ◆ ragFindEdges()

template<class RAGGRAPH , class GRAPH , class RAGEDGES , unsigned int N, class T >

MultiArray< 2, MultiArrayIndex > ragFindEdges | ( | const RAGGRAPH & | rag,
|  | const GRAPH & | graph,
|  | const RAGEDGES & | affiliatedEdges,
|  | MultiArrayView< N, T > | labelsArray,
|  | const typename RAGGRAPH::Node & | node
| ) |  |

Find indices of points on the edges.

Parameters

  rag | : Region adjacency graph of the labels array
  graph | : Graph of labels array
  affiliatedEdges | : The affiliated edges of the region adjacency graph
  labelsArray | : The label image
  node | : The node (of the region adjacency graph), whose edges shall be found

## ◆ edgeWeightsFromNodeWeights()

template<unsigned int N, class DirectedTag , class NODEMAP , class EDGEMAP , class FUNCTOR >

void edgeWeightsFromNodeWeights | ( | const GridGraph< N, DirectedTag > & | g,
|  | const NODEMAP & | nodeWeights,
|  | EDGEMAP & | edgeWeights,
|  | bool | euclidean,
|  | FUNCTOR const & | func
| ) |  |

create edge weights from node weights

Parameters

  | g | : input graph
  | nodeWeights | : node property map holding node weights
  [out] | edgeWeights | : resulting edge weights
  | euclidean | : if 'true', multiply the computed weights with the Euclidean distance between the edge's end nodes (default: 'false')
  | func | : binary function that computes the edge weight from the weights of the edge's end nodes (default: take the average)

## ◆ edgeWeightsFromInterpolatedImage()

template<unsigned int N, class DirectedTag , class T , class EDGEMAP >

void edgeWeightsFromInterpolatedImage | ( | const GridGraph< N, DirectedTag > & | g,
|  | const MultiArrayView< N, T > & | interpolatedImage,
|  | EDGEMAP & | edgeWeights,
|  | bool | euclidean = `false`
| ) |  |

create edge weights from an interpolated image

Parameters

  | g | : input graph
  | interpolatedImage | : interpolated image
  [out] | edgeWeights | : edge weights
  | euclidean | : if 'true', multiply the weights with the Euclidean distance between the edge's end nodes (default: 'false')

For each edge, the function reads the weight from `interpolatedImage[u+v]`, where `u` and `v` are the coordinates of the edge's end points.

## ◆ projectBack()

template<class BASE_GRAPH , class BASE_GRAPH_LABELS , class RAG_FEATURES , class BASE_GRAPH_FEATURES >

void projectBack | ( | const AdjacencyListGraph & | rag,
|  | const BASE_GRAPH & | bg,
|  | const Int64 | ignoreLabel,
|  | const BASE_GRAPH_LABELS | bgLabels,
|  | const RAG_FEATURES & | ragFeatures,
|  | BASE_GRAPH_FEATURES & | bgFeatures
| ) |  |

project node features of a region adjacency graph back to the base graph.

This function can be used to show a segmentation or node features of RAG on pixel / voxel level

## ◆ readHDF5()

template<... >

void readHDF5 | ( |  | ... | ) |

Read the data specified by the given vigra::HDF5ImportInfo object and write the into the given 'array'.

The array must have the correct number of dimensions and shape for the dataset represented by 'info'. When the element type of 'array' differs from the stored element type, HDF5 will convert the type on the fly (except when the HDF5 version is 1.6 or below, in which case an error will result). Multi-channel element types (i.e. vigra::RGBValue, vigra::TinyVector, and vigra::FFTWComplex) are recognized and handled correctly.

Declaration:

namespace vigra {
template<unsigned int N, class T, class StrideTag>
void
readHDF5(const HDF5ImportInfo &info, MultiArrayView<N, T, StrideTag> array);
}
vigra::HDF5ImportInfo
Argument object for the function readHDF5().
Definition hdf5impex.hxx:683
vigra::readHDF5
void readHDF5(...)
Read the data specified by the given vigra::HDF5ImportInfo object and write the into the given 'array...

Usage:

#include <vigra/hdf5impex.hxx>
Namespace: vigra

HDF5ImportInfo info(filename, dataset_name);
vigra_precondition(info.numDimensions() == 3, "Dataset must be 3-dimensional.");
MultiArrayShape<3>::type shape(info.shape().begin());
MultiArray<3, int> array(shape);
readHDF5(info, array);

## ◆ writeHDF5()

template<... >

void writeHDF5 | ( |  | ... | ) |

Store array data in an HDF5 file.

The number of dimensions, shape and element type of the stored dataset is automatically determined from the properties of the given array. Strided arrays are stored in an unstrided way, i.e. in contiguous scan-order. Multi-channel element types (i.e. vigra::RGBValue, vigra::TinyVector and vigra::FFTWComplex) are recognized and handled correctly (in particular, the will form the innermost dimension of the stored dataset). pathInFile may contain '/'-separated group names, but must end with the name of the dataset to be created.

Declaration:

namespace vigra {
template<unsigned int N, class T, class StrideTag>
void
writeHDF5(const char* filePath, const char* pathInFile,
MultiArrayView<N, T, StrideTag>const & array);
}
vigra::writeHDF5
void writeHDF5(...)
Store array data in an HDF5 file.

Usage:

#include <vigra/hdf5impex.hxx>
Namespace: vigra

MultiArrayShape<3>::type shape(100, 200, 20);
MultiArray<3, int> array(shape);
... // fill array with data
writeHDF5("mydata.h5", "/group1/my_dataset", array);

## ◆ writeHDF5Attr() [1/4]

template<size_t N, class T , class C >

void writeHDF5Attr | ( | hid_t | loc,
|  | const char * | name,
|  | MultiArrayView< N, T, C > const & | array
| ) |  |

Write a numeric MultiArray as an attribute with name name of the dataset specified by the handle loc.

#include <vigra/hdf5impex.hxx>
Namespace: vigra

## ◆ writeHDF5Attr() [2/4]

template<size_t N, class C >

void writeHDF5Attr | ( | hid_t | loc,
|  | const char * | name,
|  | MultiArrayView< N, std::string, C > const & | array
| ) |  |

Write a string MultiArray as an attribute with name name of the dataset specified by the handle loc.

#include <vigra/hdf5impex.hxx>
Namespace: vigra

## ◆ writeHDF5Attr() [3/4]

template<class T >

void writeHDF5Attr | ( | hid_t | loc,
|  | const char * | name,
|  | ArrayVectorView< T > & | array
| ) |  |

Write a numeric ArrayVectorView as an attribute with name name of the dataset specified by the handle loc.

#include <vigra/hdf5impex.hxx>
Namespace: vigra

## ◆ writeHDF5Attr() [4/4]

template<class Arr >

void writeHDF5Attr | ( | std::string | filePath,
|  | std::string | pathInFile,
|  | Arr & | ar
| ) |  |

write an Attribute given a file and a path in the file. the path in the file should have the format [attribute] or /[subgroups/]dataset.attribute or /[subgroups/]group.attribute. The attribute is written to the root group, a dataset or a subgroup respectively

## ◆ hierarchicalClustering()

template<... >

void hierarchicalClustering | ( |  | ... | ) |

Reduce the number of nodes in a graph by iteratively contracting the cheapest edge.

Declarations:

namespace vigra {
template <class GRAPH,
class EDGE_WEIGHT_MAP, class EDGE_LENGTH_MAP,
class NODE_FEATURE_MAP, class NOSE_SIZE_MAP,
class NODE_LABEL_MAP>
void
hierarchicalClustering(GRAPH const & graph,
EDGE_WEIGHT_MAP const & edgeWeights, EDGE_LENGTH_MAP const & edgeLengths,
NODE_FEATURE_MAP const & nodeFeatures, NOSE_SIZE_MAP const & nodeSizes,
NODE_LABEL_MAP & labelMap,
ClusteringOptions options = ClusteringOptions());
}
vigra::ClusteringOptions
Options object for hierarchical clustering.
Definition hierarchical_clustering.hxx:647
vigra::hierarchicalClustering
void hierarchicalClustering(...)
Reduce the number of nodes in a graph by iteratively contracting the cheapest edge.

Hierarchical clustering is a simple and versatile image segmentation algorithm that typically operates either directly on the pixels (e.g. on a vigra::GridGraph) or on a region adjacency graph over suitable superpixels (e.g. on an vigra::AdjacencyListGraph). The graph is passed to the function in its first argument. After clustering is completed, the parameter labelMap contains a mapping from original node IDs to the ID of the cluster each node belongs to. Cluster IDs correspond to the ID of an arbitrarily chosen representative node within each cluster, i.e. they form a sparse subset of the original IDs.

Properties of the graph's edges and nodes are provided in the property maps edgeWeights, edgeLengths, nodeFeatures, and nodeSizes. These maps are indexed by edge or node ID and return the corresponding feature. Features must by arithmetic scalars or, in case of node features, scalars or vectors of scalars (precisely: objects that provide `begin()` and `end()` to create an STL range). Edge weights are typically derived from an edge indicator such as the gradient magnitude, and node features are either the responses of a filter family (when clustering on the pixel grid), or region statistics as computed by Feature Accumulators (when clustering on superpixels).

In each step, the algorithm merges the two nodes and whose cluster distance is smallest, where the cluster distance is defined as

with denoting the weight of edge , and being the node features (possibly vectors to be compared with metric ), and and the corresponding node sizes. The metric is defined in the option object by calling vigra::ClusteringOptions::nodeFeatureMetric() and must be selected from the tags defined in vigra::metrics::MetricType.

The parameters and control the relative influence of the inputs: With , the node features are ignored, whereas with the edge weights are ignored. Similarly, with , the node size is ignored, whereas with , cluster distances are scaled by the harmonic mean of the cluster sizes, making the merging of small clusters more favorable. The parameters are defined in the option object by calling vigra::ClusteringOptions::nodeFeatureImportance() and vigra::ClusteringOptions::sizeImportance() respectively.

After each merging step, the features of the resulting cluster and the weights of its outgoing edges are updated by mean of the corresponding properties of the original clusters and , weighted by the respective node sizes and edge lengths :

Clustering normally stops when only one cluster remains. This default can be overridden by the option object parameters vigra::ClusteringOptions::minRegionCount() and vigra::ClusteringOptions::maxMergeDistance() to stop at a particular number of clusters or a particular cluster distance respectively.

Usage:

#include <vigra/hierarchical_clustering.hxx>
Namespace: vigra

A fully worked example can be found in graph_agglomerative_clustering.cxx

## ◆ impexListFormats()

std::string impexListFormats | ( |  | ) |

List the image formats VIGRA can read and write.

This is useful for creating error messages if VIGRA encounters an image format it doesn't recognize.

Usage:

#include <vigra/imageinfo.hxx>
Namespace: vigra

std::cout << "supported formats: " << vigra::impexListFormats() << std::endl;
vigra::impexListFormats
std::string impexListFormats()
List the image formats VIGRA can read and write.

Examples
  imageImportInfo_tutorial.cxx, invert_explicitly.cxx, and pyramid.cxx.

## ◆ impexListExtensions()

std::string impexListExtensions | ( |  | ) |

List the file extension VIGRA understands.

This is useful for creating file dialogs that only list image files VIGRA can actually import.

Usage:

#include <vigra/imageinfo.hxx>
Namespace: vigra

std::cout << "supported extensions: " << vigra::impexListExtensions() << std::endl;
vigra::impexListExtensions
std::string impexListExtensions()
List the file extension VIGRA understands.

## ◆ isImage()

bool isImage | ( | char const * | filename | ) |

Test whether a file is an image format known to VIGRA.

This checks the first few bytes of the file and compares them with the "magic strings" of each recognized image format.

Usage:

#include <vigra/imageinfo.hxx>
Namespace: vigra

std::cout << "is image: " << vigra::isImage("foo.bmp") << std::endl;
vigra::isImage
bool isImage(char const *filename)
Test whether a file is an image format known to VIGRA.

## ◆ initImage()

template<... >

void initImage | ( |  | ... | ) |

Write a value to every pixel in an image or rectangular ROI.

This function can be used to init the image.

The initial value can either be a constant of appropriate type (compatible with the destination's value_type), or a functor with compatible result_type. These two cases are automatically distinguished when `FunctorTraits<FUNCTOR>::isInitializer` yields `VigraTrueType`. Since the functor is passed by `const` reference, its `operator()` must be const, and its internal state may need to be `mutable`.

Function initMultiArray() implements the same functionality for arbitrary dimensional arrays. In many situations, the assignment functions of vigra::MultiArrayView offer a simpler and more readable alternative to the init functions.

Declarations:

pass 2D array views:

namespace vigra {
template <class T, class S, class VALUETYPE>
void
initImage(MultiArrayView<2, T, S> img, VALUETYPE const & v);
template <class T, class S, class FUNCTOR>
void
initImage(MultiArrayView<2, T, S> img, FUNCTOR const & v);
}
vigra::initImage
void initImage(...)
Write a value to every pixel in an image or rectangular ROI.

show deprecated declarations

pass Image Iterators and Data Accessors :
namespace vigra {
template <class ImageIterator, class Accessor, class VALUETYPE>
void initImage(ImageIterator upperleft, ImageIterator lowerright,
Accessor a, VALUETYPE const & v);
template <class ImageIterator, class Accessor, class FUNCTOR>
void initImage(ImageIterator upperleft, ImageIterator lowerright,
Accessor a, FUNCTOR const & v);
}
vigra::ImageIterator
Standard 2D random access iterator for images that store the data in a linear array.
Definition imageiterator.hxx:851
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
template <class ImageIterator, class Accessor, class VALUETYPE>
void initImage(triple<ImageIterator, ImageIterator, Accessor> img, VALUETYPE const & v);
template <class ImageIterator, class Accessor, class FUNCTOR>
void initImage(triple<ImageIterator, ImageIterator, Accessor> img, FUNCTOR const & v);
}

Usage:

#include <vigra/initimage.hxx>
Namespace: vigra

Initialize with a constant:

MultiArray<2, unsigned char> img(100, 100);
// init the image with the value 128
initImage(img, 128);
// init the interior with the value 1
initImage(img.subarray(Shape2(10), Shape2(-10)), 1);
// equivalent to
img = 128;
img.init(128);
img.subarray(Shape2(10), Shape2(-10)) = 1;
vigra::TinyVectorBase::subarray
TinyVectorView< VALUETYPE, TO-FROM > subarray() const
Definition tinyvector.hxx:887

Initialize with a functor:

struct Counter {
Counter() : count(0) {}
int operator()() const { return count++; }
mutable int count;
};
MultiArray<2, int> img(100, 100);
// write the current count in every pixel
initImage(img, Counter());
// equivalent to
#include <vigra/algorithm.hxx>
linearSequence(img.begin(), img.end());

show deprecated examples

vigra::BImage img(100, 100);
// init the image with the value 128
vigra::initImage(destImageRange(img), 128);
// Initialize with a functor:
struct Counter {
Counter() : count(0) {}
int operator()() const { return count++; }
mutable int count;
};
// write the current count in every pixel
vigra::initImage(destImageRange(img), Counter());
Required Interface:
ImageIterator upperleft, lowerright;
ImageIterator::row_iterator ix = upperleft.rowIterator();
Accessor accessor;
VALUETYPE v;
accessor.set(v, ix);
vigra::ImageIteratorBase< ImageIterator< PIXELTYPE >, PIXELTYPE, PIXELTYPE &, PIXELTYPE * >::row_iterator
RowIteratorSelector::res row_iterator
Definition imageiterator.hxx:605

## ◆ initImageWithFunctor()

template<... >

void initImageWithFunctor | ( |  | ... | ) |

Write the result of a functor call to every pixel in an image or rectangular ROI.

This function can be used to init the image by calling the given functor for each pixel. The functor is passed by reference, so that its internal state can be updated in each call.

Declarations:

pass 2D array views:

namespace vigra {
template <class T, class S, class FUNCTOR>
void
initImageWithFunctor(MultiArrayView<2, T, S> img, FUNCTOR & f);
}
vigra::initImageWithFunctor
void initImageWithFunctor(...)
Write the result of a functor call to every pixel in an image or rectangular ROI.

show deprecated declarations

pass Image Iterators and Data Accessors :
namespace vigra {
template <class ImageIterator, class Accessor, class FUNCTOR>
void
initImageWithFunctor(ImageIterator upperleft, ImageIterator lowerright,
Accessor a, FUNCTOR & f);
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
template <class ImageIterator, class Accessor, class FUNCTOR>
void
initImageWithFunctor(triple<ImageIterator, ImageIterator, Accessor> img, FUNCTOR & f);
}

Usage:

#include <vigra/initimage.hxx>
Namespace: vigra

struct Counter {
Counter() : count(0) {}
int operator()() const { return count++; }
int count;
};
MultiArray<2, int> img(100, 100);
// write the current count in every pixel
Counter counter;
initImageWithFunctor(img, counter);
// equivalent to
#include <vigra/algorithm.hxx>
linearSequence(img.begin(), img.end());

show deprecated examples

struct Counter {
Counter() : count(0) {}
int operator()() const { return count++; }
mutable int count;
};
vigra::IImage img(100, 100);
// write the current count in every pixel
Counter counter;
vigra::initImageWithFunctor(destImageRange(img), counter);
Required Interface:
ImageIterator upperleft, lowerright;
ImageIterator::row_iterator ix = upperleft.rowIterator();
Accessor accessor;
Functor f;
accessor.set(f(), ix);

## ◆ initImageIf()

template<... >

void initImageIf | ( |  | ... | ) |

Write value to pixel in the image if mask is true.

This function can be used to init a region-of-interest of the image.

The initial value can either be a constant of appropriate type (compatible with the destination's value_type), or a functor with compatible result_type. These two cases are automatically distinguished when `FunctorTraits<FUNCTOR>::isInitializer` yields `VigraTrueType`. Since the functor is passed by `const` reference, its `operator()` must be const, and its internal state may need to be `mutable`.

Declarations:

pass 2D array views:

namespace vigra {
template <class T, class S,
class TM, class SM,
class VALUETYPE>
void
initImageIf(MultiArrayView<2, T, S> img,
MultiArrayView<2, TM, SM> const & mask,
VALUETYPE const & v);
template <class T, class S,
class TM, class SM,
class FUNCTOR>
void
initImageIf(MultiArrayView<2, T, S> img,
MultiArrayView<2, TM, SM> const & mask,
FUNCTOR const & v);
}
vigra::initImageIf
void initImageIf(...)
Write value to pixel in the image if mask is true.

show deprecated declarations

pass Image Iterators and Data Accessors :
namespace vigra {
template <class ImageIterator, class Accessor,
class MaskImageIterator, class MaskAccessor,
class VALUETYPE>
void initImageIf(ImageIterator upperleft, ImageIterator lowerright, Accessor a,
MaskImageIterator mask_upperleft, MaskAccessor ma,
VALUETYPE const & v);
template <class ImageIterator, class Accessor,
class MaskImageIterator, class MaskAccessor,
class FUNCTOR>
void initImageIf(ImageIterator upperleft, ImageIterator lowerright, Accessor a,
MaskImageIterator mask_upperleft, MaskAccessor ma,
FUNCTOR const & v);
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
template <class ImageIterator, class Accessor,
class MaskImageIterator, class MaskAccessor,
class VALUETYPE>
void initImageIf(triple<ImageIterator, ImageIterator, Accessor> img,
pair<MaskImageIterator, MaskAccessor> mask,
VALUETYPE const & v);
template <class ImageIterator, class Accessor,
class MaskImageIterator, class MaskAccessor,
class FUNCTOR>
void initImageIf(triple<ImageIterator, ImageIterator, Accessor> img,
pair<MaskImageIterator, MaskAccessor> mask,
FUNCTOR const & v);
}

Usage:

#include <vigra/initimage.hxx>
Namespace: vigra

MultiArray<2, RGBValue<unsigned char> > img(100, 100),
MultiArray<2, unsigned char> mask(100, 100);
... // init the ROI mask
// set the ROI to one
initImageIf(img, mask,
NumericTraits<RGBValue<unsigned char> >::one());

show deprecated examples

vigra::BImage img(100, 100);
vigra::BImage mask(100, 100);
// zero the ROI
vigra::initImageIf(destImageRange(img),
maskImage(mask),
vigra::NumericTraits<vigra::BImage::PixelType>::zero());
Required Interface:
ImageIterator upperleft, lowerright;
MaskImageIterator mask_upperleft;
ImageIterator::row_iterator ix = upperleft.rowIterator();
MaskImageIterator::row_iterator mx = mask_upperleft.rowIterator();
Accessor accessor;
MaskAccessor mask_accessor;
VALUETYPE v;
if(mask_accessor(mx)) accessor.set(v, ix);

## ◆ initImageBorder()

template<... >

void initImageBorder | ( |  | ... | ) |

Write value to the specified border pixels in the image.

A pixel is initialized if its distance to the border is at most 'borderwidth'.

The initial value can either be a constant of appropriate type (compatible with the destination's value_type), or a functor with compatible result_type. These two cases are automatically distinguished when `FunctorTraits<FUNCTOR>::isInitializer` yields `VigraTrueType`. Since the functor is passed by `const` reference, its `operator()` must be const, and its internal state may need to be `mutable`.

Declarations:

pass 2D array views:

namespace vigra {
template <class T, class S, class VALUETYPE>
void
initImageBorder(MultiArrayView<2, T, S> img,
int border_width, VALUETYPE const & v);
template <class T, class S, class FUNCTOR>
void
initImageBorder(MultiArrayView<2, T, S> img,
int border_width, FUNCTOR const & v);
}
vigra::initImageBorder
void initImageBorder(...)
Write value to the specified border pixels in the image.

show deprecated declarations

pass Image Iterators and Data Accessors :
namespace vigra {
template <class ImageIterator, class Accessor, class VALUETYPE>
void initImageBorder(ImageIterator upperleft, ImageIterator lowerright, Accessor a,
int border_width, VALUETYPE const & v);
template <class ImageIterator, class Accessor, class FUNCTOR>
void initImageBorder(ImageIterator upperleft, ImageIterator lowerright, Accessor a,
int border_width, FUNCTOR const & v);
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
template <class ImageIterator, class Accessor, class VALUETYPE>
void initImageBorder(triple<ImageIterator, ImageIterator, Accessor> img,
int border_width, VALUETYPE const & v);
template <class ImageIterator, class Accessor, class FUNCTOR>
void initImageBorder(triple<ImageIterator, ImageIterator, Accessor> img,
int border_width, FUNCTOR const & v);
}

Usage:

#include <vigra/initimage.hxx>
Namespace: vigra

#include <vigra/random.hxx>
MultiArray<2, int> img(100, 100);
// fill a border of 5 pixels with random numbers
initImageBorder(img, 5, MersenneTwister());
vigra::MersenneTwister
RandomNumberGenerator< detail::RandomState< detail::MT19937 > > MersenneTwister
Definition random.hxx:634

show deprecated examples

vigra::BImage img(100, 100);
// zero a border of 5 pixel
vigra::initImageBorder(destImageRange(img),
5, vigra::NumericTraits<vigra::BImage::PixelType>::zero());
Required Interface:
see initImage()

## ◆ inspectImage()

template<... >

void inspectImage | ( |  | ... | ) |

Apply read-only functor to every pixel in the image.

This function can be used to collect statistics of the image etc. The results must be stored in the functor, which serves as a return value (and is therefore passed by reference).

For many common statistics, the use of vigra::acc::extractFeatures() in combination with Feature Accumulators is more convenient.

Declarations:

pass 2D array views:

namespace vigra {
template <class T, class S, class Functor>
void
inspectImage(MultiArrayView<2, T, S> const & img,
Functor & f);
}
vigra::inspectImage
void inspectImage(...)
Apply read-only functor to every pixel in the image.

show deprecated declarations

pass Image Iterators and Data Accessors :
namespace vigra {
template <class ImageIterator, class Accessor, class Functor>
void
inspectImage(ImageIterator upperleft, ImageIterator lowerright, Accessor a,
Functor & f)
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
template <class ImageIterator, class Accessor, class Functor>
void
inspectImage(triple<ImageIterator, ImageIterator, Accessor> img,
Functor & f)
}

Usage:

#include <vigra/inspectimage.hxx>
Namespace: vigra

MultiArray<2, unsigned char> img(width, height);
... // fill img
// init functor
FindMinMax<unsined char> minmax;
inspectImage(img, minmax);
cout << "Min: " << minmax.min << " Max: " << minmax.max;

show deprecated examples

// init functor
vigra::BImage img;
vigra::FindMinMax<vigra::BImage::PixelType> minmax;
vigra::inspectImage(srcImageRange(img), minmax);
cout << "Min: " << minmax.min << " Max: " << minmax.max;
Required Interface:
ConstImageIterator upperleft, lowerright;
ConstImageIterator::row_iterator ix = upperleft.rowIterator();
Accessor accessor;
Functor functor;
functor(accessor(ix)); // return not used
vigra::ConstImageIterator
Standard 2D random access const iterator for images that store the data as a linear array.
Definition imageiterator.hxx:896

See also
  Functors To Inspect Images, Feature Accumulators

## ◆ inspectImageIf()

template<... >

void inspectImageIf | ( |  | ... | ) |

Apply read-only functor to every pixel in the ROI.

This function can be used to collect statistics of the ROI etc. The functor is called whenever the return value of the mask's accessor is not zero. The results must be stored in the functor, which serves as a return value (and is therefore passed by reference.

Declarations:

pass 2D array views:

namespace vigra {
template <class T, class S,
class TM, class SM, class Functor>
void
inspectImageIf(MultiArrayView<2, T, S> const & img,
MultiArrayView<2, TM, SM> const & mask,
Functor & f);
}

show deprecated declarations

pass Image Iterators and Data Accessors :
namespace vigra {
template <class ImageIterator, class Accessor,
class MaskImageIterator, class MaskAccessor, class Functor>
void
inspectImageIf(ImageIterator upperleft, ImageIterator lowerright,
MaskImageIterator mask_upperleft, MaskAccessor ma,
Functor & f)
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
template <class ImageIterator, class Accessor,
class MaskImageIterator, class MaskAccessor, class Functor>
void
inspectImageIf(triple<ImageIterator, ImageIterator, Accessor> img,
pair<MaskImageIterator, MaskAccessor> mask,
Functor & f)
}

Usage:

#include <vigra/inspectimage.hxx>
Namespace: vigra

MultiArray<2, unsigned char> img(100, 100),
mask(100, 100);
... // fill img and mask
// init functor
FindMinMax<unsigned char> minmax;
inspectImageIf(img, mask, minmax);
cout << "Min: " << minmax.min << " Max: " << minmax.max;

show deprecated examples

vigra::BImage img(100, 100);
vigra::BImage mask(100, 100);
// init functor
vigra::FindMinMax<vigra::BImage::PixelType> minmax;
vigra::inspectImageIf(srcImageRange(img),
maskImage(mask), minmax);
cout << "Min: " << minmax.min << " Max: " << minmax.max;
Required Interface:
ConstImageIterator upperleft, lowerright;
MaskImageIterator mask_upperleft;
ConstImageIterator::row_iterator ix = upperleft.rowIterator();
MaskImageIterator::row_iterator mx = mask_upperleft.rowIterator();
Accessor accessor;
MaskAccessor mask_accessor;
Functor functor;
if(mask_accessor(mx)) functor(accessor(ix));

See also
  Functors To Inspect Images, Feature Accumulators

## ◆ inspectTwoImages()

template<... >

void inspectTwoImages | ( |  | ... | ) |

Apply read-only functor to every pixel of both images.

This function can be used to collect statistics for each region of a labeled image, especially in conjunction with the ArrayOfRegionStatistics functor. The results must be stored in the functor which serves as a return value.

Note: For many common statistics, the use of vigra::acc::extractFeatures() in combination with Feature Accumulators is more convenient.

Declarations:

pass 2D array views:

namespace vigra {
template <class T1, class S1,
class T2, class S2,
class Functor>
void
inspectTwoImages(MultiArrayView<2, T1, S1> const & img1,
MultiArrayView<2, T2, S2> const & img2,
Functor & f);
}
vigra::inspectTwoImages
void inspectTwoImages(...)
Apply read-only functor to every pixel of both images.

show deprecated declarations

pass Image Iterators and Data Accessors :
namespace vigra {
template <class ImageIterator1, class Accessor1,
class ImageIterator2, class Accessor2,
class Functor>
void
inspectTwoImages(ImageIterator1 upperleft1, ImageIterator1 lowerright1, Accessor1 a1,
ImageIterator2 upperleft2, Accessor2 a2,
Functor & f)
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
template <class ImageIterator1, class Accessor1,
class ImageIterator2, class Accessor2,
class Functor>
void
inspectTwoImages(triple<ImageIterator1, ImageIterator1, Accessor1> img1,
pair<ImageIterator2, Accessor2> img2,
Functor & f)
}

Usage:

#include <vigra/inspectimage.hxx>
Namespace: vigra

MultiArray<2, unsigned char> image1(width, height), image2(width, height);
SomeStatisticsFunctor stats(...); // init functor
inspectTwoImages(image1, image2, stats);

show deprecated examples

vigra::BImage image1;
vigra::BImage image2;
SomeStatisticsFunctor stats(...); // init functor
vigra::inspectTwoImages(srcImageRange(image1), srcImage(image2),
stats);
Required Interface:
ImageIterator1 upperleft1, lowerright1;
ImageIterator2 upperleft2;
ImageIterator1::row_iterator ix1 = upperleft1.rowIterator();
ImageIterator2::row_iterator ix2 = upperleft2.rowIterator();
Accessor1 accessor1;
Accessor2 accessor2;
Functor functor;
functor(accessor1(ix1), accessor2(ix2)); // return not used

See also
  Functors To Inspect Images, Feature Accumulators

## ◆ inspectTwoImagesIf()

template<... >

void inspectTwoImagesIf | ( |  | ... | ) |

Apply read-only functor to those pixels of both images where the mask image is non-zero.

This function can be used to collect statistics for selected regions of a labeled image, especially in conjunction with the ArrayOfRegionStatistics functor. The results must be stored in the functor which serves as a return value.

Declarations:

pass 2D array views:

namespace vigra {
template <class T1, class S1,
class T2, class S2,
class TM, class SM,
class Functor>
void
inspectTwoImagesIf(MultiArrayView<2, T1, S1> const & img1,
MultiArrayView<2, T2, S2> const & img2,
MultiArrayView<2, TM, SM> const & mask,
Functor & f);
}
vigra::inspectTwoImagesIf
void inspectTwoImagesIf(...)
Apply read-only functor to those pixels of both images where the mask image is non-zero.

show deprecated declarations

pass Image Iterators and Data Accessors :
namespace vigra {
template <class ImageIterator1, class Accessor1,
class ImageIterator2, class Accessor2,
class MaskImageIterator, class MaskAccessor,
class Functor>
void
inspectTwoImagesIf(ImageIterator1 upperleft1, ImageIterator1 lowerright1, Accessor1 a1,
ImageIterator2 upperleft2, Accessor2 a2,
MaskImageIterator mupperleft, MaskAccessor mask,
Functor & f)
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
template <class ImageIterator1, class Accessor1,
class ImageIterator2, class Accessor2,
class MaskImageIterator, class MaskAccessor,
class Functor>
void
inspectTwoImagesIf(triple<ImageIterator1, ImageIterator1, Accessor1> img1,
pair<ImageIterator2, Accessor2> img2,
pair<MaskImageIterator, MaskAccessor> mimg,
Functor & f)
}

Usage:

#include <vigra/inspectimage.hxx>
Namespace: vigra

MultiArray<2, unsigned char> image1(width, height), image2(width, height),
maskimage(width, height);
SomeStatisticsFunctor stats(...); // init functor
inspectTwoImagesIf(image1, image2, maskimage, region_stats);

show deprecated examples

vigra::BImage image1;
vigra::BImage image2;
vigra::BImage maskimage;
SomeStatisticsFunctor stats(...); // init functor
vigra::inspectTwoImagesIf(srcImageRange(image1), srcImage(image2),
srcImage(maskimage), region_stats);
Required Interface:
ImageIterator1 upperleft1, lowerright1;
ImageIterator2 upperleft2;
MaskImageIterator upperleftm;
ImageIterator1::row_iterator ix1 = upperleft1.rowIterator();
ImageIterator2::row_iterator ix2 = upperleft2.rowIterator();
MaskImageIterator::row_iterator mx = mupperleft.rowIterator();
Accessor1 accessor1;
Accessor2 accessor2;
MaskAccessor mask;
Functor functor;
if(mask(mx))
functor(accessor1(ix1), accessor2(ix2));

See also
  Functors To Inspect Images, Feature Accumulators

## ◆ labelImage()

template<... >

unsigned int labelImage | ( |  | ... | ) |

Find the connected components of a segmented image.

Deprecated. Use labelMultiArray() instead.

Connected components are defined as regions with uniform pixel values. Thus, `T1` either must be equality comparable, or a suitable EqualityFunctor must be provided that realizes the desired predicate. The destination's value type `T2` should be large enough to hold the labels without overflow. Region numbers will be a consecutive sequence starting with one and ending with the region number returned by the function (inclusive). The parameter '`eight_neighbors`' determines whether the regions should be 4-connected (false) or 8-connected (true).

Return: the number of regions found (= largest region label)

See labelMultiArray() for a dimension-independent implementation of connected components labelling.

Declarations:

pass 2D array views:

namespace vigra {
template <class T1, class S1,
class T2, class S2,
class EqualityFunctor = std::equal_to<T1> >
unsigned int
labelImage(MultiArrayView<2, T1, S1> const & src,
MultiArrayView<2, T2, S2> dest,
bool eight_neighbors, EqualityFunctor equal = EqualityFunctor());
}
vigra::labelImage
unsigned int labelImage(...)
Find the connected components of a segmented image.

show deprecated declarations

pass Image Iterators and Data Accessors :
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor>
unsigned int labelImage(SrcIterator upperlefts,
SrcIterator lowerrights, SrcAccessor sa,
DestIterator upperleftd, DestAccessor da,
bool eight_neighbors);
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor,
class EqualityFunctor>
unsigned int labelImage(SrcIterator upperlefts,
SrcIterator lowerrights, SrcAccessor sa,
DestIterator upperleftd, DestAccessor da,
bool eight_neighbors, EqualityFunctor equal);
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor>
unsigned int labelImage(triple<SrcIterator, SrcIterator, SrcAccessor> src,
pair<DestIterator, DestAccessor> dest,
bool eight_neighbors);
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor,
class EqualityFunctor>
unsigned int labelImage(triple<SrcIterator, SrcIterator, SrcAccessor> src,
pair<DestIterator, DestAccessor> dest,
bool eight_neighbors, EqualityFunctor equal)
}

Usage:

#include <vigra/labelimage.hxx>
Namespace: vigra

MultiArray<2, unsigned char> src(w,h);
MultiArray<2, unsigned int> labels(w,h);
// threshold at 128
transformImage(src, src, Threshold<int, int>(128, 256, 0, 255));
// find 4-connected regions
labelImage(src, labels, false);

show deprecated examples

vigra::BImage src(w,h);
vigra::IImage labels(w,h);
// threshold at 128
vigra::transformImage(srcImageRange(src), destImage(src),
vigra::Threshold<vigra::BImage::PixelType, vigra::BImage::PixelType>(
128, 256, 0, 255));
// find 4-connected regions
vigra::labelImage(srcImageRange(src), destImage(labels), false);
Required Interface:
SrcImageIterator src_upperleft, src_lowerright;
DestImageIterator dest_upperleft;
SrcAccessor src_accessor;
DestAccessor dest_accessor;
SrcAccessor::value_type u = src_accessor(src_upperleft);
u == u // first form
EqualityFunctor equal; // second form
equal(u, u) // second form
int i;
dest_accessor.set(i, dest_upperleft);

## ◆ labelImageWithBackground()

template<... >

unsigned int labelImageWithBackground | ( |  | ... | ) |

Find the connected components of a segmented image, excluding the background from labeling.

Deprecated. Use labelMultiArray() instead.

This function works like labelImage(), but considers all background pixels (i.e. pixels having the given '`background_value`') as a single region that is ignored when determining connected components and remains untouched in the destination image. Usually, you will zero-initialize the output image, so that the background gets label 0 (remember that actual region labels start at one).

Return: the number of non-background regions found (= largest region label)

See labelMultiArrayWithBackground() for a dimension-independent implementation if this algorithm.

Declarations:

pass 2D array views:

namespace vigra {
template <class T1, class S1,
class T2, class S2,
class ValueType,
class EqualityFunctor = std::equal_to<T1> >
unsigned int
labelImageWithBackground(MultiArrayView<2, T1, S1> const & src,
MultiArrayView<2, T2, S2> dest,
bool eight_neighbors,
ValueType background_value,
EqualityFunctor equal = EqualityFunctor());
}
vigra::labelImageWithBackground
unsigned int labelImageWithBackground(...)
Find the connected components of a segmented image, excluding the background from labeling.

show deprecated declarations

pass Image Iterators and Data Accessors :
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor,
class ValueType>
int labelImageWithBackground(SrcIterator upperlefts,
SrcIterator lowerrights, SrcAccessor sa,
DestIterator upperleftd, DestAccessor da,
bool eight_neighbors,
ValueType background_value );
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor,
class ValueType, class EqualityFunctor>
int labelImageWithBackground(SrcIterator upperlefts,
SrcIterator lowerrights, SrcAccessor sa,
DestIterator upperleftd, DestAccessor da,
bool eight_neighbors,
ValueType background_value, EqualityFunctor equal);
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor,
class ValueType>
int labelImageWithBackground(triple<SrcIterator, SrcIterator, SrcAccessor> src,
pair<DestIterator, DestAccessor> dest,
bool eight_neighbors,
ValueType background_value);
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor,
class ValueType, class EqualityFunctor>
int labelImageWithBackground(triple<SrcIterator, SrcIterator, SrcAccessor> src,
pair<DestIterator, DestAccessor> dest,
bool eight_neighbors,
ValueType background_value, EqualityFunctor equal);
}

Usage:

#include <vigra/labelimage.hxx>
Namespace: vigra

MultiArray<2, unsigned char> src(w,h);
MultiArray<2, unsigned int> labels(w,h);
// threshold at 128
transformImage(src, src, Threshold<int, int>(128, 256, 0, 255));
// find 4-connected regions of foreground (= white pixels) only
labelImageWithBackground(src, labels, false, 0);

show deprecated examples

vigra::BImage src(w,h);
vigra::IImage labels(w,h);
// threshold at 128
vigra::transformImage(srcImageRange(src), destImage(src),
vigra::Threshold<vigra::BImage::PixelType, vigra::BImage::PixelType>(
128, 256, 0, 255));
// find 4-connected regions of foreground (= white pixels) only
vigra::labelImageWithBackground(srcImageRange(src), destImage(labels),
false, 0);
Required Interface:
SrcImageIterator src_upperleft, src_lowerright;
DestImageIterator dest_upperleft;
SrcAccessor src_accessor;
DestAccessor dest_accessor;
SrcAccessor::value_type u = src_accessor(src_upperleft);
ValueType background_value;
u == u // first form
u == background_value // first form
EqualityFunctor equal; // second form
equal(u, u) // second form
equal(u, background_value) // second form
int i;
dest_accessor.set(i, dest_upperleft);

## ◆ regionImageToCrackEdgeImage()

template<... >

void regionImageToCrackEdgeImage | ( |  | ... | ) |

Transform a labeled image into a crack edge (interpixel edge) image.

Declarations:

pass 2D array views:

namespace vigra {
template <class T1, class S1,
class T2, class S2, class DestValue>
void
regionImageToCrackEdgeImage(MultiArrayView<2, T1, S1> const & src,
MultiArrayView<2, T2, S2> dest,
DestValue edge_marker,
EdgeImageLabelPolicy labelPolicy = CopyRegionLabels);
}
vigra::regionImageToCrackEdgeImage
void regionImageToCrackEdgeImage(...)
Transform a labeled image into a crack edge (interpixel edge) image.

show deprecated declarations

pass Image Iterators and Data Accessors :
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor, class DestValue>
void regionImageToCrackEdgeImage(
SrcIterator sul, SrcIterator slr, SrcAccessor sa,
DestIterator dul, DestAccessor da,
DestValue edge_marker,
EdgeImageLabelPolicy labelPolicy = CopyRegionLabels)
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor, class DestValue>
void regionImageToCrackEdgeImage(
triple<SrcIterator, SrcIterator, SrcAccessor> src,
pair<DestIterator, DestAccessor> dest,
DestValue edge_marker,
EdgeImageLabelPolicy labelPolicy = CopyRegionLabels)
}

The destination image must be twice the size of the input image (precisely, `(2*w-1)` by `(2*h-1)` pixels) to have space for the so called "crack edges" or "interpixel edges" which are logically situated between pixels (at half-integer coordinates of the input image) and correspond to the odd-valued coordinates in the result image (see Crack Edge Image for more details).

When `labelPolicy == CopyRegionLabels` (the default), this algorithm transfers the labels of a labeled image to the output image (repeating them as appropriate to account for the output image size) and inserts border pixels when the label changes. For example, if `a` and `c` are the original labels, and `0` is the value of `edge_marker`, the transformation looks like this:

original image copy labels and insert edges
a 0 c c c
a c c a 0 0 0 c
a a c => a a a 0 c
a a a a a a 0 0
a a a a a

When `labelPolicy == EdgeOverlayOnly`, the region pixels of the output image remain untouched, and only the edge marker is inserted. This is especially useful for visualization, when the output is the interpolated original image:

original image destination image overlay edges only
d d d d d d 0 d d d
a c c d d d d d d 0 0 0 d
a a c + d d d d d => d d d 0 d
a a a d d d d d d d d 0 0
d d d d d d d d d d

The algorithm assumes that the original labeled image contains no background. Therefore, it is suitable as a post-processing operation of labelImage() or seededRegionGrowing().

The source value type (`SrcAccessor::value-type`) must be equality-comparable.

Usage:

#include <vigra/labelimage.hxx>
Namespace: vigra

MultiArray<2, unsigned char> src(w,h);
MultiArray<2, unsigned int> labels(w,h),
cellgrid(2*w-1, 2*h-1);
// threshold at 128
transformImage(src, src, Threshold<int, int>(128, 256, 0, 255));
// find 4-connected regions
labelImage(src, labels, false);
// create cell grid image, mark edges with 0
regionImageToCrackEdgeImage(labels, cellgrid, 0);

show deprecated examples

vigra::BImage src(w,h);
vigra::IImage labels(w,h);
vigra::IImage cellgrid(2*w-1, 2*h-1);
// threshold at 128
vigra::transformImage(srcImageRange(src), destImage(src),
vigra::Threshold<vigra::BImage::PixelType, vigra::BImage::PixelType>(
128, 256, 0, 255));
// find 4-connected regions
vigra::labelImage(srcImageRange(src), destImage(labels), false);
// create cell grid image, mark edges with 0
vigra::regionImageToCrackEdgeImage(srcImageRange(labels), destImage(cellgrid), 0);
Required Interface:
ImageIterator src_upperleft, src_lowerright;
ImageIterator dest_upperleft;
SrcAccessor src_accessor;
DestAccessor dest_accessor;
SrcAccessor::value_type u = src_accessor(src_upperleft);
u != u
DestValue edge_marker;
dest_accessor.set(edge_marker, dest_upperleft);

Preconditions:

The destination image must have twice the size of the source:

w_dest = 2 * w_src - 1
h_dest = 2 * h_src - 1

## ◆ regionImageToEdgeImage()

template<... >

void regionImageToEdgeImage | ( |  | ... | ) |

Transform a labeled image into an edge image.

Declarations:

pass 2D array views:

namespace vigra {
template <class T1, class S1,
class T2, class S2, class DestValue>
void
regionImageToEdgeImage(MultiArrayView<2, T1, S1> const & src,
MultiArrayView<2, T2, S2> dest,
DestValue edge_marker);
}
vigra::regionImageToEdgeImage
void regionImageToEdgeImage(...)
Transform a labeled image into an edge image.

show deprecated declarations

pass Image Iterators and Data Accessors :
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor, class DestValue>
void regionImageToEdgeImage(
SrcIterator sul, SrcIterator slr, SrcAccessor sa,
DestIterator dul, DestAccessor da,
DestValue edge_marker)
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor, class DestValue>
void regionImageToEdgeImage(
triple<SrcIterator, SrcIterator, SrcAccessor> src,
pair<DestIterator, DestAccessor> dest,
DestValue edge_marker)
}

This algorithm marks all pixels with the given `edge_marker` which belong to a different region (label) than their right or lower neighbors:

original image edges
(assuming edge_marker == 1)
a c c 1 1 *
a a c => * 1 1
a a a * * *

The non-edge pixels of the destination image will not be touched. The source value type `T1` must be equality-comparable.

Usage:

#include <vigra/labelimage.hxx>
Namespace: vigra

MultiArray<2, unsigned char> src(w,h),
edges(w,h);
MultiArray<2, unsigned int> labels(w,h);
edges = 255; // init background (non-edge) to 255
// threshold at 128
transformImage(src, src, Threshold<int, int>(128, 256, 0, 255));
// find 4-connected regions
labelImage(src, labels, false);
// create edge image, mark edges with 0
regionImageToEdgeImage(labels, edges, 0);

show deprecated examples

vigra::BImage src(w,h);
vigra::IImage labels(w,h);
vigra::IImage edges(w, h);
edges = 255; // init background (non-edge) to 255
// threshold at 128
vigra::transformImage(srcImageRange(src), destImage(src),
vigra::Threshold<vigra::BImage::PixelType, vigra::BImage::PixelType>(
128, 256, 0, 255));
// find 4-connected regions
vigra::labelImage(srcImageRange(src), destImage(labels), false);
// create edge image, mark edges with 0
vigra::regionImageToEdgeImage(srcImageRange(labels), destImage(edges), 0);
Required Interface:
ImageIterator src_upperleft, src_lowerright;
ImageIterator dest_upperleft;
SrcAccessor src_accessor;
DestAccessor dest_accessor;
SrcAccessor::value_type u = src_accessor(src_upperleft);
u != u
DestValue edge_marker;
dest_accessor.set(edge_marker, dest_upperleft);

## ◆ labelVolume()

template<... >

unsigned int labelVolume | ( |  | ... | ) |

Find the connected components of a segmented volume.

Deprecated. Use labelMultiArray() instead.

Connected components are defined as regions with uniform voxel values. Thus, `T1` either must be equality comparable, or an EqualityFunctor must be provided explicitly that realizes the desired equivalence predicate. The destination's value type `T2` should be large enough to hold the labels without overflow. Region numbers will be a consecutive sequence starting with one and ending with the region number returned by the function (inclusive).

Return: the number of regions found (= largest region label)

See labelMultiArray() for a dimension-independent implementation of connected components labelling.

Declarations:

pass 3D array views:

namespace vigra {
template <class T1, class S1,
class T2, class S2,
class Neighborhood3D,
class EqualityFunctor = std::equal_to<T1> >
unsigned int
labelVolume(MultiArrayView<3, T1, S1> const & source,
MultiArrayView<3, T2, S2> dest,
Neighborhood3D neighborhood3D,
EqualityFunctor equal = EqualityFunctor());
}
vigra::labelVolume
unsigned int labelVolume(...)
Find the connected components of a segmented volume.

show deprecated declarations

pass MultiIterators and Data Accessors :
namespace vigra {
template <class SrcIterator, class SrcAccessor,class SrcShape,
class DestIterator, class DestAccessor,
class Neighborhood3D>
unsigned int labelVolume(SrcIterator s_Iter, SrcShape srcShape, SrcAccessor sa,
DestIterator d_Iter, DestAccessor da,
Neighborhood3D neighborhood3D);
template <class SrcIterator, class SrcAccessor,class SrcShape,
class DestIterator, class DestAccessor,
class Neighborhood3D, class EqualityFunctor>
unsigned int labelVolume(SrcIterator s_Iter, SrcShape srcShape, SrcAccessor sa,
DestIterator d_Iter, DestAccessor da,
Neighborhood3D neighborhood3D, EqualityFunctor equal);
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
template <class SrcIterator, class SrcAccessor,class SrcShape,
class DestIterator, class DestAccessor,
class Neighborhood3D>
unsigned int labelVolume(triple<SrcIterator, SrcShape, SrcAccessor> src,
pair<DestIterator, DestAccessor> dest,
Neighborhood3D neighborhood3D);
template <class SrcIterator, class SrcAccessor,class SrcShape,
class DestIterator, class DestAccessor,
class Neighborhood3D, class EqualityFunctor>
unsigned int labelVolume(triple<SrcIterator, SrcShape, SrcAccessor> src,
pair<DestIterator, DestAccessor> dest,
Neighborhood3D neighborhood3D, EqualityFunctor equal);
}
use with 3D-Six-Neighborhood:
namespace vigra {
template <class SrcIterator, class SrcAccessor,class SrcShape,
class DestIterator, class DestAccessor>
unsigned int labelVolumeSix(triple<SrcIterator, SrcShape, SrcAccessor> src,
pair<DestIterator, DestAccessor> dest);
}
vigra::labelVolumeSix
unsigned int labelVolumeSix(triple< SrcIterator, SrcShape, SrcAccessor > src, pair< DestIterator, DestAccessor > dest)
Find the connected components of a segmented volume using the 6-neighborhood.
Definition labelvolume.hxx:387

Usage:

#include <vigra/labelvolume.hxx>
Namespace: vigra

typedef MultiArray<3,int> IntVolume;
IntVolume src(Shape3(w,h,d));
IntVolume dest(Shape3(w,h,d));
// find 6-connected regions
int max_region_label = labelVolumeSix(src, dest);
// find 26-connected regions
int max_region_label = labelVolume(src, dest, NeighborCode3DTwentySix());
vigra::NeighborCode3DTwentySix
Neighborhood3DTwentySix::NeighborCode3D NeighborCode3DTwentySix
Definition voxelneighborhood.hxx:1646

show deprecated examples

typedef vigra::MultiArray<3,int> IntVolume;
IntVolume src(IntVolume::difference_type(w,h,d));
IntVolume dest(IntVolume::difference_type(w,h,d));
// find 6-connected regions
int max_region_label = vigra::labelVolumeSix(srcMultiArrayRange(src), destMultiArray(dest));
// find 26-connected regions
int max_region_label = vigra::labelVolume(srcMultiArrayRange(src), destMultiArray(dest), NeighborCode3DTwentySix());
Required Interface:
SrcIterator src_begin;
SrcShape shape;
DestIterator dest_begin;
SrcAccessor src_accessor;
DestAccessor dest_accessor;
SrcAccessor::value_type u = src_accessor(src_begin);
u == u // first form
EqualityFunctor equal; // second form
equal(u, u) // second form
int i;
dest_accessor.set(i, dest_begin);

## ◆ labelVolumeSix()

template<class SrcIterator , class SrcAccessor , class SrcShape , class DestIterator , class DestAccessor >

unsigned int labelVolumeSix | ( | triple< SrcIterator, SrcShape, SrcAccessor > | src,
|  | pair< DestIterator, DestAccessor > | dest
| ) |  |

Find the connected components of a segmented volume using the 6-neighborhood.

See labelVolume() for detailed documentation.

## ◆ labelVolumeWithBackground()

template<... >

unsigned int labelVolumeWithBackground | ( |  | ... | ) |

Find the connected components of a segmented volume, excluding the background from labeling.

Deprecated. Use labelMultiArray() instead.

This function works like labelVolume(), but considers all background voxels (i.e. voxels having the given '`background_value`') as a single region that is ignored when determining connected components and remains untouched in the destination array. Usually, you will zero-initialize the output array, so that the background gets label 0 (remember that actual region labels start at one).

Return: the number of regions found (= largest region label)

See labelMultiArrayWithBackground() for a dimension-independent implementation if this algorithm.

Declarations:

pass 3D array views:

namespace vigra {
template <class T1, class S1,
class T2, class S2,
class Neighborhood3D,
class ValueType,
class EqualityFunctor = std::equalt_to<T1> >
unsigned int
labelVolumeWithBackground(MultiArrayView<3, T1, S1> const & source,
MultiArrayView<3, T2, S2> dest,
Neighborhood3D neighborhood3D,
ValueType backgroundValue,
EqualityFunctor equal = EqualityFunctor());
}
vigra::labelVolumeWithBackground
unsigned int labelVolumeWithBackground(...)
Find the connected components of a segmented volume, excluding the background from labeling.

show deprecated declarations

pass MultiIterators and Data Accessors :
namespace vigra {
template <class SrcIterator, class SrcAccessor,class SrcShape,
class DestIterator, class DestAccessor,
class Neighborhood3D, class ValueType>
unsigned int labelVolumeWithBackground( SrcIterator s_Iter, SrcShape srcShape, SrcAccessor sa,
DestIterator d_Iter, DestAccessor da,
Neighborhood3D neighborhood3D, ValueType background_value);
template <class SrcIterator, class SrcAccessor,class SrcShape,
class DestIterator, class DestAccessor,
class Neighborhood3D, class ValueType, class EqualityFunctor>
unsigned int labelVolumeWithBackground( SrcIterator s_Iter, SrcShape srcShape, SrcAccessor sa,
DestIterator d_Iter, DestAccessor da,
Neighborhood3D neighborhood3D, ValueType background_value,
EqualityFunctor equal);
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
template <class SrcIterator, class SrcAccessor,class SrcShape,
class DestIterator, class DestAccessor,
class Neighborhood3D, class ValueType>
unsigned int labelVolumeWithBackground( triple<SrcIterator, SrcShape, SrcAccessor> src,
pair<DestIterator, DestAccessor> dest,
Neighborhood3D neighborhood3D, ValueType background_value);
template <class SrcIterator, class SrcAccessor,class SrcShape,
class DestIterator, class DestAccessor,
class Neighborhood3D, class ValueType, class EqualityFunctor>
unsigned int labelVolumeWithBackground( triple<SrcIterator, SrcShape, SrcAccessor> src,
pair<DestIterator, DestAccessor> dest,
Neighborhood3D neighborhood3D, ValueType background_value,
EqualityFunctor equal);
}

Usage:

#include <vigra/labelvolume.hxx>
Namespace: vigra

typedef vigra::MultiArray<3,int> IntVolume;
IntVolume src(Shape3(w,h,d));
IntVolume dest(Shape3(w,h,d));
// find 6-connected regions
int max_region_label = labelVolumeWithBackground(src, dest, NeighborCode3DSix(), 0);
vigra::NeighborCode3DSix
Neighborhood3DSix::NeighborCode3D NeighborCode3DSix
Definition voxelneighborhood.hxx:490

show deprecated examples

typedef vigra::MultiArray<3,int> IntVolume;
IntVolume src(IntVolume::difference_type(w,h,d));
IntVolume dest(IntVolume::difference_type(w,h,d));
// find 6-connected regions
int max_region_label = vigra::labelVolumeWithBackground(
srcMultiArrayRange(src), destMultiArray(dest), NeighborCode3DSix(), 0);
Required Interface:
SrcIterator src_begin;
SrcShape shape;
DestIterator dest_begin;
SrcAccessor src_accessor;
DestAccessor dest_accessor;
SrcAccessor::value_type u = src_accessor(src_begin);
u == u // first form
EqualityFunctor equal; // second form
equal(u, u) // second form
int i;
dest_accessor.set(i, dest_begin);

## ◆ localMinima()

template<... >

void localMinima | ( |  | ... | ) |

Find local minima in an image or multi-dimensional array.

By default, minima are defined as points which are not at the array border and whose value is lower than the value of all indirect neighbors (i.e. 8-neighbors in 2D, 26-neighbors in 3D, 3N-1 neighbors in N-D). The detected points will be marked with the default value 1 in the destination array.

The defaults can be overridden in various ways by providing LocalMinmaxOptions : you can switch to the direct neighborhood (i.e. 4-neighborhood in 2D, 6-neighborhood in 3D, 2*N neighborhood in N-D), allow minima at the border, discard minima where the function value is not below a given threshold, allow extended minima (i.e. minima that form minimal plateaus rather than isolated pixels – note that this option is only supported for 2D images), and change the marker in the destination image. See usage examples below for details.

There are also variants of the localMinima() function where parameters are passed explicitly rather than via an option object. These versions of the function are deprecated, but will be kept for compatibility.

Declarations:

use arbitrary-dimensional arrays:

namespace vigra {
template <unsigned int N, class T1, class C1, class T2, class C2>
void
localMinima(MultiArrayView<N, T1, C1> src,
MultiArrayView<N, T2, C2> dest,
LocalMinmaxOptions const & options = LocalMinmaxOptions());
}
vigra::LocalMinmaxOptions
Options object for localMinima() and localMaxima().
Definition localminmax.hxx:494
vigra::localMinima
void localMinima(...)
Find local minima in an image or multi-dimensional array.

show deprecated declarations

pass Image Iterators and Data Accessors :
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor>
void
localMinima(SrcIterator sul, SrcIterator slr, SrcAccessor sa,
DestIterator dul, DestAccessor da,
LocalMinmaxOptions const & options = LocalMinmaxOptions());
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor>
void
localMinima(triple<SrcIterator, SrcIterator, SrcAccessor> src,
pair<DestIterator, DestAccessor> dest,
LocalMinmaxOptions const & options = LocalMinmaxOptions());
}

Usage:

#include <vigra/localminmax.hxx>
#include <vigra/multi_localminmax.hxx>
Namespace: vigra

// 3D examples (other dimensions work likewise)
Shape3 shape(w,h,d);
MultiArray<3, unsigned char> src(shape), minima(shape);
... // fill src
// use default parameterisation
localMinima(src, minima);
// reset destination image
minima = 0;
// use direct neighborhood (i.e. 6-neighborhood since we are in 3D)
// and allow minima at the image border
localMinima(src, minima,
LocalMinmaxOptions().neighborhood(0).allowAtBorder());

show deprecated examples

// 2D examples using BasicImage
BImage src(w,h), minima(w,h);
... // fill src
// use default parameterisation
localMinima(srcImageRange(src), destImage(minima));
// reset destination image
minima = 0;
// use 4-neighborhood and allow minima at the image border
localMinima(srcImageRange(src), destImage(minima),
LocalMinmaxOptions().neighborhood(4).allowAtBorder());
// reset destination image
minima = 0;
// allow extended minima (minimal plateaus) and use value '255' as a marker
localMinima(srcImageRange(src), destImage(minima),
LocalMinmaxOptions().allowPlateaus().markWith(255));
Required Interface:
SrcIterator src_upperleft, src_lowerright;
DestIterator dest_upperleft;
SrcAccessor src_accessor;
DestAccessor dest_accessor;
SrcAccessor::value_type u = src_accessor(src_upperleft);
u < u

## ◆ localMinima3D()

template<... >

void localMinima3D | ( |  | ... | ) |

Find local minima in a 3D multi array.

Deprecated, use localMinima() instead.

## ◆ localMaxima()

template<... >

void localMaxima | ( |  | ... | ) |

Find local maxima in an image or multi-dimensional array.

By default, maxima are defined as points which are not at the array border and whose value is higher than the value of all indirect neighbors (i.e. 8-neighbors in 2D, 26-neighbors in 3D, 3N-1 neighbors in N-D). The detected points will be marked with the default value 1 in the destination array.

The defaults can be overridden in various ways by providing LocalMinmaxOptions : you can switch to the direct neighborhood (i.e. 4-neighborhood in 2D, 6-neighborhood in 3D, 2*N neighborhood in N-D), allow maxima at the border, discard maxima where the function value is not above a given threshold, allow extended maxima (i.e. maxima that form maximal plateaus rather than isolated pixels – note that this option is only supported for 2D images), and change the marker in the destination image. See usage examples below for details.

There are also variants of the localMaxima() function where parameters are passed explicitly rather than via an option object. These versions of the function are deprecated, but will be kept for compatibility.

Declarations:

use arbitrary-dimensional arrays:

namespace vigra {
template <unsigned int N, class T1, class C1, class T2, class C2>
void
localMaxima(MultiArrayView<N, T1, C1> src,
MultiArrayView<N, T2, C2> dest,
LocalMinmaxOptions const & options = LocalMinmaxOptions());
}

show deprecated declarations

pass Image Iterators and Data Accessors :
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor>
void
localMaxima(SrcIterator sul, SrcIterator slr, SrcAccessor sa,
DestIterator dul, DestAccessor da,
LocalMinmaxOptions const & options = LocalMinmaxOptions());
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor>
void
localMaxima(triple<SrcIterator, SrcIterator, SrcAccessor> src,
pair<DestIterator, DestAccessor> dest,
LocalMinmaxOptions const & options = LocalMinmaxOptions());
}

Usage:

#include <vigra/localminmax.hxx>
#include <vigra/multi_localminmax.hxx>
Namespace: vigra

// 3D examples (other dimensions work likewise)
Shape3 shape(w,h,d);
MultiArray<3, unsigned char> src(shape), maxima(shape);
... // fill src
// use default parameterisation
localMaxima(src, maxima);
// reset destination image
maxima = 0;
// use direct neighborhood (i.e. 6-neighborhood sine we are in 3D)
// and allow maxima at the image border
localMaxima(src, maxima,
LocalMinmaxOptions().neighborhood(0).allowAtBorder());

show deprecated examples

// 2D examples using BasicImage
BImage src(w,h), maxima(w,h);
... // fill src
// use default parameterisation
localMaxima(srcImageRange(src), destImage(maxima));
// reset destination image
maxima = 0;
// use 4-neighborhood and allow maxima at the image border
localMaxima(srcImageRange(src), destImage(maxima),
LocalMinmaxOptions().neighborhood(4).allowAtBorder());
// reset destination image
maxima = 0;
// allow extended maxima (maximal plateaus) and use value '255' as a marker
localMaxima(srcImageRange(src), destImage(maxima),
LocalMinmaxOptions().allowPlateaus().markWith(255));
Required Interface:
SrcIterator src_upperleft, src_lowerright;
DestIterator dest_upperleft;
SrcAccessor src_accessor;
DestAccessor dest_accessor;
SrcAccessor::value_type u = src_accessor(src_upperleft);
u < u

## ◆ localMaxima3D()

template<... >

void localMaxima3D | ( |  | ... | ) |

Find local maxima in a 3D multi array.

Deprecated, use localMaxima() instead.

## ◆ extendedLocalMinima()

template<... >

void extendedLocalMinima | ( |  | ... | ) |

Find local minimal regions (plateaus) in an array.

This function is only needed when you want to pass a non-standard equality predicate via `EqualityFunctor`. Otherwise (i.e. when equality is defined by the '==' operator of the source value type `T1`), you can simply call localMinima() with the option `LocalMinmaxOptions::allowPlateaus()`.

This function finds regions of uniform pixel values whose neighboring regions all have larger values, i.e. it finds minimal plateaus of arbitrary size (including size 1). The `EqualityFunctor` determines when pixels are considered equal, so that one can allow for plateaus that are not quite constant (this is often necessary with float pixel values). Otherwise, the functionality is identical to localMinima().

Declarations:

use arbitrary-dimensional arrays:

namespace vigra {
template <unsigned int N, class T1, class S1,
class T2, class S2,
class EqualityFunctor>
unsigned int
extendedLocalMinima(MultiArrayView<N, T1, S1> const & src,
MultiArrayView<N, T2, S2> dest,
EqualityFunctor const & equal,
LocalMinmaxOptions options = LocalMinmaxOptions());
vigra::extendedLocalMinima
void extendedLocalMinima(...)
Find local minimal regions (plateaus) in an array.

show deprecated declarations

pass Image Iterators and Data Accessors :
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor,
class DestValue = DestAccessor::value_type,
class Neighborhood = EightNeighborCode,
class EqualityFunctor = std::equal_to<typename SrcAssessor::value_type> >
void
extendedLocalMinima(SrcIterator sul, SrcIterator slr, SrcAccessor sa,
DestIterator dul, DestAccessor da,
DestValue marker = NumericTraits<DestValue>::one(),
Neighborhood neighborhood = EightNeighborCode(),
EqualityFunctor equal = EqualityFunctor());
template<class SrcIterator, class SrcShape, class SrcAccessor,
class DestIterator, class DestAccessor,
class Neighborhood = NeighborCode3DSix,
class EqualityFunctor = std::equal_to<typename SrcAssessor::value_type> >
void
extendedLocalMinima3D(SrcIterator sul, SrcShape slr, SrcAccessor sa,
DestIterator dul, DestAccessor da,
typename DestAccessor::value_type marker,
Neighborhood neighborhood = Neighborhood(),
EqualityFunctor equal = EqualityFunctor());
}
vigra::EightNeighborCode
EightNeighborhood::NeighborCode EightNeighborCode
Definition pixelneighborhood.hxx:687
vigra::extendedLocalMinima3D
void extendedLocalMinima3D(...)
Find local minimal regions in a volume.
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor,
class DestValue = DestAccessor::value_type,
class Neighborhood = EightNeighborCode,
class EqualityFunctor = std::equal_to<typename SrcAssessor::value_type> >
void
extendedLocalMinima(triple<SrcIterator, SrcIterator, SrcAccessor> src,
pair<DestIterator, DestAccessor> dest,
DestValue marker = NumericTraits<DestValue>::one(),
Neighborhood neighborhood = EightNeighborCode(),
EqualityFunctor equal = EqualityFunctor());
template<class SrcIterator, class SrcAccessor, class SrcShape,
class DestIterator, class DestAccessor,
class Neighborhood>
void
extendedLocalMinima3D(triple<SrcIterator, SrcShape, SrcAccessor> src,
pair<DestIterator, DestAccessor> dest,
typename DestAccessor::value_type marker,
Neighborhood neighborhood);
}

Usage:

#include <vigra/localminmax.hxx>
Namespace: vigra

// define an equality functor
template <class T>
struct EqualWithToleranceFunctor
{
EqualWithToleranceFunctor(T tolerance)
: t(tolerance)
{}
bool operator()(T l, T r) const
{
return abs(l-r) <= t;
}
T t;
};
MultiArray<2, unsigned char> src(w,h), minima(w,h);
// allow plateaus
localMinima(src, minima, LocalMinmaxOptions().allowPlateaus());
// reset result image
minima.init(0);
// allow plateaus with tolerance (grayvalues may differ by one)
extendedLocalMinima(src, minima, EqualWithToleranceFunctor<unsigned char>(1));

show deprecated examples

// optional: define an equality functor
template <class T>
struct EqualWithToleranceFunctor
{
EqualWithToleranceFunctor(T tolerance)
: t(tolerance)
{}
bool operator()(T l, T r) const
{
return abs(l-r) <= t;
}
T t;
};
BImage src(w,h), minima(w,h);
// init destiniation image
minima.init(0);
extendedLocalMinima(srcImageRange(src), destImage(minima));
// allow plateaus with tolerance
minima.init(0);
extendedLocalMinima(srcImageRange(src), destImage(minima), 1.0,
FourNeighborCode(),
EqualWithToleranceFunctor<unsigned char>(1));
vigra::FourNeighborCode
FourNeighborhood::NeighborCode FourNeighborCode
Definition pixelneighborhood.hxx:379
vigra::BImage
BasicImage< UInt8 > BImage
Definition stdimage.hxx:62
Required Interface:
SrcImageIterator src_upperleft, src_lowerright;
DestImageIterator dest_upperleft;
SrcAccessor src_accessor;
DestAccessor dest_accessor;
SrcAccessor::value_type u = src_accessor(src_upperleft);
EqualityFunctor equal;
u == u
equal(u, u);
u < u
DestValue marker;
dest_accessor.set(marker, dest_upperleft);

## ◆ extendedLocalMinima3D()

template<... >

void extendedLocalMinima3D | ( |  | ... | ) |

Find local minimal regions in a volume.

See extendedLocalMinima().

## ◆ extendedLocalMaxima()

template<... >

void extendedLocalMaxima | ( |  | ... | ) |

Find local maximal regions in an array.

This function is only needed when you want to pass a non-standard equality predicate via `EqualityFunctor`. Otherwise (i.e. when equality is defined by the '==' operator of the source value type `T1`), you can simply call localMaxima() with the option `LocalMinmaxOptions::allowPlateaus()`.

This function finds regions of uniform pixel values whose neighboring regions all have smaller values, i.e. it finds maximal plateaus of arbitrary size (including size 1). The `EqualityFunctor` determines when pixels are considered equal, so that one can allow for plateaus that are not quite constant (this is often necessary with float pixel values). Otherwise, the functionality is identical to localMaxima().

Declarations:

use arbitrary-dimensional arrays:

namespace vigra {
template <unsigned int N, class T1, class S1,
class T2, class S2>
unsigned int // return number of maxima
extendedLocalMaxima(MultiArrayView<N, T1, S1> const & src,
MultiArrayView<N, T2, S2> dest,
LocalMinmaxOptions options = LocalMinmaxOptions());
vigra::extendedLocalMaxima
void extendedLocalMaxima(...)
Find local maximal regions in an array.

show deprecated declarations

pass Image Iterators and Data Accessors :
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor,
class DestValue = DestAccessor::value_type,
class Neighborhood = EightNeighborCode,
class EqualityFunctor = std::equal_to<typename SrcAssessor::value_type> >
void
extendedLocalMaxima(SrcIterator sul, SrcIterator slr, SrcAccessor sa,
DestIterator dul, DestAccessor da,
DestValue marker = NumericTraits<DestValue>::one(),
Neighborhood neighborhood = EightNeighborCode(),
EqualityFunctor equal = EqualityFunctor())
template<class SrcIterator, class SrcShape, class SrcAccessor,
class DestIterator, class DestAccessor,
class Neighborhood = NeighborCode3DSix,
class EqualityFunctor = std::equal_to<typename SrcAssessor::value_type> >
void
extendedLocalMaxima3D(SrcIterator sul, SrcShape slr, SrcAccessor sa,
DestIterator dul, DestAccessor da,
typename DestAccessor::value_type marker,
Neighborhood neighborhood = Neighborhood(),
EqualityFunctor equal = EqualityFunctor());
}
vigra::Neighborhood3DSix::NeighborCode3D
Encapsulation of direction management of neighbors for a 3D 6-neighborhood.
Definition voxelneighborhood.hxx:164
vigra::extendedLocalMaxima3D
void extendedLocalMaxima3D(...)
Find local maximal regions in 3D multi array.
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor,
class DestValue = DestAccessor::value_type,
class Neighborhood = EightNeighborCode,
class EqualityFunctor = std::equal_to<typename SrcAssessor::value_type> >
void
extendedLocalMaxima(triple<SrcIterator, SrcIterator, SrcAccessor> src,
pair<DestIterator, DestAccessor> dest,
DestValue marker = NumericTraits<DestValue>::one(),
Neighborhood neighborhood = EightNeighborCode(),
EqualityFunctor equal = EqualityFunctor())
template<class SrcIterator, class SrcAccessor, class SrcShape,
class DestIterator, class DestAccessor,
class Neighborhood>
void
extendedLocalMaxima3D(triple<SrcIterator, SrcShape, SrcAccessor> src,
pair<DestIterator, DestAccessor> dest,
typename DestAccessor::value_type marker,
Neighborhood neighborhood);
}

Usage:

#include <vigra/localminmax.hxx>
Namespace: vigra

// define an equality functor
template <class T>
struct EqualWithToleranceFunctor
{
EqualWithToleranceFunctor(T tolerance)
: t(tolerance)
{}
bool operator()(T l, T r) const
{
return abs(l-r) <= t;
}
T t;
};
MultiArray<2, unsigned char> src(w,h), maxima(w,h);
// allow plateaus
localMaxima(src, maxima, LocalMinmaxOptions().allowPlateaus());
// reset result image
maxima.init(0);
// allow plateaus with tolerance (grayvalues may differ by one)
extendedLocalMaxima(src, maxima, EqualWithToleranceFunctor<unsigned char>(1));

show deprecated examples

// optional: define an equality functor
template <class T>
struct EqualWithToleranceFunctor
{
EqualWithToleranceFunctor(T tolerance)
: t(tolerance)
{}
bool operator()(T l, T r) const
{
return abs(l-r) <= t;
}
T t;
};
BImage src(w,h), maxima(w,h);
// init destiniation image
maxima.init(0);
extendedLocalMaxima(srcImageRange(src), destImage(maxima));
// allow plateaus with tolerance
maxima.init(0);
extendedLocalMaxima(srcImageRange(src), destImage(maxima), 1.0,
FourNeighborCode(),
EqualWithToleranceFunctor<unsigned char>(1));
Required Interface:
SrcImageIterator src_upperleft, src_lowerright;
DestImageIterator dest_upperleft;
SrcAccessor src_accessor;
DestAccessor dest_accessor;
SrcAccessor::value_type u = src_accessor(src_upperleft);
EqualityFunctor equal;
u == u
equal(u, u);
u < u
DestValue marker;
dest_accessor.set(marker, dest_upperleft);

## ◆ extendedLocalMaxima3D()

template<... >

void extendedLocalMaxima3D | ( |  | ... | ) |

Find local maximal regions in 3D multi array.

See extendedLocalMaxima().

## ◆ round() [1/2]

REAL round | ( | REAL | v | ) |

The rounding function.

Defined for all floating point types. Rounds towards the nearest integer such that `abs(round(t)) == round(abs(t))` for all `t`.

#include <vigra/mathutil.hxx>
Namespace: vigra

## ◆ roundi() [1/2]

long long roundi | ( | double | t | ) |

Round and cast to integer.

Rounds to the nearest integer like round(), but casts the result to `long long` (this will be faster and is usually needed anyway).

#include <vigra/mathutil.hxx>
Namespace: vigra

## ◆ ceilPower2()

UInt32 ceilPower2 | ( | UInt32 | x | ) |

Round up to the nearest power of 2.

Efficient algorithm for finding the smallest power of 2 which is not smaller than x (function clp2() from Henry Warren: "Hacker's Delight", Addison-Wesley, 2003, see http://www.hackersdelight.org/). If x > 2^31, the function will return 0 because integer arithmetic is defined modulo 2^32.

#include <vigra/mathutil.hxx>
Namespace: vigra

## ◆ floorPower2()

UInt32 floorPower2 | ( | UInt32 | x | ) |

Round down to the nearest power of 2.

Efficient algorithm for finding the largest power of 2 which is not greater than x (function flp2() from Henry Warren: "Hacker's Delight", Addison-Wesley, 2003, see http://www.hackersdelight.org/).

#include <vigra/mathutil.hxx>
Namespace: vigra

## ◆ log2i()

Int32 log2i | ( | UInt32 | x | ) |

Compute the base-2 logarithm of an integer.

Returns the position of the left-most 1-bit in the given number x, or -1 if x == 0. That is,

assert(k >= 0 && k < 32 && log2i(1 << k) == k);
vigra::log2i
Int32 log2i(UInt32 x)
Compute the base-2 logarithm of an integer.
Definition mathutil.hxx:361

The function uses Robert Harley's algorithm to determine the number of leading zeros in x (algorithm nlz10() at http://www.hackersdelight.org/). But note that the functions floorPower2() or ceilPower2() are more efficient and should be preferred when possible.

#include <vigra/mathutil.hxx>
Namespace: vigra

## ◆ sq()

template<class T >

NumericTraits< T >::Promote sq | ( | T | t | ) |

The square function.

`sq(x) = x*x` is needed so often that it makes sense to define it as a function.

#include <vigra/mathutil.hxx>
Namespace: vigra

## ◆ power()

template<unsigned n, class V >

V power | ( | const V & | x | ) |

Exponentiation to a positive integer power by squaring.

#include <vigra/mathutil.hxx>
Namespace: vigra

## ◆ sqrti()

UInt32 sqrti | ( | Int32 | v | ) |

Signed integer square root.

Unsigned integer square root.

Useful for fast fixed-point computations.

#include <vigra/mathutil.hxx>
Namespace: vigra

## ◆ sign() [1/2]

template<class T >

T sign | ( | T | t | ) |

The sign function.

Returns 1, 0, or -1 depending on the sign of t, but with the same type as t.

#include <vigra/mathutil.hxx>
Namespace: vigra

## ◆ signi()

template<class T >

int signi | ( | T | t | ) |

The integer sign function.

Returns 1, 0, or -1 depending on the sign of t, converted to int.

#include <vigra/mathutil.hxx>
Namespace: vigra

## ◆ sign() [2/2]

template<class T1 , class T2 >

T1 sign | ( | T1 | t1,
|  | T2 | t2
| ) |  |

The binary sign function.

Transfers the sign of t2 to t1.

#include <vigra/mathutil.hxx>
Namespace: vigra

## ◆ even()

bool even | ( | int | t | ) |

Check if an integer is even.

Defined for all integral types.

## ◆ odd()

bool odd | ( | int | t | ) |

Check if an integer is odd.

Defined for all integral types.

## ◆ squaredNorm()

NormTraits< T >::SquaredNormType squaredNorm | ( | T const & | t | ) |

The squared norm of a numerical object.

- For scalar types: equals `vigra::sq(t)`.
- For vectorial types (including TinyVector): equals `vigra::dot(t, t)`.
- For complex number types: equals `vigra::sq(t.real()) + vigra::sq(t.imag())`.
- For array and matrix types: results in the squared Frobenius norm (sum of squares of the matrix elements).

## ◆ norm()

template<class T >

NormTraits< T >::NormType norm | ( | T const & | t | ) |

The norm of a numerical object.

For scalar types: implemented as `abs(t)`
otherwise: implemented as `sqrt(squaredNorm(t))`.

#include <vigra/mathutil.hxx>
Namespace: vigra

## ◆ symmetric2x2Eigenvalues()

template<class T >

void symmetric2x2Eigenvalues | ( | T | a00,
|  | T | a01,
|  | T | a11,
|  | T * | r0,
|  | T * | r1
| ) |  |

Compute the eigenvalues of a 2x2 real symmetric matrix.

This uses the analytical eigenvalue formula

#include <vigra/mathutil.hxx>
Namespace: vigra

## ◆ symmetric3x3Eigenvalues()

template<class T >

void symmetric3x3Eigenvalues | ( | T | a00,
|  | T | a01,
|  | T | a02,
|  | T | a11,
|  | T | a12,
|  | T | a22,
|  | T * | r0,
|  | T * | r1,
|  | T * | r2
| ) |  |

Compute the eigenvalues of a 3x3 real symmetric matrix.

This uses a numerically stable version of the analytical eigenvalue formula according to

David Eberly: "Eigensystems for 3 x 3 Symmetric Matrices (Revisited)", Geometric Tools Documentation, 2006

#include <vigra/mathutil.hxx>
Namespace: vigra

## ◆ ellipticIntegralF()

double ellipticIntegralF | ( | double | x,
|  | double | k
| ) |  |

The incomplete elliptic integral of the first kind.

This function computes

according to the algorithm given in Press et al. "Numerical Recipes".

Note: In some libraries (e.g. Mathematica), the second parameter of the elliptic integral functions must be k^2 rather than k. Check the documentation when results disagree!

#include <vigra/mathutil.hxx>
Namespace: vigra

## ◆ ellipticIntegralE()

double ellipticIntegralE | ( | double | x,
|  | double | k
| ) |  |

The incomplete elliptic integral of the second kind.

This function computes

according to the algorithm given in Press et al. "Numerical Recipes". The complete elliptic integral of the second kind is simply `ellipticIntegralE(M_PI/2, k)`.

Note: In some libraries (e.g. Mathematica), the second parameter of the elliptic integral functions must be k^2 rather than k. Check the documentation when results disagree!

#include <vigra/mathutil.hxx>
Namespace: vigra

## ◆ chi2()

double chi2 | ( | unsigned int | degreesOfFreedom,
|  | double | arg,
|  | double | accuracy = `1e-7`
| ) |  |

Chi square distribution.

Computes the density of a chi square distribution with degreesOfFreedom and tolerance accuracy at the given argument arg by calling `noncentralChi2(degreesOfFreedom, 0.0, arg, accuracy)`.

#include <vigra/mathutil.hxx>
Namespace: vigra

## ◆ chi2CDF()

double chi2CDF | ( | unsigned int | degreesOfFreedom,
|  | double | arg,
|  | double | accuracy = `1e-7`
| ) |  |

Cumulative chi square distribution.

Computes the cumulative density of a chi square distribution with degreesOfFreedom and tolerance accuracy at the given argument arg, i.e. the probability that a random number drawn from the distribution is below arg by calling `noncentralChi2CDF(degreesOfFreedom, 0.0, arg, accuracy)`.

#include <vigra/mathutil.hxx>
Namespace: vigra

## ◆ noncentralChi2()

double noncentralChi2 | ( | unsigned int | degreesOfFreedom,
|  | double | noncentrality,
|  | double | arg,
|  | double | accuracy = `1e-7`
| ) |  |

Non-central chi square distribution.

Computes the density of a non-central chi square distribution with degreesOfFreedom, noncentrality parameter noncentrality and tolerance accuracy at the given argument arg. It uses Algorithm AS 231 from Appl. Statist. (1987) Vol.36, No.3 (code ported from http://lib.stat.cmu.edu/apstat/231). The algorithm has linear complexity in the number of degrees of freedom.

#include <vigra/mathutil.hxx>
Namespace: vigra

## ◆ noncentralChi2CDF()

double noncentralChi2CDF | ( | unsigned int | degreesOfFreedom,
|  | double | noncentrality,
|  | double | arg,
|  | double | accuracy = `1e-7`
| ) |  |

Cumulative non-central chi square distribution.

Computes the cumulative density of a chi square distribution with degreesOfFreedom, noncentrality parameter noncentrality and tolerance accuracy at the given argument arg, i.e. the probability that a random number drawn from the distribution is below arg It uses Algorithm AS 231 from Appl. Statist. (1987) Vol.36, No.3 (code ported from http://lib.stat.cmu.edu/apstat/231). The algorithm has linear complexity in the number of degrees of freedom (see noncentralChi2CDFApprox() for a constant-time algorithm).

#include <vigra/mathutil.hxx>
Namespace: vigra

## ◆ noncentralChi2CDFApprox()

double noncentralChi2CDFApprox | ( | unsigned int | degreesOfFreedom,
|  | double | noncentrality,
|  | double | arg
| ) |  |

Cumulative non-central chi square distribution (approximate).

Computes approximate values of the cumulative density of a chi square distribution with degreesOfFreedom, and noncentrality parameter noncentrality at the given argument arg, i.e. the probability that a random number drawn from the distribution is below arg It uses the approximate transform into a normal distribution due to Wilson and Hilferty (see Abramovitz, Stegun: "Handbook of Mathematical Functions", formula 26.3.32). The algorithm's running time is independent of the inputs, i.e. is should be used when noncentralChi2CDF() is too slow, and approximate values are sufficient. The accuracy is only about 0.1 for few degrees of freedom, but reaches about 0.001 above dof = 5.

#include <vigra/mathutil.hxx>
Namespace: vigra

## ◆ legendre() [1/2]

template<class REAL >

REAL legendre | ( | unsigned int | l,
|  | int | m,
|  | REAL | x
| ) |  |

Associated Legendre polynomial.

Computes the value of the associated Legendre polynomial of order `l, m` for argument `x`. `x` must be in the range `[-1.0, 1.0]`, otherwise an exception is thrown. The standard Legendre polynomials are the special case `m == 0`.

#include <vigra/mathutil.hxx>
Namespace: vigra

## ◆ legendre() [2/2]

template<class REAL >

REAL legendre | ( | unsigned int | l,
|  | REAL | x
| ) |  |

Legendre polynomial.

Computes the value of the Legendre polynomial of order `l` for argument `x`. `x` must be in the range `[-1.0, 1.0]`, otherwise an exception is thrown.

#include <vigra/mathutil.hxx>
Namespace: vigra

## ◆ sin_pi()

template<class REAL >

REAL sin_pi | ( | REAL | x | ) |

sin(pi*x).

Essentially calls `std::sin(M_PI*x)` but uses a more accurate implementation to make sure that `sin_pi(1.0) == 0.0` (which does not hold for `std::sin(M_PI)` due to round-off error), and `sin_pi(0.5) == 1.0`.

#include <vigra/mathutil.hxx>
Namespace: vigra

## ◆ cos_pi()

template<class REAL >

REAL cos_pi | ( | REAL | x | ) |

cos(pi*x).

Essentially calls `std::cos(M_PI*x)` but uses a more accurate implementation to make sure that `cos_pi(1.0) == -1.0` and `cos_pi(0.5) == 0.0`.

#include <vigra/mathutil.hxx>
Namespace: vigra

## ◆ gamma()

double gamma | ( | double | x | ) |

The gamma function.

This function implements the algorithm from
Zhang and Jin: "Computation of Special Functions", John Wiley and Sons, 1996.

The argument must be <= 171.0 and cannot be zero or a negative integer. An exception is thrown when these conditions are violated.

#include <vigra/mathutil.hxx>
Namespace: vigra

## ◆ loggamma()

double loggamma | ( | double | x | ) |

The natural logarithm of the gamma function.

This function is based on a free implementation by Sun Microsystems, Inc., see sourceware.org archive. It can be removed once all compilers support the new C99 math functions.

The argument must be positive and < 1e30. An exception is thrown when these conditions are violated.

#include <vigra/mathutil.hxx>
Namespace: vigra

## ◆ closeAtTolerance()

template<class T1 , class T2 >

bool closeAtTolerance | ( | T1 | l,
|  | T2 | r,
|  | typename PromoteTraits< T1, T2 >::Promote | epsilon
| ) |  |

Tolerance based floating-point equality.

Check whether two floating point numbers are equal within the given tolerance. This is useful because floating point numbers that should be equal in theory are rarely exactly equal in practice. If the tolerance epsilon is not given, twice the machine epsilon is used.

#include <vigra/mathutil.hxx>
Namespace: vigra

## ◆ lessEqualAtTolerance()

template<class T1 , class T2 >

bool lessEqualAtTolerance | ( | T1 | l,
|  | T2 | r,
|  | typename PromoteTraits< T1, T2 >::Promote | epsilon
| ) |  |

Tolerance based floating-point less-or-equal.

Check whether two floating point numbers are less or equal within the given tolerance. That is, l can actually be greater than r within the given epsilon. This is useful because floating point numbers that should be equal in theory are rarely exactly equal in practice. If the tolerance epsilon is not given, twice the machine epsilon is used.

#include <vigra/mathutil.hxx>
Namespace: vigra

## ◆ greaterEqualAtTolerance()

template<class T1 , class T2 >

bool greaterEqualAtTolerance | ( | T1 | l,
|  | T2 | r,
|  | typename PromoteTraits< T1, T2 >::Promote | epsilon
| ) |  |

Tolerance based floating-point greater-or-equal.

Check whether two floating point numbers are greater or equal within the given tolerance. That is, l can actually be less than r within the given epsilon. This is useful because floating point numbers that should be equal in theory are rarely exactly equal in practice. If the tolerance epsilon is not given, twice the machine epsilon is used.

#include <vigra/mathutil.hxx>
Namespace: vigra

## ◆ medianFilter()

template<... >

void medianFilter | ( |  | ... | ) |

This function calculates the median of a window of given size for the complete image.

This function calculates the median of a window of given size for the complete image. It also allows a correct border handling, since it uses the applyWindowFunction environment for computation!

All border treatment modes (except BORDER_TREATMENT_CLIP) are supported.

The input pixel type `T1` must be a linear space over the window functions' value_type `T`. Especially, the values must be sortable by std::sort, to derive the mean values aka the median.

Declarations:

pass 2D array views:

namespace vigra {
template <class T1, class S1,
class T2, class S2>
void
medianFilter(MultiArrayView<2, T1, S1> const & src,
MultiArrayView<2, T2, S2> dest,
Diff2D window_shape,
BorderTreatmentMode border = BORDER_TREATMENT_REPEAT);
}
vigra::medianFilter
void medianFilter(...)
This function calculates the median of a window of given size for the complete image.

show deprecated declarations

pass Image Iterators and Data Accessors :
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor>
void medianFilter(SrcIterator supperleft,
SrcIterator slowerright, SrcAccessor sa,
DestIterator dupperleft, DestAccessor da,
Diff2D window_shape,
BorderTreatmentMode border = BORDER_TREATMENT_REPEAT);
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor>
void
medianFilter(triple<SrcIterator, SrcIterator, SrcAccessor> src,
pair<DestIterator, DestAccessor> dest,
Diff2D window_shape,
BorderTreatmentMode border = BORDER_TREATMENT_REPEAT);
}

Usage:

#include <vigra/medianfilter.hxx>
Namespace: vigra

unsigned int w=1000, h=1000;
MultiArray<2, float> src(w,h), dest(w,h);
...
// apply a median filter with a window size of 5x5
medianFilter(src, dest, Diff2D(5,5));

Preconditions:

The image must be larger than the window size of the filter.

## ◆ meshGrid()

triple< Diff2D, Diff2D, MeshGridAccessor > meshGrid | ( | Diff2D | upperLeft,
|  | Diff2D | lowerRight
| ) |  |

Create a mesh grid for the specified rectangle.

The mesh grid concept is adapted from MATLAB. It is a two banded image (i.e. with 2D vector pixel type) whose first band contains the x-coordinates of the current pixel, and whose second band contains the y-coordinates. If upperLeft is not the point (0,0), the mesh grid is translated relative to the pixel indices.

Declarations:

triple<Diff2D, Diff2D, MeshGridAccessor>
meshGrid(Diff2D upperLeft, Diff2D lowerRight);
triple<Diff2D, Diff2D, MeshGridAccessor>
meshGrid(Rect2D const & r);
vigra::Rect2D
Two dimensional rectangle.
Definition diff2d.hxx:873
vigra::meshGrid
triple< Diff2D, Diff2D, MeshGridAccessor > meshGrid(Diff2D upperLeft, Diff2D lowerRight)
Definition meshgrid.hxx:119

Usage:

#include <vigra/meshgrid.hxx>
// create an image whose values are equal to each pixel's distance from the image center
int width = 5, height = 7;
int xc = width/2, yc = height/2; // the image center
FImage dist(width, height);
Point2D upperLeft(-xc, -yc);
using namespace vigra::functor;
transformImage(meshGrid(upperLeft, upperLeft+dist.size()),
destImage(dist),
norm(Arg1()));
vigra::Point2D
Two dimensional point or position.
Definition diff2d.hxx:593

## ◆ makeBasicImageView() [1/2]

template<class T , class Stride >

BasicImageView< T > makeBasicImageView | ( | MultiArrayView< 2, T, Stride > const & | array | ) |

Create a vigra::BasicImageView from an unstrided 2-dimensional vigra::MultiArrayView.

The vigra::BasicImageView will have the same `value_type` as the original vigra::MultiArrayView.

## ◆ makeBasicImageView() [2/2]

template<class T >

BasicImageView< T > makeBasicImageView | ( | MultiArray< 3, T > const & | array | ) |

Create a vigra::BasicImageView from a 3-dimensional vigra::MultiArray.

This wrapper flattens the two innermost dimensions of the array into single rows of the resulting image. The vigra::BasicImageView will have the same `value_type` as the original vigra::MultiArray.

## ◆ makeRGBImageView()

template<class T , class Stride >

BasicImageView< RGBValue< T > > makeRGBImageView | ( | MultiArrayView< 3, T, Stride > const & | array | ) |

Create a vigra::BasicImageView from a 3-dimensional vigra::MultiArray.

This wrapper only works if `T` is a scalar type and the array's innermost dimension has size 3. It then re-interprets the data array as a 2-dimensional array with value_type `RGBValue<T>`.

## ◆ createCoupledIterator() [1/7]

template<unsigned int N, class T >

ChunkedArray< N, T >::iterator createCoupledIterator | ( | ChunkedArray< N, T > & | m | ) |

Returns a CoupledScanOrderIterator to simultaneously iterate over image m1 and its coordinates.

## ◆ separableConvolveMultiArray()

template<... >

void separableConvolveMultiArray | ( |  | ... | ) |

Separated convolution on multi-dimensional arrays.

This function computes a separated convolution on all dimensions of the given multi-dimensional array. Both source and destination arrays are represented by iterators, shape objects and accessors. The destination array is required to already have the correct size.

There are two variants of this functions: one takes a single kernel of type vigra::Kernel1D which is then applied to all dimensions, whereas the other requires an iterator referencing a sequence of vigra::Kernel1D objects, one for every dimension of the data. Then the first kernel in this sequence is applied to the innermost dimension (e.g. the x-axis of an image), while the last is applied to the outermost dimension (e.g. the z-axis in a 3D image).

This function may work in-place, which means that `source.data() == dest.data()` is allowed. A full-sized internal array is only allocated if working on the destination array directly would cause round-off errors (i.e. if `typeid(typename NumericTraits<T2>::RealPromote) != typeid(T2)`).

If `start` and `stop` have non-default values, they must represent a valid subarray of the input array. The convolution is then restricted to that subarray, and it is assumed that the output array only refers to the subarray (i.e. `dest.shape() == stop - start`). Negative ROI boundaries are interpreted relative to the end of the respective dimension (i.e. `if(stop[k] < 0) stop[k] += source.shape(k);`).

Declarations:

pass arbitrary-dimensional array views:

namespace vigra {
// apply each kernel from the sequence 'kernels' in turn
template <unsigned int N, class T1, class S1,
class T2, class S2,
class KernelIterator>
void
separableConvolveMultiArray(MultiArrayView<N, T1, S1> const & source,
MultiArrayView<N, T2, S2> dest,
KernelIterator kernels,
typename MultiArrayShape<N>::type start = typename MultiArrayShape<N>::type(),
typename MultiArrayShape<N>::type stop = typename MultiArrayShape<N>::type());
// apply the same kernel to all dimensions
template <unsigned int N, class T1, class S1,
class T2, class S2,
class T>
void
separableConvolveMultiArray(MultiArrayView<N, T1, S1> const & source,
MultiArrayView<N, T2, S2> dest,
Kernel1D<T> const & kernel,
typename MultiArrayShape<N>::type const & start = typename MultiArrayShape<N>::type(),
typename MultiArrayShape<N>::type const & stop = typename MultiArrayShape<N>::type());
}
vigra::separableConvolveMultiArray
void separableConvolveMultiArray(...)
Separated convolution on multi-dimensional arrays.

show deprecated declarations

pass MultiIterators and Data Accessors :
namespace vigra {
// apply the same kernel to all dimensions
template <class SrcIterator, class SrcShape, class SrcAccessor,
class DestIterator, class DestAccessor, class T>
void
separableConvolveMultiArray(SrcIterator siter, SrcShape const & shape, SrcAccessor src,
DestIterator diter, DestAccessor dest,
Kernel1D<T> const & kernel,
SrcShape const & start = SrcShape(),
SrcShape const & stop = SrcShape());
// apply each kernel from the sequence 'kernels' in turn
template <class SrcIterator, class SrcShape, class SrcAccessor,
class DestIterator, class DestAccessor, class KernelIterator>
void
separableConvolveMultiArray(SrcIterator siter, SrcShape const & shape, SrcAccessor src,
DestIterator diter, DestAccessor dest,
KernelIterator kernels,
SrcShape const & start = SrcShape(),
SrcShape const & stop = SrcShape());
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
// apply the same kernel to all dimensions
template <class SrcIterator, class SrcShape, class SrcAccessor,
class DestIterator, class DestAccessor, class T>
void
separableConvolveMultiArray(triple<SrcIterator, SrcShape, SrcAccessor> const & source,
pair<DestIterator, DestAccessor> const & dest,
Kernel1D<T> const & kernel,
SrcShape const & start = SrcShape(),
SrcShape const & stop = SrcShape());
// apply each kernel from the sequence 'kernels' in turn
template <class SrcIterator, class SrcShape, class SrcAccessor,
class DestIterator, class DestAccessor, class KernelIterator>
void
separableConvolveMultiArray(triple<SrcIterator, SrcShape, SrcAccessor> const & source,
pair<DestIterator, DestAccessor> const & dest,
KernelIterator kernels,
SrcShape const & start = SrcShape(),
SrcShape const & stop = SrcShape());
}

Usage:

#include <vigra/multi_convolution.hxx>
Namespace: vigra

Shape3 shape(width, height, depth);
MultiArray<3, unsigned char> source(shape);
MultiArray<3, float> dest(shape);
...
Kernel1D<float> gauss;
gauss.initGaussian(sigma);
// smooth all dimensions with the same kernel
separableConvolveMultiArray(source, dest, gauss);
// create 3 Gauss kernels, one for each dimension, but smooth the z-axis less
ArrayVector<Kernel1D<float> > kernels(3, gauss);
kernels[2].initGaussian(sigma / 2.0);
// perform Gaussian smoothing on all dimensions
separableConvolveMultiArray(source, dest, kernels.begin());
// create output array for a ROI
MultiArray<3, float> destROI(shape - Shape3(10,10,10));
// only smooth the given ROI (ignore 5 pixels on all sides of the array)
separableConvolveMultiArray(source, destROI, gauss, Shape3(5,5,5), Shape3(-5,-5,-5));

show deprecated examples

MultiArray<3, unsigned char>::size_type shape(width, height, depth);
MultiArray<3, unsigned char> source(shape);
MultiArray<3, float> dest(shape);
...
Kernel1D<float> gauss;
gauss.initGaussian(sigma);
// create 3 Gauss kernels, one for each dimension
ArrayVector<Kernel1D<float> > kernels(3, gauss);
// perform Gaussian smoothing on all dimensions
separableConvolveMultiArray(source, dest,
kernels.begin());
Required Interface:
see \ref separableConvolveImage(), in addition:
NumericTraits<T1>::RealPromote s = src[0];
s = s + s;
s = kernel(0) * s;

See also
  vigra::Kernel1D, convolveLine()

## ◆ convolveMultiArrayOneDimension()

template<... >

void convolveMultiArrayOneDimension | ( |  | ... | ) |

Convolution along a single dimension of a multi-dimensional arrays.

This function computes a convolution along one dimension (specified by the parameter `dim` of the given multi-dimensional array with the given `kernel`. The destination array must already have the correct size.

If `start` and `stop` have non-default values, they must represent a valid subarray of the input array. The convolution is then restricted to that subarray, and it is assumed that the output array only refers to the subarray (i.e. `dest.shape() == stop - start`). Negative ROI boundaries are interpreted relative to the end of the respective dimension (i.e. `if(stop[k] < 0) stop[k] += source.shape(k);`).

This function may work in-place, which means that `source.data() == dest.data()` is allowed.

Declarations:

pass arbitrary-dimensional array views:

namespace vigra {
template <unsigned int N, class T1, class S1,
class T2, class S2,
class T>
void
convolveMultiArrayOneDimension(MultiArrayView<N, T1, S1> const & source,
MultiArrayView<N, T2, S2> dest,
unsigned int dim,
Kernel1D<T> const & kernel,
typename MultiArrayShape<N>::type start = typename MultiArrayShape<N>::type(),
typename MultiArrayShape<N>::type stop = typename MultiArrayShape<N>::type());
}
vigra::convolveMultiArrayOneDimension
void convolveMultiArrayOneDimension(...)
Convolution along a single dimension of a multi-dimensional arrays.

show deprecated declarations

pass MultiIterators and Data Accessors :
namespace vigra {
template <class SrcIterator, class SrcShape, class SrcAccessor,
class DestIterator, class DestAccessor, class T>
void
convolveMultiArrayOneDimension(SrcIterator siter, SrcShape const & shape, SrcAccessor src,
DestIterator diter, DestAccessor dest,
unsigned int dim, vigra::Kernel1D<T> const & kernel,
SrcShape const & start = SrcShape(),
SrcShape const & stop = SrcShape());
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
template <class SrcIterator, class SrcShape, class SrcAccessor,
class DestIterator, class DestAccessor, class T>
void
convolveMultiArrayOneDimension(triple<SrcIterator, SrcShape, SrcAccessor> const & source,
pair<DestIterator, DestAccessor> const & dest,
unsigned int dim, vigra::Kernel1D<T> const & kernel,
SrcShape const & start = SrcShape(),
SrcShape const & stop = SrcShape());
}

Usage:

#include <vigra/multi_convolution.hxx>
Namespace: vigra

Shape3 shape(width, height, depth);
MultiArray<3, unsigned char> source(shape);
MultiArray<3, float> dest(shape);
...
Kernel1D<float> gauss;
gauss.initGaussian(sigma);
// perform Gaussian smoothing along dimension 1 (height)
convolveMultiArrayOneDimension(source, dest, 1, gauss);

See also
  separableConvolveMultiArray()

## ◆ gaussianSmoothMultiArray()

template<... >

void gaussianSmoothMultiArray | ( |  | ... | ) |

Isotropic Gaussian smoothing of a multi-dimensional arrays.

This function computes an isotropic convolution of the given N-dimensional array with a Gaussian filter at the given standard deviation `sigma`. Both source and destination arrays are represented by iterators, shape objects and accessors. The destination array is required to already have the correct size. This function may work in-place, which means that `source.data() == dest.data()` is allowed. It is implemented by a call to separableConvolveMultiArray() with the appropriate kernel.

Anisotropic data should be provided with appropriate vigra::ConvolutionOptions to adjust the filter sizes for the resolution of each axis. Otherwise, the parameter `opt` is optional unless the parameter `sigma` is omitted.

If you pass vigra::BlockwiseConvolutionOptions instead, the algorithm will be executed in parallel on data blocks of a certain size. The block size can be customized via `BlockwiseConvolutionOptions::blockShape()`, but the defaults usually work reasonably. By default, the number of threads equals the capabilities of your hardware, but you can change this via `BlockwiseConvolutionOptions::numThreads()`.

Declarations:

pass arbitrary-dimensional array views:

namespace vigra {
// pass filter scale explicitly
template <unsigned int N, class T1, class S1,
class T2, class S2>
void
gaussianSmoothMultiArray(MultiArrayView<N, T1, S1> const & source,
MultiArrayView<N, T2, S2> dest,
double sigma,
ConvolutionOptions<N> opt = ConvolutionOptions<N>());
// pass filer scale(s) in the option object
template <unsigned int N, class T1, class S1,
class T2, class S2>
void
gaussianSmoothMultiArray(MultiArrayView<N, T1, S1> const & source,
MultiArrayView<N, T2, S2> dest,
ConvolutionOptions<N> opt);
// as above, but execute algorithm in parallel
template <unsigned int N, class T1, class S1,
class T2, class S2>
void
gaussianSmoothMultiArray(MultiArrayView<N, T1, S1> const & source,
MultiArrayView<N, T2, S2> dest,
BlockwiseConvolutionOptions<N> opt);
}
vigra::gaussianSmoothMultiArray
void gaussianSmoothMultiArray(...)
Isotropic Gaussian smoothing of a multi-dimensional arrays.

show deprecated declarations

pass MultiIterators and Data Accessors :
namespace vigra {
template <class SrcIterator, class SrcShape, class SrcAccessor,
class DestIterator, class DestAccessor>
void
gaussianSmoothMultiArray(SrcIterator siter, SrcShape const & shape, SrcAccessor src,
DestIterator diter, DestAccessor dest,
double sigma,
const ConvolutionOptions<N> & opt = ConvolutionOptions<N>());
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
template <class SrcIterator, class SrcShape, class SrcAccessor,
class DestIterator, class DestAccessor>
void
gaussianSmoothMultiArray(triple<SrcIterator, SrcShape, SrcAccessor> const & source,
pair<DestIterator, DestAccessor> const & dest,
double sigma,
const ConvolutionOptions<N> & opt = ConvolutionOptions<N>());
}

Usage:

#include <vigra/multi_convolution.hxx> (sequential version)
#include <vigra/multi_blockwise.hxx> (parallel version)
Namespace: vigra

Shape3 shape(width, height, depth);
MultiArray<3, unsigned char> source(shape);
MultiArray<3, float> dest(shape);
...
// perform isotropic Gaussian smoothing at scale 'sigma'
gaussianSmoothMultiArray(source, dest, sigma);

Multi-threaded execution:

Shape3 shape(width, height, depth);
MultiArray<3, unsigned char> source(shape);
MultiArray<3, float> dest(shape);
...
BlockwiseConvolutionOptions<3> opt;
opt.numThreads(4); // use 4 threads (uses hardware default if not given)
opt.innerScale(sigma);
// perform isotropic Gaussian smoothing at scale 'sigma' in parallel
gaussianSmoothMultiArray(source, dest, sigma, opt);

Usage with anisotropic data:

Shape3 shape(width, height, depth);
MultiArray<3, unsigned char> source(shape);
MultiArray<3, float> dest(shape);
TinyVector<float, 3> step_size;
TinyVector<float, 3> resolution_sigmas;
...
// perform anisotropic Gaussian smoothing at scale 'sigma'
gaussianSmoothMultiArray(source, dest, sigma,
ConvolutionOptions<3>().stepSize(step_size).resolutionStdDev(resolution_sigmas));

See also
  separableConvolveMultiArray()

## ◆ gaussianGradientMultiArray()

template<... >

void gaussianGradientMultiArray | ( |  | ... | ) |

Calculate Gaussian gradient of a multi-dimensional arrays.

This function computes the Gaussian gradient of the given N-dimensional array with a sequence of first-derivative-of-Gaussian filters at the given standard deviation `sigma` (differentiation is applied to each dimension in turn, starting with the innermost dimension). The destination array is required to have a vector valued pixel type with as many elements as the number of dimensions. This function is implemented by calls to separableConvolveMultiArray() with the appropriate kernels.

Anisotropic data should be provided with appropriate vigra::ConvolutionOptions to adjust the filter sizes for the resolution of each axis. Otherwise, the parameter `opt` is optional unless the parameter `sigma` is omitted.

If you pass vigra::BlockwiseConvolutionOptions instead, the algorithm will be executed in parallel on data blocks of a certain size. The block size can be customized via `BlockwiseConvolutionOptions::blockShape()`, but the defaults usually work reasonably. By default, the number of threads equals the capabilities of your hardware, but you can change this via `BlockwiseConvolutionOptions::numThreads()`.

Declarations:

pass arbitrary-dimensional array views:

namespace vigra {
// pass filter scale explicitly
template <unsigned int N, class T1, class S1,
class T2, class S2>
void
gaussianGradientMultiArray(MultiArrayView<N, T1, S1> const & source,
MultiArrayView<N, TinyVector<T2, int(N)>, S2> dest,
double sigma,
ConvolutionOptions<N> opt = ConvolutionOptions<N>());
// pass filter scale(s) in option object
template <unsigned int N, class T1, class S1,
class T2, class S2>
void
gaussianGradientMultiArray(MultiArrayView<N, T1, S1> const & source,
MultiArrayView<N, TinyVector<T2, int(N)>, S2> dest,
ConvolutionOptions<N> opt);
// likewise, but execute algorithm in parallel
template <unsigned int N, class T1, class S1,
class T2, class S2>
void
gaussianGradientMultiArray(MultiArrayView<N, T1, S1> const & source,
MultiArrayView<N, TinyVector<T2, int(N)>, S2> dest,
BlockwiseConvolutionOptions<N> opt);
}
vigra::gaussianGradientMultiArray
void gaussianGradientMultiArray(...)
Calculate Gaussian gradient of a multi-dimensional arrays.

show deprecated declarations

pass MultiIterators and Data Accessors :
namespace vigra {
template <class SrcIterator, class SrcShape, class SrcAccessor,
class DestIterator, class DestAccessor>
void
gaussianGradientMultiArray(SrcIterator siter, SrcShape const & shape, SrcAccessor src,
DestIterator diter, DestAccessor dest,
double sigma,
const ConvolutionOptions<N> & opt = ConvolutionOptions<N>());
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
template <class SrcIterator, class SrcShape, class SrcAccessor,
class DestIterator, class DestAccessor>
void
gaussianGradientMultiArray(triple<SrcIterator, SrcShape, SrcAccessor> const & source,
pair<DestIterator, DestAccessor> const & dest,
double sigma,
const ConvolutionOptions<N> & opt = ConvolutionOptions<N>());
}

Usage:

#include <vigra/multi_convolution.hxx> (sequential version)
#include <vigra/multi_blockwise.hxx> (parallel version)
Namespace: vigra

Shape3 shape(width, height, depth);
MultiArray<3, unsigned char> source(shape);
MultiArray<3, TinyVector<float, 3> > dest(shape);
...
// compute Gaussian gradient at scale sigma
gaussianGradientMultiArray(source, dest, sigma);

Usage with anisotropic data:

Shape3 shape(width, height, depth);
MultiArray<3, unsigned char> source(shape);
MultiArray<3, TinyVector<float, 3> > dest(shape);
TinyVector<float, 3> step_size;
TinyVector<float, 3> resolution_sigmas;
...
// compute Gaussian gradient at scale sigma
gaussianGradientMultiArray(source, dest, sigma,
ConvolutionOptions<3>().stepSize(step_size).resolutionStdDev(resolution_sigmas));

See also
  separableConvolveMultiArray()

## ◆ symmetricGradientMultiArray()

template<... >

void symmetricGradientMultiArray | ( |  | ... | ) |

Calculate gradient of a multi-dimensional arrays using symmetric difference filters.

This function computes the gradient of the given N-dimensional array with a sequence of symmetric difference filters a (differentiation is applied to each dimension in turn, starting with the innermost dimension). The destination array is required to have a vector valued pixel type with as many elements as the number of dimensions. This function is implemented by calls to convolveMultiArrayOneDimension() with the symmetric difference kernel.

Anisotropic data should be provided with appropriate vigra::ConvolutionOptions to adjust the filter sizes for the resolution of each axis. Otherwise, the parameter `opt` is optional unless the parameter `sigma` is omitted.

If you pass vigra::BlockwiseConvolutionOptions instead, the algorithm will be executed in parallel on data blocks of a certain size. The block size can be customized via `BlockwiseConvolutionOptions::blockShape()`, but the defaults usually work reasonably. By default, the number of threads equals the capabilities of your hardware, but you can change this via `BlockwiseConvolutionOptions::numThreads()`.

Declarations:

pass arbitrary-dimensional array views:

namespace vigra {
// execute algorithm sequentially
template <unsigned int N, class T1, class S1,
class T2, class S2>
void
symmetricGradientMultiArray(MultiArrayView<N, T1, S1> const & source,
MultiArrayView<N, TinyVector<T2, int(N)>, S2> dest,
ConvolutionOptions<N> opt = ConvolutionOptions<N>());
// execute algorithm in parallel
template <unsigned int N, class T1, class S1,
class T2, class S2>
void
symmetricGradientMultiArray(MultiArrayView<N, T1, S1> const & source,
MultiArrayView<N, TinyVector<T2, int(N)>, S2> dest,
BlockwiseConvolutionOptions<N> opt);
}
vigra::symmetricGradientMultiArray
void symmetricGradientMultiArray(...)
Calculate gradient of a multi-dimensional arrays using symmetric difference filters.

show deprecated declarations

pass MultiIterators and Data Accessors :
namespace vigra {
template <class SrcIterator, class SrcShape, class SrcAccessor,
class DestIterator, class DestAccessor>
void
symmetricGradientMultiArray(SrcIterator siter, SrcShape const & shape, SrcAccessor src,
DestIterator diter, DestAccessor dest,
const ConvolutionOptions<N> & opt = ConvolutionOptions<N>());
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
template <class SrcIterator, class SrcShape, class SrcAccessor,
class DestIterator, class DestAccessor>
void
symmetricGradientMultiArray(triple<SrcIterator, SrcShape, SrcAccessor> const & source,
pair<DestIterator, DestAccessor> const & dest,
const ConvolutionOptions<N> & opt = ConvolutionOptions<N>());
}

Usage:

#include <vigra/multi_convolution.hxx> (sequential version)
#include <vigra/multi_blockwise.hxx> (parallel version)
Namespace: vigra

MultiArray<3, unsigned char>::size_type shape(width, height, depth);
MultiArray<3, unsigned char> source(shape);
MultiArray<3, TinyVector<float, 3> > dest(shape);
...
// compute gradient
symmetricGradientMultiArray(srcMultiArrayRange(source), destMultiArray(dest));

Usage with anisotropic data:

Shape3 shape(width, height, depth);
MultiArray<3, unsigned char> source(shape);
MultiArray<3, TinyVector<float, 3> > dest(shape);
TinyVector<float, 3> step_size;
...
// compute gradient
symmetricGradientMultiArray(source, dest,
ConvolutionOptions<3>().stepSize(step_size));

See also
  convolveMultiArrayOneDimension()

## ◆ laplacianOfGaussianMultiArray()

template<... >

void laplacianOfGaussianMultiArray | ( |  | ... | ) |

Calculate Laplacian of a N-dimensional arrays using Gaussian derivative filters.

This function computes the Laplacian of the given N-dimensional array with a sequence of second-derivative-of-Gaussian filters at the given standard deviation `sigma`. Both source and destination arrays must have scalar value_type. This function is implemented by calls to separableConvolveMultiArray() with the appropriate kernels, followed by summation.

Anisotropic data should be provided with appropriate vigra::ConvolutionOptions to adjust the filter sizes for the resolution of each axis. Otherwise, the parameter `opt` is optional unless the parameter `sigma` is omitted.

If you pass vigra::BlockwiseConvolutionOptions instead, the algorithm will be executed in parallel on data blocks of a certain size. The block size can be customized via `BlockwiseConvolutionOptions::blockShape()`, but the defaults usually work reasonably. By default, the number of threads equals the capabilities of your hardware, but you can change this via `BlockwiseConvolutionOptions::numThreads()`.

Declarations:

pass arbitrary-dimensional array views:

namespace vigra {
// pass scale explicitly
template <unsigned int N, class T1, class S1,
class T2, class S2>
void
laplacianOfGaussianMultiArray(MultiArrayView<N, T1, S1> const & source,
MultiArrayView<N, T2, S2> dest,
double sigma,
ConvolutionOptions<N> opt = ConvolutionOptions<N>());
// pass scale(s) in option object
template <unsigned int N, class T1, class S1,
class T2, class S2>
void
laplacianOfGaussianMultiArray(MultiArrayView<N, T1, S1> const & source,
MultiArrayView<N, T2, S2> dest,
ConvolutionOptions<N> opt );
// likewise, but execute algorithm in parallel
template <unsigned int N, class T1, class S1,
class T2, class S2>
void
laplacianOfGaussianMultiArray(MultiArrayView<N, T1, S1> const & source,
MultiArrayView<N, T2, S2> dest,
BlockwiseConvolutionOptions<N> opt );
}
vigra::laplacianOfGaussianMultiArray
void laplacianOfGaussianMultiArray(...)
Calculate Laplacian of a N-dimensional arrays using Gaussian derivative filters.

show deprecated declarations

pass MultiIterators and Data Accessors :
namespace vigra {
template <class SrcIterator, class SrcShape, class SrcAccessor,
class DestIterator, class DestAccessor>
void
laplacianOfGaussianMultiArray(SrcIterator siter, SrcShape const & shape, SrcAccessor src,
DestIterator diter, DestAccessor dest,
double sigma,
const ConvolutionOptions<N> & opt = ConvolutionOptions<N>());
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
template <class SrcIterator, class SrcShape, class SrcAccessor,
class DestIterator, class DestAccessor>
void
laplacianOfGaussianMultiArray(triple<SrcIterator, SrcShape, SrcAccessor> const & source,
pair<DestIterator, DestAccessor> const & dest,
double sigma,
const ConvolutionOptions<N> & opt = ConvolutionOptions<N>());
}

Usage:

#include <vigra/multi_convolution.hxx> (sequential version)
#include <vigra/multi_blockwise.hxx> (parallel version)
Namespace: vigra

Shape3 shape(width, height, depth);
MultiArray<3, float> source(shape);
MultiArray<3, float> laplacian(shape);
...
// compute Laplacian at scale sigma
laplacianOfGaussianMultiArray(source, laplacian, sigma);

Usage with anisotropic data:

MultiArray<3, float> source(shape);
MultiArray<3, float> laplacian(shape);
TinyVector<float, 3> step_size;
TinyVector<float, 3> resolution_sigmas;
...
// compute Laplacian at scale sigma
laplacianOfGaussianMultiArray(source, laplacian, sigma,
ConvolutionOptions<3>().stepSize(step_size).resolutionStdDev(resolution_sigmas));

See also
  separableConvolveMultiArray()

## ◆ gaussianDivergenceMultiArray()

template<... >

void gaussianDivergenceMultiArray | ( |  | ... | ) |

Calculate the divergence of a vector field using Gaussian derivative filters.

This function computes the divergence of the given N-dimensional vector field with a sequence of first-derivative-of-Gaussian filters at the given standard deviation `sigma`. The input vector field can either be given as a sequence of scalar array views (one for each vector field component), represented by an iterator range, or by a single vector array with the appropriate shape. This function is implemented by calls to separableConvolveMultiArray() with the suitable kernels, followed by summation.

Anisotropic data should be provided with appropriate vigra::ConvolutionOptions to adjust the filter sizes for the resolution of each axis. Otherwise, the parameter `opt` is optional unless the parameter `sigma` is omitted.

If you pass vigra::BlockwiseConvolutionOptions instead, the algorithm will be executed in parallel on data blocks of a certain size. The block size can be customized via `BlockwiseConvolutionOptions::blockShape()`, but the defaults usually work reasonably. By default, the number of threads equals the capabilities of your hardware, but you can change this via `BlockwiseConvolutionOptions::numThreads()`.

Declarations:

pass arbitrary-dimensional array views:

namespace vigra {
// specify input vector field as a sequence of scalar arrays
template <class Iterator,
unsigned int N, class T, class S>
void
gaussianDivergenceMultiArray(Iterator vectorField, Iterator vectorFieldEnd,
MultiArrayView<N, T, S> divergence,
ConvolutionOptions<N> const & opt);
template <class Iterator,
unsigned int N, class T, class S>
void
gaussianDivergenceMultiArray(Iterator vectorField, Iterator vectorFieldEnd,
MultiArrayView<N, T, S> divergence,
double sigma,
ConvolutionOptions<N> opt = ConvolutionOptions<N>());
// pass input vector field as an array of vectors
template <unsigned int N, class T1, class S1,
class T2, class S2>
void
gaussianDivergenceMultiArray(MultiArrayView<N, TinyVector<T1, int(N)>, S1> const & vectorField,
MultiArrayView<N, T2, S2> divergence,
ConvolutionOptions<N> const & opt);
template <unsigned int N, class T1, class S1,
class T2, class S2>
void
gaussianDivergenceMultiArray(MultiArrayView<N, TinyVector<T1, int(N)>, S1> const & vectorField,
MultiArrayView<N, T2, S2> divergence,
double sigma,
ConvolutionOptions<N> opt = ConvolutionOptions<N>());
// pass input vector field as an array of vectors and
// execute algorithm in parallel
template <unsigned int N, class T1, class S1,
class T2, class S2>
void
gaussianDivergenceMultiArray(MultiArrayView<N, TinyVector<T1, int(N)>, S1> const & vectorField,
MultiArrayView<N, T2, S2> divergence,
BlockwiseConvolutionOptions<N> const & opt);
}
vigra::gaussianDivergenceMultiArray
void gaussianDivergenceMultiArray(...)
Calculate the divergence of a vector field using Gaussian derivative filters.

Usage:

#include <vigra/multi_convolution.hxx> (sequential version)
#include <vigra/multi_blockwise.hxx> (parallel version)
Namespace: vigra

Shape3 shape(width, height, depth);
MultiArray<3, TinyVector<float, 3> > source(shape);
MultiArray<3, float> laplacian(shape);
...
// compute divergence at scale sigma
gaussianDivergenceMultiArray(source, laplacian, sigma);

Usage with anisotropic data:

MultiArray<3, TinyVector<float, 3> > source(shape);
MultiArray<3, float> laplacian(shape);
TinyVector<float, 3> step_size;
TinyVector<float, 3> resolution_sigmas;
...
// compute divergence at scale sigma
gaussianDivergenceMultiArray(source, laplacian, sigma,
ConvolutionOptions<3>().stepSize(step_size).resolutionStdDev(resolution_sigmas));

## ◆ hessianOfGaussianMultiArray()

template<... >

void hessianOfGaussianMultiArray | ( |  | ... | ) |

Calculate Hessian matrix of a N-dimensional arrays using Gaussian derivative filters.

This function computes the Hessian matrix the given scalar N-dimensional array with a sequence of second-derivative-of-Gaussian filters at the given standard deviation `sigma`. The destination array must have a vector valued element type with N*(N+1)/2 elements (it represents the upper triangular part of the symmetric Hessian matrix, flattened row-wise). This function is implemented by calls to separableConvolveMultiArray() with the appropriate kernels.

Anisotropic data should be provided with appropriate vigra::ConvolutionOptions to adjust the filter sizes for the resolution of each axis. Otherwise, the parameter `opt` is optional unless the parameter `sigma` is omitted.

If you pass vigra::BlockwiseConvolutionOptions instead, the algorithm will be executed in parallel on data blocks of a certain size. The block size can be customized via `BlockwiseConvolutionOptions::blockShape()`, but the defaults usually work reasonably. By default, the number of threads equals the capabilities of your hardware, but you can change this via `BlockwiseConvolutionOptions::numThreads()`.

Declarations:

pass arbitrary-dimensional array views:

namespace vigra {
// pass scale explicitly
template <unsigned int N, class T1, class S1,
class T2, class S2>
void
hessianOfGaussianMultiArray(MultiArrayView<N, T1, S1> const & source,
MultiArrayView<N, TinyVector<T2, int(N*(N+1)/2)>, S2> dest,
double sigma,
ConvolutionOptions<N> opt = ConvolutionOptions<N>());
// pass scale(s) in option object
template <unsigned int N, class T1, class S1,
class T2, class S2>
void
hessianOfGaussianMultiArray(MultiArrayView<N, T1, S1> const & source,
MultiArrayView<N, TinyVector<T2, int(N*(N+1)/2)>, S2> dest,
ConvolutionOptions<N> opt);
// likewise, but execute algorithm in parallel
template <unsigned int N, class T1, class S1,
class T2, class S2>
void
hessianOfGaussianMultiArray(MultiArrayView<N, T1, S1> const & source,
MultiArrayView<N, TinyVector<T2, int(N*(N+1)/2)>, S2> dest,
BlockwiseConvolutionOptions<N> opt);
}
vigra::hessianOfGaussianMultiArray
void hessianOfGaussianMultiArray(...)
Calculate Hessian matrix of a N-dimensional arrays using Gaussian derivative filters.

show deprecated declarations

pass MultiIterators and Data Accessors :
namespace vigra {
template <class SrcIterator, class SrcShape, class SrcAccessor,
class DestIterator, class DestAccessor>
void
hessianOfGaussianMultiArray(SrcIterator siter, SrcShape const & shape, SrcAccessor src,
DestIterator diter, DestAccessor dest,
double sigma,
const ConvolutionOptions<N> & opt = ConvolutionOptions<N>());
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
template <class SrcIterator, class SrcShape, class SrcAccessor,
class DestIterator, class DestAccessor>
void
hessianOfGaussianMultiArray(triple<SrcIterator, SrcShape, SrcAccessor> const & source,
pair<DestIterator, DestAccessor> const & dest,
double sigma,
const ConvolutionOptions<N> & opt = ConvolutionOptions<N>());
}

Usage:

#include <vigra/multi_convolution.hxx> (sequential version)
#include <vigra/multi_blockwise.hxx> (parallel version)
Namespace: vigra

Shape3 shape(width, height, depth);
MultiArray<3, float> source(shape);
MultiArray<3, TinyVector<float, 6> > dest(shape);
...
// compute Hessian at scale sigma
hessianOfGaussianMultiArray(source, dest, sigma);

Usage with anisotropic data:

MultiArray<3, float> source(shape);
MultiArray<3, TinyVector<float, 6> > dest(shape);
TinyVector<float, 3> step_size;
TinyVector<float, 3> resolution_sigmas;
...
// compute Hessian at scale sigma
hessianOfGaussianMultiArray(source, dest, sigma,
ConvolutionOptions<3>().stepSize(step_size).resolutionStdDev(resolution_sigmas));

See also
  separableConvolveMultiArray(), vectorToTensorMultiArray()

## ◆ structureTensorMultiArray()

template<... >

void structureTensorMultiArray | ( |  | ... | ) |

Calculate the structure tensor of a multi-dimensional arrays.

This function computes the gradient (outer product) tensor for each element of the given N-dimensional array with first-derivative-of-Gaussian filters at the given `innerScale`, followed by Gaussian smoothing at `outerScale`. The destination array must have a vector valued pixel type with N*(N+1)/2 elements (it represents the upper triangular part of the symmetric structure tensor matrix, flattened row-wise). If the source array is also vector valued, the resulting structure tensor is the sum of the individual tensors for each channel. This function is implemented by calls to separableConvolveMultiArray() with the appropriate kernels.

Anisotropic data should be provided with appropriate vigra::ConvolutionOptions to adjust the filter sizes for the resolution of each axis. Otherwise, the parameter `opt` is optional unless the parameters `innerScale` and `outerScale` are both omitted.

If you pass vigra::BlockwiseConvolutionOptions instead, the algorithm will be executed in parallel on data blocks of a certain size. The block size can be customized via `BlockwiseConvolutionOptions::blockShape()`, but the defaults usually work reasonably. By default, the number of threads equals the capabilities of your hardware, but you can change this via `BlockwiseConvolutionOptions::numThreads()`.

Declarations:

pass arbitrary-dimensional array views:

namespace vigra {
// pass scales explicitly
template <unsigned int N, class T1, class S1,
class T2, class S2>
void
structureTensorMultiArray(MultiArrayView<N, T1, S1> const & source,
MultiArrayView<N, TinyVector<T2, int(N*(N+1)/2)>, S2> dest,
double innerScale, double outerScale,
ConvolutionOptions<N> opt = ConvolutionOptions<N>());
// pass scales in option object
template <unsigned int N, class T1, class S1,
class T2, class S2>
void
structureTensorMultiArray(MultiArrayView<N, T1, S1> const & source,
MultiArrayView<N, TinyVector<T2, int(N*(N+1)/2)>, S2> dest,
ConvolutionOptions<N> opt );
// likewise, but execute algorithm in parallel
template <unsigned int N, class T1, class S1,
class T2, class S2>
void
structureTensorMultiArray(MultiArrayView<N, T1, S1> const & source,
MultiArrayView<N, TinyVector<T2, int(N*(N+1)/2)>, S2> dest,
BlockwiseConvolutionOptions<N> opt );
}
vigra::structureTensorMultiArray
void structureTensorMultiArray(...)
Calculate the structure tensor of a multi-dimensional arrays.

show deprecated declarations

pass MultiIterators and Data Accessors :
namespace vigra {
template <class SrcIterator, class SrcShape, class SrcAccessor,
class DestIterator, class DestAccessor>
void
structureTensorMultiArray(SrcIterator siter, SrcShape const & shape, SrcAccessor src,
DestIterator diter, DestAccessor dest,
double innerScale, double outerScale,
ConvolutionOptions<N> opt);
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
template <class SrcIterator, class SrcShape, class SrcAccessor,
class DestIterator, class DestAccessor>
void
structureTensorMultiArray(triple<SrcIterator, SrcShape, SrcAccessor> const & source,
pair<DestIterator, DestAccessor> const & dest,
double innerScale, double outerScale,
const ConvolutionOptions<N> & opt);
}

Usage:

#include <vigra/multi_convolution.hxx> (sequential version)
#include <vigra/multi_blockwise.hxx> (parallel version)
Namespace: vigra

Shape3 shape(width, height, depth);
MultiArray<3, RGBValue<float> > source(shape);
MultiArray<3, TinyVector<float, 6> > dest(shape);
...
// compute structure tensor at scales innerScale and outerScale
structureTensorMultiArray(source, dest, innerScale, outerScale);

Usage with anisotropic data:

MultiArray<3, RGBValue<float> > source(shape);
MultiArray<3, TinyVector<float, 6> > dest(shape);
TinyVector<float, 3> step_size;
TinyVector<float, 3> resolution_sigmas;
...
// compute structure tensor at scales innerScale and outerScale
structureTensorMultiArray(source, dest, innerScale, outerScale,
ConvolutionOptions<3>().stepSize(step_size).resolutionStdDev(resolution_sigmas));

See also
  separableConvolveMultiArray(), vectorToTensorMultiArray()

## ◆ separableMultiDistSquared()

template<... >

void separableMultiDistSquared | ( |  | ... | ) |

Euclidean distance squared on multi-dimensional arrays.

The algorithm is taken from Donald Bailey: "An Efficient Euclidean Distance Transform", Proc. IWCIA'04, Springer LNCS 3322, 2004.

Declarations:

pass arbitrary-dimensional array views:

namespace vigra {
// explicitly specify pixel pitch for each coordinate
template <unsigned int N, class T1, class S1,
class T2, class S2,
class Array>
void
separableMultiDistSquared(MultiArrayView<N, T1, S1> const & source,
MultiArrayView<N, T2, S2> dest,
bool background,
Array const & pixelPitch);
// use default pixel pitch = 1.0 for each coordinate
template <unsigned int N, class T1, class S1,
class T2, class S2>
void
separableMultiDistSquared(MultiArrayView<N, T1, S1> const & source,
MultiArrayView<N, T2, S2> dest,
bool background);
}
vigra::separableMultiDistSquared
void separableMultiDistSquared(...)
Euclidean distance squared on multi-dimensional arrays.

show deprecated declarations

pass MultiIterators and Data Accessors :
namespace vigra {
// explicitly specify pixel pitch for each coordinate
template <class SrcIterator, class SrcShape, class SrcAccessor,
class DestIterator, class DestAccessor, class Array>
void
separableMultiDistSquared( SrcIterator s, SrcShape const & shape, SrcAccessor src,
DestIterator d, DestAccessor dest,
bool background,
Array const & pixelPitch);
// use default pixel pitch = 1.0 for each coordinate
template <class SrcIterator, class SrcShape, class SrcAccessor,
class DestIterator, class DestAccessor>
void
separableMultiDistSquared(SrcIterator siter, SrcShape const & shape, SrcAccessor src,
DestIterator diter, DestAccessor dest,
bool background);
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
// explicitly specify pixel pitch for each coordinate
template <class SrcIterator, class SrcShape, class SrcAccessor,
class DestIterator, class DestAccessor, class Array>
void
separableMultiDistSquared( triple<SrcIterator, SrcShape, SrcAccessor> const & source,
pair<DestIterator, DestAccessor> const & dest,
bool background,
Array const & pixelPitch);
// use default pixel pitch = 1.0 for each coordinate
template <class SrcIterator, class SrcShape, class SrcAccessor,
class DestIterator, class DestAccessor>
void
separableMultiDistSquared(triple<SrcIterator, SrcShape, SrcAccessor> const & source,
pair<DestIterator, DestAccessor> const & dest,
bool background);
}

This function performs a squared Euclidean squared distance transform on the given multi-dimensional array. Both source and destination arrays are represented by iterators, shape objects and accessors. The destination array is required to already have the correct size.

This function expects a mask as its source, where background pixels are marked as zero, and non-background pixels as non-zero. If the parameter background is true, then the squared distance of all background pixels to the nearest object is calculated. Otherwise, the distance of all object pixels to the nearest background pixel is calculated.

Optionally, one can pass an array that specifies the pixel pitch in each direction. This is necessary when the data have non-uniform resolution (as is common in confocal microscopy, for example).

This function may work in-place, which means that `siter == diter` is allowed. A full-sized internal array is only allocated if working on the destination array directly would cause overflow errors (i.e. if `NumericTraits<typename DestAccessor::value_type>::max() < N * M*M`, where M is the size of the largest dimension of the array.

Usage:

#include <vigra/multi_distance.hxx>
Namespace: vigra

Shape3 shape(width, height, depth);
MultiArray<3, unsigned char> source(shape);
MultiArray<3, unsigned int> dest(shape);
...
// Calculate Euclidean distance squared for all background pixels
separableMultiDistSquared(source, dest, true);

See also
  vigra::distanceTransform(), vigra::separableMultiDistance()

## ◆ separableMultiDistance()

template<... >

void separableMultiDistance | ( |  | ... | ) |

Euclidean distance on multi-dimensional arrays.

Declarations:

pass arbitrary-dimensional array views:

namespace vigra {
// explicitly specify pixel pitch for each coordinate
template <unsigned int N, class T1, class S1,
class T2, class S2, class Array>
void
separableMultiDistance(MultiArrayView<N, T1, S1> const & source,
MultiArrayView<N, T2, S2> dest,
bool background,
Array const & pixelPitch);
// use default pixel pitch = 1.0 for each coordinate
template <unsigned int N, class T1, class S1,
class T2, class S2>
void
separableMultiDistance(MultiArrayView<N, T1, S1> const & source,
MultiArrayView<N, T2, S2> dest,
bool background);
}
vigra::separableMultiDistance
void separableMultiDistance(...)
Euclidean distance on multi-dimensional arrays.

show deprecated declarations

pass MultiIterators and Data Accessors :
namespace vigra {
// explicitly specify pixel pitch for each coordinate
template <class SrcIterator, class SrcShape, class SrcAccessor,
class DestIterator, class DestAccessor, class Array>
void
separableMultiDistance( SrcIterator s, SrcShape const & shape, SrcAccessor src,
DestIterator d, DestAccessor dest,
bool background,
Array const & pixelPitch);
// use default pixel pitch = 1.0 for each coordinate
template <class SrcIterator, class SrcShape, class SrcAccessor,
class DestIterator, class DestAccessor>
void
separableMultiDistance(SrcIterator siter, SrcShape const & shape, SrcAccessor src,
DestIterator diter, DestAccessor dest,
bool background);
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
// explicitly specify pixel pitch for each coordinate
template <class SrcIterator, class SrcShape, class SrcAccessor,
class DestIterator, class DestAccessor, class Array>
void
separableMultiDistance( triple<SrcIterator, SrcShape, SrcAccessor> const & source,
pair<DestIterator, DestAccessor> const & dest,
bool background,
Array const & pixelPitch);
// use default pixel pitch = 1.0 for each coordinate
template <class SrcIterator, class SrcShape, class SrcAccessor,
class DestIterator, class DestAccessor>
void
separableMultiDistance(triple<SrcIterator, SrcShape, SrcAccessor> const & source,
pair<DestIterator, DestAccessor> const & dest,
bool background);
}

This function performs a Euclidean distance transform on the given multi-dimensional array. It simply calls separableMultiDistSquared() and takes the pixel-wise square root of the result. See separableMultiDistSquared() for more documentation.

Usage:

#include <vigra/multi_distance.hxx>
Namespace: vigra

Shape3 shape(width, height, depth);
MultiArray<3, unsigned char> source(shape);
MultiArray<3, float> dest(shape);
...
// Calculate Euclidean distance for all background pixels
separableMultiDistance(source, dest, true);

See also
  vigra::distanceTransform(), vigra::separableMultiDistSquared()

## ◆ boundaryMultiDistance()

template<... >

void boundaryMultiDistance | ( |  | ... | ) |

Euclidean distance to the implicit boundaries of a multi-dimensional label array.

Declarations:

pass arbitrary-dimensional array views:

namespace vigra {
template <unsigned int N, class T1, class S1,
class T2, class S2>
void
boundaryMultiDistance(MultiArrayView<N, T1, S1> const & labels,
MultiArrayView<N, T2, S2> dest,
bool array_border_is_active=false,
BoundaryDistanceTag boundary=InterpixelBoundary);
}
vigra::BoundaryDistanceTag
BoundaryDistanceTag
Specify which boundary is used for boundaryMultiDistance().
Definition multi_distance.hxx:835
vigra::InterpixelBoundary
@ InterpixelBoundary
Half-integer points between pixels of different labels.
Definition multi_distance.hxx:837
vigra::boundaryMultiDistance
void boundaryMultiDistance(...)
Euclidean distance to the implicit boundaries of a multi-dimensional label array.

This function computes the distance transform of a labeled image simultaneously for all regions. Depending on the requested type of boundary, three modes are supported:

- `OuterBoundary`: In each region, compute the distance to the nearest pixel not belonging to that regions. This is the same as if a normal distance transform where applied to a binary image containing just this region.
- `InterpixelBoundary` (default): Like `OuterBoundary`, but shift the distance to the interpixel boundary by subtractiong 1/2. This make the distences consistent accross boundaries.
- `InnerBoundary`: In each region, compute the distance to the nearest pixel in the region which is adjacent to the boundary.

If `array_border_is_active=true`, the outer border of the array (i.e. the interpixel boundary between the array and the infinite region) is also used. Otherwise (the default), regions touching the array border are treated as if they extended to infinity.

Usage:

#include <vigra/multi_distance.hxx>
Namespace: vigra

Shape3 shape(width, height, depth);
MultiArray<3, unsigned char> source(shape);
MultiArray<3, UInt32> labels(shape);
MultiArray<3, float> dest(shape);
...
// find regions (interpixel boundaries are implied)
labelMultiArray(source, labels);
// Calculate Euclidean distance to interpixel boundary for all pixels
boundaryMultiDistance(labels, dest);

See also
  vigra::distanceTransform(), vigra::separableMultiDistance()

## ◆ fftwCorrespondingShapeR2C()

template<class T , int N>

TinyVector< T, N > fftwCorrespondingShapeR2C | ( | TinyVector< T, N > | shape | ) |

Find frequency domain shape for a R2C Fourier transform.

When a real valued array is transformed to the frequency domain, about half of the Fourier coefficients are redundant. The transform can be optimized as a R2C transform that doesn't compute and store the redundant coefficients. This function computes the appropriate frequency domain shape for a given shape in the spatial domain. It simply replaces `shape[0]` with `shape[0] / 2 + 1`.

#include <vigra/multi_fft.hxx>
Namespace: vigra

## ◆ convolveFFT()

template<... >

void convolveFFT | ( |  | ... | ) |

Convolve an array with a kernel by means of the Fourier transform.

Thanks to the convolution theorem of Fourier theory, a convolution in the spatial domain is equivalent to a multiplication in the frequency domain. Thus, for certain kernels (especially large, non-separable ones), it is advantageous to perform the convolution by first transforming both array and kernel to the frequency domain, multiplying the frequency representations, and transforming the result back into the spatial domain. Some kernels have a much simpler definition in the frequency domain, so that they are readily computed there directly, avoiding Fourier transformation of those kernels.

The following functions implement various variants of FFT-based convolution:

convolveFFT
  Convolve a real-valued input array with a kernel such that the result is also real-valued. That is, the kernel is either provided as a real-valued array in the spatial domain, or as a complex-valued array in the Fourier domain, using the half-space format of the R2C Fourier transform (see below).
convolveFFTMany
  Like `convolveFFT`, but you may provide many kernels at once (using an iterator pair specifying the kernel sequence). This has the advantage that the forward transform of the input array needs to be executed only once.
convolveFFTComplex
  Convolve a complex-valued input array with a complex-valued kernel, resulting in a complex-valued output array. An additional flag is used to specify whether the kernel is defined in the spatial or frequency domain.
convolveFFTComplexMany
  Like `convolveFFTComplex`, but you may provide many kernels at once (using an iterator pair specifying the kernel sequence). This has the advantage that the forward transform of the input array needs to be executed only once.

The output arrays must have the same shape as the input arrays. In the "Many" variants of the convolution functions, the kernels must all have the same shape.

The origin of the kernel is always assumed to be in the center of the kernel array (precisely, at the point `floor(kernel.shape() / 2.0)`, except when the half-space format is used, see below). The function moveDCToUpperLeft() will be called internally to align the kernel with the transformed input as appropriate.

If a real input is combined with a real kernel, the kernel is automatically assumed to be defined in the spatial domain. If a real input is combined with a complex kernel, the kernel is assumed to be defined in the Fourier domain in half-space format. If the input array is complex, a flag `fourierDomainKernel` determines where the kernel is defined.

When the kernel is defined in the spatial domain, the convolution functions will automatically pad (enlarge) the input array by at least the kernel radius in each direction. The newly added space is filled according to reflective boundary conditions in order to minimize border artifacts during convolution. It is thus ensured that convolution in the Fourier domain yields the same results as convolution in the spatial domain (e.g. when separableConvolveMultiArray() is called with the same kernel). A little further padding may be added to make sure that the padded array shape uses integers which have only small prime factors, because FFTW is then able to use the fastest possible algorithms. Any padding is automatically removed from the result arrays before the function returns.

When the kernel is defined in the frequency domain, it must be complex-valued, and its shape determines the shape of the Fourier representation (i.e. the input is padded according to the shape of the kernel). If we are going to perform a complex-valued convolution, the kernel must be defined for the entire frequency domain, and its shape directly determines the size of the FFT.

In contrast, a frequency domain kernel for a real-valued convolution must have symmetry properties that allow to drop half of the kernel coefficients, as in the R2C transform. That is, the kernel must have the half-space format, that is the shape returned by `fftwCorrespondingShapeR2C(fourier_shape)`, where `fourier_shape` is the desired logical shape of the frequency representation (and thus the size of the padded input). The origin of the kernel must be at the point `(0, floor(fourier_shape[0] / 2.0), ..., floor(fourier_shape[N-1] / 2.0))` (i.e. as in a regular kernel except for the first dimension).

The `Real` type in the declarations can be `double`, `float`, and `long double`. Your program must always link against `libfftw3`. If you use `float` or `long double` arrays, you must additionally link against `libfftw3f` and `libfftw3l` respectively.

The Fourier transform functions internally create FFTW plans which control the algorithm details. The plans are created with the flag `FFTW_ESTIMATE`, i.e. optimal settings are guessed or read from saved "wisdom" files. If you need more control over planning, you can use the class FFTWConvolvePlan.

See also applyFourierFilter() for corresponding functionality on the basis of the old image iterator interface.

Declarations:

Real-valued convolution with kernel in the spatial domain:

namespace vigra {
template <unsigned int N, class Real, class C1, class C2, class C3>
void
convolveFFT(MultiArrayView<N, Real, C1> in,
MultiArrayView<N, Real, C2> kernel,
MultiArrayView<N, Real, C3> out);
}
vigra::convolveFFT
void convolveFFT(...)
Convolve an array with a kernel by means of the Fourier transform.

Real-valued convolution with kernel in the Fourier domain (half-space format):

namespace vigra {
template <unsigned int N, class Real, class C1, class C2, class C3>
void
convolveFFT(MultiArrayView<N, Real, C1> in,
MultiArrayView<N, FFTWComplex<Real>, C2> kernel,
MultiArrayView<N, Real, C3> out);
}

Series of real-valued convolutions with kernels in the spatial or Fourier domain (the kernel and out sequences must have the same length):

namespace vigra {
template <unsigned int N, class Real, class C1,
class KernelIterator, class OutIterator>
void
convolveFFTMany(MultiArrayView<N, Real, C1> in,
KernelIterator kernels, KernelIterator kernelsEnd,
OutIterator outs);
}
vigra::convolveFFTMany
void convolveFFTMany(...)
Convolve a real-valued array with a sequence of kernels by means of the Fourier transform.

Complex-valued convolution (parameter `fourierDomainKernel` determines if the kernel is defined in the spatial or Fourier domain):

namespace vigra {
template <unsigned int N, class Real, class C1, class C2, class C3>
void
convolveFFTComplex(MultiArrayView<N, FFTWComplex<Real>, C1> in,
MultiArrayView<N, FFTWComplex<Real>, C2> kernel,
MultiArrayView<N, FFTWComplex<Real>, C3> out,
bool fourierDomainKernel);
}
vigra::convolveFFTComplex
void convolveFFTComplex(...)
Convolve a complex-valued array by means of the Fourier transform.

Series of complex-valued convolutions (parameter `fourierDomainKernel` determines if the kernels are defined in the spatial or Fourier domain, the kernel and out sequences must have the same length):

namespace vigra {
template <unsigned int N, class Real, class C1,
class KernelIterator, class OutIterator>
void
convolveFFTComplexMany(MultiArrayView<N, FFTWComplex<Real>, C1> in,
KernelIterator kernels, KernelIterator kernelsEnd,
OutIterator outs,
bool fourierDomainKernel);
}
vigra::convolveFFTComplexMany
void convolveFFTComplexMany(...)
Convolve a complex-valued array with a sequence of kernels by means of the Fourier transform.

Usage:

#include <vigra/multi_fft.hxx>
Namespace: vigra

// convolve real array with a Gaussian (sigma=1) defined in the spatial domain
// (implicitly uses padding by at least 4 pixels)
MultiArray<2, double> src(Shape2(w, h)), dest(Shape2(w,h));
MultiArray<2, double> spatial_kernel(Shape2(9, 9));
Gaussian<double> gauss(1.0);
for(int y=0; y<9; ++y)
for(int x=0; x<9; ++x)
spatial_kernel(x, y) = gauss(x-4.0)*gauss(y-4.0);
convolveFFT(src, spatial_kernel, dest);
// convolve real array with a Gaussian (sigma=1) defined in the Fourier domain
// (uses no padding, because the kernel size corresponds to the input size)
MultiArray<2, FFTWComplex<double> > fourier_kernel(fftwCorrespondingShapeR2C(src.shape()));
int y0 = h / 2;
for(int y=0; y<fourier_kernel.shape(1); ++y)
for(int x=0; x<fourier_kernel.shape(0); ++x)
fourier_kernel(x, y) = exp(-0.5*sq(x / double(w))) * exp(-0.5*sq((y-y0)/double(h)));
convolveFFT(src, fourier_kernel, dest);

## ◆ convolveFFTComplex()

template<... >

void convolveFFTComplex | ( |  | ... | ) |

Convolve a complex-valued array by means of the Fourier transform.

See convolveFFT() for details.

## ◆ convolveFFTMany()

template<... >

void convolveFFTMany | ( |  | ... | ) |

Convolve a real-valued array with a sequence of kernels by means of the Fourier transform.

See convolveFFT() for details.

## ◆ convolveFFTComplexMany()

template<... >

void convolveFFTComplexMany | ( |  | ... | ) |

Convolve a complex-valued array with a sequence of kernels by means of the Fourier transform.

See convolveFFT() for details.

## ◆ correlateFFT()

template<... >

void correlateFFT | ( |  | ... | ) |

Correlate an array with a kernel by means of the Fourier transform.

This function correlates a real-valued input array with a real-valued kernel such that the result is also real-valued. Thanks to the correlation theorem of Fourier theory, a correlation in the spatial domain is equivalent to a multiplication with the complex conjugate in the frequency domain. Thus, for certain kernels (especially large, non-separable ones), it is advantageous to perform the correlation by first transforming both array and kernel to the frequency domain, multiplying the frequency representations, and transforming the result back into the spatial domain.

The output arrays must have the same shape as the input arrays.

See also convolveFFT() for corresponding functionality.

Declarations:

namespace vigra {
template <unsigned int N, class Real, class C1, class C2, class C3>
void
correlateFFT(MultiArrayView<N, Real, C1> in,
MultiArrayView<N, Real, C2> kernel,
MultiArrayView<N, Real, C3> out);
}
vigra::correlateFFT
void correlateFFT(...)
Correlate an array with a kernel by means of the Fourier transform.

Usage:

#include <vigra/multi_fft.hxx>
Namespace: vigra

// correlate real array with a template to find best matches
// (implicitly uses padding by at least 4 pixels)
MultiArray<2, double> src(Shape2(w, h)), dest(Shape2(w, h));
MultiArray<2, double> template(Shape2(9, 9));
template = ...;
correlateFFT(src, template, dest);

## ◆ get() [1/2]

template<unsigned int TARGET_INDEX, class Handle >

CoupledHandleCast< TARGET_INDEX, Handle >::reference get | ( | Handle & | handle | ) |

Returns reference to the element in the band of the handle with index TARGET_INDEX.

## ◆ get() [2/2]

template<unsigned int TARGET_INDEX, class Handle >

CoupledHandleCast< TARGET_INDEX, Handle >::const_reference get | ( | Handle const & | handle | ) |

Returns a constant reference to the element in the band of the handle with index TARGET_INDEX.

## ◆ createHierarchicalIterator() [1/6]

template<int N>

HierarchicalIteratorType< N >::type createHierarchicalIterator | ( | TinyVector< MultiArrayIndex, N > const & | shape | ) |

Returns a HierarchicalIterator from shape to iterate over coordinates.

## ◆ createHierarchicalIterator() [2/6]

template<unsigned int N1, class T1 , class S1 >

HierarchicalIteratorType< N1, T1 >::type createHierarchicalIterator | ( | MultiArrayView< N1, T1, S1 > const & | m1 | ) |

Returns a HierarchicalIterator to simultaneously iterate over image m1 and its coordinates.

## ◆ createHierarchicalIterator() [3/6]

template<unsigned int N1, class T1 , class S1 , unsigned int N2, class T2 , class S2 >

HierarchicalIteratorType< N1, T1, T2 >::type createHierarchicalIterator | ( | MultiArrayView< N1, T1, S1 > const & | m1,
|  | MultiArrayView< N2, T2, S2 > const & | m2
| ) |  |

Returns a HierarchicalIterator to simultaneously iterate over images m1, m2 and their coordinates.

## ◆ createHierarchicalIterator() [4/6]

template<unsigned int N1, class T1 , class S1 , unsigned int N2, class T2 , class S2 , unsigned int N3, class T3 , class S3 >

HierarchicalIteratorType< N1, T1, T2, T3 >::type createHierarchicalIterator | ( | MultiArrayView< N1, T1, S1 > const & | m1,
|  | MultiArrayView< N2, T2, S2 > const & | m2,
|  | MultiArrayView< N3, T3, S3 > const & | m3
| ) |  |

Returns a HierarchicalIterator to simultaneously iterate over images m1, m2, m3 and their coordinates.

## ◆ createHierarchicalIterator() [5/6]

template<unsigned int N1, class T1 , class S1 , unsigned int N2, class T2 , class S2 , unsigned int N3, class T3 , class S3 , unsigned int N4, class T4 , class S4 >

HierarchicalIteratorType< N1, T1, T2, T3, T4 >::type createHierarchicalIterator | ( | MultiArrayView< N1, T1, S1 > const & | m1,
|  | MultiArrayView< N2, T2, S2 > const & | m2,
|  | MultiArrayView< N3, T3, S3 > const & | m3,
|  | MultiArrayView< N4, T4, S4 > const & | m4
| ) |  |

Returns a HierarchicalIterator to simultaneously iterate over images m1, m2, m3, m4 and their coordinates.

## ◆ createHierarchicalIterator() [6/6]

template<unsigned int N1, class T1 , class S1 , unsigned int N2, class T2 , class S2 , unsigned int N3, class T3 , class S3 , unsigned int N4, class T4 , class S4 , unsigned int N5, class T5 , class S5 >

HierarchicalIteratorType< N1, T1, T2, T3, T4, T5 >::type createHierarchicalIterator | ( | MultiArrayView< N1, T1, S1 > const & | m1,
|  | MultiArrayView< N2, T2, S2 > const & | m2,
|  | MultiArrayView< N3, T3, S3 > const & | m3,
|  | MultiArrayView< N4, T4, S4 > const & | m4,
|  | MultiArrayView< N5, T5, S5 > const & | m5
| ) |  |

Returns a HierarchicalIterator to simultaneously iterate over images m1, m2, m3, m4, m5 and their coordinates.

## ◆ importVolume()

template<... >

void importVolume | ( |  | ... | ) |

Function for importing a 3D volume.

Declarations:

namespace vigra {
// variant 1: read data specified by the given VolumeImportInfo object
template <class T, class Stride>
void
importVolume(VolumeImportInfo const & info,
MultiArrayView <3, T, Stride> &volume);
// variant 2: read data using a single filename, resize volume automatically
template <class T, class Allocator>
void
importVolume(MultiArray <3, T, Allocator> & volume,
const std::string &filename);
// variant 3: read data from an image stack, resize volume automatically
template <class T, class Allocator>
void
importVolume(MultiArray <3, T, Allocator> & volume,
const std::string &name_base,
const std::string &name_ext);
}
vigra::VolumeImportInfo
Argument object for the function importVolume().
Definition multi_impex.hxx:77
vigra::importVolume
void importVolume(...)
Function for importing a 3D volume.

Data can be read either from a single file containing 3D data (supported formats: Andor .SIF or multi-page TIFF), a ".info" text file which describes the contents of an accompanying raw data file, or a stack of 2D images (numbered according to the scheme `name_base+"[0-9]+"+name_extension`) each representing a slice of the volume. The decision which of these possibilities applies is taken in the VolumeImportInfo constructor, see there for full details.

Variant 1 is the basic version of this function. Here, the info object and a destination array of approriate size must already be constructed. The other variants are just abbreviations provided for your convenience:

// variant 2 is equivalent to
VolumeImportInfo info(filename);
volume.reshape(info.shape());
importVolume(info, volume); // call variant 1
// variant 3 is equivalent to
VolumeImportInfo info(name_base, name_ext);
volume.reshape(info.shape());
importVolume(info, volume); // call variant 1

Usage:

#include <vigra/multi_impex.hxx>
Namespace: vigra

// read data from a multi-page TIFF file, using variant 1
VolumeImportInfo info("multipage.tif");
MultiArray<3, float> volume(info.shape());
importVolume(info, volume);
// read data from a stack of 2D png-images, using variant 1
VolumeImportInfo info("my_data", ".png"); // looks for files 'my_data0.png', 'my_data1.png' etc.
MultiArray<3, float> volume(info.shape());
importVolume(info, volume);

Notice that slice numbers in a stack need not be consecutive (i.e. gaps are allowed) and will be interpreted according to their numerical order (i.e. "009", "010", "011" are read in the same order as "9", "10", "11"). The number of images found determines the depth of the volume.

## ◆ exportVolume()

template<... >

void exportVolume | ( |  | ... | ) |

Function for exporting a 3D volume.

Declarations:

namespace vigra {
// variant 1: writa data as specified in the given VolumeExportInfo object
template <class T, class Tag>
void
exportVolume (MultiArrayView <3, T, Tag> const & volume,
const VolumeExportInfo & info);
// variant 2: write data to a multi-page TIFF file
template <class T, class Tag>
void
exportVolume (MultiArrayView <3, T, Tag> const & volume,
const std::string &filename);
// variant 3: write data to an image stack
template <class T, class Tag>
void
exportVolume (MultiArrayView <3, T, Tag> const & volume,
const std::string &name_base,
const std::string &name_ext);
}
vigra::VolumeExportInfo
Argument object for the function exportVolume().
Definition multi_impex.hxx:258
vigra::exportVolume
void exportVolume(...)
Function for exporting a 3D volume.

The volume can either be exported as a multi-page TIFF file (variant 2, only available if libtiff is installed), or as a stack of 2D images, one image per slice (variant 3, files are named according to the scheme `name_base+"000"+name_ext`, `name_base+"001"+name_ext` etc.). If the target image format does not support the source `value_type`, all slices will be mapped to the appropriate target range in the same way.

Variant 1 is the basic version of the function. It allows full control over the export via an already constructed vigra::VolumeExportInfo object. The other two are just abbreviations that construct the VolumeExportInfo object internally.

Usage:

#include <vigra/multi_impex.hxx>
Namespace: vigra

MultiArray<3, RGBValue<UInt8> > volume(shape);
... // fill in data
// export a stack named "my_data01.jpg", "my_data02.jpg" etc.
VolumeExportInfo info("my_data", ".jpg");
info.setCompression("JPEG QUALITY=95");
exportVolume(volume, info);

## ◆ createCoupledIterator() [2/7]

template<int N>

CoupledIteratorType< N >::type createCoupledIterator | ( | TinyVector< MultiArrayIndex, N > const & | shape | ) |

Returns a CoupledScanOrderIterator from shape to iterate over coordinates.

## ◆ createCoupledIterator() [3/7]

template<unsigned int N1, class T1 , class S1 >

CoupledIteratorType< N1, T1 >::type createCoupledIterator | ( | MultiArrayView< N1, T1, S1 > const & | m1 | ) |

Returns a CoupledScanOrderIterator to simultaneously iterate over image m1 and its coordinates.

## ◆ createCoupledIterator() [4/7]

template<unsigned int N1, class T1 , class S1 , unsigned int N2, class T2 , class S2 >

CoupledIteratorType< N1, T1, T2 >::type createCoupledIterator | ( | MultiArrayView< N1, T1, S1 > const & | m1,
|  | MultiArrayView< N2, T2, S2 > const & | m2
| ) |  |

Returns a CoupledScanOrderIterator to simultaneously iterate over images m1, m2 and their coordinates.

## ◆ createCoupledIterator() [5/7]

template<unsigned int N1, class T1 , class S1 , unsigned int N2, class T2 , class S2 , unsigned int N3, class T3 , class S3 >

CoupledIteratorType< N1, T1, T2, T3 >::type createCoupledIterator | ( | MultiArrayView< N1, T1, S1 > const & | m1,
|  | MultiArrayView< N2, T2, S2 > const & | m2,
|  | MultiArrayView< N3, T3, S3 > const & | m3
| ) |  |

Returns a CoupledScanOrderIterator to simultaneously iterate over images m1, m2, m3 and their coordinates.

## ◆ createCoupledIterator() [6/7]

template<unsigned int N1, class T1 , class S1 , unsigned int N2, class T2 , class S2 , unsigned int N3, class T3 , class S3 , unsigned int N4, class T4 , class S4 >

CoupledIteratorType< N1, T1, T2, T3, T4 >::type createCoupledIterator | ( | MultiArrayView< N1, T1, S1 > const & | m1,
|  | MultiArrayView< N2, T2, S2 > const & | m2,
|  | MultiArrayView< N3, T3, S3 > const & | m3,
|  | MultiArrayView< N4, T4, S4 > const & | m4
| ) |  |

Returns a CoupledScanOrderIterator to simultaneously iterate over images m1, m2, m3, m4 and their coordinates.

## ◆ createCoupledIterator() [7/7]

template<unsigned int N1, class T1 , class S1 , unsigned int N2, class T2 , class S2 , unsigned int N3, class T3 , class S3 , unsigned int N4, class T4 , class S4 , unsigned int N5, class T5 , class S5 >

CoupledIteratorType< N1, T1, T2, T3, T4, T5 >::type createCoupledIterator | ( | MultiArrayView< N1, T1, S1 > const & | m1,
|  | MultiArrayView< N2, T2, S2 > const & | m2,
|  | MultiArrayView< N3, T3, S3 > const & | m3,
|  | MultiArrayView< N4, T4, S4 > const & | m4,
|  | MultiArrayView< N5, T5, S5 > const & | m5
| ) |  |

Returns a CoupledScanOrderIterator to simultaneously iterate over images m1, m2, m3, m4, m5 and their coordinates.

## ◆ labelMultiArray()

template<... >

unsigned int labelMultiArray | ( |  | ... | ) |

Find the connected components of a MultiArray with arbitrary many dimensions.

See also labelMultiArrayBlockwise() for a parallel version of this algorithm.

By specifying a background value in the vigra::LabelOptions, this function can also realize the behavior of labelMultiArrayWithBackground().

Declaration:

namespace vigra {
// specify parameters directly
template <unsigned int N, class T, class S1,
class Label, class S2,
class EqualityFunctor = std::equal_to<T> >
Label
labelMultiArray(MultiArrayView<N, T, S1> const & data,
MultiArrayView<N, Label, S2> labels,
NeighborhoodType neighborhood = DirectNeighborhood,
EqualityFunctor equal = std::equal_to<T>())
// specify parameters via LabelOptions
template <unsigned int N, class T, class S1,
class Label, class S2,
class Equal = std::equal<T> >
Label
labelMultiArray(MultiArrayView<N, T, S1> const & data,
MultiArrayView<N, Label, S2> labels,
LabelOptions const & options,
Equal equal = std::equal<T>());
}
vigra::labelMultiArray
unsigned int labelMultiArray(...)
Find the connected components of a MultiArray with arbitrary many dimensions.
vigra::NeighborhoodType
NeighborhoodType
Choose the neighborhood system in a dimension-independent way.
Definition multi_fwd.hxx:186

Connected components are defined as regions with uniform values. Thus, the value type `T` of the input array data either must be equality comparable, or an EqualityFunctor must be provided that realizes the desired predicate. The destination array's value type `Label` should be large enough to hold the labels without overflow. Region numbers will form a consecutive sequence starting at one and ending with the region number returned by the function (inclusive).

Argument neighborhood specifies the type of connectivity used. It can take the values `DirectNeighborhood` (which corresponds to 4-neighborhood in 2D and 6-neighborhood in 3D, default) or `IndirectNeighborhood` (which corresponds to 8-neighborhood in 2D and 26-neighborhood in 3D).

Return: the highest region label used

Usage:

#include <vigra/multi_labeling.hxx>
Namespace: vigra

MultiArray<3,int> src(Shape3(w,h,d));
MultiArray<3,int> dest(Shape3(w,h,d));
// find 6-connected regions
int max_region_label = labelMultiArray(src, dest);
// find 26-connected regions
max_region_label = labelMultiArray(src, dest, IndirectNeighborhood);
// find 6-connected regions, ignore the background value 0
// (i.e. call labelMultiArrayWithBackground() internally)
max_region_label = labelMultiArray(src, dest,
LabelOptions().neighborhood(DirectNeighborhood)
.ignoreBackgroundValue(0));

Required Interface:

T t;
t == t // T is equality comparable
EqualityFunctor equal; // or a suitable functor is supplied
equal(t, t)

## ◆ labelMultiArrayWithBackground()

template<... >

unsigned int labelMultiArrayWithBackground | ( |  | ... | ) |

Find the connected components of a MultiArray with arbitrary many dimensions, excluding the background from labeling.

From a user's point of view, this function is no longer needed because labelMultiArray() can realizes the same behavior when an appropriate background value is specified in its vigra::LabelOptions. Similarly, labelMultiArrayBlockwise() implements a parallel version of this algorithm.

Declaration:

namespace vigra {
template <unsigned int N, class T, class S1,
class Label, class S2
class Equal = std::equal<T> >
Label
labelMultiArrayWithBackground(MultiArrayView<N, T, S1> const & data,
MultiArrayView<N, Label, S2> labels,
NeighborhoodType neighborhood = DirectNeighborhood,
T backgroundValue = T(),
Equal equal = std::equal<T>());
}
vigra::labelMultiArrayWithBackground
unsigned int labelMultiArrayWithBackground(...)
Find the connected components of a MultiArray with arbitrary many dimensions, excluding the backgroun...

This function is the same as labelMultiArray(), except for the additional parameter backgroundValue. Points in the input array data with this value (which default to zero) are ignored during labeling, and their output label is automatically set to zero. Region numbers will be a consecutive sequence starting at zero (when background was present) or at one (when no background was present) and ending with the region number returned by the function (inclusive).

Return: the number of non-background regions found (= highest region label, because background has label 0)

Usage:

#include <vigra/multi_labeling.hxx>
Namespace: vigra

MultiArray<3, int> src(Shape3(w,h,d));
MultiArray<3, int> dest(Shape3(w,h,d));
// find 6-connected regions, ignoring background value zero (the default)
int max_region_label = labelMultiArrayWithBackground(src, dest);
// find 26-connected regions, using -1 as the background value
max_region_label = labelMultiArrayWithBackground(src, dest, IndirectNeighborhood, -1);

Required Interface:

T t, backgroundValue;
t == backgroundValue // T is equality comparable
EqualityFunctor equal; // or a suitable functor is supplied
equal(t, backgroundValue)

## ◆ multiBinaryErosion()

template<... >

void multiBinaryErosion | ( |  | ... | ) |

Binary erosion on multi-dimensional arrays.

This function applies a flat circular erosion operator with a given radius. The operation is isotropic. The input is interpreted as a binary multi-dimensional array where non-zero pixels represent foreground and zero pixels represent background. In the output, foreground is always represented by ones (i.e. NumericTrais<typename DestAccessor::value_type>::one()).

This function may work in-place, which means that `siter == diter` is allowed. A temporary internal array is only allocated if working on the destination array directly would cause overflow errors (that is if `NumericTraits<typename DestAccessor::value_type>::max() < squaredNorm(shape)`, i.e. the squared length of the image diagonal doesn't fit into the destination type).

Declarations:

pass arbitrary-dimensional array views:

namespace vigra {
template <unsigned int N, class T1, class S1,
class T2, class S2>
void
multiBinaryErosion(MultiArrayView<N, T1, S1> const & source,
MultiArrayView<N, T2, S2> dest,
double radius);
}
vigra::multiBinaryErosion
void multiBinaryErosion(...)
Binary erosion on multi-dimensional arrays.

show deprecated declarations

pass MultiIterators and Data Accessors :
namespace vigra {
template <class SrcIterator, class SrcShape, class SrcAccessor,
class DestIterator, class DestAccessor>
void
multiBinaryErosion(SrcIterator siter, SrcShape const & shape, SrcAccessor src,
DestIterator diter, DestAccessor dest, int radius);
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
template <class SrcIterator, class SrcShape, class SrcAccessor,
class DestIterator, class DestAccessor>
void
multiBinaryErosion(triple<SrcIterator, SrcShape, SrcAccessor> const & source,
pair<DestIterator, DestAccessor> const & dest,
int radius);
}

Usage:

#include <vigra/multi_morphology.hxx>
Namespace: vigra

Shape3 shape(width, height, depth);
MultiArray<3, unsigned char> source(shape);
MultiArray<3, unsigned char> dest(shape);
...
// perform isotropic binary erosion
multiBinaryErosion(source, dest, 3);

See also
  vigra::discErosion(), vigra::multiGrayscaleErosion()

## ◆ multiBinaryDilation()

template<... >

void multiBinaryDilation | ( |  | ... | ) |

Binary dilation on multi-dimensional arrays.

This function applies a flat circular dilation operator with a given radius. The operation is isotropic. The input is interpreted as a binary multi-dimensional array where non-zero pixels represent foreground and zero pixels represent background. In the output, foreground is always represented by ones (i.e. NumericTrais<typename DestAccessor::value_type>::one()).

This function may work in-place, which means that `siter == diter` is allowed. A temporary internal array is only allocated if working on the destination array directly would cause overflow errors (that is if `NumericTraits<typename DestAccessor::value_type>::max() < squaredNorm(shape)`, i.e. the squared length of the image diagonal doesn't fit into the destination type).

Declarations:

pass arbitrary-dimensional array views:

namespace vigra {
template <unsigned int N, class T1, class S1,
class T2, class S2>
void
multiBinaryDilation(MultiArrayView<N, T1, S1> const & source,
MultiArrayView<N, T2, S2> dest,
double radius);
}
vigra::multiBinaryDilation
void multiBinaryDilation(...)
Binary dilation on multi-dimensional arrays.

show deprecated declarations

pass MultiIterators and Data Accessors :
namespace vigra {
template <class SrcIterator, class SrcShape, class SrcAccessor,
class DestIterator, class DestAccessor>
void
multiBinaryDilation(SrcIterator siter, SrcShape const & shape, SrcAccessor src,
DestIterator diter, DestAccessor dest, int radius);
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
template <class SrcIterator, class SrcShape, class SrcAccessor,
class DestIterator, class DestAccessor>
void
multiBinaryDilation(triple<SrcIterator, SrcShape, SrcAccessor> const & source,
pair<DestIterator, DestAccessor> const & dest,
int radius);
}

Usage:

#include <vigra/multi_morphology.hxx>
Namespace: vigra

Shape3 shape(width, height, depth);
MultiArray<3, unsigned char> source(shape);
MultiArray<3, unsigned char> dest(shape);
...
// perform isotropic binary erosion
multiBinaryDilation(source, dest, 3);

See also
  vigra::discDilation(), vigra::multiGrayscaleDilation()

## ◆ multiGrayscaleErosion()

template<... >

void multiGrayscaleErosion | ( |  | ... | ) |

Parabolic grayscale erosion on multi-dimensional arrays.

This function applies a parabolic erosion operator with a given spread (sigma) on a grayscale array. The operation is isotropic. The input is a grayscale multi-dimensional array.

This function may work in-place, which means that `siter == diter` is allowed. A full-sized internal array is only allocated if working on the destination array directly would cause overflow errors (i.e. if `typeid(typename DestAccessor::value_type) < N * M*M`, where M is the size of the largest dimension of the array.

Declarations:

pass arbitrary-dimensional array views:

namespace vigra {
template <unsigned int N, class T1, class S1,
class T2, class S2>
void
multiGrayscaleErosion(MultiArrayView<N, T1, S1> const & source,
MultiArrayView<N, T2, S2> dest,
double sigma);
}
vigra::multiGrayscaleErosion
void multiGrayscaleErosion(...)
Parabolic grayscale erosion on multi-dimensional arrays.

show deprecated declarations

pass MultiIterators and Data Accessors :
namespace vigra {
template <class SrcIterator, class SrcShape, class SrcAccessor,
class DestIterator, class DestAccessor>
void
multiGrayscaleErosion(SrcIterator siter, SrcShape const & shape, SrcAccessor src,
DestIterator diter, DestAccessor dest, double sigma);
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
template <class SrcIterator, class SrcShape, class SrcAccessor,
class DestIterator, class DestAccessor>
void
multiGrayscaleErosion(triple<SrcIterator, SrcShape, SrcAccessor> const & source,
pair<DestIterator, DestAccessor> const & dest,
double sigma);
}

Usage:

#include <vigra/multi_morphology.hxx>
Namespace: vigra

Shape3 shape(width, height, depth);
MultiArray<3, unsigned char> source(shape);
MultiArray<3, unsigned char> dest(shape);
...
// perform isotropic grayscale erosion
multiGrayscaleErosion(source, dest, 3.0);

See also
  vigra::discErosion(), vigra::multiBinaryErosion()

## ◆ multiGrayscaleDilation()

template<... >

void multiGrayscaleDilation | ( |  | ... | ) |

Parabolic grayscale dilation on multi-dimensional arrays.

This function applies a parabolic dilation operator with a given spread (sigma) on a grayscale array. The operation is isotropic. The input is a grayscale multi-dimensional array.

This function may work in-place, which means that `siter == diter` is allowed. A full-sized internal array is only allocated if working on the destination array directly would cause overflow errors (i.e. if `typeid(typename DestAccessor::value_type) < N * M*M`, where M is the size of the largest dimension of the array.

Declarations:

pass arbitrary-dimensional array views:

namespace vigra {
template <unsigned int N, class T1, class S1,
class T2, class S2>
void
multiGrayscaleDilation(MultiArrayView<N, T1, S1> const & source,
MultiArrayView<N, T2, S2> dest,
double sigma);
}
vigra::multiGrayscaleDilation
void multiGrayscaleDilation(...)
Parabolic grayscale dilation on multi-dimensional arrays.

show deprecated declarations

pass MultiIterators and Data Accessors :
namespace vigra {
template <class SrcIterator, class SrcShape, class SrcAccessor,
class DestIterator, class DestAccessor>
void
multiGrayscaleDilation(SrcIterator siter, SrcShape const & shape, SrcAccessor src,
DestIterator diter, DestAccessor dest, double sigma);
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
template <class SrcIterator, class SrcShape, class SrcAccessor,
class DestIterator, class DestAccessor>
void
multiGrayscaleDilation(triple<SrcIterator, SrcShape, SrcAccessor> const & source,
pair<DestIterator, DestAccessor> const & dest,
double sigma);
}

Usage:

#include <vigra/multi_morphology.hxx>
Namespace: vigra

Shape3 shape(width, height, depth);
MultiArray<3, unsigned char> source(shape);
MultiArray<3, unsigned char> dest(shape);
...
// perform isotropic grayscale erosion
multiGrayscaleDilation(source, dest, 3.0);

See also
  vigra::discDilation(), vigra::multiBinaryDilation()

## ◆ initMultiArray()

template<... >

void initMultiArray | ( |  | ... | ) |

Write a value to every element in a multi-dimensional array.

The initial value can either be a constant of appropriate type (compatible with the destination's value_type), or a functor with compatible result_type. These two cases are automatically distinguished when `FunctorTraits<FUNCTOR>::isInitializer` yields `VigraTrueType`. Since the functor is passed by `const` reference, its `operator()` must be const, and its internal state may need to be `mutable`.

Declarations:

pass arbitrary-dimensional array views:

namespace vigra {
template <unsigned int N, class T, class S, class VALUETYPE>
void
initMultiArray(MultiArrayView<N, T, S> s, VALUETYPE const & v);
template <unsigned int N, class T, class S, class FUNCTOR>
void
initMultiArray(MultiArrayView<N, T, S> s, FUNCTOR const & f);
}
vigra::initMultiArray
void initMultiArray(...)
Write a value to every element in a multi-dimensional array.

show deprecated declarations

pass MultiIterators and Data Accessors :
namespace vigra {
template <class Iterator, class Shape, class Accessor, class VALUETYPE>
void
initMultiArray(Iterator s, Shape const & shape, Accessor a, VALUETYPE const & v);
template <class Iterator, class Shape, class Accessor, class FUNCTOR>
void
initMultiArray(Iterator s, Shape const & shape, Accessor a, FUNCTOR const & f);
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
template <class Iterator, class Shape, class Accessor, class VALUETYPE>
void
initMultiArray(triple<Iterator, Shape, Accessor> const & s, VALUETYPE const & v);
template <class Iterator, class Shape, class Accessor, class FUNCTOR>
void
initMultiArray(triple<Iterator, Shape, Accessor> const & s, FUNCTOR const & f);
}

Usage:

#include <vigra/multi_pointoperators.hxx>
Namespace: vigra

MultiArray<3, unsigned int> array(Shape3(100, 200, 50));
// make an array of all ones
initMultiArray(array, 1);
// equivalent calls:
array = 1;
array.init(1);
// fill the array with random numbers
#include <vigra/random.hxx>
initMultiArray(array, MersenneTwister());

show deprecated examples

MultiArray<3, int> array(Shape3(100, 200, 50));
// make an array of all twos
vigra::initMultiArray(destMultiArrayRange(array), 2);
Required Interface: The function accepts either a value that is copied into every destination element:
MultiIterator begin;
Accessor accessor;
VALUETYPE v;
accessor.set(v, begin);
vigra::MultiIterator
A multi-dimensional hierarchical iterator to be used with vigra::MultiArrayView if it is not strided.
Definition multi_iterator.hxx:1154
or a functor that is called (without argument) at every location, and the result is written into the current element. Internally, functors are recognized by the meta function `FunctorTraits<FUNCTOR>::isInitializer` yielding `VigraTrueType`. Make sure that your functor correctly defines `FunctorTraits` because otherwise the code will not compile.
MultiIterator begin;
Accessor accessor;
FUNCTOR f;
assert(typeid(FunctorTraits<FUNCTOR>::isInitializer) == typeid(VigraTrueType));
accessor.set(f(), begin);

## ◆ initMultiArrayBorder()

template<... >

void initMultiArrayBorder | ( |  | ... | ) |

Write values to the specified border values in the array.

This functions is similar to initMultiArray(), but it initializes only the array elements whose distance from any array border is at most border_width.

Declarations:

pass arbitrary-dimensional array views:

namespace vigra {
// init equal borders on all array sides
template <unsigned int N, class T, class S,
class VALUETYPE>
void
initMultiArrayBorder( MultiArrayView<N, T, S> array,
MultiArrayIndex border_width, VALUETYPE const & v);
template <unsigned int N, class T, class S,
class FUNCTOR>
void
initMultiArrayBorder( MultiArrayView<N, T, S> array,
MultiArrayIndex border_width, FUNCTOR const & v);
// specify border width individually for all array sides
template <unsigned int N, class T, class S,
class VALUETYPE>
void
initMultiArrayBorder( MultiArrayView<N, T, S> array,
typename MultiArrayShape<N>::type const & lower_border,
typename MultiArrayShape<N>::type const & upper_border,
VALUETYPE const & v);
}
vigra::MultiArrayIndex
std::ptrdiff_t MultiArrayIndex
Definition multi_fwd.hxx:60
vigra::initMultiArrayBorder
void initMultiArrayBorder(...)
Write values to the specified border values in the array.

show deprecated declarations

pass MultiIterators and Data Accessors :
namespace vigra {
template <class Iterator, class Diff_type, class Accessor,
class VALUETYPE>
void
initMultiArrayBorder(Iterator upperleft, Diff_type shape, Accessor a,
MultiArrayIndex border_width, VALUETYPE const & v);
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
template <class Iterator, class Diff_type, class Accessor,
class VALUETYPE>
inline void
initMultiArrayBorder( triple<Iterator, Diff_type, Accessor> multiArray,
MultiArrayIndex border_width, VALUETYPE const & v);
}

Usage:

#include <vigra/multi_pointoperators.hxx>
Namespace: vigra

MultiArray<3, unsigned int> array(Shape3(100, 200, 50));
int border_width = 5;
// init the array interior to 1, the border to 2
initMultiArray(array.subarray(Shape3(border_width), Shape3(-border_width)), 1);
initMultiArrayBorder(array, border_width, 2);

## ◆ copyMultiArray()

template<... >

void copyMultiArray | ( |  | ... | ) |

Copy a multi-dimensional array.

This function can be applied in two modes:

Standard Mode:
  If the source and destination arrays have the same size, the corresponding array elements are simply copied. If necessary, type conversion takes place.
Expanding Mode:
  If the source array has length 1 along some (or even all) dimensions, the source value at index 0 is used for all destination elements in those dimensions. For example, if we have single row of data (column length is 1), we can copy it into a 2D image of the same width: The given row is automatically repeated for every row of the destination image. Again, type conversion os performed if necessary.

The arrays must be represented by iterators compatible with vigra::MultiIterator, and the iteration range is specified by means of shape objects. If only the source shape is given the destination array is assumed to have the same shape, and standard mode is applied. If two shapes are given, the size of corresponding dimensions must be either equal (standard copy), or the source length must be 1 (expanding copy).

Declarations:

#include <vigra/multi_pointoperators.hxx>
Namespace: vigra

pass arbitrary-dimensional array views:

namespace vigra {
template <unsigned int N, class T1, class S1,
class T2, class S2>
void
copyMultiArray(MultiArrayView<N, T1, S1> const & source,
MultiArrayView<N, T2, S2> dest);
}
vigra::copyMultiArray
void copyMultiArray(...)
Copy a multi-dimensional array.

show deprecated declarations

pass MultiIterators and Data Accessors :
namespace vigra {
template <class SrcIterator, class SrcShape, class SrcAccessor,
class DestIterator, class DestAccessor>
void
copyMultiArray(SrcIterator s,
SrcShape const & shape, SrcAccessor src,
DestIterator d, DestAccessor dest);
template <class SrcIterator, class SrcShape, class SrcAccessor,
class DestIterator, class DestShape, class DestAccessor>
void
copyMultiArray(SrcIterator s, SrcShape const & sshape, SrcAccessor src,
DestIterator d, DestShape const & dshape, DestAccessor dest);
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
template <class SrcIterator, class SrcShape, class SrcAccessor,
class DestIterator, class DestAccessor>
void
copyMultiArray(triple<SrcIterator, SrcShape, SrcAccessor> const & src,
pair<DestIterator, DestAccessor> const & dest);
template <class SrcIterator, class SrcShape, class SrcAccessor,
class DestIterator, class DestShape, class DestAccessor>
void
copyMultiArray(triple<SrcIterator, SrcShape, SrcAccessor> const & src,
triple<DestIterator, DestShape, DestAccessor> const & dest);
}

Usage - Standard Mode:

MultiArray<3, int> src(Shape3(100, 200, 50)),
dest(Shape3(100, 200, 50));
...
copyMultiArray(src, dest);
// equivalent to
dest = src;
// copy only the red channel (i.e. channl 0) of an RGB array
MultiArray<3, RGBValue<int> > rgb_src(Shape3(100, 200, 50));
copyMultiArray(rgb_src.bindElementChannel(0), dest);
// equivalent to
dest = rgb_src.bindElementChannel(0);

Usage - Expanding Mode:

The source array is effectively only a 2D image (it has a 3D shape, but 'depth' is a singleton dimension with length 1). Thus, the destination will contain 50 identical copies of this image:

MultiArray<3, int> src(Shape2(100, 200)),
dest(Shape3(100, 200, 50));
...
copyMultiArray(src.insertSingletonDimension(2), dest);
// create an RGB image with three identical color bands
MultiArray<3, RGBValue<int> > rgb_dest(Shape2(100, 200));
copyMultiArray(src.insertSingletonDimension(2), rgb_dest.expandElements(2));

show deprecated examples

typedef vigra::MultiArray<3, int> Array;
Array src(Array::size_type(100, 200, 50)),
dest(Array::size_type(100, 200, 50));
...
vigra::copyMultiArray(srcMultiArrayRange(src), destMultiArray(dest));
Required Interface:
MultiIterator src_begin, dest_begin;
SrcAccessor src_accessor;
DestAccessor dest_accessor;
dest_accessor.set(src_accessor(src_begin), dest_begin);

## ◆ transformMultiArray()

template<... >

void transformMultiArray | ( |  | ... | ) |

Transform a multi-dimensional array with a unary function or functor.

Note: The effect of this function can often be achieved in a simpler and more readable way by means of array expressions.

This function can be applied in three modes:

Standard Mode:
  If the source and destination arrays have the same size, the transformation given by the functor is applied to every source element and the result written into the corresponding destination element. Unary functions, unary functors from the STL and the functors specifically defined in Functors to Transform Images can be used in standard mode. Creation of new functors is easiest by using Functor Expressions
  .
Expanding Mode:
  If the source array has length 1 along some (or even all) dimensions, the source value at index 0 is used for all destination elements in those dimensions. In other words, the source index is not incremented along these dimensions, but the transformation functor is applied as usual. So, we can expand a small array (e.g. a single row of data, column length is 1), into a larger one (e.g. a 2D image with the same width): the given values are simply reused as necessary (e.g. for every row of the destination image). The same functors as in standard mode can be applied.
Reducing Mode:
  If the destination array has length 1 along some (or even all) dimensions, the source values in these dimensions are reduced to single values by means of a suitable functor (e.g. vigra::ReduceFunctor), which supports two function call operators: one with a single argument to collect the values, and without argument to obtain the final (reduced) result. This behavior is a multi-dimensional generalization of the C++ standard function `std::accumulate()`.

The arrays must be represented by MultiArrayViews. If source and destination shapes match, standard mode is applied. If the shapes differ, the size of corresponding dimensions must either be equal, or the source length must be 1 (expand mode), or the destination length must be 1 (reduce mode). However, reduction and expansion cannot be executed at the same time, so the latter conditions are mutual exclusive, even if they apply to different dimensions.

Declarations:

#include <vigra/multi_pointoperators.hxx>
Namespace: vigra

pass arbitrary-dimensional array views:

namespace vigra {
template <unsigned int N, class T1, class S1,
class T2, class S2,
class Functor>
void
transformMultiArray(MultiArrayView<N, T1, S1> const & source,
MultiArrayView<N, T2, S2> dest, Functor const & f);
}
vigra::transformMultiArray
void transformMultiArray(...)
Transform a multi-dimensional array with a unary function or functor.

show deprecated declarations

pass MultiIterators and Data Accessors :
namespace vigra {
template <class SrcIterator, class SrcShape, class SrcAccessor,
class DestIterator, class DestAccessor,
class Functor>
void
transformMultiArray(SrcIterator s, SrcShape const & shape, SrcAccessor src,
DestIterator d, DestAccessor dest, Functor const & f);
template <class SrcIterator, class SrcShape, class SrcAccessor,
class DestIterator, class DestShape, class DestAccessor,
class Functor>
void
transformMultiArray(SrcIterator s, SrcShape const & sshape, SrcAccessor src,
DestIterator d, DestShape const & dshape, DestAccessor dest,
Functor const & f);
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
template <class SrcIterator, class SrcShape, class SrcAccessor,
class DestIterator, class DestAccessor,
class Functor>
void
transformMultiArray(triple<SrcIterator, SrcShape, SrcAccessor> const & src,
pair<DestIterator, DestAccessor> const & dest, Functor const & f);
template <class SrcIterator, class SrcShape, class SrcAccessor,
class DestIterator, class DestShape, class DestAccessor,
class Functor>
void
transformMultiArray(triple<SrcIterator, SrcShape, SrcAccessor> const & src,
triple<DestIterator, DestShape, DestAccessor> const & dest,
Functor const & f)
}

Usage - Standard Mode:

Source and destination array have the same size.

#include <cmath> // for sqrt()
MultiArray<3, float> src(Shape3(100, 200, 50)),
dest(Shape3(100, 200, 50));
...
transformMultiArray(src, dest, &std::sqrt );

Usage - Expand Mode:

The source array is effectively only a 2D image(it has a 3D shape, but depth is a singleton dimension with length 1). Thus, the destination will contain 50 identical copies of the transformed source image.

#include <cmath> // for sqrt()
MultiArray<3, float> src(Shape3(100, 200, 1)),
dest(Shape3(100, 200, 50));
...
transformMultiArray(src, dest, &std::sqrt );

Usage - Reduce Mode:

The destination array is effectively only 1D (it's width and height are singleton dimensions). Thus, it will contain accumulated data for every slice of the source volume (or for every frame, if the source is interpreted as an image sequence). In the example, we use the functor vigra::FindAverage to calculate the average gray value of every slice.

MultiArray<3, float> src(Shape3(100, 200, 50)),
dest(Shape3(1, 1, 50));
...
transformMultiArray(src, dest,
FindAverage<float>() );

Note that the functor must define the appropriate traits described below in order to be recognized as a reduce functor. This is most easily achieved by deriving from `UnaryReduceFunctorTag` (see vigra::FunctorTraits).

show deprecated examples

#include <cmath> // for sqrt()
typedef vigra::MultiArray<3, float> Array;
Array src(Shape3(100, 200, 50)),
dest(Shape3(100, 200, 50));
...
vigra::transformMultiArray(srcMultiArrayRange(src),
destMultiArray(dest),
(float(*)(float))&std::sqrt );

Required Interface:

In standard and expand mode, the functor must be a model of UnaryFunction (i.e. support one-argument function call which accepts values of type `T1` and a return value that is convertible into `T2`.

In reduce mode, it must be a model of UnaryAnalyser (i.e. support function call with one argument and no return value `functor(arg)`) and Initializer (i.e. support function call with no argument, but return value `res = functor()`). Internally, such functors are recognized by the meta functions `FunctorTraits<FUNCTOR>::isUnaryAnalyser` and `FunctorTraits<FUNCTOR>::isInitializer` which must both yield `VigraTrueType`. Make sure that your functor correctly defines `FunctorTraits` because otherwise reduce mode will not work. This is most easily achieved by deriving the functor from `UnaryReduceFunctorTag` (see vigra::FunctorTraits). In addition, the functor must be copy constructible in order to start each reduction with a fresh functor.

See also
  Functors to Transform Images, vigra::multi_math, Functor Expressions

## ◆ combineTwoMultiArrays()

template<... >

void combineTwoMultiArrays | ( |  | ... | ) |

Combine two multi-dimensional arrays into one using a binary function or functor.

Note: The effect of this function can often be achieved in a simpler and more readable way by means of array expressions.

This function can be applied in three modes:

Standard Mode:
  If the source and destination arrays have the same size, the transformation given by the functor is applied to every pair of corresponding source elements and the result written into the corresponding destination element. Binary functions, binary functors from the STL and the functors specifically defined in Functors to Combine Images can be used in standard mode. Creation of new functors is easiest by using Functor Expressions
  .
Expanding Mode:
  If the source arrays have length 1 along some (or even all) dimensions, the source values at index 0 are used for all destination elements in those dimensions. In other words, the source index is not incremented along those dimensions, but the transformation functor is applied as usual. So, we can expand small arrays (e.g. a single row of data, column length is 1), into larger ones (e.g. a 2D image with the same width): the given values are simply reused as necessary (e.g. for every row of the destination image). It is not even necessary that the source array shapes are equal. For example, we can combine a small array with one that hase the same size as the destination array. The same functors as in standard mode can be applied.
Reducing Mode:
  If the destination array has length 1 along some (or even all) dimensions, the source values in these dimensions are reduced to single values by means of a suitable functor which supports two function call operators: one with two arguments to collect the values, and one without argument to obtain the final (reduced) result. This behavior is a multi-dimensional generalization of the C++ standard function `std::accumulate()`.

The arrays must be represented by MultiArrayViews. If all shapes are identical, standard mode is applied. If the shapes differ, the size of corresponding dimensions must either be equal, or the length of this dimension must be 1 in one or both source arrays (expand mode), or the destination length must be 1 (reduce mode). However, reduction and expansion cannot be executed at the same time, so the latter conditions are mutual exclusive, even if they apply to different dimensions.

Declarations:

#include <vigra/multi_pointoperators.hxx>
Namespace: vigra

pass arbitrary-dimensional array views:

namespace vigra {
template <unsigned int N, class T11, class S11,
class T12, class S12,
class T2, class S2,
class Functor>
void
combineTwoMultiArrays(MultiArrayView<N, T11, S11> const & source1,
MultiArrayView<N, T12, S12> const & source2,
MultiArrayView<N, T2, S2> dest,
Functor const & f);
}
vigra::combineTwoMultiArrays
void combineTwoMultiArrays(...)
Combine two multi-dimensional arrays into one using a binary function or functor.

show deprecated declarations

pass MultiIterators and Data Accessors :
namespace vigra {
template <class SrcIterator1, class SrcShape, class SrcAccessor1,
class SrcIterator2, class SrcAccessor2,
class DestIterator, class DestAccessor,
class Functor>
void combineTwoMultiArrays(
SrcIterator1 s1, SrcShape const & shape, SrcAccessor1 src1,
SrcIterator2 s2, SrcAccessor2 src2,
DestIterator d, DestAccessor dest, Functor const & f);
template <class SrcIterator1, class SrcShape1, class SrcAccessor1,
class SrcIterator2, class SrcShape2, class SrcAccessor2,
class DestIterator, class DestShape, class DestAccessor,
class Functor>
void combineTwoMultiArrays(
SrcIterator1 s1, SrcShape1 const & sshape1, SrcAccessor1 src1,
SrcIterator2 s2, SrcShape2 const & sshape2, SrcAccessor2 src2,
DestIterator d, DestShape const & dshape, DestAccessor dest,
Functor const & f);
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
template <class SrcIterator1, class SrcShape, class SrcAccessor1,
class SrcIterator2, class SrcAccessor2,
class DestIterator, class DestAccessor, class Functor>
void combineTwoMultiArrays(
triple<SrcIterator1, SrcShape, SrcAccessor1> const & src1,
pair<SrcIterator2, SrcAccessor2> const & src2,
pair<DestIterator, DestAccessor> const & dest, Functor const & f);
template <class SrcIterator1, class SrcShape1, class SrcAccessor1,
class SrcIterator2, class SrcShape2, class SrcAccessor2,
class DestIterator, class DestShape, class DestAccessor,
class Functor>
void combineTwoMultiArrays(
triple<SrcIterator1, SrcShape1, SrcAccessor1> const & src1,
triple<SrcIterator2, SrcShape2, SrcAccessor2> const & src2,
triple<DestIterator, DestShape, DestAccessor> const & dest,
Functor const & f);
}

Usage - Standard Mode:

Source and destination arrays have the same size.

#include <functional> // for std::plus
MultiArray<3, int> src1(Shape3(100, 200, 50)),
src2(Shape3(100, 200, 50)),
dest(Shape3(100, 200, 50));
...
combineTwoMultiArrays(src1, src2, dest,
std::plus<int>());

Usage - Expand Mode:

One source array is effectively only a 2D image (it has depth 1). This image will be added to every slice of the other source array, and the result is written into the corresponding destination slice.

#include <functional> // for std::plus
MultiArray<3, int> src1(Shape3(100, 200, 1)),
src2(Shape3(100, 200, 50)),
dest(Shape3(100, 200, 50));
...
combineTwoMultiArrays(src1, src2, dest,
std::plus<int>());

Usage - Reduce Mode:

The destination array is only 1D (it's width and height are singleton dimensions). Thus, it will contain accumulated data for every slice of the source volumes (or for every frame, if the sources are interpreted as image sequences). In the example, we use vigra::ReduceFunctor together with a functor expression (see Functor Expressions
) to calculate the total absolute difference of the gray values in every pair of source slices.

#include <vigra/functorexpression.hxx>
using namespace vigra::functor;
MultiArray<3, int> src1(Shape3(100, 200, 50)),
src2(Shape3(100, 200, 50)),
dest(Shape3(1, 1, 50));
...
combineTwoMultiArrays(src1, src2, dest,
reduceFunctor(Arg1() + abs(Arg2() - Arg3()), 0) );
// Arg1() is the sum accumulated so far, initialized with 0

Note that the functor must define the appropriate traits described below in order to be recognized as a reduce functor. This is most easily achieved by deriving from `BinaryReduceFunctorTag` (see vigra::FunctorTraits).

show deprecated examples

#include <functional> // for std::plus
typedef vigra::MultiArray<3, int> Array;
Array src1(Shape3(100, 200, 50)),
src2(Shape3(100, 200, 50)),
dest(Shape3(100, 200, 50));
...
vigra::combineTwoMultiArrays(
srcMultiArrayRange(src1),
srcMultiArray(src2),
destMultiArray(dest),
std::plus<int>());

Required Interface:

In standard and expand mode, the functor must be a model of BinaryFunction (i.e. support function call with two arguments and a return value which is convertible into `T2`: `T2 res = functor(arg1, arg2)`):

In reduce mode, it must be a model of BinaryAnalyser (i.e. support function call with two arguments and no return value `functor(arg1, arg2)`) and Initializer (i.e. support function call with no argument, but return value `res = functor()`). Internally, such functors are recognized by the meta functions `FunctorTraits<FUNCTOR>::isBinaryAnalyser` and `FunctorTraits<FUNCTOR>::isInitializer` which must both yield `VigraTrueType`. Make sure that your functor correctly defines `FunctorTraits` because otherwise reduce mode will not work. This is most easily achieved by deriving the functor from `BinaryReduceFunctorTag` (see vigra::FunctorTraits). In addition, the functor must be copy constructible in order to start each reduction with a fresh functor.

See also
  Functors to Transform Images, vigra::multi_math, Functor Expressions

## ◆ combineThreeMultiArrays()

template<... >

void combineThreeMultiArrays | ( |  | ... | ) |

Combine three multi-dimensional arrays into one using a ternary function or functor.

Note: The effect of this function can often be achieved in a simpler and more readable way by means of array expressions.

Except for the fact that it operates on three input arrays, this function is identical to the standard mode of combineTwoMultiArrays() (reduce and expand modes are not supported).

Declarations:

pass arbitrary-dimensional array views:

namespace vigra {
template <unsigned int N, class T11, class S11,
class T12, class S12,
class T13, class S13,
class T2, class S2,
class Functor>
void
combineThreeMultiArrays(MultiArrayView<N, T11, S11> const & source1,
MultiArrayView<N, T12, S12> const & source2,
MultiArrayView<N, T13, S13> const & source3,
MultiArrayView<N, T2, S2> dest,
Functor const & f);
}
vigra::combineThreeMultiArrays
void combineThreeMultiArrays(...)
Combine three multi-dimensional arrays into one using a ternary function or functor.

show deprecated declarations

pass MultiIterators and Data Accessors :
namespace vigra {
template <class SrcIterator1, class SrcShape, class SrcAccessor1,
class SrcIterator2, class SrcAccessor2,
class SrcIterator3, class SrcAccessor3,
class DestIterator, class DestAccessor,
class Functor>
void
combineThreeMultiArrays(SrcIterator1 s1, SrcShape const & shape, SrcAccessor1 src1,
SrcIterator2 s2, SrcAccessor2 src2,
SrcIterator3 s3, SrcAccessor3 src3,
DestIterator d, DestAccessor dest, Functor const & f);
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
template <class SrcIterator1, class SrcShape, class SrcAccessor1,
class SrcIterator2, class SrcAccessor2,
class SrcIterator3, class SrcAccessor3,
class DestIterator, class DestAccessor,
class Functor>
inline void
combineThreeMultiArrays(triple<SrcIterator1, SrcShape, SrcAccessor1> const & src1,
pair<SrcIterator2, SrcAccessor2> const & src2,
pair<SrcIterator3, SrcAccessor3> const & src3,
pair<DestIterator, DestAccessor> const & dest, Functor const & f);
}

Usage:

#include <vigra/multi_pointoperators.hxx>
Namespace: vigra

#include <vigra/functorexpression.hxx>
MultiArray<3, int> src1(Shape3(100, 200, 50)),
src2(Shape3(100, 200, 50)),
src3(Shape3(100, 200, 50)),
dest(Shape3(100, 200, 50));
...
using namespace vigra::functor; // activate VIGRA's lambda library
combineThreeMultiArrays(src1, src2, src3, dest,
Arg1()*exp(-abs(Arg2()-Arg3())));

show deprecated examples

#include <functional> // for plus
typedef vigra::MultiArray<3, int> Array;
Array src1(Shape3(100, 200, 50)),
src2(Shape3(100, 200, 50)),
src3(Shape3(100, 200, 50)),
dest(Shape3(100, 200, 50));
...
vigra::combineThreeMultiArrays(
srcMultiArrayRange(src1),
srcMultiArray(src2),
srcMultiArray(src3),
destMultiArray(dest),
SomeThreeArgumentFunctor());

See also
  Functors to Transform Images, vigra::multi_math, Functor Expressions

## ◆ inspectMultiArray()

template<... >

void inspectMultiArray | ( |  | ... | ) |

Call an analyzing functor at every element of a multi-dimensional array.

This function can be used to collect statistics of the array etc. The results must be stored in the functor, which serves as a return value (therefore, it is passed to the function by reference). The array must be represented as a MultiArrayView.

For many common statistics, the use of vigra::acc::extractFeatures() in combination with Feature Accumulators is more convenient.

Declarations:

pass arbitrary-dimensional array views:

namespace vigra {
template <unsigned int N, class T, class S,
class Functor>
void
inspectMultiArray(MultiArrayView<N, T, S> const & s,
Functor & f);
}
vigra::inspectMultiArray
void inspectMultiArray(...)
Call an analyzing functor at every element of a multi-dimensional array.

show deprecated declarations

pass MultiIterators and Data Accessors :
namespace vigra {
template <class Iterator, class Shape, class Accessor, class Functor>
void
inspectMultiArray(Iterator s, Shape const & shape, Accessor a, Functor & f);
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
template <class Iterator, class Shape, class Accessor, class Functor>
void
inspectMultiArray(triple<Iterator, Shape, Accessor> const & s, Functor & f);
}

Usage:

#include <vigra/multi_pointoperators.hxx>
Namespace: vigra

MultiArray<3, int> array(Shape3(100, 200, 50));
... // fill array
// init functor
FindMinMax<int> minmax;
inspectMultiArray(array, minmax);
cout << "Min: " << minmax.min << " Max: " << minmax.max;

The functor must support function call with one argument.

show deprecated examples

typedef vigra::MultiArray<3, int> Array;
Array array(Shape3(100, 200, 50));
// init functor
vigra::FindMinMax<int> minmax;
vigra::inspectMultiArray(srcMultiArrayRange(array), minmax);
cout << "Min: " << minmax.min << " Max: " << minmax.max;
Required Interface:
MultiIterator src_begin;
Accessor accessor;
Functor functor;
functor(accessor(src_begin));

## ◆ inspectTwoMultiArrays()

template<... >

void inspectTwoMultiArrays | ( |  | ... | ) |

Call an analyzing functor at all corresponding elements of two multi-dimensional arrays.

This function can be used to collect statistics over tow arrays. For example, one can holde data, and the other region labels or weights. The results must be stored in the functor, which serves as a return value (and is therefore passed by reference). The arrays must be represented by MultiArrayViews.

For many common statistics, the use of vigra::acc::extractFeatures() in combination with Feature Accumulators is more convenient.

Declarations:

pass arbitrary-dimensional array views:

namespace vigra {
template <unsigned int N, class T1, class S1,
class T2, class S2,
class Functor>
void
inspectTwoMultiArrays(MultiArrayView<N, T1, S1> const & s1,
MultiArrayView<N, T2, S2> const & s2,
Functor & f);
}
vigra::inspectTwoMultiArrays
void inspectTwoMultiArrays(...)
Call an analyzing functor at all corresponding elements of two multi-dimensional arrays.

show deprecated declarations

pass MultiIterators and Data Accessors :
namespace vigra {
template <class Iterator1, class Shape, class Accessor1,
class Iterator2, class Accessor2,
class Functor>
void
inspectTwoMultiArrays(Iterator1 s1, Shape const & shape, Accessor1 a1,
Iterator2 s2, Accessor2 a2, Functor & f);
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
template <class Iterator1, class Shape1, class Accessor1,
class Iterator2, class Accessor2,
class Functor>
void
inspectTwoMultiArrays(triple<Iterator1, Shape1, Accessor1> const & s1,
pair<Iterator2, Accessor2> const & s2, Functor & f);
}

Usage:

#include <vigra/multi_pointoperators.hxx>
Namespace: vigra

MultiArray<3, int> array1(Shape3(100, 200, 50)),
array2(Shape3(100, 200, 50));
// init functor
SomeStatisticsFunctor stats(..);
inspectTwoMultiArrays(array1, array2, stats);

The functor must support function call with two arguments.

show deprecated examples

MultiArray<3, int> array1(Shape3(100, 200, 50)),
array2(Shape3(100, 200, 50));
// init functor
SomeStatisticsFunctor stats(..);
vigra::inspectTwoMultiArrays(srcMultiArrayRange(array1), srcMultiArray(array2), stats);
Required Interface:
MultiIterator src1_begin, src2_begin;
Accessor a1, a2;
Functor functor;
functor(a1(src1_begin), a2(src2_begin));

## ◆ resizeMultiArraySplineInterpolation()

template<... >

void resizeMultiArraySplineInterpolation | ( |  | ... | ) |

Resize MultiArray using B-spline interpolation.

Declarations:

pass arbitrary-dimensional array views:

namespace vigra {
template <unsigned int N, class T1, class S1,
class T2, class S2,
class Kernel = BSpline<3, double> >
void
resizeMultiArraySplineInterpolation(MultiArrayView<N, T1, S1> const & source,
MultiArrayView<N, T2, S2> dest,
Kernel const & spline = BSpline<3, double>());
}
vigra::resizeMultiArraySplineInterpolation
void resizeMultiArraySplineInterpolation(...)
Resize MultiArray using B-spline interpolation.

show deprecated declarations

pass MultiIterators and Data Accessors :
namespace vigra {
template <class SrcIterator, class Shape, class SrcAccessor,
class DestIterator, class DestAccessor,
class Kernel = BSpline<3, double> >
void
resizeMultiArraySplineInterpolation(
SrcIterator si, Shape const & sshape, SrcAccessor src,
DestIterator di, Shape const & dshape, DestAccessor dest,
Kernel const & spline = BSpline<3, double>());
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
template <class SrcIterator, class Shape, class SrcAccessor,
class DestIterator, class DestAccessor,
class Kernel = BSpline<3, double> >
void
resizeMultiArraySplineInterpolation(
triple<SrcIterator, Shape, SrcAccessor> src,
triple<DestIterator, Shape, DestAccessor> dest,
Kernel const & spline = BSpline<3, double>());
}

The function implements separable spline interpolation algorithm described in

M. Unser, A. Aldroubi, M. Eden, "B-Spline Signal Processing" IEEE Transactions on Signal Processing, vol. 41, no. 2, pp. 821-833 (part I), pp. 834-848 (part II), 1993.

to obtain optimal interpolation quality and speed. You may pass the function a spline of arbitrary order (e.g. `BSpline<ORDER, double>` or `CatmullRomSpline<double>`). The default is a third order spline which gives a twice continuously differentiable interpolant. The implementation ensures that image values are interpolated rather than smoothed by first calling a recursive (sharpening) prefilter as described in the above paper. Then the actual interpolation is done using resamplingConvolveLine().

The range of both the input and output images (resp. regions) must be given. The input image must have a size of at least 4x4, the destination of at least 2x2. The scaling factors are then calculated accordingly. If the source image is larger than the destination, it is smoothed (band limited) using a recursive exponential filter. The source value_type (SrcAccessor::value_type) must be a linear algebra, i.e. it must support addition, subtraction, and multiplication (+, -, *), multiplication with a scalar real number and NumericTraits. The function uses accessors.

Usage:

#include <vigra/multi_resize.hxx>
Namespace: vigra

MultiArray<3, float> src(Shape3(5, 7, 10)),
dest(Shape3(9, 13, 19)); // double the size
// use default cubic spline interpolator
resizeMultiArraySplineInterpolation(src, dest);
// use linear interpolator
resizeMultiArraySplineInterpolation(src, dest, BSpline<1, double>());

show deprecated examples

vigra::MultiArray<3, float> src(Shape3(5, 7, 10)),
dest(Shape3(9, 13, 19)); // double the size
// use linear interpolator
vigra::resizeMultiArraySplineInterpolation(srcMultiArrayRange(src),
destMultiArrayRange(dest), BSpline<1, double>());
// use default cubic spline interpolator
vigra::resizeMultiArraySplineInterpolation(
srcMultiArrayRange(src),
destMultiArrayRange(dest));
Required Interface: The source and destination iterators must be compatible with vigra::MultiIterator. The array value types must be models of LinearSpace.

## ◆ vectorToTensorMultiArray()

template<... >

void vectorToTensorMultiArray | ( |  | ... | ) |

Calculate the tensor (outer) product of a N-D vector with itself.

This function is useful to transform vector arrays into a tensor representation that can be used as input to tensor based processing and analysis functions (e.g. tensor smoothing). When the input array has N dimensions, the input value_type must be a vector of length N, whereas the output value_type mus be vectors of length N*(N-1)/2 which will represent the upper triangular part of the resulting (symmetric) tensor. That is, for 2D arrays the output contains the elements `[t11, t12 == t21, t22]` in this order, whereas it contains the elements `[t11, t12, t13, t22, t23, t33]` for 3D arrays.

Currently, `N <= 3` is required.

Declarations:

pass arbitrary-dimensional array views:

namespace vigra {
template <unsigned int N, class T1, class S1,
class T2, class S2>
void
vectorToTensorMultiArray(MultiArrayView<N, T1, S1> const & source,
MultiArrayView<N, T2, S2> dest);
}
vigra::vectorToTensorMultiArray
void vectorToTensorMultiArray(...)
Calculate the tensor (outer) product of a N-D vector with itself.

show deprecated declarations

pass MultiIterators and Data Accessors :
namespace vigra {
template <class SrcIterator, class SrcShape, class SrcAccessor,
class DestIterator, class DestAccessor>
void
vectorToTensorMultiArray(SrcIterator si, SrcShape const & shape, SrcAccessor src,
DestIterator di, DestAccessor dest);
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
template <class SrcIterator, class SrcShape, class SrcAccessor,
class DestIterator, class DestAccessor>
void
vectorToTensorMultiArray(triple<SrcIterator, SrcShape, SrcAccessor> s,
pair<DestIterator, DestAccessor> d);
}

Usage:

#include <vigra/multi_tensorutilities.hxx>
Namespace: vigra

MultiArray<3, float> vol(shape);
MultiArray<3, TinyVector<float, 3> > gradient(shape);
MultiArray<3, TinyVector<float, 6> > tensor(shape);
gaussianGradientMultiArray(vol, gradient, 2.0);
vectorToTensorMultiArray(gradient, tensor);

## ◆ tensorTraceMultiArray()

template<... >

void tensorTraceMultiArray | ( |  | ... | ) |

Calculate the tensor trace for every element of a N-D tensor array.

This function turns a N-D tensor (whose value_type is a vector of length N*(N+1)/2, see vectorToTensorMultiArray()) representing the upper triangular part of a symmetric tensor into a scalar array holding the tensor trace.

Currently, `N <= 3` is required.

Declarations:

pass arbitrary-dimensional array views:

namespace vigra {
template <unsigned int N, class T1, class S1,
class T2, class S2>
void
tensorTraceMultiArray(MultiArrayView<N, T1, S1> const & source,
MultiArrayView<N, T2, S2> dest);
}
vigra::tensorTraceMultiArray
void tensorTraceMultiArray(...)
Calculate the tensor trace for every element of a N-D tensor array.

show deprecated declarations

pass MultiIterators and Data Accessors :
namespace vigra {
template <class SrcIterator, class SrcShape, class SrcAccessor,
class DestIterator, class DestAccessor>
void
tensorTraceMultiArray(SrcIterator si, SrcShape const & shape, SrcAccessor src,
DestIterator di, DestAccessor dest);
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
template <class SrcIterator, class SrcShape, class SrcAccessor,
class DestIterator, class DestAccessor>
void
tensorTraceMultiArray(triple<SrcIterator, SrcShape, SrcAccessor> s,
pair<DestIterator, DestAccessor> d);
}

Usage:

#include <vigra/multi_tensorutilities.hxx>
Namespace: vigra

MultiArray<3, float> vol(shape);
MultiArray<3, TinyVector<float, 6> > hessian(shape);
MultiArray<3, float> trace(shape);
hessianOfGaussianMultiArray(vol, hessian, 2.0);
tensorTraceMultiArray(hessian, trace);

Preconditions:

`N == 2` or `N == 3`

## ◆ tensorEigenvaluesMultiArray()

template<... >

void tensorEigenvaluesMultiArray | ( |  | ... | ) |

Calculate the tensor eigenvalues for every element of a N-D tensor array.

This function turns a N-D tensor (whose value_type is a vector of length N*(N+1)/2, see vectorToTensorMultiArray()) representing the upper triangular part of a symmetric tensor into a vector-valued array holding the tensor eigenvalues (thus, the destination value_type must be vectors of length N).

Currently, `N <= 3` is required.

Declarations:

pass arbitrary-dimensional array views:

namespace vigra {
template <unsigned int N, class T1, class S1,
class T2, class S2>
void
tensorEigenvaluesMultiArray(MultiArrayView<N, T1, S1> const & source,
MultiArrayView<N, T2, S2> dest);
}
vigra::tensorEigenvaluesMultiArray
void tensorEigenvaluesMultiArray(...)
Calculate the tensor eigenvalues for every element of a N-D tensor array.

show deprecated declarations

pass MultiIterators and Data Accessors :
namespace vigra {
template <class SrcIterator, class SrcShape, class SrcAccessor,
class DestIterator, class DestAccessor>
void
tensorEigenvaluesMultiArray(SrcIterator si, SrcShape const & shape, SrcAccessor src,
DestIterator di, DestAccessor dest);
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
template <class SrcIterator, class SrcShape, class SrcAccessor,
class DestIterator, class DestAccessor>
void
tensorEigenvaluesMultiArray(triple<SrcIterator, SrcShape, SrcAccessor> s,
pair<DestIterator, DestAccessor> d);
}

Usage (MultiArrayView API):

#include <vigra/multi_tensorutilities.hxx>
Namespace: vigra

MultiArray<3, float> vol(shape);
MultiArray<3, TinyVector<float, 6> > hessian(shape);
MultiArray<3, TinyVector<float, 3> > eigenvalues(shape);
hessianOfGaussianMultiArray(vol, hessian, 2.0);
tensorEigenvaluesMultiArray(hessian, eigenvalues);

Preconditions:

`N == 2` or `N == 3`

## ◆ tensorDeterminantMultiArray()

template<... >

void tensorDeterminantMultiArray | ( |  | ... | ) |

Calculate the tensor determinant for every element of a ND tensor array.

This function turns a N-D tensor (whose value_type is a vector of length N*(N+1)/2, see vectorToTensorMultiArray()) representing the upper triangular part of a symmetric tensor into the a scalar array holding the tensor determinant.

Currently, `N <= 3` is required.

Declarations:

pass arbitrary-dimensional array views:

namespace vigra {
template <unsigned int N, class T1, class S1,
class T2, class S2>
void
tensorDeterminantMultiArray(MultiArrayView<N, T1, S1> const & source,
MultiArrayView<N, T2, S2> dest);
}
vigra::tensorDeterminantMultiArray
void tensorDeterminantMultiArray(...)
Calculate the tensor determinant for every element of a ND tensor array.

show deprecated declarations

pass MultiIterators and Data Accessors :
namespace vigra {
template <class SrcIterator, class SrcShape, class SrcAccessor,
class DestIterator, class DestAccessor>
void
tensorDeterminantMultiArray(SrcIterator si, SrcShape const & shape, SrcAccessor src,
DestIterator di, DestAccessor dest);
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
template <class SrcIterator, class SrcShape, class SrcAccessor,
class DestIterator, class DestAccessor>
void
tensorDeterminantMultiArray(triple<SrcIterator, SrcShape, SrcAccessor> s,
pair<DestIterator, DestAccessor> d);
}

Usage (MultiArrayView API):

#include <vigra/multi_tensorutilities.hxx>
Namespace: vigra

MultiArray<3, float> vol(shape);
MultiArray<3, TinyVector<float, 6> > hessian(shape);
MultiArray<3, float> determinant(shape);
hessianOfGaussianMultiArray(vol, hessian, 2.0);
tensorDeterminantMultiArray(hessian, determinant);

Preconditions:

`N == 2` or `N == 3`

## ◆ watershedsMultiArray()

template<... >

Label watershedsMultiArray | ( |  | ... | ) |

Watershed segmentation of an arbitrary-dimensional array.

See also unionFindWatershedsBlockwise() for a parallel version of the watershed algorithm.

This function implements variants of the watershed algorithms described in

[1] L. Vincent and P. Soille: "Watersheds in digital spaces: An efficient algorithm based on immersion simulations", IEEE Trans. Patt. Analysis Mach. Intell. 13(6):583-598, 1991

[2] J. Roerdink, R. Meijster: "The watershed transform: definitions, algorithms, and parallelization strategies", Fundamenta Informaticae, 41:187-228, 2000

The source array data is a boundary indicator such as the gaussianGradientMagnitude() or the trace of the boundaryTensor(), and the destination labels is a label array designating membership of each point in one of the regions found. Plateaus in the boundary indicator are handled via simple tie breaking strategies. Argument neighborhood specifies the connectivity between points and can be `DirectNeighborhood` (meaning 4-neighborhood in 2D and 6-neighborhood in 3D, default) or `IndirectNeighborhood` (meaning 8-neighborhood in 2D and 26-neighborhood in 3D).

The watershed variant to be applied can be selected in the WatershedOptions object: When you call `WatershedOptions::regionGrowing()` (default), the flooding algorithm from [1] is used. Alternatively, `WatershedOptions::unionFind()` uses the scan-line algorithm 4.7 from [2]. The latter is faster, but does not support any options (if you pass options nonetheless, they are silently ignored).

The region growing algorithm needs a seed for each region. Seeds can either be provided in the destination array labels (which will then be overwritten with the result) or computed automatically by an internal call to generateWatershedSeeds(). In the former case you have full control over seed placement, while the latter is more convenient. Automatic seed computation is performed when you provide seeding options via `WatershedOptions::seedOptions()` or when the array labels is empty (all zeros), in which case default seeding options are chosen. The destination image should be zero-initialized for automatic seed computation.

Further options to be specified via WatershedOptions are:

- `keepContours()`: Whether to keep a 1-pixel-wide contour (with label 0) between regions (otherwise, a complete grow is performed, i.e. all pixels are assigned to a region).
- `stopAtThreshold()`: Whether to stop growing when the boundaryness exceeds a threshold (remaining pixels keep label 0).
- `biasLabel()`: Whether one region (label) is to be preferred or discouraged by biasing its cost with a given factor (smaller than 1 for preference, larger than 1 for discouragement).

The option `turboAlgorithm()` is implied by method `regionGrowing()` (this is in contrast to watershedsRegionGrowing(), which supports an additional algorithm in 2D only).

watershedsMultiArray() returns the number of regions found (= the highest region label, because labels start at 1).

Declaration:

namespace vigra {
template <unsigned int N, class T, class S1,
class Label, class S2>
Label
watershedsMultiArray(MultiArrayView<N, T, S1> const & data,
MultiArrayView<N, Label, S2> labels, // may also hold input seeds
NeighborhoodType neighborhood = DirectNeighborhood,
WatershedOptions const & options = WatershedOptions());
}
vigra::WatershedOptions
Options object for watershed algorithms.
Definition watersheds.hxx:775
vigra::watershedsMultiArray
Label watershedsMultiArray(...)
Watershed segmentation of an arbitrary-dimensional array.

Usage:

#include <vigra/multi_watersheds.hxx>
Namespace: vigra

Example: watersheds of the gradient magnitude (the example works likewise for higher dimensions).

MultiArray<2, unsigned char> src(Shape2(w, h));
... // read input data
// compute gradient magnitude at scale 1.0 as a boundary indicator
MultiArray<2, float> gradMag(src.shape());
gaussianGradientMagnitude(srcImageRange(src), destImage(gradMag), 1.0);
// example 1
{
// the pixel type of the destination image must be large enough to hold
// numbers up to 'max_region_label' to prevent overflow
MultiArray<2, unsigned int> labeling(src.shape());
// call region-growing algorithm for 4-neighborhood, leave a 1-pixel boundary between
// regions, and autogenerate seeds from all gradient minima where the magnitude is
// less than 2.0.
unsigned int max_region_label =
watershedsMultiArray(gradMag, labeling, DirectNeighborhood,
WatershedOptions().keepContours()
.seedOptions(SeedOptions().minima().threshold(2.0)));
}
// example 2
{
MultiArray<2, unsigned int> labeling(src.shape());
// compute seeds beforehand (use connected components of all pixels
// where the gradient is below 4.0)
unsigned int max_region_label = generateWatershedSeeds(gradMag, labeling,
SeedOptions().levelSets(4.0));
// quantize the gradient image to 256 gray levels
float m, M;
gradMag.minmax(&m, &M);
using namespace multi_math;
MultiArray<2, unsigned char> gradMag256(255.0 / (M - m) * (gradMag - m));
// call region-growing algorithm with 8-neighborhood,
// since the data are 8-bit, a faster priority queue will be used
watershedsMultiArray(gradMag256, labeling, IndirectNeighborhood);
}
// example 3
{
MultiArray<2, unsigned int> labeling(src.shape());
.. // put seeds in 'labeling', e.g. from an interactive labeling program,
// make sure that label 1 corresponds to the background
// bias the watershed algorithm so that the background is preferred
// by reducing the cost for label 1 to 90%
watershedsMultiArray(gradMag, labeling,
WatershedOptions().biasLabel(1, 0.9));
}
// example 4
{
MultiArray<2, unsigned int> labeling(src.shape());
// use the fast union-find algorithm with 4-neighborhood
watershedsMultiArray(gradMag, labeling, WatershedOptions().unionFind());
}
vigra::SeedOptions
Options object for generateWatershedSeeds().
Definition watersheds.hxx:330

## ◆ noiseVarianceEstimation()

template<... >

void noiseVarianceEstimation | ( |  | ... | ) |

Determine the noise variance as a function of the image intensity.

This operator applies an algorithm described in

W. Förstner: "Image Preprocessing for Feature Extraction in Digital Intensity, Color and Range Images", Proc. Summer School on Data Analysis and the Statistical Foundations of Geomatics, Lecture Notes in Earth Science, Berlin: Springer, 1999

in order to estimate the noise variance as a function of the image intensity in a robust way, i.e. so that intensity changes due to edges do not bias the estimate. The source value type (`SrcAccessor::value_type`) must be a scalar type which is convertible to `double`. The result is written into the result sequence, whose `value_type` must be constructible from two `double` values. The following options can be set via the options object (see vigra::NoiseNormalizationOptions for details):

`useGradient`, `windowRadius`, `noiseEstimationQuantile`, `noiseVarianceInitialGuess`

Declarations:

pass 2D array views:

namespace vigra {
template <class T1, class S1, class BackInsertable>
void
noiseVarianceEstimation(MultiArrayView<2, T1, S1> const & src,
BackInsertable & result,
NoiseNormalizationOptions const & options = NoiseNormalizationOptions());
}
vigra::NoiseNormalizationOptions
Pass options to one of the noise normalization functions.
Definition noise_normalization.hxx:90
vigra::noiseVarianceEstimation
void noiseVarianceEstimation(...)
Determine the noise variance as a function of the image intensity.

show deprecated declarations

pass Image Iterators and Data Accessors :
namespace vigra {
template <class SrcIterator, class SrcAccessor, class BackInsertable>
void noiseVarianceEstimation(SrcIterator sul, SrcIterator slr, SrcAccessor src,
BackInsertable & result,
NoiseNormalizationOptions const & options = NoiseNormalizationOptions());
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
template <class SrcIterator, class SrcAccessor, class BackInsertable>
void noiseVarianceEstimation(triple<SrcIterator, SrcIterator, SrcAccessor> src,
BackInsertable & result,
NoiseNormalizationOptions const & options = NoiseNormalizationOptions());
}

Usage:

#include <vigra/noise_normalization.hxx>
Namespace: vigra

MultiArray<2, float> src(w,h);
std::vector<TinyVector<double, 2> > result;
...
noiseVarianceEstimation(src, result,
NoiseNormalizationOptions().windowRadius(9).noiseVarianceInitialGuess(25.0));
// print the intensity / variance pairs found
for(int k=0; k<result.size(); ++k)
std::cout << "Intensity: " << result[k][0] << ", estimated variance: " << result[k][1] << std::endl;

show deprecated examples

vigra::BImage src(w,h);
std::vector<vigra::TinyVector<double, 2> > result;
...
vigra::noiseVarianceEstimation(srcImageRange(src), result,
vigra::NoiseNormalizationOptions().windowRadius(9).noiseVarianceInitialGuess(25.0));
// print the intensity / variance pairs found
for(int k=0; k<result.size(); ++k)
std::cout << "Intensity: " << result[k][0] << ", estimated variance: " << result[k][1] << std::endl;
Required Interface:
SrcIterator upperleft, lowerright;
SrcAccessor src;
typedef SrcAccessor::value_type SrcType;
typedef NumericTraits<SrcType>::isScalar isScalar;
assert(isScalar::asBool == true);
double value = src(uperleft);
BackInsertable result;
typedef BackInsertable::value_type ResultType;
double intensity, variance;
result.push_back(ResultType(intensity, variance));

## ◆ noiseVarianceClustering()

template<... >

void noiseVarianceClustering | ( |  | ... | ) |

Determine the noise variance as a function of the image intensity and cluster the results.

This operator first calls noiseVarianceEstimation() to obtain a sequence of intensity/variance pairs, which are then clustered using the median cut algorithm. Then the cluster centers (i.e. average variance vs. average intensity) are determined and returned in the result sequence.

In addition to the options valid for noiseVarianceEstimation(), the following options can be set via the options object (see vigra::NoiseNormalizationOptions for details):

`clusterCount`, `averagingQuantile`

Declarations:

pass 2D array views:

namespace vigra {
template <class T1, class S1, class BackInsertable>
void
noiseVarianceClustering(MultiArrayView<2, T1, S1> const & src,
BackInsertable & result,
NoiseNormalizationOptions const & options = NoiseNormalizationOptions());
}
vigra::noiseVarianceClustering
void noiseVarianceClustering(...)
Determine the noise variance as a function of the image intensity and cluster the results.

show deprecated declarations

pass Image Iterators and Data Accessors :
namespace vigra {
template <class SrcIterator, class SrcAccessor, class BackInsertable>
void noiseVarianceClustering(SrcIterator sul, SrcIterator slr, SrcAccessor src,
BackInsertable & result,
NoiseNormalizationOptions const & options = NoiseNormalizationOptions());
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
template <class SrcIterator, class SrcAccessor, class BackInsertable>
void noiseVarianceClustering(triple<SrcIterator, SrcIterator, SrcAccessor> src,
BackInsertable & result,
NoiseNormalizationOptions const & options = NoiseNormalizationOptions());
}

Usage:

#include <vigra/noise_normalization.hxx>
Namespace: vigra

MultiArray<2, float> src(w,h);
std::vector<TinyVector<double, 2> > result;
...
noiseVarianceClustering(src, result,
NoiseNormalizationOptions().windowRadius(9).noiseVarianceInitialGuess(25.0).
clusterCount(15));
// print the intensity / variance pairs representing the cluster centers
for(int k=0; k<result.size(); ++k)
std::cout << "Cluster: " << k << ", intensity: " << result[k][0] << ", estimated variance: " << result[k][1] << std::endl;

show deprecated examples

vigra::BImage src(w,h);
std::vector<vigra::TinyVector<double, 2> > result;
...
vigra::noiseVarianceClustering(srcImageRange(src), result,
vigra::NoiseNormalizationOptions().windowRadius(9).noiseVarianceInitialGuess(25.0).
clusterCount(15));
// print the intensity / variance pairs representing the cluster centers
for(int k=0; k<result.size(); ++k)
std::cout << "Cluster: " << k << ", intensity: " << result[k][0] << ", estimated variance: " << result[k][1] << std::endl;
Required Interface: same as noiseVarianceEstimation()

## ◆ nonparametricNoiseNormalization()

template<... >

bool nonparametricNoiseNormalization | ( |  | ... | ) |

Noise normalization by means of an estimated non-parametric noise model.

The original image is assumed to be corrupted by noise whose variance depends on the intensity in an unknown way. The present functions first calls noiseVarianceClustering() to obtain a sequence of intensity/variance pairs (cluster centers) which estimate this dependency. The cluster centers are connected into a piecewise linear function which is the inverted according to the formula derived in

W. Förstner: "Image Preprocessing for Feature Extraction in Digital Intensity, Color and Range Images", Proc. Summer School on Data Analysis and the Statistical Foundations of Geomatics, Lecture Notes in Earth Science, Berlin: Springer, 1999

The inverted formula defines a pixel-wise intensity transformation whose application turns the original image into one that is corrupted by additive Gaussian noise with unit variance. Most subsequent algorithms will be able to handle this type of noise much better than the original noise.

RGB and other multiband images will be processed one band at a time. The function returns `true` on success. Noise normalization will fail if the original image does not contain sufficiently homogeneous regions that allow robust estimation of the noise variance.

The options object may use all options described in vigra::NoiseNormalizationOptions.

The function returns `false` if the noise estimation failed, so that no normalization could be performed.

Declarations:

pass 2D array views:

namespace vigra {
template <class T1, class S1,
class T2, class S2>
bool
nonparametricNoiseNormalization(MultiArrayView<2, T1, S1> const & src,
MultiArrayView<2, T2, S2> dest,
NoiseNormalizationOptions const & options = NoiseNormalizationOptions());
}
vigra::nonparametricNoiseNormalization
bool nonparametricNoiseNormalization(...)
Noise normalization by means of an estimated non-parametric noise model.

show deprecated declarations

pass Image Iterators and Data Accessors :
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor>
bool nonparametricNoiseNormalization(SrcIterator sul, SrcIterator slr, SrcAccessor src,
DestIterator dul, DestAccessor dest,
NoiseNormalizationOptions const & options = NoiseNormalizationOptions());
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor>
bool nonparametricNoiseNormalization(triple<SrcIterator, SrcIterator, SrcAccessor> src,
pair<DestIterator, DestAccessor> dest,
NoiseNormalizationOptions const & options = NoiseNormalizationOptions());
}

Usage:

#include <vigra/noise_normalization.hxx>
Namespace: vigra

MultiArray<2, RGBValue<float> > src(w,h), dest(w, h);
...
nonparametricNoiseNormalization(src, dest,
NoiseNormalizationOptions().windowRadius(9).noiseVarianceInitialGuess(25.0).
clusterCount(15));

show deprecated examples

vigra::BRGBImage src(w,h), dest(w, h);
...
vigra::nonparametricNoiseNormalization(srcImageRange(src), destImage(dest),
vigra::NoiseNormalizationOptions().windowRadius(9).noiseVarianceInitialGuess(25.0).
clusterCount(15));
Required Interface: same as noiseVarianceEstimation()

## ◆ quadraticNoiseNormalization()

template<... >

bool quadraticNoiseNormalization | ( |  | ... | ) |

Noise normalization by means of an estimated or given quadratic noise model.

This function works like nonparametricNoiseNormalization() excapt that the model for the dependency between intensity and noise variance is assumed to be a quadratic function rather than a piecewise linear function. If the data conform to the quadratic model, this leads to a somewhat smoother transformation. The function returns `false` if the noise estimation failed, so that no normalization could be performed.

In the second variant of the function, the parameters of the quadratic model are not estimated, but explicitly given according to:

variance = a0 + a1 * intensity + a2 * sq(intensity)

Declarations:

pass 2D array views:

namespace vigra {
// estimate and apply a quadratic noise model
template <class T1, class S1,
class T2, class S2>
bool
quadraticNoiseNormalization(MultiArrayView<2, T1, S1> const & src,
MultiArrayView<2, T2, S2> dest,
NoiseNormalizationOptions const & options = NoiseNormalizationOptions());
// apply a given quadratic noise model
template <class T1, class S1,
class T2, class S2>
void
quadraticNoiseNormalization(MultiArrayView<2, T1, S1> const & src,
MultiArrayView<2, T2, S2> dest,
double a0, double a1, double a2);
}
vigra::quadraticNoiseNormalization
bool quadraticNoiseNormalization(...)
Noise normalization by means of an estimated or given quadratic noise model.

show deprecated declarations

pass Image Iterators and Data Accessors :
namespace vigra {
// estimate and apply a quadratic noise model
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor>
bool quadraticNoiseNormalization(SrcIterator sul, SrcIterator slr, SrcAccessor src,
DestIterator dul, DestAccessor dest,
NoiseNormalizationOptions const & options = NoiseNormalizationOptions());
// apply a given quadratic noise model
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor>
void quadraticNoiseNormalization(SrcIterator sul, SrcIterator slr, SrcAccessor src,
DestIterator dul, DestAccessor dest,
double a0, double a1, double a2);
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
// estimate and apply a quadratic noise model
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor>
bool quadraticNoiseNormalization(triple<SrcIterator, SrcIterator, SrcAccessor> src,
pair<DestIterator, DestAccessor> dest,
NoiseNormalizationOptions const & options = NoiseNormalizationOptions());
// apply a given quadratic noise model
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor>
void quadraticNoiseNormalization(triple<SrcIterator, SrcIterator, SrcAccessor> src,
pair<DestIterator, DestAccessor> dest,
double a0, double a1, double a2);
}

Usage:

#include <vigra/noise_normalization.hxx>
Namespace: vigra

MultiArray<2, RGBValue<float> > src(w,h), dest(w, h);
...
// estimate the noise model and apply it to normalize the noise variance
bool success = quadraticNoiseNormalization(src, dest,
NoiseNormalizationOptions().windowRadius(9).noiseVarianceInitialGuess(25.0).
clusterCount(15));
vigra_postcondition(success, "quadraticNoiseNormalization(): Unable to estimate noise model.");
// apply a pre-computed noise model
quadraticNoiseNormalization(src, dest, 100, 0.02, 1e-6);

show deprecated examples

vigra::BRGBImage src(w,h), dest(w, h);
...
// estimate the noise model and apply it to normalize the noise variance
vigra::quadraticNoiseNormalization(srcImageRange(src), destImage(dest),
vigra::NoiseNormalizationOptions().windowRadius(9).noiseVarianceInitialGuess(25.0).
clusterCount(15));
// apply a pre-computed noise model
vigra::quadraticNoiseNormalization(srcImageRange(src), destImage(dest),
100, 0.02, 1e-6);

Required Interface:

The source value type must be convertible to `double` or must be a vector whose elements are convertible to `double`. Likewise, the destination type must be assignable from `double` or a vector whose elements are assignable from `double`.

## ◆ linearNoiseNormalization()

template<... >

bool linearNoiseNormalization | ( |  | ... | ) |

Noise normalization by means of an estimated or given linear noise model.

This function works like nonparametricNoiseNormalization() excapt that the model for the dependency between intensity and noise variance is assumed to be a linear function rather than a piecewise linear function. If the data conform to the linear model, this leads to a very simple transformation which is similar to the familiar gamma correction. The function returns `false` if the noise estimation failed, so that no normalization could be performed.

In the second variant of the function, the parameters of the linear model are not estimated, but explicitly given according to:

variance = a0 + a1 * intensity

Declarations:

pass 2D array views:

namespace vigra {
// estimate and apply a linear noise model
template <class T1, class S1,
class T2, class S2>
bool
linearNoiseNormalization(MultiArrayView<2, T1, S1> const & src,
MultiArrayView<2, T2, S2> dest,
NoiseNormalizationOptions const & options = NoiseNormalizationOptions());
// apply a given linear noise model
template <class T1, class S1,
class T2, class S2>
void
linearNoiseNormalization(MultiArrayView<2, T1, S1> const & src,
MultiArrayView<2, T2, S2> dest,
double a0, double a1);
}
vigra::linearNoiseNormalization
bool linearNoiseNormalization(...)
Noise normalization by means of an estimated or given linear noise model.

show deprecated declarations

pass Image Iterators and Data Accessors :
namespace vigra {
// estimate and apply a linear noise model
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor>
bool linearNoiseNormalization(SrcIterator sul, SrcIterator slr, SrcAccessor src,
DestIterator dul, DestAccessor dest,
NoiseNormalizationOptions const & options = NoiseNormalizationOptions());
// apply a given linear noise model
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor>
void linearNoiseNormalization(SrcIterator sul, SrcIterator slr, SrcAccessor src,
DestIterator dul, DestAccessor dest,
double a0, double a1);
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
// estimate and apply a linear noise model
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor>
bool linearNoiseNormalization(triple<SrcIterator, SrcIterator, SrcAccessor> src,
pair<DestIterator, DestAccessor> dest,
NoiseNormalizationOptions const & options = NoiseNormalizationOptions());
// apply a given linear noise model
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor>
void linearNoiseNormalization(triple<SrcIterator, SrcIterator, SrcAccessor> src,
pair<DestIterator, DestAccessor> dest,
double a0, double a1);
}

Usage:

#include <vigra/noise_normalization.hxx>
Namespace: vigra

vigra::BRGBImage src(w,h), dest(w, h);
...
// estimate the noise model and apply it to normalize the noise variance
bool success = linearNoiseNormalization(src, dest,
NoiseNormalizationOptions().windowRadius(9).noiseVarianceInitialGuess(25.0).
clusterCount(15));
vigra_postcondition(success, "linearNoiseNormalization(): Unable to estimate noise model.");
// apply a pre-computed noise model
linearNoiseNormalization(src, dest, 100, 0.02);

show deprecated examples

vigra::BRGBImage src(w,h), dest(w, h);
...
// estimate the noise model and apply it to normalize the noise variance
vigra::linearNoiseNormalization(srcImageRange(src), destImage(dest),
vigra::NoiseNormalizationOptions().windowRadius(9).noiseVarianceInitialGuess(25.0).
clusterCount(15));
// apply a pre-computed noise model
vigra::linearNoiseNormalization(srcImageRange(src), destImage(dest),
100, 0.02);

Required Interface:

The source value type must be convertible to `double` or must be a vector whose elements are convertible to `double`. Likewise, the destination type must be assignable from `double` or a vector whose elements are assignable from `double`.

## ◆ nonlinearDiffusion()

template<... >

void nonlinearDiffusion | ( |  | ... | ) |

Perform edge-preserving smoothing at the given scale.

The algorithm solves the non-linear diffusion equation

where t is the time, x is the location vector, u( x , t) is the smoothed image at time t, and g(.) is the location dependent diffusivity. At time zero, the image u( x , 0) is simply the original image. The time is proportional to the square of the scale parameter: . The diffusion equation is solved iteratively according to the Additive Operator Splitting Scheme (AOS) from

J. Weickert: "Recursive Separable Schemes for Nonlinear Diffusion Filters", in: B. ter Haar Romeny, L. Florack, J. Koenderingk, M. Viergever (eds.): 1st Intl. Conf. on Scale-Space Theory in Computer Vision 1997, Springer LNCS 1252

`DiffusivityFunctor` implements the gradient-dependent local diffusivity. It is passed as an argument to gradientBasedTransform(). The return value must be between 0 and 1 and determines the weight a pixel gets when its neighbors are smoothed. Weickert recommends the use of the diffusivity implemented by class DiffusivityFunctor. It's also possible to use other functors, for example one that always returns 1, in which case we obtain the solution to the linear diffusion equation, i.e. Gaussian convolution.

The source value type must be a linear space with internal addition, scalar multiplication, and NumericTraits defined. The value_type of the DiffusivityFunctor must be the scalar field over wich the source value type's linear space is defined.

In addition to `nonlinearDiffusion()`, there is an algorithm `nonlinearDiffusionExplicit()` which implements the Explicit Scheme described in the above article. Both algorithms have the same interface, but the explicit scheme gives slightly more accurate approximations of the diffusion process at the cost of much slower processing.

Declarations:

pass 2D array views:

namespace vigra {
template <class T1, class S1,
class T2, class S2,
class DiffusivityFunc>
void
nonlinearDiffusion(MultiArrayView<2, T1, S1> const & src,
MultiArrayView<2, T2, S2> dest,
DiffusivityFunc const & weight, double scale);
template <class T1, class S1,
class T2, class S2,
class DiffusivityFunc>
void
nonlinearDiffusionExplicit(MultiArrayView<2, T1, S1> const & src,
MultiArrayView<2, T2, S2> dest,
DiffusivityFunc const & weight, double scale);
}
vigra::nonlinearDiffusion
void nonlinearDiffusion(...)
Perform edge-preserving smoothing at the given scale.
vigra::nonlinearDiffusionExplicit
void nonlinearDiffusionExplicit(...)
Perform edge-preserving smoothing at the given scale using an explicit scheme.

show deprecated declarations

pass Image Iterators and Data Accessors :
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor,
class DiffusivityFunctor>
void nonlinearDiffusion(SrcIterator sul, SrcIterator slr, SrcAccessor as,
DestIterator dul, DestAccessor ad,
DiffusivityFunctor const & weight, double scale);
}
vigra::DiffusivityFunctor
Diffusivity functor for non-linear diffusion.
Definition nonlineardiffusion.hxx:706
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor,
class DiffusivityFunctor>
void nonlinearDiffusion(
triple<SrcIterator, SrcIterator, SrcAccessor> src,
pair<DestIterator, DestAccessor> dest,
DiffusivityFunctor const & weight, double scale);
}

Usage:

#include <vigra/nonlineardiffusion.hxx>
Namespace: vigra

MultiArray<2, float> src(w,h), dest(w,h);
float edge_threshold, scale;
...
nonlinearDiffusion(src, dest,
DiffusivityFunctor<float>(edge_threshold), scale);

show deprecated examples

FImage src(w,h), dest(w,h);
float edge_threshold, scale;
...
nonlinearDiffusion(srcImageRange(src), destImage(dest),
DiffusivityFunctor<float>(edge_threshold), scale);
Required Interface:

- `SrcIterator` and `DestIterator` are models of ImageIterator
- `SrcAccessor` and `DestAccessor` are models of StandardAccessor
- `SrcAccessor::value_type` is a linear space
- `DiffusivityFunctor` conforms to the requirements of gradientBasedTransform(). Its range is between 0 and 1.
- `DiffusivityFunctor::value_type` is an algebraic field

Precondition:

`scale > 0`

See also
  vigra::DiffusivityFunctor

## ◆ nonlinearDiffusionExplicit()

template<... >

void nonlinearDiffusionExplicit | ( |  | ... | ) |

Perform edge-preserving smoothing at the given scale using an explicit scheme.

See nonlinearDiffusion().

## ◆ hourGlassFilter()

template<... >

void hourGlassFilter | ( |  | ... | ) |

Anisotropic tensor smoothing with the hourglass filter.

This function implements anisotropic tensor smoothing by an hourglass-shaped filters as described in

U. Köthe: "Edge and Junction Detection with an Improved Structure Tensor", in: Proc. of 25th DAGM Symposium, Magdeburg 2003, Lecture Notes in Computer Science 2781, pp. 25-32, Heidelberg: Springer, 2003

It is closely related to the structure tensor (see structureTensor()), but replaces the linear tensor smoothing with a smoothing along edges only. Smoothing across edges is largely suppressed. This means that the image structure is preserved much better because nearby features such as parallel edges are not blended into each other.

The hourglass filter is typically applied to a gradient tensor, i.e. the Euclidean product of the gradient with itself, which can be obtained by a gradient operator followed with vectorToTensor(), see example below. The hourglass shape of the filter can be interpreted as indicating the likely continuations of a local edge element. The parameter `sigma` determines the radius of the hourglass (i.e. how far the influence of the edge element reaches), and `rho` controls its opening angle (i.e. how narrow the edge orientation os followed). Recommended values are `sigma = 1.4` (or, more generally, two to three times the scale of the gradient operator used in the first step), and `rho = 0.4` which corresponds to an opening angle of 22.5 degrees to either side of the edge.

Declarations:

pass 2D array views:

namespace vigra {
template <class T1, class S1,
class T2, class S2>
void
hourGlassFilter(MultiArrayView<2, T1, S1> const & src,
MultiArrayView<2, T2, S2> dest,
double sigma, double rho);
}
vigra::hourGlassFilter
void hourGlassFilter(...)
Anisotropic tensor smoothing with the hourglass filter.

show deprecated declarations

pass Image Iterators and Data Accessors :
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor>
void hourGlassFilter(SrcIterator sul, SrcIterator slr, SrcAccessor src,
DestIterator dul, DestAccessor dest,
double sigma, double rho);
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor>
inline
void hourGlassFilter(triple<SrcIterator, SrcIterator, SrcAccessor> s,
pair<DestIterator, DestAccessor> d,
double sigma, double rho);
}

Usage:

#include <vigra/orientedtensorfilters.hxx>
Namespace: vigra

MultiArray<2, float> img(w,h);
MultiArray<2, TinyVector<float, 2> > gradient(w,h);
MultiArray<2, TinyVector<float, 3> > tensor(w,h), smoothedTensor(w,h);
gaussianGradient(img, gradient, 1.0);
vectorToTensor(gradient, tensor);
hourGlassFilter(tensor, smoothedTensor, 2.0, 0.4);
vigra::vectorToTensor
void vectorToTensor(...)
Calculate the tensor (outer) product of a 2D vector with itself.

show deprecated examples

FImage img(w,h);
FVector2Image gradient(w,h);
FVector3Image tensor(w,h), smoothedTensor(w,h);
gaussianGradient(srcImageRange(img), destImage(gradient), 1.0);
vectorToTensor(srcImageRange(gradient), destImage(tensor));
hourGlassFilter(srcImageRange(tensor), destImage(smoothedTensor), 2.0, 0.4);

See also
  vectorToTensor()

## ◆ isAtImageBorder()

AtImageBorder isAtImageBorder | ( | int | x,
|  | int | y,
|  | int | width,
|  | int | height
| ) |  |

Find out whether a point is at the image border.

This function checks if x == 0 or x == width - 1 and y == 0 or y == height - 1 and returns the appropriate value of vigra::AtImageBorder, or zero when the point is not at the image border. The behavior of the function is undefined if (x,y) is not inside the image.

#include <vigra/pixelneighborhood.hxx>
Namespace: vigra

## ◆ extractContour()

template<class T , class S , class PointArray >

void extractContour | ( | MultiArrayView< 2, T, S > const & | label_image,
|  | Shape2 const & | anchor_point,
|  | PointArray & | contour_points
| ) |  |

protected

Create a polygon from the interpixel contour of a labeled region.

The point anchor_point must be in the region whose contour we want to extract, and must be adjacent to the contour. The algorithm uses the 'left hand on the wall' algorithm to trace the connected component whose label equals the label of the anchor_point. The contour is returned in countour_points as a closed polygon that circles the region counter-clockwise in the image coordinate system (i.e. the coordinate system where x points to the right and y points downwards). Since the resulting polygon represents the interpixel contour, all points will have one integer and one half-integer coordinate.

## ◆ convexHull()

template<class PointArray1 , class PointArray2 >

void convexHull | ( | const PointArray1 & | points,
|  | PointArray2 & | convex_hull
| ) |  |

protected

Compute convex hull of a 2D polygon.

The input array points contains a (not necessarily ordered) set of 2D points whose convex hull is to be computed. The array's `value_type` (i.e. the point type) must be compatible with std::vector (in particular, it must support indexing, copying, and have `size() == 2`). The points of the convex hull will be appended to the output array convex_hull (which must support `std::back_inserter(convex_hull)`). Since the convex hull is a closed polygon, the first and last point of the output will be the same (i.e. the first point will simply be inserted at the end again). The points of the convex hull will be ordered counter-clockwise, starting with the leftmost point of the input. The function implements Andrew's Monotone Chain algorithm.

## ◆ fillPolygon()

template<class Point , class T , class S , class Value >

void fillPolygon | ( | Polygon< Point > const & | p,
|  | MultiArrayView< 2, T, S > & | output_image,
|  | Value | value
| ) |  |

protected

Render closed polygon p into the image output_image.

All pixels on the polygon's contour and in its interior are set to the given value. Parts of the polygon outside the image region are clipped. The function uses a robust X-intersection array algorithm that is able to handle all corner cases (concave and self-intersecting polygons, knots on integer coordinates).

## ◆ polynomialRoots()

template<class POLYNOMIAL , class VECTOR >

bool polynomialRoots | ( | POLYNOMIAL const & | poriginal,
|  | VECTOR & | roots,
|  | bool | polishRoots
| ) |  |

Determine the roots of the polynomial `poriginal`.

The roots are appended to the vector `roots`, with optional root polishing as specified by `polishRoots` (default: do polishing). The function uses an improved version of Laguerre's algorithm. The improvements are as follows:

- It uses a clever initial guess for the iteration, according to a proposal by Tien Chen
- It estimates each root's multiplicity, again according to Tien Chen, and reduces multiplicity by switching to the polynomial's derivative (which has the same root, with multiplicity reduced by one), as proposed by C. Bond.

The algorithm has been successfully used for polynomials up to order 80. The function stops and returns `false` if an iteration fails to converge within 80 steps. The type `POLYNOMIAL` must be compatible to vigra::PolynomialView, `VECTOR` must be compatible to `std::vector` with a `value_type` compatible to the type `POLYNOMIAL::Complex`.

Declaration:

pass arguments explicitly:

namespace vigra {
template <class POLYNOMIAL, class VECTOR>
bool
polynomialRoots(POLYNOMIAL const & poriginal, VECTOR & roots, bool polishRoots = true);
}
vigra::polynomialRoots
bool polynomialRoots(POLYNOMIAL const &poriginal, VECTOR &roots, bool polishRoots)
Definition polynomial.hxx:939

Usage:

#include <vigra/polynomial.hxx>
Namespace: vigra

// encode the polynomial x^4 - 1
Polynomial<double> poly(4);
poly[0] = -1.0;
poly[4] = 1.0;
ArrayVector<std::complex<double> > roots;
polynomialRoots(poly, roots);

See also
  polynomialRootsEigenvalueMethod()

## ◆ polynomialRealRoots()

template<class POLYNOMIAL , class VECTOR >

bool polynomialRealRoots | ( | POLYNOMIAL const & | p,
|  | VECTOR & | roots,
|  | bool | polishRoots
| ) |  |

Determine the real roots of the polynomial `p`.

This function simply calls polynomialRoots() and than throws away all complex roots. Accordingly, `VECTOR` must be compatible to `std::vector` with a `value_type` compatible to the type `POLYNOMIAL::Real`.

Declaration:

pass arguments explicitly:

namespace vigra {
template <class POLYNOMIAL, class VECTOR>
bool
polynomialRealRoots(POLYNOMIAL const & p, VECTOR & roots, bool polishRoots = true);
}
vigra::polynomialRealRoots
bool polynomialRealRoots(POLYNOMIAL const &p, VECTOR &roots, bool polishRoots)
Definition polynomial.hxx:1076

Usage:

#include <vigra/polynomial.hxx>
Namespace: vigra

// encode the polynomial x^4 - 1
Polynomial<double> poly(4);
poly[0] = -1.0;
poly[4] = 1.0;
ArrayVector<double> roots;
polynomialRealRoots(poly, roots);

See also
  polynomialRealRootsEigenvalueMethod()

## ◆ polynomialWarpWeights()

std::vector< double > polynomialWarpWeights | ( | double | x,
|  | double | y,
|  | unsigned int | polynom_order
| ) |  |

Iterative function for determinination of the polynom weights:

Example: order=2, x, y --—> [1, x, y, x^2, x*y, y^2]

This function is needed, because the polynomial transformation Matrix has the the same number of rows. the target position is then determined by multiplying each x- and y-transformation result value with the corresponding weight for the current x- and y-coordinate, given by this function.

## ◆ polynomialMatrix2DFromCorrespondingPoints()

template<int PolynomOrder, class SrcPointIterator , class DestPointIterator >

linalg::TemporaryMatrix< double > polynomialMatrix2DFromCorrespondingPoints | ( | SrcPointIterator | s,
|  | SrcPointIterator | s_end,
|  | DestPointIterator | d
| ) |  |

Create polynomial matrix of a certain degree that maps corresponding points onto each other.

For use with polynomialWarpImage() of same degree.

Since polynoms are usually non-linear functions, a special semantics is embedded to define a matrix here. Each matrix consist of two rows, containing x- and y-factors of the polynom.

The meaning of the matrix is explained at the example of a polynom of 2nd order:

First Row = [a_x b_x c_x d_x e_x f_x] Second Row = [a_y b_y c_y d_y e_y f_y]

The transformed coordinate p'=[x' y'] of a position p=[x y] is then:

x' = a_x + b_x*x + c_x*y + d_x*x^2 + e_x*x*y + f_x*y^2 y' = a_y + b_y*x + c_y*y + d_y*x^2 + e_y*x*y + f_y*y^2

Note that the order of the polynom's factors is directly influenced by the polynomialWarpWeights() function and follows the intuitive scheme.

## ◆ polynomialWarpImage()

template<... >

void polynomialWarpImage | ( |  | ... | ) |

Warp an image according to an polynomial transformation.

To get more information about the structure of the matrix, see polynomialMatrix2DFromCorrespondingPoints().

#include <vigra/polynomial_registration.hxx>
Namespace: vigra

pass 2D array views:

namespace vigra {
template <int ORDER, class T,
class T2, class S2,
class C>
void
polynomialWarpImage(SplineImageView<ORDER, T> const & src,
MultiArrayView<2, T2, S2> dest,
MultiArrayView<2, double, C> const & polynomialMatrix);
}
vigra::polynomialWarpImage
void polynomialWarpImage(...)
Warp an image according to an polynomial transformation.

show deprecated declarations

pass arguments explicitly:
namespace vigra {
template <int ORDER, class T,
class DestIterator, class DestAccessor,
class C>
void polynomialWarpImage(SplineImageView<ORDER, T> const & src,
DestIterator dul, DestIterator dlr, DestAccessor dest,
MultiArrayView<2, double, C> const & polynomialMatrix);
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
template <int ORDER, class T,
class DestIterator, class DestAccessor,
class C>
void polynomialWarpImage(SplineImageView<ORDER, T> const & src,
triple<DestIterator, DestIterator, DestAccessor> dest,
MultiArrayView<2, double, C> const & polynomialMatrix);
}

## ◆ projectiveMatrix2DFromCorrespondingPoints()

template<class SrcPointIterator , class DestPointIterator >

linalg::TemporaryMatrix< double > projectiveMatrix2DFromCorrespondingPoints | ( | SrcPointIterator | s,
|  | SrcPointIterator | send,
|  | DestPointIterator | d
| ) |  |

Create homogeneous matrix that maps corresponding points onto each other.

For use with projectiveWarpImage(). Since four corresponding points are needed to be given, the matrix will compute a full projective transform.

## ◆ projectiveWarpImage()

template<... >

void projectiveWarpImage | ( |  | ... | ) |

Warp an image according to an projective transformation.

The matrix can be computed from a set of correspondung points using projectiveMatrix2DFromCorrespondingPoints().

Declarations:

#include <vigra/projective_registration.hxx>
Namespace: vigra

pass 2D array views:

namespace vigra {
template <int ORDER, class T,
class T2, class S2,
class C>
void
projectiveWarpImage(SplineImageView<ORDER, T> const & src,
MultiArrayView<2, T2, S2> dest,
MultiArrayView<2, double, C> const & projectiveMatrix);
}
vigra::projectiveWarpImage
void projectiveWarpImage(...)
Warp an image according to an projective transformation.

show deprecated declarations

pass Image Iterators and Data Accessors :
pass arguments explicitly:
namespace vigra {
template <int ORDER, class T,
class DestIterator, class DestAccessor,
class C>
void projectiveWarpImage(SplineImageView<ORDER, T> const & src,
DestIterator dul, DestIterator dlr, DestAccessor dest,
MultiArrayView<2, double, C> const & projectiveMatrix);
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
template <int ORDER, class T,
class DestIterator, class DestAccessor,
class C>
void projectiveWarpImage(SplineImageView<ORDER, T> const & src,
triple<DestIterator, DestIterator, DestAccessor> dest,
MultiArrayView<2, double, C> const & projectiveMatrix);
}

The algorithm applies the given projectiveMatrix to the destination coordinates and copies the image value from the resulting source coordinates, using the given SplineImageView src for interpolation. If the resulting coordinate is outside the source image, nothing will be written at that destination point.

for all dest pixels:
currentSrcCoordinate = projectiveMatrix * currentDestCoordinate;
if src.isInside(currentSrcCoordinate):
dest[currentDestCoordinate] = src[currentSrcCoordinate]; // copy an interpolated value

The matrix represent a 2-dimensional projective transform by means of homogeneous coordinates, i.e. it must be a 3x3 matrix whose last row is (p1,p2,1).

Required Interface:

DestImageIterator dest_upperleft;
double x = ..., y = ...;
if (spline.isInside(x,y))
dest_accessor.set(spline(x, y), dest_upperleft);

See also: Functions to specify projective transformation: translationMatrix2D(), scalingMatrix2D(), shearMatrix2D(), rotationMatrix2DRadians(), rotationMatrix2DDegrees() and projectiveMatrix2DFromCorrespondingPoints()

## ◆ quadraticProgramming()

template<... >

unsigned int quadraticProgramming | ( |  | ... | ) |

Solve Quadratic Programming Problem.

The quadraticProgramming() function implements the algorithm described in

D. Goldfarb, A. Idnani: "A numerically stable dual method for solving strictly convex quadratic programs", Mathematical Programming 27:1-33, 1983.

for the solution of (convex) quadratic programming problems by means of a primal-dual method.

#include <vigra/quadprog.hxx>
Namespaces: vigra

Declaration:

namespace vigra {
template <class T, class C1, class C2, class C3, class C4, class C5, class C6, class C7>
T
quadraticProgramming(MultiArrayView<2, T, C1> const & GG, MultiArrayView<2, T, C2> const & g,
MultiArrayView<2, T, C3> const & CE, MultiArrayView<2, T, C4> const & ce,
MultiArrayView<2, T, C5> const & CI, MultiArrayView<2, T, C6> const & ci,
MultiArrayView<2, T, C7> & x);
}
vigra::quadraticProgramming
unsigned int quadraticProgramming(...)

The problem must be specified in the form:

Matrix G G must be symmetric positive definite, and matrix CE must have full row rank. Matrix and vector dimensions must be as follows:

- G: [n * n], g: [n * 1]
- CE: [me * n], ce: [me * 1]
- CI: [mi * n], ci: [mi * 1]
- x: [n * 1]

The function writes the optimal solution into the vector x and returns the cost of this solution. If the problem is infeasible, `std::numeric_limits::infinity()` is returned. In this case the value of vector x is undefined.

Usage:

Minimize `f = 0.5 * x'*G*x + g'*x` subject to `-1 <= x <= 1`. The solution is `x' = [1.0, 0.5, -1.0]` with `f = -22.625`.

double Gdata[] = {13.0, 12.0, -2.0,
12.0, 17.0, 6.0,
-2.0, 6.0, 12.0};
double gdata[] = {-22.0, -14.5, 13.0};
double CIdata[] = { 1.0, 0.0, 0.0,
0.0, 1.0, 0.0,
0.0, 0.0, 1.0,
-1.0, 0.0, 0.0,
0.0, -1.0, 0.0,
0.0, 0.0, -1.0};
double cidata[] = {-1.0, -1.0, -1.0, -1.0, -1.0, -1.0};
Matrix<double> G(3,3, Gdata),
g(3,1, gdata),
CE, // empty since there are no equality constraints
ce, // likewise
CI(7,3, CIdata),
ci(7,1, cidata),
x(3,1);
double f = quadraticProgramming(G, g, CE, ce, CI, ci, x);

This algorithm can also be used to solve non-negative least squares problems (see nonnegativeLeastSquares() for an alternative algorithm). Consider the problem to minimize `f = (A*x - b)' * (A*x - b)` subject to `x >= 0`. Expanding the product in the objective gives `f = x'*A'*A*x - 2*b'*A*x + b'*b`. This is equivalent to the problem of minimizing `fn = 0.5 * x'*G*x + g'*x` with `G = A'*A` and `g = -A'*b` (the constant term `b'*b` has no effect on the optimal solution and can be dropped). The following code computes the solution `x' = [18.4493, 0, 4.50725]`:

double A_data[] = {
1, -3, 2,
-3, 10, -5,
2, -5, 6
};
double b_data[] = {
27,
-78,
64
};
Matrix<double> A(3, 3, A_data),
b(3, 1, b_data),
G = transpose(A)*A,
g = -(transpose(A)*b),
CE, // empty since there are no equality constraints
ce, // likewise
CI = identityMatrix<double>(3), // constrain all elements of x
ci(3, 1, 0.0), // ... to be non-negative
x(3, 1);
quadraticProgramming(G, g, CE, ce, CI, ci, x);
vigra::linalg::transpose
void transpose(const MultiArrayView< 2, T, C1 > &v, MultiArrayView< 2, T, C2 > &r)
Definition matrix.hxx:965

## ◆ randomTT800()

RandomTT800 & randomTT800 | ( |  | ) |

Access the global (program-wide) instance of the TT800 random number generator.

## ◆ randomMT19937()

RandomMT19937 & randomMT19937 | ( |  | ) |

Access the global (program-wide) instance of the MT19937 random number generator.

## ◆ rf_default()

detail::RF_DEFAULT & rf_default | ( |  | ) |

factory function to return a RF_DEFAULT tag

See also
  RandomForest<>::learn()

## ◆ rf_export_HDF5() [1/3]

template<class T , class Tag >

void rf_export_HDF5 | ( | const RandomForest< T, Tag > & | rf,
|  | HDF5File & | h5context,
|  | const std::string & | pathname = `""`
| ) |  |

Save a random forest to an HDF5File object into a specified HDF5 group.

The random forest is saved as a set of HDF5 datasets, groups, and attributes below a certain HDF5 group (default: current group of the HDF5File object). No additional data should be stored in that group.

Parameters

  rf | Random forest object to be exported
  h5context | HDF5File object to use
  pathname | If empty or not supplied, save the random forest to the current group of the HDF5File object. Otherwise, save to a new-created group specified by the path name, which may be either relative or absolute.

## ◆ rf_export_HDF5() [2/3]

template<class T , class Tag >

void rf_export_HDF5 | ( | const RandomForest< T, Tag > & | rf,
|  | const std::string & | filename,
|  | const std::string & | pathname = `""`
| ) |  |

Save a random forest to a named HDF5 file into a specified HDF5 group.

The random forest is saved as a set of HDF5 datasets, groups, and attributes below a certain HDF5 group (default: root). No additional data should be stored in that group.

Parameters

  rf | Random forest object to be exported
  filename | Name of an HDF5 file to open
  pathname | If empty or not supplied, save the random forest to the root group of the HDF5 file. Otherwise, save to a new-created group specified by the path name (relative to the root group).

## ◆ rf_export_HDF5() [3/3]

template<class T , class Tag >

void rf_export_HDF5 | ( | const RandomForest< T, Tag > & | rf,
|  | hid_t | outf_id,
|  | const std::string & | pathname = `""`
| ) |  |

Save a random forest to an HDF5 file specified by its id.

The random forest is saved as a set of HDF5 datasets, groups, and attributes below a certain HDF5 group (default: root). No additional data should be stored in that group.

Warning
  In case the underlying HDF5 library used by Vigra is not exactly the same library used to open the file with the given id, this method will lead to crashes.

Parameters

  rf | Random forest object to be exported
  outf_id | HDF5 file id
  pathname | If empty or not supplied, save the random forest to the root group of the HDF5 file. Otherwise, save to a new-created group specified by the path name (relative to the root group).

## ◆ rf_import_HDF5() [1/3]

template<class T , class Tag >

bool rf_import_HDF5 | ( | RandomForest< T, Tag > & | rf,
|  | HDF5File & | h5context,
|  | const std::string & | pathname = `""`
| ) |  |

Read a random forest from an HDF5File object's specified group.

The random forest is read from a certain HDF5 group (default: current group of the HDF5File object) as a set of HDF5 datasets, groups, and attributes. No additional data should be present in that group.

Parameters

  rf | Random forest object to be imported
  h5context | HDF5File object to use
  pathname | If empty or not supplied, read from the random forest from the current group of the HDF5File object. Otherwise, use the group specified by the path name, which may be either relative or absolute.

## ◆ rf_import_HDF5() [2/3]

template<class T , class Tag >

bool rf_import_HDF5 | ( | RandomForest< T, Tag > & | rf,
|  | const std::string & | filename,
|  | const std::string & | pathname = `""`
| ) |  |

Read a random forest from a named HDF5 file's specified group.

The random forest is read from a certain HDF5 group (default: root group of the HDF5 file) as a set of HDF5 datasets, groups, and attributes. No additional data should be present in that group.

Parameters

  rf | Random forest object to be imported
  filename | Name of an HDF5 file to open
  pathname | If empty or not supplied, read from the random forest from the current group of the HDF5 file. Otherwise, use the group specified by the path name, which may be either relative or absolute.

## ◆ rf_import_HDF5() [3/3]

template<class T , class Tag >

bool rf_import_HDF5 | ( | RandomForest< T, Tag > & | rf,
|  | hid_t | inf_id,
|  | const std::string & | pathname = `""`
| ) |  |

Read a random forest from an HDF5 file specified by its id.

The random forest is read from a certain HDF5 group (default: root group of the HDF5 file) as a set of HDF5 datasets, groups, and attributes. No additional data should be present in that group.

Warning
  In case the underlying HDF5 library used by Vigra is not exactly the same library used to open the file with the given id, this method will lead to crashes.

Parameters

  rf | Random forest object to be imported
  inf_id | HDF5 file id
  pathname | If empty or not supplied, read from the random forest from the current group of the HDF5 file. Otherwise, use the group specified by the path name, which may be either relative or absolute.

## ◆ gcd()

template<typename IntType >

IntType gcd | ( | IntType | n,
|  | IntType | m
| ) |  |

Calculate the greatest common divisor.

This function works for arbitrary integer types, including user-defined (e.g. infinite precision) ones.

#include <vigra/rational.hxx>
Namespace: vigra

## ◆ lcm()

template<typename IntType >

IntType lcm | ( | IntType | n,
|  | IntType | m
| ) |  |

Calculate the lowest common multiple.

This function works for arbitrary integer types, including user-defined (e.g. infinite precision) ones.

#include <vigra/rational.hxx>
Namespace: vigra

## ◆ pow() [1/2]

template<typename IntType >

Rational< IntType > pow | ( | const Rational< IntType > & | r,
|  | int | e
| ) |  |

integer powers

`throws bad_rational` if indeterminate expression.

## ◆ rational_cast()

template<typename T , typename IntType >

T rational_cast | ( | const Rational< IntType > & | src | ) |

Type conversion

Executes `static_cast<T>(numerator()) / denominator()`.

Usage:

Rational<int> r;
int i;
double d;
i = rational_cast<int>(r); // round r downwards
d = rational_cast<double>(r); // represent rational as a double
r = rational_cast<Rational<int> >(r); // no change

## ◆ rbfMatrix2DFromCorrespondingPoints()

template<class RadialBasisFunctor , class SrcPointIterator , class DestPointIterator >

linalg::TemporaryMatrix< double > rbfMatrix2DFromCorrespondingPoints | ( | SrcPointIterator | s,
|  | SrcPointIterator | s_end,
|  | DestPointIterator | d,
|  | RadialBasisFunctor const & | rbf
| ) |  |

Create a matrix that maps corresponding points onto each other using a given RBF.

For use with rbfWarpImage(). For n given (corresponding) points, the matrix will be of size (n+3,2). Note that the representation of this matrix is exactly the same as the "W" matrix of Bookstein. More information can be found in the following article:

Fred L. Bookstein. Principal Warps: Thin-Plate Splines and the Decomposition of Deformations. IEEE PAMI, Vol 11, No 8. 1989

## ◆ rbfWarpImage()

template<int ORDER, class T , class DestIterator , class DestAccessor , class DestPointIterator , class C , class RadialBasisFunctor >

void rbfWarpImage | ( | SplineImageView< ORDER, T > const & | src,
|  | DestIterator | dul,
|  | DestIterator | dlr,
|  | DestAccessor | dest,
|  | DestPointIterator | d,
|  | DestPointIterator | d_end,
|  | MultiArrayView< 2, double, C > const & | W,
|  | RadialBasisFunctor | rbf
| ) |  |

Warp an image according to an radial basis function based transformation.

To get more information about the structure of the matrix, see rbfMatrix2DFromCorrespondingPoints()

#include <vigra/rbf_registration.hxx>
Namespace: vigra

pass 2D array views:

namespace vigra {
template <int ORDER, class T,
class T2, class S2,
class DestPointIterator,
class C,
class RadialBasisFunctor>
void
rbfWarpImage(SplineImageView<ORDER, T> const & src,
MultiArrayView<2, T2, S2> dest,
DestPointIterator d, DestPointIterator d_end,
MultiArrayView<2, double, C> const & W,
RadialBasisFunctor rbf);
}
vigra::rbfWarpImage
void rbfWarpImage(SplineImageView< ORDER, T > const &src, DestIterator dul, DestIterator dlr, DestAccessor dest, DestPointIterator d, DestPointIterator d_end, MultiArrayView< 2, double, C > const &W, RadialBasisFunctor rbf)
Warp an image according to an radial basis function based transformation.
Definition rbf_registration.hxx:238

show deprecated declarations

pass arguments explicitly:
namespace vigra {
template <int ORDER, class T,
class DestIterator, class DestAccessor,
class DestPointIterator,
class C,
class RadialBasisFunctor>
void
rbfWarpImage(SplineImageView<ORDER, T> const & src,
DestIterator dul, DestIterator dlr, DestAccessor dest,
DestPointIterator d, DestPointIterator d_end,
MultiArrayView<2, double, C> const & W,
RadialBasisFunctor rbf);
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
template <int ORDER, class T,
class DestIterator, class DestAccessor,
class DestPointIterator,
class C,
class RadialBasisFunctor>
void
rbfWarpImage(SplineImageView<ORDER, T> const & src,
triple<DestIterator, DestIterator, DestAccessor> dest,
DestPointIterator d, DestPointIterator d_end,
MultiArrayView<2, double, C> const & W,
RadialBasisFunctor rbf);
}
}

## ◆ recursiveFilterLine()

template<... >

void recursiveFilterLine | ( |  | ... | ) |

Performs a 1-dimensional recursive convolution of the source signal.

The function performs a causal and an anti-causal first or second order recursive filtering with the given filter parameter `b1` and border treatment `border` (first order filter, `b2 = 0`) or parameters `b1, b2` and `BORDER_TREATMENT_REFLECT` (second order filter). Thus, the result is always a filtering with linear phase.

The signal's value_type (SrcAccessor::value_type) must be a linear space over `double`, i.e. addition of source values, multiplication with `double`, and `NumericTraits` must be defined.

Declaration:

First order recursive filter:

namespace vigra {
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor>
void recursiveFilterLine(SrcIterator is, SrcIterator isend, SrcAccessor as,
DestIterator id, DestAccessor ad,
double b1, BorderTreatmentMode border)
}
vigra::recursiveFilterLine
void recursiveFilterLine(...)
Performs a 1-dimensional recursive convolution of the source signal.

Second order recursive filter:

namespace vigra {
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor>
void recursiveFilterLine(SrcIterator is, SrcIterator isend, SrcAccessor as,
DestIterator id, DestAccessor ad,
double b1, double b2)
}

Usage:

#include <vigra/recursiveconvolution.hxx>
Namespace: vigra

vector<float> src, dest;
...
DefaultAccessor<vector<float>::iterator, float> FAccessor;
recursiveFilterLine(src.begin(), src.end(), FAccessor(),
dest.begin(), FAccessor(),
0.5, BORDER_TREATMENT_REFLECT);
vigra::TinyVectorBase::end
iterator end()
Definition tinyvector.hxx:864

Required Interface:

RandomAccessIterator is, isend;
RandomAccessIterator id;
SrcAccessor src_accessor;
DestAccessor dest_accessor;
NumericTraits<SrcAccessor::value_type>::RealPromote s = src_accessor(is);
double d;
s = s + s;
s = d * s;
dest_accessor.set(
NumericTraits<DestAccessor::value_type>::fromRealPromote(s), id);

Preconditions:

-1 < b < 1

## ◆ recursiveGaussianFilterLine()

template<... >

void recursiveGaussianFilterLine | ( |  | ... | ) |

Compute a 1-dimensional recursive approximation of Gaussian smoothing.

The function applies a causal and an anti-causal third order recursive filter which optimally approximates the Gaussian filter, as proposed in

I. Young, L. van Vliet: Recursive implementation of the Gaussian filter
Signal Processing 44:139-151, 1995

The formulas for transforming the given scale parameter `sigma` into the actual filter coefficients are taken from Luigi Rosa's Matlab implementation.

The signal's value_type (SrcAccessor::value_type) must be a linear space over `double`, i.e. addition of source values, multiplication with `double`, and `NumericTraits` must be defined.

Declaration:

namespace vigra {
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor>
void
recursiveGaussianFilterLine(SrcIterator is, SrcIterator isend, SrcAccessor as,
DestIterator id, DestAccessor ad,
double sigma);
}
vigra::recursiveGaussianFilterLine
void recursiveGaussianFilterLine(...)
Compute a 1-dimensional recursive approximation of Gaussian smoothing.

Usage:

#include <vigra/recursiveconvolution.hxx>
Namespace: vigra

vector<float> src, dest;
...
vigra::DefaultAccessor<vector<float>::iterator, float> FAccessor;
double sigma = 2.5;
vigra::recursiveGaussianFilterLine(src.begin(), src.end(), FAccessor(),
dest.begin(), FAccessor(),
sigma);

Required Interface:

RandomAccessIterator is, isend;
RandomAccessIterator id;
SrcAccessor src_accessor;
DestAccessor dest_accessor;
NumericTraits<SrcAccessor::value_type>::RealPromote s = src_accessor(is);
double d;
s = s + s;
s = d * s;
dest_accessor.set(
NumericTraits<DestAccessor::value_type>::fromRealPromote(s), id);

Preconditions:

0 <= sigma (absolute values are used for negative sigma)

## ◆ recursiveSmoothLine()

template<... >

void recursiveSmoothLine | ( |  | ... | ) |

Convolves the image with a 1-dimensional exponential filter.

This function calls recursiveFilterLine() with `b = exp(-1.0/scale)` and `border = BORDER_TREATMENT_REPEAT`. See recursiveFilterLine() for more documentation.

Declaration:

namespace vigra {
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor>
void recursiveSmoothLine(SrcIterator is, SrcIterator isend, SrcAccessor as,
DestIterator id, DestAccessor ad, double scale)
}
vigra::recursiveSmoothLine
void recursiveSmoothLine(...)
Convolves the image with a 1-dimensional exponential filter.

Usage:

#include <vigra/recursiveconvolution.hxx>
Namespace: vigra

vector<float> src, dest;
...
vigra::DefaultAccessor<vector<float>::iterator, float> FAccessor;
vigra::recursiveSmoothLine(src.begin(), src.end(), FAccessor(),
dest.begin(), FAccessor(), 3.0);

Required Interface:

RandomAccessIterator is, isend;
RandomAccessIterator id;
SrcAccessor src_accessor;
DestAccessor dest_accessor;
NumericTraits<SrcAccessor::value_type>::RealPromote s = src_accessor(is);
double d;
s = s + s;
s = d * s;
dest_accessor.set(
NumericTraits<DestAccessor::value_type>::fromRealPromote(s), id);

Preconditions:

scale > 0

## ◆ recursiveFirstDerivativeLine()

template<... >

void recursiveFirstDerivativeLine | ( |  | ... | ) |

Performs a 1 dimensional recursive convolution of the source signal.

It uses the first derivative an exponential `d/dx exp(-abs(x)/scale)` as a kernel. The signal's value_type (SrcAccessor::value_type) must be a linear space over `double`, i.e. addition and subtraction of source values, multiplication with `double`, and `NumericTraits` must be defined. Border treatment is always `BORDER_TREATMENT_REPEAT`.

Declaration:

namespace vigra {
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor>
void recursiveFirstDerivativeLine(SrcIterator is, SrcIterator isend, SrcAccessor as,
DestIterator id, DestAccessor ad, double scale)
}
vigra::recursiveFirstDerivativeLine
void recursiveFirstDerivativeLine(...)
Performs a 1 dimensional recursive convolution of the source signal.

Usage:

#include <vigra/recursiveconvolution.hxx>
Namespace: vigra

vector<float> src, dest;
...
vigra::DefaultAccessor<vector<float>::iterator, float> FAccessor;
vigra::recursiveFirstDerivativeLine(src.begin(), src.end(), FAccessor(),
dest.begin(), FAccessor(), 3.0);

Required Interface:

RandomAccessIterator is, isend;
RandomAccessIterator id;
SrcAccessor src_accessor;
DestAccessor dest_accessor;
NumericTraits<SrcAccessor::value_type>::RealPromote s = src_accessor(is);
double d;
s = s + s;
s = -s;
s = d * s;
dest_accessor.set(
NumericTraits<DestAccessor::value_type>::fromRealPromote(s), id);

Preconditions:

scale > 0

## ◆ recursiveSecondDerivativeLine()

template<... >

void recursiveSecondDerivativeLine | ( |  | ... | ) |

Performs a 1 dimensional recursive convolution of the source signal.

It uses the second derivative an exponential `d2/dx2 exp(-abs(x)/scale)` as a kernel. The signal's value_type (SrcAccessor::value_type) must be a linear space over `double`, i.e. addition and subtraction of source values, multiplication with `double`, and `NumericTraits` must be defined. Border treatment is always `BORDER_TREATMENT_REPEAT`.

Declaration:

namespace vigra {
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor>
void recursiveSecondDerivativeLine(SrcIterator is, SrcIterator isend, SrcAccessor as,
DestIterator id, DestAccessor ad, double scale)
}
vigra::recursiveSecondDerivativeLine
void recursiveSecondDerivativeLine(...)
Performs a 1 dimensional recursive convolution of the source signal.

Usage:

#include <vigra/recursiveconvolution.hxx>
Namespace: vigra

vector<float> src, dest;
...
vigra::DefaultAccessor<vector<float>::iterator, float> FAccessor;
vigra::recursiveSecondDerivativeLine(src.begin(), src.end(), FAccessor(),
dest.begin(), FAccessor(), 3.0);

Required Interface:

RandomAccessIterator is, isend;
RandomAccessIterator id;
SrcAccessor src_accessor;
DestAccessor dest_accessor;
NumericTraits<SrcAccessor::value_type>::RealPromote s = src_accessor(is);
double d;
s = s + s;
s = s - s;
s = d * s;
dest_accessor.set(
NumericTraits<DestAccessor::value_type>::fromRealPromote(s), id);

Preconditions:

scale > 0

## ◆ recursiveFilterX()

template<... >

void recursiveFilterX | ( |  | ... | ) |

Performs 1 dimensional recursive filtering (1st and 2nd order) in x direction.

It calls recursiveFilterLine() for every row of the image. See recursiveFilterLine() for more information about required interfaces and vigra_preconditions.

Declarations:

pass 2D array views:

namespace vigra {
// first order filter
template <class T1, class S1,
class T2, class S2>
void
recursiveFilterX(MultiArrayView<2, T1, S1> const & src,
MultiArrayView<2, T2, S2> dest,
double b, BorderTreatmentMode border);
// second order filter
template <class T1, class S1,
class T2, class S2>
void
recursiveFilterX(MultiArrayView<2, T1, S1> const & src,
MultiArrayView<2, T2, S2> dest,
double b1, double b2);
}
vigra::recursiveFilterX
void recursiveFilterX(...)
Performs 1 dimensional recursive filtering (1st and 2nd order) in x direction.

show deprecated declarations

pass Image Iterators and Data Accessors :
namespace vigra {
// first order filter
template <class SrcImageIterator, class SrcAccessor,
class DestImageIterator, class DestAccessor>
void recursiveFilterX(SrcImageIterator supperleft,
SrcImageIterator slowerright, SrcAccessor as,
DestImageIterator dupperleft, DestAccessor ad,
double b, BorderTreatmentMode border);
// second order filter
template <class SrcImageIterator, class SrcAccessor,
class DestImageIterator, class DestAccessor>
void recursiveFilterX(SrcImageIterator supperleft,
SrcImageIterator slowerright, SrcAccessor as,
DestImageIterator dupperleft, DestAccessor ad,
double b1, double b2);
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
// first order filter
template <class SrcImageIterator, class SrcAccessor,
class DestImageIterator, class DestAccessor>
void recursiveFilterX(
triple<SrcImageIterator, SrcImageIterator, SrcAccessor> src,
pair<DestImageIterator, DestAccessor> dest,
double b, BorderTreatmentMode border);
// second order filter
template <class SrcImageIterator, class SrcAccessor,
class DestImageIterator, class DestAccessor>
void recursiveFilterX(
triple<SrcImageIterator, SrcImageIterator, SrcAccessor> src,
pair<DestImageIterator, DestAccessor> dest,
double b1, double b2);
}

Usage:

#include <vigra/recursiveconvolution.hxx>
Namespace: vigra

MultiArray<2, float> src(w,h), dest(w,h);
...
// apply a first-order filter to the x-axis
recursiveFilterX(src, dest, 0.5, BORDER_TREATMENT_REFLECT);

show deprecated examples

vigra::FImage src(w,h), dest(w,h);
...
vigra::recursiveFilterX(srcImageRange(src), destImage(dest),
0.5, BORDER_TREATMENT_REFLECT);

## ◆ recursiveGaussianFilterX()

template<... >

void recursiveGaussianFilterX | ( |  | ... | ) |

Compute 1 dimensional recursive approximation of Gaussian smoothing in y direction.

It calls recursiveGaussianFilterLine() for every column of the image. See recursiveGaussianFilterLine() for more information about required interfaces and vigra_preconditions.

Declarations:

pass 2D array views:

namespace vigra {
template <class T1, class S1,
class T2, class S2>
void
recursiveGaussianFilterX(MultiArrayView<2, T1, S1> const & src,
MultiArrayView<2, T2, S2> dest,
double sigma);
}
vigra::recursiveGaussianFilterX
void recursiveGaussianFilterX(...)
Compute 1 dimensional recursive approximation of Gaussian smoothing in y direction.

show deprecated declarations

pass Image Iterators and Data Accessors :
namespace vigra {
template <class SrcImageIterator, class SrcAccessor,
class DestImageIterator, class DestAccessor>
void
recursiveGaussianFilterX(SrcImageIterator supperleft, SrcImageIterator slowerright, SrcAccessor as,
DestImageIterator dupperleft, DestAccessor ad,
double sigma);
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
template <class SrcImageIterator, class SrcAccessor,
class DestImageIterator, class DestAccessor>
void
recursiveGaussianFilterX(triple<SrcImageIterator, SrcImageIterator, SrcAccessor> src,
pair<DestImageIterator, DestAccessor> dest,
double sigma);
}

Usage:

#include <vigra/recursiveconvolution.hxx>
Namespace: vigra

MultiArray<2, float> src(w,h), dest(w,h);
...
recursiveGaussianFilterX(src, dest, 3.0);

show deprecated examples

vigra::FImage src(w,h), dest(w,h);
...
vigra::recursiveGaussianFilterX(srcImageRange(src), destImage(dest), 3.0);

## ◆ recursiveSmoothX()

template<... >

void recursiveSmoothX | ( |  | ... | ) |

Performs 1 dimensional recursive smoothing in x direction.

It calls recursiveSmoothLine() for every row of the image. See recursiveSmoothLine() for more information about required interfaces and vigra_preconditions.

Declarations:

pass 2D array views:

namespace vigra {
template <class T1, class S1,
class T2, class S2>
void
recursiveSmoothX(MultiArrayView<2, T1, S1> const & src,
MultiArrayView<2, T2, S2> dest,
double scale);
}
vigra::recursiveSmoothX
void recursiveSmoothX(...)
Performs 1 dimensional recursive smoothing in x direction.

show deprecated declarations

pass Image Iterators and Data Accessors :
namespace vigra {
template <class SrcImageIterator, class SrcAccessor,
class DestImageIterator, class DestAccessor>
void recursiveSmoothX(SrcImageIterator supperleft,
SrcImageIterator slowerright, SrcAccessor as,
DestImageIterator dupperleft, DestAccessor ad,
double scale)
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
template <class SrcImageIterator, class SrcAccessor,
class DestImageIterator, class DestAccessor>
void recursiveSmoothX(
triple<SrcImageIterator, SrcImageIterator, SrcAccessor> src,
pair<DestImageIterator, DestAccessor> dest,
double scale)
}

Usage:

#include <vigra/recursiveconvolution.hxx>
Namespace: vigra

MultiArray<2, float> src(w,h), dest(w,h);
...
recursiveSmoothX(src, dest, 3.0);

show deprecated examples

vigra::FImage src(w,h), dest(w,h);
...
vigra::recursiveSmoothX(srcImageRange(src), destImage(dest), 3.0);

## ◆ recursiveFilterY()

template<... >

void recursiveFilterY | ( |  | ... | ) |

Performs 1 dimensional recursive filtering (1st and 2nd order) in y direction.

It calls recursiveFilterLine() for every column of the image. See recursiveFilterLine() for more information about required interfaces and vigra_preconditions.

Declarations:

pass 2D array views:

namespace vigra {
// first order filter
template <class T1, class S1,
class T2, class S2>
void
recursiveFilterY(MultiArrayView<2, T1, S1> const & src,
MultiArrayView<2, T2, S2> dest,
double b, BorderTreatmentMode border);
// second order filter
template <class T1, class S1,
class T2, class S2>
void
recursiveFilterY(MultiArrayView<2, T1, S1> const & src,
MultiArrayView<2, T2, S2> dest,
double b1, double b2);
}
vigra::recursiveFilterY
void recursiveFilterY(...)
Performs 1 dimensional recursive filtering (1st and 2nd order) in y direction.

show deprecated declarations

pass Image Iterators and Data Accessors :
namespace vigra {
// first order filter
template <class SrcImageIterator, class SrcAccessor,
class DestImageIterator, class DestAccessor>
void recursiveFilterY(SrcImageIterator supperleft,
SrcImageIterator slowerright, SrcAccessor as,
DestImageIterator dupperleft, DestAccessor ad,
double b, BorderTreatmentMode border);
// second order filter
template <class SrcImageIterator, class SrcAccessor,
class DestImageIterator, class DestAccessor>
void recursiveFilterY(SrcImageIterator supperleft,
SrcImageIterator slowerright, SrcAccessor as,
DestImageIterator dupperleft, DestAccessor ad,
double b1, double b2);
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
// first order filter
template <class SrcImageIterator, class SrcAccessor,
class DestImageIterator, class DestAccessor>
void recursiveFilterY(
triple<SrcImageIterator, SrcImageIterator, SrcAccessor> src,
pair<DestImageIterator, DestAccessor> dest,
double b, BorderTreatmentMode border);
// second order filter
template <class SrcImageIterator, class SrcAccessor,
class DestImageIterator, class DestAccessor>
void recursiveFilterY(
triple<SrcImageIterator, SrcImageIterator, SrcAccessor> src,
pair<DestImageIterator, DestAccessor> dest,
double b1, double b2);
}

Usage:

#include <vigra/recursiveconvolution.hxx>
Namespace: vigra

MultiArray<2, float> src(w,h), dest(w,h);
...
// apply a second-order filter to the y-axis
recursiveFilterY(src, dest, -0.6, -0.06);

show deprecated examples

vigra::FImage src(w,h), dest(w,h);
...
vigra::recursiveFilterY(srcImageRange(src), destImage(dest), -0.6, -0.06);

## ◆ recursiveGaussianFilterY()

template<... >

void recursiveGaussianFilterY | ( |  | ... | ) |

Compute 1 dimensional recursive approximation of Gaussian smoothing in y direction.

It calls recursiveGaussianFilterLine() for every column of the image. See recursiveGaussianFilterLine() for more information about required interfaces and vigra_preconditions.

Declarations:

pass 2D array views:

namespace vigra {
template <class T1, class S1,
class T2, class S2>
void
recursiveGaussianFilterY(MultiArrayView<2, T1, S1> const & src,
MultiArrayView<2, T2, S2> dest,
double sigma);
}
vigra::recursiveGaussianFilterY
void recursiveGaussianFilterY(...)
Compute 1 dimensional recursive approximation of Gaussian smoothing in y direction.

show deprecated declarations

pass Image Iterators and Data Accessors :
namespace vigra {
template <class SrcImageIterator, class SrcAccessor,
class DestImageIterator, class DestAccessor>
void
recursiveGaussianFilterY(SrcImageIterator supperleft, SrcImageIterator slowerright, SrcAccessor as,
DestImageIterator dupperleft, DestAccessor ad,
double sigma);
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
template <class SrcImageIterator, class SrcAccessor,
class DestImageIterator, class DestAccessor>
void
recursiveGaussianFilterY(triple<SrcImageIterator, SrcImageIterator, SrcAccessor> src,
pair<DestImageIterator, DestAccessor> dest,
double sigma);
}

Usage:

#include <vigra/recursiveconvolution.hxx>
Namespace: vigra

MultiArray<2, float> src(w,h), dest(w,h);
...
recursiveGaussianFilterY(src, dest, 3.0);

show deprecated examples

vigra::FImage src(w,h), dest(w,h);
...
vigra::recursiveGaussianFilterY(srcImageRange(src), destImage(dest), 3.0);

## ◆ recursiveSmoothY()

template<... >

void recursiveSmoothY | ( |  | ... | ) |

Performs 1 dimensional recursive smoothing in y direction.

It calls recursiveSmoothLine() for every column of the image. See recursiveSmoothLine() for more information about required interfaces and vigra_preconditions.

Declarations:

pass 2D array views:

namespace vigra {
template <class T1, class S1,
class T2, class S2>
void
recursiveSmoothY(MultiArrayView<2, T1, S1> const & src,
MultiArrayView<2, T2, S2> dest,
double scale);
}
vigra::recursiveSmoothY
void recursiveSmoothY(...)
Performs 1 dimensional recursive smoothing in y direction.

show deprecated declarations

pass Image Iterators and Data Accessors :
namespace vigra {
template <class SrcImageIterator, class SrcAccessor,
class DestImageIterator, class DestAccessor>
void recursiveSmoothY(SrcImageIterator supperleft,
SrcImageIterator slowerright, SrcAccessor as,
DestImageIterator dupperleft, DestAccessor ad,
double scale)
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
template <class SrcImageIterator, class SrcAccessor,
class DestImageIterator, class DestAccessor>
void recursiveSmoothY(
triple<SrcImageIterator, SrcImageIterator, SrcAccessor> src,
pair<DestImageIterator, DestAccessor> dest,
double scale)
}

Usage:

#include <vigra/recursiveconvolution.hxx>
Namespace: vigra

MultiArray<2, float> src(w,h), dest(w,h);
...
recursiveSmoothY(src, dest, 3.0);

show deprecated examples

vigra::FImage src(w,h), dest(w,h);
...
vigra::recursiveSmoothY(srcImageRange(src), destImage(dest), 3.0);

## ◆ recursiveFirstDerivativeX()

template<... >

void recursiveFirstDerivativeX | ( |  | ... | ) |

Recursively calculates the 1 dimensional first derivative in x direction.

It calls recursiveFirstDerivativeLine() for every row of the image. See recursiveFirstDerivativeLine() for more information about required interfaces and vigra_preconditions.

Declarations:

pass 2D array views:

namespace vigra {
template <class T1, class S1,
class T2, class S2>
void
recursiveFirstDerivativeX(MultiArrayView<2, T1, S1> const & src,
MultiArrayView<2, T2, S2> dest,
double scale);
}
vigra::recursiveFirstDerivativeX
void recursiveFirstDerivativeX(...)
Recursively calculates the 1 dimensional first derivative in x direction.

show deprecated declarations

pass Image Iterators and Data Accessors :
namespace vigra {
template <class SrcImageIterator, class SrcAccessor,
class DestImageIterator, class DestAccessor>
void recursiveFirstDerivativeX(SrcImageIterator supperleft,
SrcImageIterator slowerright, SrcAccessor as,
DestImageIterator dupperleft, DestAccessor ad,
double scale)
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
template <class SrcImageIterator, class SrcAccessor,
class DestImageIterator, class DestAccessor>
void recursiveFirstDerivativeX(
triple<SrcImageIterator, SrcImageIterator, SrcAccessor> src,
pair<DestImageIterator, DestAccessor> dest,
double scale)
}

Usage:

#include <vigra/recursiveconvolution.hxx>
Namespace: vigra

MultiArray<2, float> src(w,h), dest(w,h);
...
recursiveFirstDerivativeX(src, dest, 3.0);

show deprecated examples

vigra::FImage src(w,h), dest(w,h);
...
vigra::recursiveFirstDerivativeX(srcImageRange(src), destImage(dest), 3.0);

## ◆ recursiveFirstDerivativeY()

template<... >

void recursiveFirstDerivativeY | ( |  | ... | ) |

Recursively calculates the 1 dimensional first derivative in y direction.

It calls recursiveFirstDerivativeLine() for every column of the image. See recursiveFirstDerivativeLine() for more information about required interfaces and vigra_preconditions.

Declarations:

pass 2D array views:

namespace vigra {
template <class T1, class S1,
class T2, class S2>
void
recursiveFirstDerivativeY(MultiArrayView<2, T1, S1> const & src,
MultiArrayView<2, T2, S2> dest,
double scale);
}
vigra::recursiveFirstDerivativeY
void recursiveFirstDerivativeY(...)
Recursively calculates the 1 dimensional first derivative in y direction.

show deprecated declarations

pass Image Iterators and Data Accessors :
namespace vigra {
template <class SrcImageIterator, class SrcAccessor,
class DestImageIterator, class DestAccessor>
void recursiveFirstDerivativeY(SrcImageIterator supperleft,
SrcImageIterator slowerright, SrcAccessor as,
DestImageIterator dupperleft, DestAccessor ad,
double scale)
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
template <class SrcImageIterator, class SrcAccessor,
class DestImageIterator, class DestAccessor>
void recursiveFirstDerivativeY(
triple<SrcImageIterator, SrcImageIterator, SrcAccessor> src,
pair<DestImageIterator, DestAccessor> dest,
double scale)
}

Usage:

#include <vigra/recursiveconvolution.hxx>
Namespace: vigra

MultiArray<2, float> src(w,h), dest(w,h);
...
recursiveFirstDerivativeY(src, dest, 3.0);

show deprecated examples

vigra::FImage src(w,h), dest(w,h);
...
vigra::recursiveFirstDerivativeY(srcImageRange(src), destImage(dest), 3.0);

## ◆ recursiveSecondDerivativeX()

template<... >

void recursiveSecondDerivativeX | ( |  | ... | ) |

Recursively calculates the 1 dimensional second derivative in x direction.

It calls recursiveSecondDerivativeLine() for every row of the image. See recursiveSecondDerivativeLine() for more information about required interfaces and vigra_preconditions.

Declarations:

pass 2D array views:

namespace vigra {
template <class T1, class S1,
class T2, class S2>
void
recursiveSecondDerivativeX(MultiArrayView<2, T1, S1> const & src,
MultiArrayView<2, T2, S2> dest,
double scale);
}
vigra::recursiveSecondDerivativeX
void recursiveSecondDerivativeX(...)
Recursively calculates the 1 dimensional second derivative in x direction.

show deprecated declarations

pass Image Iterators and Data Accessors :
namespace vigra {
template <class SrcImageIterator, class SrcAccessor,
class DestImageIterator, class DestAccessor>
void recursiveSecondDerivativeX(SrcImageIterator supperleft,
SrcImageIterator slowerright, SrcAccessor as,
DestImageIterator dupperleft, DestAccessor ad,
double scale)
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
template <class SrcImageIterator, class SrcAccessor,
class DestImageIterator, class DestAccessor>
void recursiveSecondDerivativeX(
triple<SrcImageIterator, SrcImageIterator, SrcAccessor> src,
pair<DestImageIterator, DestAccessor> dest,
double scale)
}

Usage:

#include <vigra/recursiveconvolution.hxx>
Namespace: vigra

MultiArray<2, float> src(w,h), dest(w,h);
...
recursiveSecondDerivativeX(src, dest, 3.0);

show deprecated examples

vigra::FImage src(w,h), dest(w,h);
...
vigra::recursiveSecondDerivativeX(srcImageRange(src), destImage(dest), 3.0);

## ◆ recursiveSecondDerivativeY()

template<... >

void recursiveSecondDerivativeY | ( |  | ... | ) |

Recursively calculates the 1 dimensional second derivative in y direction.

It calls recursiveSecondDerivativeLine() for every column of the image. See recursiveSecondDerivativeLine() for more information about required interfaces and vigra_preconditions.

Declarations:

pass 2D array views:

namespace vigra {
template <class T1, class S1,
class T2, class S2>
void
recursiveSecondDerivativeY(MultiArrayView<2, T1, S1> const & src,
MultiArrayView<2, T2, S2> dest,
double scale);
}
vigra::recursiveSecondDerivativeY
void recursiveSecondDerivativeY(...)
Recursively calculates the 1 dimensional second derivative in y direction.

show deprecated declarations

pass Image Iterators and Data Accessors :
namespace vigra {
template <class SrcImageIterator, class SrcAccessor,
class DestImageIterator, class DestAccessor>
void recursiveSecondDerivativeY(SrcImageIterator supperleft,
SrcImageIterator slowerright, SrcAccessor as,
DestImageIterator dupperleft, DestAccessor ad,
double scale)
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
template <class SrcImageIterator, class SrcAccessor,
class DestImageIterator, class DestAccessor>
void recursiveSecondDerivativeY(
triple<SrcImageIterator, SrcImageIterator, SrcAccessor> src,
pair<DestImageIterator, DestAccessor> dest,
double scale)
}

Usage:

#include <vigra/recursiveconvolution.hxx>
Namespace: vigra

MultiArray<2, float> src(w,h), dest(w,h);
...
recursiveSecondDerivativeY(src, dest, 3.0);

show deprecated examples

vigra::FImage src(w,h), dest(w,h);
...
vigra::recursiveSecondDerivativeY(srcImageRange(src), destImage(dest), 3.0);

## ◆ nonlinearLeastSquares()

template<... >

void nonlinearLeastSquares | ( |  | ... | ) |

Fit a non-linear model to given data by minimizing least squares loss.

Declarations:

namespace vigra {
// variant 1: optimize a univariate model ('x' is a 1D array of scalar data points)
template <class T, class S1, class S2,
class U, int N,
class Functor>
T
nonlinearLeastSquares(MultiArrayView<1, T, S1> const & x,
MultiArrayView<1, T, S2> const & y,
TinyVector<U, N> & model_parameters,
Functor model,
NonlinearLSQOptions const & options = NonlinearLSQOptions());
// variant 2: optimize a multivariate model ('x' is a 2D array of vector-valued data points)
template <class T, class S1, class S2,
class U, int N,
class Functor>
T
nonlinearLeastSquares(MultiArrayView<2, T, S1> const & x,
MultiArrayView<1, T, S2> const & y,
TinyVector<U, N> & model_parameters,
Functor model,
NonlinearLSQOptions const & options = NonlinearLSQOptions());
}
vigra::NonlinearLSQOptions
Pass options to nonlinearLeastSquares().
Definition regression.hxx:992
vigra::nonlinearLeastSquares
void nonlinearLeastSquares(...)
Fit a non-linear model to given data by minimizing least squares loss.

This function implements the Levenberg-Marquardt algorithm to fit a non-linear model to given data. The model depends on a vector of parameters p which are to be choosen such that the least-squares residual between the data and the model's predictions is minimized according to the objective function:

where is the model to be optimized (with arguments and parameters ), and are the feature/response pairs of the given data. Since the model is non-linear (otherwise, you should use ordinary leastSquares()), it must be linearized in terms of a first-order Taylor expansion, and the optimal parameters p have to be determined iteratively. In order for the iterations to converge to the desired solution, a good initial guess on p is required.

The model must be specified by a functor which takes one of the following forms:

typedef double DataType; // type of your data samples, may be any numeric type
static const int N = ...; // number of model parameters
// variant 1: the features x are scalars
struct UnivariateModel
{
template <class T>
T operator()(DataType x, TinyVector<T, N> const & p) const { ... }
};
// variant 2: the features x are vectors
struct MultivariateModel
{
template <class T>
T operator()(MultiArrayView<1, DataType> const & x, TinyVector<T, N> const & p) const { ... }
};

Each call to the functor's `operator()` computes the model's prediction for a single data point. The current model parameters are specified in a TinyVector of appropriate length. The type `T` must be templated: normally, it is the same as `DataType`, but the nonlinearLeastSquares() function will temporarily replace it with a special number type that supports automatic differentiation (see vigra::autodiff::DualVector). In this way, the derivatives needed in the model's Taylor expansion can be computed automatically.

When the model is univariate (has a single scalar argument), the samples must be passed to nonlinearLeastSquares() in a pair 'x', 'y' of 1D `MultiArrayView`s (variant 1). When the model is multivariate (has a vector-valued argument), the 'x' input must be a 2D `MultiArrayView` (variant 2) whose rows represent a single data sample (i.e. the number of columns corresponds to the length of the model's argument vector). The number of rows in 'x' defines the number of data samples and must match the length of array 'y'.

The `TinyVector` 'model_parameters' holds the initial guess for the model parameters and will be overwritten by the optimal values found by the algorithm. The algorithm's internal behavior can be controlled by customizing the option object vigra::NonlinearLSQOptions.

The function returns the residual sum of squared errors of the final solution.

Usage:

#include <vigra/regression.hxx>
Namespace: vigra

Suppose that we want to fit a centered Gaussian function of the form

to noisy data , i.e. we want to find parameters a, s, b such that the residual is minimized. The model parameters are placed in a `TinyVector<T, 3>` p according to the rules
`p[0] <=> a`, `p[1] <=> s` and `p[2] <=> b`.
The following functor computes the model's prediction for a single data point `x`:

struct GaussianModel
{
template <class T>
T operator()(double x, TinyVector<T, 3> const & p) const
{
return p[0] * exp(-0.5 * sq(x / p[1])) + p[2];
}
};

Now we can find optimal values for the parameters like this:

int size = ...; // number of data points
MultiArray<1, double> x(size), y(size);
... // fill the data arrays
TinyVector<double, 3> p(2.0, 1.0, 0.5); // your initial guess of the parameters
// (will be overwritten with the optimal values)
double residual = nonlinearLeastSquares(x, y, p, GaussianModel());
std::cout << "Model parameters: a=" << p[0] << ", s=" << p[1] << ", b=" << p[2] << " (residual: " << residual << ")\n";

## ◆ resamplingConvolveLine()

template<... >

void resamplingConvolveLine | ( |  | ... | ) |

Performs a 1-dimensional resampling convolution of the source signal using the given set of kernels.

This function is mainly used internally: It is called for each dimension of a higher dimensional array in order to perform a separable resize operation.

Declaration:

#include <vigra/resampling_convolution.hxx>
Namespace: vigra

namespace vigra {
template <class SrcIter, class SrcAcc,
class DestIter, class DestAcc,
class KernelArray,
class Functor>
void
resamplingConvolveLine(SrcIter s, SrcIter send, SrcAcc src,
DestIter d, DestIter dend, DestAcc dest,
KernelArray const & kernels,
Functor mapTargetToSourceCoordinate)
}
vigra::resamplingConvolveLine
void resamplingConvolveLine(...)
Performs a 1-dimensional resampling convolution of the source signal using the given set of kernels.

## ◆ resamplingConvolveX()

template<... >

void resamplingConvolveX | ( |  | ... | ) |

Apply a resampling filter in the x-direction.

This function implements a convolution operation in x-direction (i.e. applies a 1D filter to every row) where the width of the source and destination images differ. This is typically used to avoid aliasing if the image is scaled down, or to interpolate smoothly if the image is scaled up. The target coordinates are transformed into source coordinates by

xsource = (xtarget - offset) / samplingRatio

The `samplingRatio` and `offset` must be given as vigra::Rational in order to avoid rounding errors in this transformation. It is required that for all pixels of the target image, `xsource` remains within the range of the source image (i.e. `0 <= xsource <= sourceWidth-1`. Since `xsource` is in general not an integer, the `kernel` must be a functor that can be accessed at arbitrary (`double`) coordinates. It must also provide a member function `radius()` which specifies the support (non-zero interval) of the kernel. VIGRA already provides a number of suitable functors, e.g. vigra::Gaussian, vigra::BSpline vigra::CatmullRomSpline, and vigra::CoscotFunction. The function resizeImageSplineInterpolation() is implemented by means of resamplingConvolveX() and resamplingConvolveY().

Declarations:

pass 2D array views:

namespace vigra {
template <class T1, class S1,
class T2, class S2,
class Kernel>
void
resamplingConvolveX(MultiArrayView<2, T1, S1> const & src,
MultiArrayView<2, T2, S2> dest,
Kernel const & kernel,
Rational<int> const & samplingRatio, Rational<int> const & offset);
}
vigra::resamplingConvolveX
void resamplingConvolveX(...)
Apply a resampling filter in the x-direction.

show deprecated declarations

pass Image Iterators and Data Accessors :
namespace vigra {
template <class SrcIter, class SrcAcc,
class DestIter, class DestAcc,
class Kernel>
void
resamplingConvolveX(SrcIter sul, SrcIter slr, SrcAcc src,
DestIter dul, DestIter dlr, DestAcc dest,
Kernel const & kernel,
Rational<int> const & samplingRatio, Rational<int> const & offset);
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
template <class SrcIter, class SrcAcc,
class DestIter, class DestAcc,
class Kernel>
void
resamplingConvolveX(triple<SrcIter, SrcIter, SrcAcc> src,
triple<DestIter, DestIter, DestAcc> dest,
Kernel const & kernel,
Rational<int> const & samplingRatio, Rational<int> const & offset);
}

Usage:

#include <vigra/resampling_convolution.hxx>
Namespace: vigra

Rational<int> ratio(2), offset(0);
MultiArray<2, float> src(w,h),
dest(rational_cast<int>(ratio*w), h);
float sigma = 2.0;
Gaussian<float> smooth(sigma);
...
// simultaneously enlarge and smooth source image
resamplingConvolveX(src, dest,
smooth, ratio, offset);

show deprecated examples

Rational<int> ratio(2), offset(0);
FImage src(w,h),
dest(rational_cast<int>(ratio*w), h);
float sigma = 2.0;
Gaussian<float> smooth(sigma);
...
// simultaneously enlarge and smooth source image
resamplingConvolveX(srcImageRange(src), destImageRange(dest),
smooth, ratio, offset);
Required Interface:
Kernel kernel;
int kernelRadius = kernel.radius();
double x = ...; // must be <= radius()
double value = kernel(x);

## ◆ resamplingConvolveY()

template<... >

void resamplingConvolveY | ( |  | ... | ) |

Apply a resampling filter in the y-direction.

This function implements a convolution operation in y-direction (i.e. applies a 1D filter to every column) where the height of the source and destination images differ. This is typically used to avoid aliasing if the image is scaled down, or to interpolate smoothly if the image is scaled up. The target coordinates are transformed into source coordinates by

ysource = (ytarget - offset) / samplingRatio

The `samplingRatio` and `offset` must be given as vigra::Rational in order to avoid rounding errors in this transformation. It is required that for all pixels of the target image, `ysource` remains within the range of the source image (i.e. `0 <= ysource <= sourceHeight-1`. Since `ysource` is in general not an integer, the `kernel` must be a functor that can be accessed at arbitrary (`double`) coordinates. It must also provide a member function `radius()` which specifies the support (non-zero interval) of the kernel. VIGRA already provides a number of suitable functors, e.g. vigra::Gaussian, vigra::BSpline vigra::CatmullRomSpline, and vigra::CoscotFunction. The function resizeImageSplineInterpolation() is implemented by means of resamplingConvolveX() and resamplingConvolveY().

Declarations:

pass 2D array views:

namespace vigra {
template <class T1, class S1,
class T2, class S2,
class Kernel>
void
resamplingConvolveY(MultiArrayView<2, T1, S1> const & src,
MultiArrayView<2, T2, S2> dest,
Kernel const & kernel,
Rational<int> const & samplingRatio, Rational<int> const & offset);
}
vigra::resamplingConvolveY
void resamplingConvolveY(...)
Apply a resampling filter in the y-direction.

show deprecated declarations

pass Image Iterators and Data Accessors :
namespace vigra {
template <class SrcIter, class SrcAcc,
class DestIter, class DestAcc,
class Kernel>
void
resamplingConvolveY(SrcIter sul, SrcIter slr, SrcAcc src,
DestIter dul, DestIter dlr, DestAcc dest,
Kernel const & kernel,
Rational<int> const & samplingRatio, Rational<int> const & offset);
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
template <class SrcIter, class SrcAcc,
class DestIter, class DestAcc,
class Kernel>
void
resamplingConvolveY(triple<SrcIter, SrcIter, SrcAcc> src,
triple<DestIter, DestIter, DestAcc> dest,
Kernel const & kernel,
Rational<int> const & samplingRatio, Rational<int> const & offset);
}

Usage:

#include <vigra/resampling_convolution.hxx>
Namespace: vigra

Rational<int> ratio(2), offset(0);
MultiArray<2, float> src(w,h),
dest(w, rational_cast<int>(ratio*h));
float sigma = 2.0;
Gaussian<float> smooth(sigma);
...
// simultaneously enlarge and smooth source image
resamplingConvolveY(src, dest,
smooth, ratio, offset);

show deprecated examples

Rational<int> ratio(2), offset(0);
FImage src(w,h),
dest(w, rational_cast<int>(ratio*h));
float sigma = 2.0;
Gaussian<float> smooth(sigma);
...
// simultaneously enlarge and smooth source image
resamplingConvolveY(srcImageRange(src), destImageRange(dest),
smooth, ratio, offset);
Required Interface:
Kernel kernel;
int kernelRadius = kernel.radius();
double y = ...; // must be <= radius()
double value = kernel(y);

## ◆ resamplingConvolveImage()

template<... >

void resamplingConvolveImage | ( |  | ... | ) |

Apply two separable resampling filters successively, the first in x-direction, the second in y-direction.

This function is a shorthand for the concatenation of a call to resamplingConvolveX() and resamplingConvolveY() with the given kernels. See there for detailed documentation.

Declarations:

pass 2D array views:

namespace vigra {
template <class T1, class S1,
class T2, class S2,
class KernelX, class KernelY>
void
resamplingConvolveImage(MultiArrayView<2, T1, S1> const & src,
MultiArrayView<2, T2, S2> dest,
KernelX const & kx,
Rational<int> const & samplingRatioX, Rational<int> const & offsetX,
KernelY const & ky,
Rational<int> const & samplingRatioY, Rational<int> const & offsetY);
}
vigra::resamplingConvolveImage
void resamplingConvolveImage(...)
Apply two separable resampling filters successively, the first in x-direction, the second in y-direct...

show deprecated declarations

pass Image Iterators and Data Accessors :
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor,
class KernelX, class KernelY>
void resamplingConvolveImage(SrcIterator sul,SrcIterator slr, SrcAccessor src,
DestIterator dul, DestIterator dlr, DestAccessor dest,
KernelX const & kx,
Rational<int> const & samplingRatioX, Rational<int> const & offsetX,
KernelY const & ky,
Rational<int> const & samplingRatioY, Rational<int> const & offsetY);
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor,
class KernelX, class KernelY>
void
resamplingConvolveImage(triple<SrcIterator, SrcIterator, SrcAccessor> src,
triple<DestIterator, DestIterator, DestAccessor> dest,
KernelX const & kx,
Rational<int> const & samplingRatioX, Rational<int> const & offsetX,
KernelY const & ky,
Rational<int> const & samplingRatioY, Rational<int> const & offsetY);
}

Usage:

#include <vigra/resampling_convolution.hxx>
Namespace: vigra

Rational<int> xratio(2), yratio(3), offset(0);
MultiArray<2, float> src(w,h),
dest(rational_cast<int>(xratio*w), rational_cast<int>(yratio*h));
float sigma = 2.0;
Gaussian<float> smooth(sigma);
...
// simultaneously enlarge and smooth source image
resamplingConvolveImage(src, dest,
smooth, xratio, offset,
smooth, yratio, offset);

## ◆ pyramidReduceBurtFilter()

template<... >

void pyramidReduceBurtFilter | ( |  | ... | ) |

Two-fold down-sampling for image pyramid construction.

This function implements the reduction by one resolution level (first signature) or across several pyramid levels (last signature) of a Gaussian pyramid as described in

P. Burt, E. Adelson: "The Laplacian Pyramid as a Compact Image Code", IEEE Trans. Communications, 9(4):532-540, 1983

That is, it applies the smoothing filter

[0.25 - centerValue / 2.0, 0.25, centerValue, 0.25, 0.25 - centerValue / 2.0]

to the source image and then copies all pixels with even coordinates to the destination image. The destination image shape must be `dest_shape = ceil(src_shape / 2.0)`. `centerValue` must be between 0.25 and 0.5 and determines the strength of smoothing (bigger values correspond to less smoothing). If `toLevel - fromLevel > 1` in the pyramid variant of the function, this process is repeated until `toLevel` is reached.

Typically, this functions is used in connection with a vigra::ImagePyramid (last signature below) to perform several levels of reduction in one go.

Declarations:

#include <vigra/resampling_convolution.hxx>
Namespace: vigra

pass 2D array views:

namespace vigra {
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor>
void pyramidReduceBurtFilter(SrcIterator sul, SrcIterator slr, SrcAccessor src,
DestIterator dul, DestIterator dlr, DestAccessor dest,
double centerValue = 0.4);
}
vigra::pyramidReduceBurtFilter
void pyramidReduceBurtFilter(...)
Two-fold down-sampling for image pyramid construction.

show deprecated declarations

pass Image Iterators and Data Accessors :
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor>
void pyramidReduceBurtFilter(SrcIterator sul, SrcIterator slr, SrcAccessor src,
DestIterator dul, DestIterator dlr, DestAccessor dest,
double centerValue = 0.4);
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor>
void pyramidReduceBurtFilter(triple<SrcIterator, SrcIterator, SrcAccessor> src,
triple<DestIterator, DestIterator, DestAccessor> dest,
double centerValue = 0.4);
}

use a vigra::ImagePyramid :

namespace vigra {
template <class Image, class Alloc>
void pyramidReduceBurtFilter(ImagePyramid<Image, Alloc> & pyramid,
int fromLevel, int toLevel,
double centerValue = 0.4);
}

## ◆ pyramidExpandBurtFilter()

template<... >

void pyramidExpandBurtFilter | ( |  | ... | ) |

Two-fold up-sampling for image pyramid reconstruction.

This function implements the expansion by one resolution level (first signature) or across several pyramid levels (last signature) of a Gaussian pyramid as described in

P. Burt, E. Adelson: "The Laplacian Pyramid as a Compact Image Code", IEEE Trans. Communications, 9(4):532-540, 1983

That is, the function first places the pixel values of the low-resolution image at the even pixel coordinates of the high-resolution image (pixels with at least one odd coordinate are zero-initialized) and then applies the interpolation filter

[0.5 - centerValue, 0.5, 2*centerValue, 0.5, 0.5 - centerValue]

to the high-resolution image. The source image shape must be `src_shape = ceil(dest_shape / 2.0)`. `centerValue` must be between 0.25 and 0.5 and determines the sharpness of the interpolation (bigger values correspond to sharper images). If `fromLevel - toLevel > 1` in the pyramid variant of the function, this process is repeated until `toLevel` is reached.

Typically, this functions is used in connection with a vigra::ImagePyramid (last signature below) to perform several levels of expansion in one go.

Declarations:

#include <vigra/resampling_convolution.hxx>
Namespace: vigra

pass 2D array views:

namespace vigra {
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor>
void pyramidExpandBurtFilter(SrcIterator sul, SrcIterator slr, SrcAccessor src,
DestIterator dul, DestIterator dlr, DestAccessor dest,
double centerValue = 0.4);
}
vigra::pyramidExpandBurtFilter
void pyramidExpandBurtFilter(...)
Two-fold up-sampling for image pyramid reconstruction.

show deprecated declarations

pass Image Iterators and Data Accessors :
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor>
void pyramidExpandBurtFilter(SrcIterator sul, SrcIterator slr, SrcAccessor src,
DestIterator dul, DestIterator dlr, DestAccessor dest,
double centerValue = 0.4);
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor>
void pyramidExpandBurtFilter(triple<SrcIterator, SrcIterator, SrcAccessor> src,
triple<DestIterator, DestIterator, DestAccessor> dest,
double centerValue = 0.4);
}

use a vigra::ImagePyramid :

namespace vigra {
template <class Image, class Alloc>
void pyramidExpandBurtFilter(ImagePyramid<Image, Alloc> & pyramid,
int fromLevel, int toLevel,
double centerValue = 0.4);
}

## ◆ pyramidReduceBurtLaplacian()

template<class Image , class Alloc >

void pyramidReduceBurtLaplacian | ( | ImagePyramid< Image, Alloc > & | pyramid,
|  | int | fromLevel,
|  | int | toLevel,
|  | double | centerValue = `0.4`
| ) |  |

Create a Laplacian pyramid.

This function implements the reduction across several resolution levels of a Laplacian pyramid as described in

P. Burt, E. Adelson: "The Laplacian Pyramid as a Compact Image Code", IEEE Trans. Communications, 9(4):532-540, 1983

It first creates a Gaussian pyramid using pyramidReduceBurtFilter(), then upsamples each level once using pyramidExpandBurtFilter(), and finally stores the difference between the upsampled and original versions of each level (i.e. the Laplacian of Gaussian is approximated by a difference of Gaussian).

#include <vigra/resampling_convolution.hxx>
Namespace: vigra

## ◆ pyramidExpandBurtLaplacian()

template<class Image , class Alloc >

void pyramidExpandBurtLaplacian | ( | ImagePyramid< Image, Alloc > & | pyramid,
|  | int | fromLevel,
|  | int | toLevel,
|  | double | centerValue = `0.4`
| ) |  |

Reconstruct a Laplacian pyramid.

This function implements the reconstruction of a Gaussian pyramid across several resolution levels of a Laplacian pyramid as described in

P. Burt, E. Adelson: "The Laplacian Pyramid as a Compact Image Code", IEEE Trans. Communications, 9(4):532-540, 1983

At each level starting from `fromLevel`, this function calls pyramidExpandBurtFilter() to interpolate the image to the next highest resolution, and then adds the interpolated image to the image stored at the next level.

#include <vigra/resampling_convolution.hxx>
Namespace: vigra

## ◆ resizeImageNoInterpolation()

template<... >

void resizeImageNoInterpolation | ( |  | ... | ) |

Resize image by repeating the nearest pixel values.

This algorithm is very fast and does not require any arithmetic on the pixel types.

The range of both the input and output images (resp. regions) must be given. Both images must have a size of at least 2x2 pixels. The scaling factors are then calculated accordingly. Destination pixels are directly copied from the appropriate source pixels.

Declarations:

pass 2D array views:

namespace vigra {
template <class T1, class S1,
class T2, class S2>
void
resizeImageNoInterpolation(MultiArrayView<2, T1, S1> const & src,
MultiArrayView<2, T2, S2> dest);
}
vigra::resizeImageNoInterpolation
void resizeImageNoInterpolation(...)
Resize image by repeating the nearest pixel values.

show deprecated declarations

pass Image Iterators and Data Accessors :
namespace vigra {
template <class SrcImageIterator, class SrcAccessor,
class DestImageIterator, class DestAccessor>
void
resizeImageNoInterpolation(
SrcImageIterator is, SrcImageIterator iend, SrcAccessor sa,
DestImageIterator id, DestImageIterator idend, DestAccessor da)
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
template <class SrcImageIterator, class SrcAccessor,
class DestImageIterator, class DestAccessor>
void
resizeImageNoInterpolation(
triple<SrcImageIterator, SrcImageIterator, SrcAccessor> src,
triple<DestImageIterator, DestImageIterator, DestAccessor> dest)
}

Usage:

#include <vigra/resizeimage.hxx>
Namespace: vigra

MultiArray<2, unsigned char> src(w, h);
MultiArray<2, float> dest(w_new, h_new);
resizeImageNoInterpolation(src, dest);

show deprecated examples

vigra::resizeImageNoInterpolation(
src.upperLeft(), src.lowerRight(), src.accessor(),
dest.upperLeft(), dest.lowerRight(), dest.accessor());
Required Interface:
SrcImageIterator src_upperleft, src_lowerright;
DestImageIterator dest_upperleft, src_lowerright;
SrcAccessor src_accessor;
DestAccessor dest_accessor;
dest_accessor.set(src_accessor(src_upperleft), dest_upperleft);

Preconditions:

Source and destination must have at least 2 pixels along each axis.

## ◆ resizeImageLinearInterpolation()

template<... >

void resizeImageLinearInterpolation | ( |  | ... | ) |

Resize image using linear interpolation.

The function uses the standard separable bilinear interpolation algorithm to obtain a good compromise between quality and speed.

The range must of both the input and output images (resp. regions) must be given. Both images must have a size of at least 2x2. The scaling factors are then calculated accordingly. If the source image is larger than the destination, it is smoothed (band limited) using a recursive exponential filter. The source value_type (SrcAccessor::value_type) must be a linear space, i.e. it must support addition, multiplication with a scalar real number and NumericTraits.

Declarations:

pass 2D array views:

namespace vigra {
template <class T1, class S1,
class T2, class S2>
void
resizeImageLinearInterpolation(MultiArrayView<2, T1, S1> const & src,
MultiArrayView<2, T2, S2> dest);
}
vigra::resizeImageLinearInterpolation
void resizeImageLinearInterpolation(...)
Resize image using linear interpolation.

show deprecated declarations

pass Image Iterators and Data Accessors :
namespace vigra {
template <class SrcImageIterator, class SrcAccessor,
class DestImageIterator, class DestAccessor>
void
resizeImageLinearInterpolation(
SrcImageIterator is, SrcImageIterator iend, SrcAccessor sa,
DestImageIterator id, DestImageIterator idend, DestAccessor da)
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
template <class SrcImageIterator, class SrcAccessor,
class DestImageIterator, class DestAccessor>
void
resizeImageLinearInterpolation(
triple<SrcImageIterator, SrcImageIterator, SrcAccessor> src,
triple<DestImageIterator, DestImageIterator, DestAccessor> dest)
}

Usage:

#include <vigra/resizeimage.hxx>
Namespace: vigra

MultiArray<2, unsigned char> src(w, h);
MultiArray<2, float> dest(w_new, h_new);
resizeImageLinearInterpolation(src, dest);

show deprecated examples

vigra::resizeImageLinearInterpolation(
src.upperLeft(), src.lowerRight(), src.accessor(),
dest.upperLeft(), dest.lowerRight(), dest.accessor());
Required Interface:
SrcImageIterator src_upperleft, src_lowerright;
DestImageIterator dest_upperleft, src_lowerright;
SrcAccessor src_accessor;
DestAccessor dest_accessor;
NumericTraits<SrcAccessor::value_type>::RealPromote
u = src_accessor(src_upperleft),
v = src_accessor(src_upperleft, 1);
double d;
u = d * v;
u = u + v;
dest_accessor.set(
NumericTraits<DestAccessor::value_type>::fromRealPromote(u),
dest_upperleft);

Preconditions:

Source and destination must have at least 2 pixels along each axis.

## ◆ resizeImageSplineInterpolation()

template<... >

void resizeImageSplineInterpolation | ( |  | ... | ) |

Resize image using B-spline interpolation.

The function implements separable spline interpolation algorithm described in

M. Unser, A. Aldroubi, M. Eden, "B-Spline Signal Processing" IEEE Transactions on Signal Processing, vol. 41, no. 2, pp. 821-833 (part I), pp. 834-848 (part II), 1993.

to obtain optimal interpolation quality and speed. You may pass the function a spline of arbitrary order (e.g. `BSpline<ORDER, double>` or `CatmullRomSpline<double>`). The default is a third order spline which gives a twice continuously differentiable interpolant. The implementation ensures that image values are interpolated rather than smoothed by first calling a recursive (sharpening) prefilter as described in the above paper. Then the actual interpolation is done using resamplingConvolveLine().

The range of both the input and output images (resp. regions) must be given. The input image must have a size of at least 4x4, the destination of at least 2x2. The scaling factors are then calculated accordingly. If the source image is larger than the destination, it is smoothed (band limited) using a recursive exponential filter. The source value_type (SrcAccessor::value_type) must be a linear algebra, i.e. it must support addition, subtraction, and multiplication (+, -, *), multiplication with a scalar real number and NumericTraits. The function uses accessors.

Declarations:

pass 2D array views:

namespace vigra {
template <class T1, class S1,
class T2, class S2,
class SPLINE>
void
resizeImageSplineInterpolation(MultiArrayView<2, T1, S1> const & src,
MultiArrayView<2, T2, S2> dest,
SPLINE const & spline = BSpline<3, double>());
}
vigra::resizeImageSplineInterpolation
void resizeImageSplineInterpolation(...)
Resize image using B-spline interpolation.

show deprecated declarations

pass Image Iterators and Data Accessors :
namespace vigra {
template <class SrcImageIterator, class SrcAccessor,
class DestImageIterator, class DestAccessor,
class SPLINE>
void
resizeImageSplineInterpolation(
SrcImageIterator is, SrcImageIterator iend, SrcAccessor sa,
DestImageIterator id, DestImageIterator idend, DestAccessor da,
SPLINE spline = BSpline<3, double>())
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
template <class SrcImageIterator, class SrcAccessor,
class DestImageIterator, class DestAccessor,
class SPLINE>
void
resizeImageSplineInterpolation(
triple<SrcImageIterator, SrcImageIterator, SrcAccessor> src,
triple<DestImageIterator, DestImageIterator, DestAccessor> dest,
SPLINE spline = BSpline<3, double>())
}

Usage:

#include <vigra/resizeimage.hxx>
Namespace: vigra

MultiArray<2, unsigned char> src(w, h);
MultiArray<2, float> dest(w_new, h_new);
// use default cubic spline interpolator
resizeImageSplineInterpolation(src, dest);
// use 5th-order spline interpolator
resizeImageSplineInterpolation(src, dest, BSpline<5, double>());

show deprecated examples

vigra::resizeImageSplineInterpolation(
src.upperLeft(), src.lowerRight(), src.accessor(),
dest.upperLeft(), dest.lowerRight(), dest.accessor());
Required Interface:
SrcImageIterator src_upperleft, src_lowerright;
DestImageIterator dest_upperleft, src_lowerright;
SrcAccessor src_accessor;
DestAccessor dest_accessor;
NumericTraits<SrcAccessor::value_type>::RealPromote
u = src_accessor(src_upperleft),
v = src_accessor(src_upperleft, 1);
double d;
u = d * v;
u = u + v;
u = u - v;
u = u * v;
u += v;
u -= v;
dest_accessor.set(
NumericTraits<DestAccessor::value_type>::fromRealPromote(u),
dest_upperleft);

Preconditions:

Source and destination must have at least 2 pixels along each axis.

## ◆ resizeImageCatmullRomInterpolation()

template<... >

void resizeImageCatmullRomInterpolation | ( |  | ... | ) |

Resize image using the Catmull/Rom interpolation function.

The function calls like resizeImageSplineInterpolation() with vigra::CatmullRomSpline as an interpolation kernel. The interpolated function has one continuous derivative. (See resizeImageSplineInterpolation() for more documentation)

Declarations:

pass 2D array views:

namespace vigra {
template <class T1, class S1,
class T2, class S2>
void
resizeImageCatmullRomInterpolation(MultiArrayView<2, T1, S1> const & src,
MultiArrayView<2, T2, S2> dest);
}
vigra::resizeImageCatmullRomInterpolation
void resizeImageCatmullRomInterpolation(...)
Resize image using the Catmull/Rom interpolation function.

show deprecated declarations

pass Image Iterators and Data Accessors :
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor>
void
resizeImageCatmullRomInterpolation(SrcIterator src_iter, SrcIterator src_iter_end, SrcAccessor src_acc,
DestIterator dest_iter, DestIterator dest_iter_end, DestAccessor dest_acc);
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor>
void
resizeImageCatmullRomInterpolation(triple<SrcIterator, SrcIterator, SrcAccessor> src,
triple<DestIterator, DestIterator, DestAccessor> dest);
}

#include <vigra/resizeimage.hxx>
Namespace: vigra

MultiArray<2, unsigned char> src(w, h);
MultiArray<2, float> dest(w_new, h_new);
resizeImageCatmullRomInterpolation(src, dest);

## ◆ resizeImageCoscotInterpolation()

template<... >

void resizeImageCoscotInterpolation | ( |  | ... | ) |

Resize image using the Coscot interpolation function.

The function calls resizeImageSplineInterpolation() with vigra::CoscotFunction as an interpolation kernel. The interpolated function has one continuous derivative. (See resizeImageSplineInterpolation() for more documentation)

Declarations:

pass 2D array views:

namespace vigra {
template <class T1, class S1,
class T2, class S2>
void
resizeImageCoscotInterpolation(MultiArrayView<2, T1, S1> const & src,
MultiArrayView<2, T2, S2> dest);
}
vigra::resizeImageCoscotInterpolation
void resizeImageCoscotInterpolation(...)
Resize image using the Coscot interpolation function.

show deprecated declarations

pass Image Iterators and Data Accessors :
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor>
void
resizeImageCoscotInterpolation(SrcIterator src_iter, SrcIterator src_iter_end, SrcAccessor src_acc,
DestIterator dest_iter, DestIterator dest_iter_end, DestAccessor dest_acc);
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor>
void
resizeImageCoscotInterpolation(triple<SrcIterator, SrcIterator, SrcAccessor> src,
triple<DestIterator, DestIterator, DestAccessor> dest);
}

#include <vigra/resizeimage.hxx>
Namespace: vigra

MultiArray<2, unsigned char> src(w, h);
MultiArray<2, float> dest(w_new, h_new);
resizeImageCoscotInterpolation(src, dest);

## ◆ ceil() [1/2]

template<class V , unsigned int RIDX, unsigned int GIDX, unsigned int BIDX>

RGBValue< V, RIDX, GIDX, BIDX > ceil | ( | RGBValue< V, RIDX, GIDX, BIDX > const & | r | ) |

Apply ceil() function to each RGB component.

## ◆ floor() [1/2]

template<class V , unsigned int RIDX, unsigned int GIDX, unsigned int BIDX>

RGBValue< V, RIDX, GIDX, BIDX > floor | ( | RGBValue< V, RIDX, GIDX, BIDX > const & | r | ) |

Apply floor() function to each RGB component.

## ◆ seededRegionGrowing()

template<... >

void seededRegionGrowing | ( |  | ... | ) |

Region Segmentation by means of Seeded Region Growing.

This algorithm implements seeded region growing as described in

R. Adams, L. Bischof: "Seeded Region Growing", IEEE Trans. on Pattern Analysis and Maschine Intelligence, vol 16, no 6, 1994, and

Ullrich Köthe: Primary Image Segmentation, in: G. Sagerer, S. Posch, F. Kummert (eds.): Mustererkennung 1995, Proc. 17. DAGM-Symposium, Springer 1995

The seed image is a partly segmented image which contains uniquely labeled regions (the seeds) and unlabeled pixels (the candidates, label 0). The highest seed label found in the seed image is returned by the algorithm.

Seed regions can be as large as you wish and as small as one pixel. If there are no candidates, the algorithm will simply copy the seed image into the output image. Otherwise it will aggregate the candidates into the existing regions so that a cost function is minimized. Candidates are taken from the neighborhood of the already assigned pixels, where the type of neighborhood is determined by parameter `neighborhood` which can take the values `FourNeighborCode()` (the default) or `EightNeighborCode()`. The algorithm basically works as follows (illustrated for 4-neighborhood, but 8-neighborhood works in the same way):

1. Find all candidate pixels that are 4-adjacent to a seed region. Calculate the cost for aggregating each candidate into its adjacent region and put the candidates into a priority queue.

2. While( priority queue is not empty and termination criterion is not fulfilled)

   1. Take the candidate with least cost from the queue. If it has not already been merged, merge it with it's adjacent region.

   2. Put all candidates that are 4-adjacent to the pixel just processed into the priority queue.

`SRGType` can take the following values:

`CompleteGrow`
  produce a complete tesselation of the volume (default).
`KeepContours`
  keep a 1-voxel wide unlabeled contour between all regions.
`StopAtThreshold`
  stop when the boundary indicator values exceed the threshold given by parameter `max_cost`.
`KeepContours | StopAtThreshold`
  keep 1-voxel wide contour and stop at given `max_cost`.

The cost is determined jointly by the source image and the region statistics functor. The source image contains feature values for each pixel which will be used by the region statistics functor to calculate and update statistics for each region and to calculate the cost for each candidate. The `RegionStatisticsArray` must be compatible to the ArrayOfRegionStatistics functor and contains an array of statistics objects for each region. The indices must correspond to the labels of the seed regions. The statistics for the initial regions must have been calculated prior to calling `seededRegionGrowing()` (for example by means of inspectTwoImagesIf()).

For each candidate `x` that is adjacent to region `i`, the algorithm will call `stats[i].cost(as(x))` to get the cost (where `x` is a `SrcIterator` and `as` is the SrcAccessor). When a candidate has been merged with a region, the statistics are updated by calling `stats[i].operator()(as(x))`. Since the `RegionStatisticsArray` is passed by reference, this will overwrite the original statistics.

If a candidate could be merged into more than one regions with identical cost, the algorithm will favour the nearest region. If `StopAtThreshold` is active, and the cost of the current candidate at any point in the algorithm exceeds the optional `max_cost` value (which defaults to `NumericTraits<double>::max()`), region growing is aborted, and all voxels not yet assigned to a region remain unlabeled.

In some cases, the cost only depends on the feature value of the current pixel. Then the update operation will simply be a no-op, and the `cost()` function returns its argument. This behavior is implemented by the SeedRgDirectValueFunctor. With `SRGType == KeepContours`, this is equivalent to the watershed algorithm.

Declarations:

pass 2D array views:

namespace vigra {
template <class T1, class S1,
class TS, class AS,
class T2, class S2,
class RegionStatisticsArray, class Neighborhood>
TS
seededRegionGrowing(MultiArrayView<2, T1, S1> const & src,
MultiArrayView<2, TS, AS> const & seeds,
MultiArrayView<2, T2, S2> labels,
RegionStatisticsArray & stats,
SRGType srgType = CompleteGrow,
Neighborhood n = FourNeighborCode(),
double max_cost = NumericTraits<double>::max());
}
vigra::SRGType
SRGType
Definition seededregiongrowing.hxx:176
vigra::seededRegionGrowing
void seededRegionGrowing(...)
Region Segmentation by means of Seeded Region Growing.

show deprecated declarations

pass Image Iterators and Data Accessors :
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class SeedImageIterator, class SeedAccessor,
class DestIterator, class DestAccessor,
class RegionStatisticsArray, class Neighborhood>
typename SeedAccessor::value_type
seededRegionGrowing(SrcIterator srcul, SrcIterator srclr, SrcAccessor as,
SeedImageIterator seedsul, SeedAccessor aseeds,
DestIterator destul, DestAccessor ad,
RegionStatisticsArray & stats,
SRGType srgType = CompleteGrow,
Neighborhood neighborhood = FourNeighborCode(),
double max_cost = NumericTraits<double>::max());
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class SeedImageIterator, class SeedAccessor,
class DestIterator, class DestAccessor,
class RegionStatisticsArray, class Neighborhood>
typename SeedAccessor::value_type
seededRegionGrowing(triple<SrcIterator, SrcIterator, SrcAccessor> src,
pair<SeedImageIterator, SeedAccessor> seeds,
pair<DestIterator, DestAccessor> dest,
RegionStatisticsArray & stats,
SRGType srgType = CompleteGrow,
Neighborhood neighborhood = FourNeighborCode(),
double max_cost = NumericTraits<double>::max());
}

Usage:

#include <vigra/seededregiongrowing.hxx>
Namespace: vigra

Example: implementation of the voronoi tesselation

MultiArray<2, int> points(w,h);
MultiArray<2, float> dist(x,y);
int max_region_label = 100;
// throw in some random points:
for(int i = 1; i <= max_region_label; ++i)
points(w * rand() / RAND_MAX , h * rand() / RAND_MAX) = i;
// calculate Euclidean distance transform
distanceTransform(points, dist, 2);
// init statistics functor
ArrayOfRegionStatistics<SeedRgDirectValueFunctor<float> > stats(max_region_label);
// find voronoi region of each point (the point image is overwritten with the
// voronoi region labels)
seededRegionGrowing(dist, points, points, stats);

show deprecated examples

vigra::BImage points(w,h);
vigra::FImage dist(x,y);
// empty edge image
points = 0;
dist = 0;
int max_region_label = 100;
// throw in some random points:
for(int i = 1; i <= max_region_label; ++i)
points(w * rand() / RAND_MAX , h * rand() / RAND_MAX) = i;
// calculate Euclidean distance transform
vigra::distanceTransform(srcImageRange(points), destImage(dist), 2);
// init statistics functor
vigra::ArrayOfRegionStatistics<vigra::SeedRgDirectValueFunctor<float> >
stats(max_region_label);
// find voronoi region of each point
vigra:: seededRegionGrowing(srcImageRange(dist), srcImage(points),
destImage(points), stats);
Required Interface:
SrcIterator src_upperleft, src_lowerright;
SeedImageIterator seed_upperleft;
DestIterator dest_upperleft;
SrcAccessor src_accessor;
SeedAccessor seed_accessor;
DestAccessor dest_accessor;
RegionStatisticsArray stats;
// calculate costs
RegionStatisticsArray::value_type::cost_type cost =
stats[seed_accessor(seed_upperleft)].cost(src_accessor(src_upperleft));
// compare costs
cost < cost;
// update statistics
stats[seed_accessor(seed_upperleft)](src_accessor(src_upperleft));
// set result
dest_accessor.set(seed_accessor(seed_upperleft), dest_upperleft);

Further requirements are determined by the `RegionStatisticsArray`.

## ◆ seededRegionGrowing3D()

template<... >

void seededRegionGrowing3D | ( |  | ... | ) |

Three-dimensional Region Segmentation by means of Seeded Region Growing.

This algorithm implements seeded region growing as described in

The seed image is a partly segmented multi-dimensional array which contains uniquely labeled regions (the seeds) and unlabeled voxels (the candidates, label 0). Seed regions can be as large as you wish and as small as one voxel. If there are no candidates, the algorithm will simply copy the seed array into the output array. Otherwise it will aggregate the candidates into the existing regions so that a cost function is minimized. Candidates are taken from the neighborhood of the already assigned pixels, where the type of neighborhood is determined by parameter `neighborhood` which can take the values `NeighborCode3DSix()` (the default) or `NeighborCode3DTwentySix()`. The algorithm basically works as follows (illustrated for 6-neighborhood, but 26-neighborhood works in the same way):

1. Find all candidate pixels that are 6-adjacent to a seed region. Calculate the cost for aggregating each candidate into its adjacent region and put the candidates into a priority queue.

2. While( priority queue is not empty)

   1. Take the candidate with least cost from the queue. If it has not already been merged, merge it with it's adjacent region.

   2. Put all candidates that are 4-adjacent to the pixel just processed into the priority queue.

`SRGType` can take the following values:

`CompleteGrow`
  produce a complete tesselation of the volume (default).
`KeepContours`
  keep a 1-voxel wide unlabeled contour between all regions.
`StopAtThreshold`
  stop when the boundary indicator values exceed the threshold given by parameter `max_cost`.
`KeepContours | StopAtThreshold`
  keep 1-voxel wide contour and stop at given `max_cost`.

The cost is determined jointly by the source array and the region statistics functor. The source array contains feature values for each pixel which will be used by the region statistics functor to calculate and update statistics for each region and to calculate the cost for each candidate. The `RegionStatisticsArray` must be compatible to the ArrayOfRegionStatistics functor and contains an array of statistics objects for each region. The indices must correspond to the labels of the seed regions. The statistics for the initial regions must have been calculated prior to calling `seededRegionGrowing3D()`

For each candidate `x` that is adjacent to region `i`, the algorithm will call `stats[i].cost(as(x))` to get the cost (where `x` is a `SrcImageIterator` and `as` is the SrcAccessor). When a candidate has been merged with a region, the statistics are updated by calling `stats[i].operator()(as(x))`. Since the `RegionStatisticsArray` is passed by reference, this will overwrite the original statistics.

If a candidate could be merged into more than one regions with identical cost, the algorithm will favour the nearest region. If `StopAtThreshold` is active, and the cost of the current candidate at any point in the algorithm exceeds the optional `max_cost` value (which defaults to `NumericTraits<double>::max()`), region growing is aborted, and all voxels not yet assigned to a region remain unlabeled.

In some cases, the cost only depends on the feature value of the current voxel. Then the update operation will simply be a no-op, and the `cost()` function returns its argument. This behavior is implemented by the SeedRgDirectValueFunctor.

Declarations:

pass 3D array views:

namespace vigra {
template <class T1, class S1,
class TS, class AS,
class T2, class S2,
class RegionStatisticsArray, class Neighborhood>
void
seededRegionGrowing3D(MultiArrayView<3, T1, S1> const & src,
MultiArrayView<3, TS, AS> const & seeds,
MultiArrayView<3, T2, S2> labels,
RegionStatisticsArray & stats,
SRGType srgType = CompleteGrow,
Neighborhood neighborhood = NeighborCode3DSix(),
double max_cost = NumericTraits<double>::max());
}
vigra::seededRegionGrowing3D
void seededRegionGrowing3D(...)
Three-dimensional Region Segmentation by means of Seeded Region Growing.

show deprecated declarations

pass MultiIterators and Data Accessors :
namespace vigra {
template <class SrcImageIterator, class Shape, class SrcAccessor,
class SeedImageIterator, class SeedAccessor,
class DestImageIterator, class DestAccessor,
class RegionStatisticsArray, class Neighborhood>
void
seededRegionGrowing3D(SrcImageIterator srcul, Shape shape, SrcAccessor as,
SeedImageIterator seedsul, SeedAccessor aseeds,
DestImageIterator destul, DestAccessor ad,
RegionStatisticsArray & stats,
SRGType srgType = CompleteGrow,
Neighborhood neighborhood = NeighborCode3DSix(),
double max_cost = NumericTraits<double>::max());
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
template <class SrcImageIterator, class Shape, class SrcAccessor,
class SeedImageIterator, class SeedAccessor,
class DestImageIterator, class DestAccessor,
class RegionStatisticsArray, class Neighborhood>
void
seededRegionGrowing3D(triple<SrcImageIterator, Shape, SrcAccessor> src,
pair<SeedImageIterator, SeedAccessor> seeds,
pair<DestImageIterator, DestAccessor> dest,
RegionStatisticsArray & stats,
SRGType srgType = CompleteGrow,
Neighborhood neighborhood = NeighborCode3DSix(),
double max_cost = NumericTraits<double>::max());
}

Usage:

#include <vigra/seededregiongrowing3d.hxx>
Namespace: vigra

See seededRegionGrowing() for an example

## ◆ convolveLine()

template<... >

void convolveLine | ( |  | ... | ) |

Performs a 1-dimensional convolution of the source signal using the given kernel.

The KernelIterator must point to the center iterator, and the kernel's size is given by its left (kleft <= 0) and right (kright >= 0) borders. The signal must always be larger than the kernel. At those positions where the kernel does not completely fit into the signal's range, the specified BorderTreatmentMode is applied.

The signal's value_type (SrcAccessor::value_type) must be a linear space over the kernel's value_type (KernelAccessor::value_type), i.e. addition of source values, multiplication with kernel values, and NumericTraits must be defined. The kernel's value_type must be an algebraic field, i.e. the arithmetic operations (+, -, *, /) and NumericTraits must be defined.

If `start` and `stop` are non-zero, the relation `0 <= start < stop <= width` must hold (where `width` is the length of the input array). The convolution is then restricted to that subrange, and it is assumed that the output array only refers to that subrange (i.e. `id` points to the element corresponding to `start`). If `start` and `stop` are both zero (the default), the entire array is convolved.

Declarations:

pass Image Iterators and Data Accessors :

namespace vigra {
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor,
class KernelIterator, class KernelAccessor>
void convolveLine(SrcIterator is, SrcIterator isend, SrcAccessor sa,
DestIterator id, DestAccessor da,
KernelIterator ik, KernelAccessor ka,
int kleft, int kright, BorderTreatmentMode border,
int start = 0, int stop = 0 )
}
vigra::convolveLine
void convolveLine(...)
Performs a 1-dimensional convolution of the source signal using the given kernel.

use argument objects in conjunction with Argument Object Factories :

namespace vigra {
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor,
class KernelIterator, class KernelAccessor>
void convolveLine(triple<SrcIterator, SrcIterator, SrcAccessor> src,
pair<DestIterator, DestAccessor> dest,
tuple5<KernelIterator, KernelAccessor,
int, int, BorderTreatmentMode> kernel,
int start = 0, int stop = 0)
}

Usage:

#include <vigra/separableconvolution.hxx>
Namespace: vigra

std::vector<float> src, dest;
...
// define binomial filter of size 5
static float kernel[] =
{ 1.0/16.0, 4.0/16.0, 6.0/16.0, 4.0/16.0, 1.0/16.0};
typedef vigra::StandardAccessor<float> FAccessor;
typedef vigra::StandardAccessor<float> KernelAccessor;
vigra::convolveLine(src.begin(), src.end(), FAccessor(), dest.begin(), FAccessor(),
kernel+2, KernelAccessor(), -2, 2, BORDER_TREATMENT_REFLECT);
// ^^^^^^^^ this is the center of the kernel

Required Interface:

RandomAccessIterator is, isend;
RandomAccessIterator id;
RandomAccessIterator ik;
SrcAccessor src_accessor;
DestAccessor dest_accessor;
KernelAccessor kernel_accessor;
NumericTraits<SrcAccessor::value_type>::RealPromote s = src_accessor(is);
s = s + s;
s = kernel_accessor(ik) * s;
dest_accessor.set(
NumericTraits<DestAccessor::value_type>::fromRealPromote(s), id);

If border == BORDER_TREATMENT_CLIP:

NumericTraits<KernelAccessor::value_type>::RealPromote k = kernel_accessor(ik);
k = k + k;
k = k - k;
k = k * k;
k = k / k;

Preconditions:

kleft <= 0
kright >= 0
iend - is >= kright + kleft + 1

If border == BORDER_TREATMENT_CLIP: Sum of kernel elements must be != 0.

## ◆ separableConvolveX()

template<... >

void separableConvolveX | ( |  | ... | ) |

Performs a 1 dimensional convolution in x direction.

It calls convolveLine() for every row of the image. See convolveLine() for more information about required interfaces and vigra_preconditions.

Declarations:

pass 2D array views:

namespace vigra {
template <class T1, class S1,
class T2, class S2,
class T3>
void
separableConvolveX(MultiArrayView<2, T1, S1> const & src,
MultiArrayView<2, T2, S2> dest,
Kernel1D<T3> const & kernel);
}
vigra::separableConvolveX
void separableConvolveX(...)
Performs a 1 dimensional convolution in x direction.

show deprecated declarations

pass Image Iterators and Data Accessors :
namespace vigra {
template <class SrcImageIterator, class SrcAccessor,
class DestImageIterator, class DestAccessor,
class KernelIterator, class KernelAccessor>
void separableConvolveX(SrcImageIterator supperleft,
SrcImageIterator slowerright, SrcAccessor sa,
DestImageIterator dupperleft, DestAccessor da,
KernelIterator ik, KernelAccessor ka,
int kleft, int kright, BorderTreatmentMode border)
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
template <class SrcImageIterator, class SrcAccessor,
class DestImageIterator, class DestAccessor,
class KernelIterator, class KernelAccessor>
void separableConvolveX(triple<SrcImageIterator, SrcImageIterator, SrcAccessor> src,
pair<DestImageIterator, DestAccessor> dest,
tuple5<KernelIterator, KernelAccessor,
int, int, BorderTreatmentMode> kernel)
}

Usage:

#include <vigra/separableconvolution.hxx>
Namespace: vigra

MultiArray<2, float> src(w,h), dest(w,h);
...
// define Gaussian kernel with std. deviation 3.0
Kernel1D<double> kernel;
kernel.initGaussian(3.0);
// apply 1D filter along the x-axis
separableConvolveX(src, dest, kernel);

show deprecated examples

vigra::FImage src(w,h), dest(w,h);
...
// define Gaussian kernel with std. deviation 3.0
vigra::Kernel1D<double> kernel;
kernel.initGaussian(3.0);
// apply 1D filter along the x-axis
vigra::separableConvolveX(srcImageRange(src), destImage(dest), kernel1d(kernel));

Preconditions:

- The x-axis must be longer than the kernel radius: `w > std::max(kernel.right(), -kernel.left())`.
- If `border == BORDER_TREATMENT_CLIP`: The sum of kernel elements must be != 0.

## ◆ separableConvolveY()

template<... >

void separableConvolveY | ( |  | ... | ) |

Performs a 1 dimensional convolution in y direction.

It calls convolveLine() for every column of the image. See convolveLine() for more information about required interfaces and vigra_preconditions.

Declarations:

pass 2D array views:

namespace vigra {
template <class T1, class S1,
class T2, class S2,
class T3>
void
separableConvolveY(MultiArrayView<2, T1, S1> const & src,
MultiArrayView<2, T2, S2> dest,
Kernel1D<T3> const & kernel);
}
vigra::separableConvolveY
void separableConvolveY(...)
Performs a 1 dimensional convolution in y direction.

show deprecated declarations

pass Image Iterators and Data Accessors :
namespace vigra {
template <class SrcImageIterator, class SrcAccessor,
class DestImageIterator, class DestAccessor,
class KernelIterator, class KernelAccessor>
void separableConvolveY(SrcImageIterator supperleft,
SrcImageIterator slowerright, SrcAccessor sa,
DestImageIterator dupperleft, DestAccessor da,
KernelIterator ik, KernelAccessor ka,
int kleft, int kright, BorderTreatmentMode border)
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
template <class SrcImageIterator, class SrcAccessor,
class DestImageIterator, class DestAccessor,
class KernelIterator, class KernelAccessor>
void separableConvolveY(triple<SrcImageIterator, SrcImageIterator, SrcAccessor> src,
pair<DestImageIterator, DestAccessor> dest,
tuple5<KernelIterator, KernelAccessor,
int, int, BorderTreatmentMode> kernel)
}

Usage:

#include <vigra/separableconvolution.hxx>
Namespace: vigra

MultiArray<2, float> src(w,h), dest(w,h);
...
// define Gaussian kernel with std. deviation 3.0
Kernel1D kernel;
kernel.initGaussian(3.0);
// apply 1D filter along the y-axis
separableConvolveY(src, dest, kernel);

show deprecated examples

vigra::FImage src(w,h), dest(w,h);
...
// define Gaussian kernel with std. deviation 3.0
vigra::Kernel1D kernel;
kernel.initGaussian(3.0);
vigra::separableConvolveY(srcImageRange(src), destImage(dest), kernel1d(kernel));

Preconditions:

- The y-axis must be longer than the kernel radius: `h > std::max(kernel.right(), -kernel.left())`.
- If `border == BORDER_TREATMENT_CLIP`: The sum of kernel elements must be != 0.

## ◆ upwindImage()

template<... >

void upwindImage | ( |  | ... | ) |

This function calculates discrete upwinding scheme proposed by J. Weickert (2002) in Coherence-Enhancing Show Filters.

This function calculates of the coherence enhancing shock filter proposed by J. Weickert (2002) in Coherence-Enhancing Show Filters.

This function calculates of the coherence enhancing shock filter proposed by J. Weickert (2002): Coherence-Enhancing Show Filters. It uses the structure tensor information of an image and an iterative discrete upwinding scheme instead of pure dilation and erosion to perform the necessary morphological operations on the image.

An image is upwinded positively (dilation), if the given second src is positive. Otherwise it is upwinds negatively (eroded). The effect can be steered by an upwinding factor.

Declarations:

pass 2D array views:

namespace vigra {
template <class T1, class S1,
class T2, class S2
class T3, class S3>
void
upwindImage(MultiArrayView<2, T1, S1> const & src,
MultiArrayView<2, T2, S2> const & src2,
MultiArrayView<2, T3, S3> dest,
float upwind_factor_h);
}
vigra::upwindImage
void upwindImage(...)
This function calculates discrete upwinding scheme proposed by J. Weickert (2002) in Coherence-Enhanc...

show deprecated declarations

pass Image Iterators and Data Accessors :
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class Src2Iterator, class Src2Accessor,
class DestIterator, class DestAccessor>
void upwindImage(SrcIterator s_ul, SrcIterator s_lr, SrcAccessor s_acc,
Src2Iterator s2_ul, Src2Accessor s2_acc,
DestIterator d_ul, DestAccessor d_acc,
float upwind_factor_h)
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class Src2Iterator, class Src2Accessor,
class DestIterator, class DestAccessor>
void
upwindImage(triple<SrcIterator, SrcIterator, SrcAccessor> src,
pair<Src2Iterator, Src2Accessor> src2,
pair<DestIterator, DestAccessor> dest,
float upwind_factor_h);
}

Declarations:

pass 2D array views:

namespace vigra {
template <class T1, class S1,
class T2, class S2>
void
shockFilter(MultiArrayView<2, T1, S1> const & src,
MultiArrayView<2, T2, S2> dest,
float sigma, float rho, float upwind_factor_h,
unsigned int iterations);
}

show deprecated declarations

pass Image Iterators and Data Accessors :
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor>
void shockFilter(SrcIterator supperleft,
SrcIterator slowerright, SrcAccessor sa,
DestIterator dupperleft, DestAccessor da,
float sigma, float rho, float upwind_factor_h,
unsigned int iterations);
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor>
void
shockFilter(triple<SrcIterator, SrcIterator, SrcAccessor> src,
pair<DestIterator, DestAccessor> dest,
float sigma, float rho, float upwind_factor_h,
unsigned int iterations);
}

Usage:

#include <vigra/shockilter.hxx>
Namespace: vigra

unsigned int w=1000, h=1000;
MultiArray<2, float> src(w,h), dest(w,h);
...
// apply a shock-filter:
shockFilter(src, dest, 1.0, 5.0, 0.3, 5);

Preconditions:

The image must be larger than the window size of the filter.

## ◆ readSIF()

void readSIF | ( | const SIFImportInfo & | info,
|  | MultiArrayView< 3, float > | array
| ) |  |

Read the image data specified by the given vigra::SIFImportInfo object and write them into the given 'array'.

The array must have the correct number of dimensions and shape for the dataset represented by 'info'.

Declaration:

namespace vigra {
void
readSIF(const SIFImportInfo &info, MultiArrayView<3, float> array);
}
vigra::SIFImportInfo
Extracts image properties from an Andor SIF file header.
Definition sifImport.hxx:88
vigra::readSIF
void readSIF(const SIFImportInfo &info, MultiArrayView< 3, float > array)
Read the image data specified by the given vigra::SIFImportInfo object and write them into the given ...

Usage:

#include <vigra/sifImport.hxx>
Namespace: vigra

SIFImportInfo info(filename);
// create a 3D array of appropriate size
typedef MultiArray<3, float>::difference_type Shape;
MultiArray<3, float> in(Shape(info.width(), info.height(), info.stacksize()));
readSIF(info, in);

## ◆ readSIFBlock()

void readSIFBlock | ( | const SIFImportInfo & | info,
|  | Shape3 | offset,
|  | Shape3 | shape,
|  | MultiArrayView< 3, float > | array
| ) |  |

Read parts of the image data from an Andor SIF file specified with an SIFImportInfo object and write them into the MultiArray array.

SIFImportInfo info(filename);
// create a 3D array of appropriate size
MultiArray<3, float> in(Shape3(info.width(), info.height(), 1));
readBlock(info, Shape3(0,0,0), Shape3(w,h,1), im); // read the first frame only

## ◆ operator<<()

std::ostream & operator<< | ( | std::ostream & | os,
|  | const SIFImportInfo & | info
| ) |  |

Output all information such as shutter, Temperature etc. as human readable output.

Usage:

#include <vigra/sifImport.hxx>
Namespace: vigra

SIFImportInfo info(filename);
std::cout << info << std::endl; // print infos to the console

## ◆ skeletonizeImage()

template<... >

void skeletonizeImage | ( |  | ... | ) |

Skeletonization of all regions in a labeled 2D image.

Declarations:

namespace vigra {
template <class T1, class S1,
class T2, class S2>
void
skeletonizeImage(MultiArrayView<2, T1, S1> const & labels,
MultiArrayView<2, T2, S2> dest,
SkeletonOptions const & options = SkeletonOptions());
}
vigra::skeletonizeImage
void skeletonizeImage(...)
Skeletonization of all regions in a labeled 2D image.
vigra::SkeletonOptions
Option object for skeletonizeImage()
Definition skeleton.hxx:258

This function computes the skeleton for each region in the 2D label image labels and paints the results into the result image dest. Input label `0` is interpreted as background and always ignored. Skeletons will be marked with the same label as the corresponding region (unless options `returnLength()` or `returnSalience()` are selected, see below). Non-skeleton pixels will receive label `0`.

For each region, the algorithm proceeds in the following steps:

1. Compute the boundaryVectorDistance() relative to the OuterBoundary of the region.
2. Mark the raw skeleton: find 4-adjacent pixel pairs whose nearest boundary points are neither equal nor adjacent and mark one pixel of the pair as a skeleton candidate. The resulting raw skeleton is 8-connected and thin. Skip the remaining steps when option `dontPrune()` is selected.
3. Compute the eccentricity transform of the raw skeleton and turn the skeleton into a tree whose root is the eccentricity center. When option `pruneCenterLine()` is selected, delete all skeleton points that do not belong to the two longest tree branches and skip the remaining steps.
4. For each pixel on the skeleton, compute its `length` attribute as the depth of the pixel's longest subtree. Compute its `salience` attribute as the ratio between `length` and `distance`, where `distance` is the pixel's distance to the nearest boundary point according to the distance transform. It holds that `length >= 0.5` and `salience >= 1.0`.
5. Detect skeleton branching points and define skeleton segments as maximal connected pieces without branching points.
6. Compute `length` and `salience` of each segment as the maximum of these attributes among the pixels in the segment. When options `returnLength()` or `returnSalience()` are selected, skip the remaining steps and return the requested segment attribute in `dest`. In this case, `dest`'s `value_type` should be a floating point type to exactly accomodate the attribute values.
7. Detect minimal cycles in the raw skeleton that enclose holes in the region (if any) and mark the corresponding pixels as critical for skeleton topology.
8. Prune skeleton segments according to the selected pruning strategy and return the result. The following pruning strategies are available:
   - `pruneLength(threshold, preserve_topology)`: Retain only segments whose length attribute exceeds the given `threshold`. When `preserve_topology` is true (the defult), cycles around holes are preserved regardless of their length. Otherwise, they are pruned as well.
   - `pruneLengthRelative(threshold, preserve_topology)`: Like `pruneLength()`, but the threshold is specified as a fraction of the maximum segment length in the present region.
   - `pruneSalience(threshold, preserve_topology)`: Retain only segments whose salience attribute exceeds the given `threshold`. When `preserve_topology` is true (the defult), cycles around holes are preserved regardless of their salience. Otherwise, they are pruned as well.
   - `pruneSalienceRelative(threshold, preserve_topology)`: Like `pruneSalience()`, but the threshold is specified as a fraction of the maximum segment salience in the present region.
   - `pruneTopology(preserve_center)`: Retain only segments that are essential for the region's topology. If `preserve_center` is true (the default), the eccentricity center is also preserved, even if it is not essential. Otherwise, it might be removed. The eccentricity center is always the only remaining point when the region has no holes.

The skeleton has the following properties:

- It is 8-connected and thin (except when two independent branches happen to run alongside before they divert). Skeleton points are defined by rounding the exact Euclidean skeleton locations to the nearest pixel.
- Skeleton branches terminate either at the region boundary or at a cycle. There are no branch end points in the region interior.
- The salience threshold acts as a scale parameter: Large thresholds only retain skeleton branches characterizing the general region shape. When the threshold gets smaller, ever more detailed boundary bulges will be represented by a skeleton branch.

Remark: If you have an application where a skeleton graph would be more useful than a skeleton image, function `skeletonizeImage()` can be changed/extended easily.

Usage:

#include <vigra/skeleton.hxx>
Namespace: vigra

Shape2 shape(width, height);
MultiArray<2, UInt32> source(shape);
MultiArray<2, UInt32> dest(shape);
...
// Skeletonize and keep only those segments that are at least 10% of the maximum
// length (the maximum length is half the skeleton diameter).
skeletonizeImage(source, dest,
SkeletonOptions().pruneLengthRelative(0.1));

See also
  vigra::boundaryVectorDistance()

## ◆ slantedEdgeMTF()

template<... >

void slantedEdgeMTF | ( |  | ... | ) |

Determine the magnitude transfer function of the camera.

This operator estimates the magnitude transfer function (MTF) of a camera by means of the slanted edge method described in:

ISO Standard No. 12233: "Photography - Electronic still picture cameras - Resolution measurements", 2000

The input must be an image that contains a single step edge with bright pixels on one side and dark pixels on the other. However, the intensity values must be neither saturated nor zero. The algorithms computes the MTF from the Fourier transform of the edge's derivative. Thus, if the actual MTF is anisotropic, the estimated MTF does actually only apply in the direction perpendicular to the edge - several edges at different orientations are required to estimate an anisotropic MTF.

The algorithm returns a sequence of frequency / attenuation pairs. The frequency axis is normalized so that the Nyquist frequency of the original image is 0.5. Since the edge's derivative is computed with subpixel accuracy, the attenuation can usually be computed for frequencies significantly above the Nyquist frequency as well. The MTF estimate ends at either the first zero crossing of the MTF or at frequency 1, whichever comes earlier.

The present implementation improves the original slanted edge algorithm according to ISO 12233 in a number of ways:

- The edge is not required to run nearly vertically or horizontally (i.e. with a slant of approximately 5 degrees). The algorithm will automatically compute the edge's actual angle and adjust estimates accordingly. However, it is still necessary for the edge to be somewhat slanted, because subpixel-accurate estimation of the derivative is impossible otherwise (i.e. the edge position perpendicular to the edge direction must differ by at least 1 pixel between the two ends of the edge).

- Our implementation uses a more accurate subpixel derivative algorithm. In addition, we first perform a shading correction in order to reduce possible derivative bias due to nonuniform illumination.

- If the input image is large enough (i.e. there are at least 20 pixels on either side of the edge over the edge's entire length), our algorithm attempts to subtract the estimated noise power spectrum from the estimated MTF.

The source value type `T1` must be a scalar type which is convertible to `double`. The result is written into the result sequence, which must be back-insertable (supports `push_back()`) and whose `value_type` must be constructible from two `double` values. Algorithm options can be set via the options object (see vigra::NoiseNormalizationOptions for details).

Declarations:

pass 2D array views:

namespace vigra {
template <class T1, class S1, class BackInsertable>
void
slantedEdgeMTF(MultiArrayView<2, T1, S1> const & src, BackInsertable & mtf,
SlantedEdgeMTFOptions const & options = SlantedEdgeMTFOptions());
}
vigra::SlantedEdgeMTFOptions
Pass options to one of the slantedEdgeMTF() functions.
Definition slanted_edge_mtf.hxx:96
vigra::slantedEdgeMTF
void slantedEdgeMTF(...)
Determine the magnitude transfer function of the camera.

show deprecated declarations

pass Image Iterators and Data Accessors :
namespace vigra {
template <class SrcIterator, class SrcAccessor, class BackInsertable>
void
slantedEdgeMTF(SrcIterator sul, SrcIterator slr, SrcAccessor src, BackInsertable & mtf,
SlantedEdgeMTFOptions const & options = SlantedEdgeMTFOptions());
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
template <class SrcIterator, class SrcAccessor, class BackInsertable>
void
slantedEdgeMTF(triple<SrcIterator, SrcIterator, SrcAccessor> src, BackInsertable & mtf,
SlantedEdgeMTFOptions const & options = SlantedEdgeMTFOptions())
}

Usage:

#include <vigra/slanted_edge_mtf.hxx>
Namespace: vigra

MultiArray<2, float> src(w,h);
std::vector<vigra::TinyVector<double, 2> > mtf;
...
// keep all options at their default values
slantedEdgeMTF(src, mtf);
// print the frequency / attenuation pairs found
for(int k=0; k<result.size(); ++k)
std::cout << "frequency: " << mtf[k][0] << ", estimated attenuation: " << mtf[k][1] << std::endl;

show deprecated examples

vigra::BImage src(w,h);
std::vector<vigra::TinyVector<double, 2> > mtf;
...
vigra::slantedEdgeMTF(srcImageRange(src), mtf);
// print the frequency / attenuation pairs found
for(int k=0; k<result.size(); ++k)
std::cout << "frequency: " << mtf[k][0] << ", estimated attenuation: " << mtf[k][1] << std::endl;
Required Interface:
SrcIterator upperleft, lowerright;
SrcAccessor src;
typedef SrcAccessor::value_type SrcType;
typedef NumericTraits<SrcType>::isScalar isScalar;
assert(isScalar::asBool == true);
double value = src(uperleft);
BackInsertable result;
typedef BackInsertable::value_type ResultType;
double intensity, variance;
result.push_back(ResultType(intensity, variance));

## ◆ mtfFitGaussian()

template<class Vector >

double mtfFitGaussian | ( | Vector const & | mtf | ) |

Fit a Gaussian function to a given MTF.

This function expects a sequence of frequency / attenuation pairs as produced by slantedEdgeMTF() and finds the best fitting Gaussian point spread function (Gaussian functions are good approximations of the PSF of many real cameras). It returns the standard deviation (scale) of this function. The algorithm computes the standard deviation by means of a linear least square on the logarithm of the MTF, i.e. an algebraic fit rather than a Euclidean fit - thus, the resulting Gaussian may not be the one that intuitively fits the data optimally.

Declaration:

namespace vigra {
template <class Vector>
double mtfFitGaussian(Vector const & mtf);
}
vigra::mtfFitGaussian
double mtfFitGaussian(Vector const &mtf)
Fit a Gaussian function to a given MTF.
Definition slanted_edge_mtf.hxx:708

Usage:

#include <vigra/slanted_edge_mtf.hxx>
Namespace: vigra

MultiArray<2, float> src(w,h);
std::vector<vigra::TinyVector<double, 2> > mtf;
...
slantedEdgeMTF(src, mtf);
double scale = vigra::mtfFitGaussian(mtf)
std::cout << "The camera PSF is approximately a Gaussian at scale " << scale << std::endl;

Required Interface:

Vector mtf;
int numberOfMeasurements = mtf.size()
double frequency = mtf[0][0];
double attenuation = mtf[0][1];

## ◆ generateSlicSeeds()

template<... >

unsigned int generateSlicSeeds | ( |  | ... | ) |

Generate seeds for SLIC superpixel computation in arbitrary dimensions.

The source array src must be a scalar boundary indicator such as the gradient magnitude. Seeds are initially placed on a regular Cartesian grid with spacing seedDist und then moved to the point with smallest boundary indicator within a search region of radius searchRadius around the initial position. The resulting points are then marked in the output array seeds by consecutive labels.

The function returns the number of selected seeds, which equals the largest seed label because labeling starts at 1.

Declaration:

use arbitrary-dimensional arrays:

namespace vigra {
template <unsigned int N, class T, class S1,
class Label, class S2>
unsigned int
generateSlicSeeds(MultiArrayView<N, T, S1> const & src,
MultiArrayView<N, Label, S2> seeds,
unsigned int seedDist,
unsigned int searchRadius = 1);
}
vigra::generateSlicSeeds
unsigned int generateSlicSeeds(...)
Generate seeds for SLIC superpixel computation in arbitrary dimensions.

Usage:

#include <vigra/slic.hxx>
Namespace: vigra

MultiArray<2, RGBValue<float> > src(Shape2(w, h));
... // fill src image
// transform image to Lab color space
transformImage(srcImageRange(src), destImage(src), RGBPrime2LabFunctor<float>());
// compute image gradient magnitude at scale 1.0 as a boundary indicator
MultiArray<2, float> grad(src.shape());
gaussianGradientMagnitude(srcImageRange(src), destImage(grad), 1.0);
MultiArray<2, unsigned int> seeds(src.shape());
int seedDistance = 15;
// place seeds on a grid with distance 15, but then move it to the lowest gradient
// poistion in a 3x3 window
generateSlicSeeds(grad, seeds, seedDistance);

For more details and examples see slicSuperpixels().

## ◆ slicSuperpixels()

template<... >

unsigned int slicSuperpixels | ( |  | ... | ) |

Compute SLIC superpixels in arbitrary dimensions.

This function implements the algorithm described in

R. Achanta et al.: "SLIC Superpixels Compared to State-of-the-Art Superpixel Methods", IEEE Trans. Patt. Analysis Mach. Intell. 34(11):2274-2281, 2012

The value type `T` of the source array src must provide the necessary functionality to compute averages and squared distances (i.e. it must fulfill the requirements of a LinearSpace and support squaredNorm(T const &)). This is true for all scalar types as well as vigra::TinyVector and vigra::RGBValue. The output array labels will be filled with labels designating membership of each point in one of the superpixel regions.

The output array can optionally contain seeds (which will be overwritten by the output) to give you full control over seed placement. If labels is empty, seeds will be created automatically by an internal call to generateSlicSeeds().

The parameter seedDistance specifies the radius of the window around each seed (or, more precisely, around the present regions centers) where the algorithm looks for potential members of the corresponding superpixel. It thus places an upper limit on the superpixel size. When seeds are computed automatically, this parameter also determines the grid spacing for seed placement.

The parameter intensityScaling is used to normalize (i.e. divide) the color/intensity difference before it is compared with the spatial distance. This corresponds to parameter m in equation (2) of the paper.

The options object can be used to specify the number of iterations (`SlicOptions::iterations()`) and an explicit minimal superpixel size (`SlicOptions::minSize()`). By default, the algorithm merges all regions that are smaller than 1/4 of the average superpixel size.

The function returns the number of superpixels, which equals the largest label because labeling starts at 1.

Declaration:

use arbitrary-dimensional arrays:

namespace vigra {
template <unsigned int N, class T, class S1,
class Label, class S2,
class DistanceType>
unsigned int
slicSuperpixels(MultiArrayView<N, T, S1> const & src,
MultiArrayView<N, Label, S2> labels,
DistanceType intensityScaling,
unsigned int seedDistance,
SlicOptions const & options = SlicOptions());
}
vigra::slicSuperpixels
unsigned int slicSuperpixels(...)
Compute SLIC superpixels in arbitrary dimensions.
vigra::SlicOptions
Options object for slicSuperpixels().
Definition slic.hxx:158

Usage:

#include <vigra/slic.hxx>
Namespace: vigra

MultiArray<2, RGBValue<float> > src(Shape2(w, h));
... // fill src image
// transform image to Lab color space
transformMultiArray(srcMultiArrayRange(src), destMultiArray(src), RGBPrime2LabFunctor<float>());
MultiArray<2, unsigned int> labels(src.shape());
int seedDistance = 15;
double intensityScaling = 20.0;
// compute seeds automatically, perform 40 iterations, and scale intensity differences
// down to 1/20 before comparing with spatial distances
slicSuperpixels(src, labels, intensityScaling, seedDistance, SlicOptions().iterations(40));

This works for arbitrary-dimensional arrays.

## ◆ frostFilter()

template<... >

void frostFilter | ( |  | ... | ) |

This function tries to reduce the speckle noise of an image by applying the basic Frost filter.

This function tries to reduce the speckle noise of an image by means of applying the basic Frost filter using a window of given size and a damping factor k. The implementation is according to the article by Lopez & Touzi & Nezry (1990): Adaptive speckle filters and scene heterogenity.

The user has to provide a window size and a damping factor k. The implementation is according to the article by
Lopez & Touzi & Nezry (1990): Adaptive speckle filters and scene heterogenity.

All restrictions of the called functions applyWindowFunction apply.

Preconditions:

0.0 < k <= 1.0

Declarations:

pass 2D array views:

namespace vigra {
template <class T1, class S1,
class T2, class S2>
void
frostFilter(MultiArrayView<2, T1, S1> const & src,
MultiArrayView<2, T2, S2> dest,
Diff2D window_shape, float k,
BorderTreatmentMode border = BORDER_TREATMENT_REPEAT);
}
vigra::frostFilter
void frostFilter(...)
This function tries to reduce the speckle noise of an image by applying the basic Frost filter.

show deprecated declarations

pass Image Iterators and Data Accessors :
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor>
void frostFilter(SrcIterator supperleft,
SrcIterator slowerright, SrcAccessor sa,
DestIterator dupperleft, DestAccessor da,
Diff2D window_shape, float k,
BorderTreatmentMode border = BORDER_TREATMENT_REPEAT);
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor>
void
frostFilter(triple<SrcIterator, SrcIterator, SrcAccessor> src,
pair<DestIterator, DestAccessor> dest,
Diff2D window_shape, float k,
BorderTreatmentMode border = BORDER_TREATMENT_REPEAT);
}

Usage:

#include <vigra/specklefilters.hxx>
Namespace: vigra

unsigned int w=1000, h=1000;
MultiArray<2, float> src(w,h), dest(w,h);
...
// apply a (basic) frost filter with a window size of 5x5 and a damping factor of 0.5
frostFilter(src, dest, Diff2D(5,5), 0.5);

## ◆ normalizedConvolveImage()

template<... >

void normalizedConvolveImage | ( |  | ... | ) |

Performs a 2-dimensional normalized convolution, i.e. convolution with a mask image.

This functions computes normalized convolution as defined in Knutsson, H. and Westin, C-F.: Normalized and differential convolution: Methods for Interpolation and Filtering of incomplete and uncertain data. Proc. of the IEEE Conf. on Computer Vision and Pattern Recognition, 1993, 515-523.

The mask image must be binary and encodes which pixels of the original image are valid. It is used as follows: Only pixel under the mask are used in the calculations. Whenever a part of the kernel lies outside the mask, it is ignored, and the kernel is renormalized to its original norm (analogous to the CLIP BorderTreatmentMode). Thus, a useful convolution result is computed whenever at least one valid pixel is within the current window Thus, destination pixels not under the mask still receive a value if they are near the mask. Therefore, this algorithm is useful as an interpolator of sparse input data. If you are only interested in the destination values under the mask, you can perform a subsequent copyImageIf().

The KernelIterator must point to the center of the kernel, and the kernel's size is given by its upper left (x and y of distance <= 0) and lower right (distance >= 0) corners. The image must always be larger than the kernel. At those positions where the kernel does not completely fit into the image, the specified BorderTreatmentMode is applied. Only BORDER_TREATMENT_CLIP and BORDER_TREATMENT_AVOID are currently supported.

The images's pixel type (SrcAccessor::value_type) must be a linear space over the kernel's value_type (KernelAccessor::value_type), i.e. addition of source values, multiplication with kernel values, and NumericTraits must be defined. The kernel's value_type must be an algebraic field, i.e. the arithmetic operations (+, -, *, /) and NumericTraits must be defined.

Declarations:

pass 2D array views:

namespace vigra {
template <class T1, class S1,
class T2, class S2,
class TM, class SM,
class T3>
void
normalizedConvolveImage(MultiArrayView<2, T1, S1> const & src,
MultiArrayView<2, TM, SM> const & mask,
MultiArrayView<2, T2, S2> dest,
Kernel2D<T3> const & kernel);
}
vigra::normalizedConvolveImage
void normalizedConvolveImage(...)
Performs a 2-dimensional normalized convolution, i.e. convolution with a mask image.

show deprecated declarations

pass Image Iterators and Data Accessors :
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class MaskIterator, class MaskAccessor,
class DestIterator, class DestAccessor,
class KernelIterator, class KernelAccessor>
void
normalizedConvolveImage(SrcIterator src_ul, SrcIterator src_lr, SrcAccessor src_acc,
MaskIterator mul, MaskAccessor am,
DestIterator dest_ul, DestAccessor dest_acc,
KernelIterator ki, KernelAccessor ak,
Diff2D kul, Diff2D klr, BorderTreatmentMode border);
}
vigra::mul
void mul(FixedPoint< IntBits1, FracBits1 > l, FixedPoint< IntBits2, FracBits2 > r, FixedPoint< IntBits3, FracBits3 > &result)
multiplication with enforced result type.
Definition fixedpoint.hxx:605
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class MaskIterator, class MaskAccessor,
class DestIterator, class DestAccessor,
class KernelIterator, class KernelAccessor>
void normalizedConvolveImage(triple<SrcIterator, SrcIterator, SrcAccessor> src,
pair<MaskIterator, MaskAccessor> mask,
pair<DestIterator, DestAccessor> dest,
tuple5<KernelIterator, KernelAccessor, Diff2D, Diff2D,
BorderTreatmentMode> kernel);
}

Usage:

#include <vigra/stdconvolution.hxx>
Namespace: vigra

MultiArray<2, float> src(w,h), dest(w,h);
MultiArray<2, unsigned char> mask(w,h);
...
// define 3x3 binomial filter
vigra::Kernel2D<float> binom;
binom.initExplicitly(Diff2D(-1,-1), Diff2D(1,1)) = // upper left and lower right
0.0625, 0.125, 0.0625,
0.125, 0.25, 0.125,
0.0625, 0.125, 0.0625;
normalizedConvolveImage(src, mask, dest, binom);

show deprecated examples

vigra::FImage src(w,h), dest(w,h);
vigra::CImage mask(w,h);
...
// define 3x3 binomial filter
vigra::Kernel2D<float> binom;
binom.initExplicitly(Diff2D(-1,-1), Diff2D(1,1)) = // upper left and lower right
0.0625, 0.125, 0.0625,
0.125, 0.25, 0.125,
0.0625, 0.125, 0.0625;
vigra::normalizedConvolveImage(srcImageRange(src), maskImage(mask), destImage(dest), kernel2d(binom));
Required Interface:
ImageIterator src_ul, src_lr;
ImageIterator mul;
ImageIterator dest_ul;
ImageIterator ik;
SrcAccessor src_accessor;
MaskAccessor mask_accessor;
DestAccessor dest_accessor;
KernelAccessor kernel_accessor;
NumericTraits<SrcAccessor::value_type>::RealPromote s = src_accessor(src_ul);
s = s + s;
s = kernel_accessor(ik) * s;
s -= s;
if(mask_accessor(mul)) ...;
dest_accessor.set(
NumericTraits<DestAccessor::value_type>::fromRealPromote(s), dest_ul);
NumericTraits<KernelAccessor::value_type>::RealPromote k = kernel_accessor(ik);
k += k;
k -= k;
k = k / k;

Preconditions:

- The image must be longer than the kernel radius: `w > std::max(kernel.lowerRight().x, -kernel.upperLeft().x)` and `h > std::max(kernel.lowerRight().y, -kernel.upperLeft().y)`.
- The sum of kernel elements must be != 0.
- `border == BORDER_TREATMENT_CLIP || border == BORDER_TREATMENT_AVOID`

## ◆ convolveImageWithMask()

template<... >

void convolveImageWithMask | ( |  | ... | ) |

Deprecated name of 2-dimensional normalized convolution, i.e. convolution with a mask image.

See normalizedConvolveImage() for documentation.

Declarations:

pass 2D array views:

namespace vigra {
template <class SrcIterator, class SrcAccessor,
class MaskIterator, class MaskAccessor,
class DestIterator, class DestAccessor,
class KernelIterator, class KernelAccessor>
void
convolveImageWithMask(SrcIterator src_ul, SrcIterator src_lr, SrcAccessor src_acc,
MaskIterator mul, MaskAccessor am,
DestIterator dest_ul, DestAccessor dest_acc,
KernelIterator ki, KernelAccessor ak,
Diff2D kul, Diff2D klr, BorderTreatmentMode border);
}
vigra::convolveImageWithMask
void convolveImageWithMask(...)
Deprecated name of 2-dimensional normalized convolution, i.e. convolution with a mask image.

show deprecated declarations

pass Image Iterators and Data Accessors :
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class MaskIterator, class MaskAccessor,
class DestIterator, class DestAccessor,
class KernelIterator, class KernelAccessor>
void
convolveImageWithMask(SrcIterator src_ul, SrcIterator src_lr, SrcAccessor src_acc,
MaskIterator mul, MaskAccessor am,
DestIterator dest_ul, DestAccessor dest_acc,
KernelIterator ki, KernelAccessor ak,
Diff2D kul, Diff2D klr, BorderTreatmentMode border);
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class MaskIterator, class MaskAccessor,
class DestIterator, class DestAccessor,
class KernelIterator, class KernelAccessor>
void convolveImageWithMask(triple<SrcIterator, SrcIterator, SrcAccessor> src,
pair<MaskIterator, MaskAccessor> mask,
pair<DestIterator, DestAccessor> dest,
tuple5<KernelIterator, KernelAccessor, Diff2D, Diff2D,
BorderTreatmentMode> kernel);
}

## ◆ radialSymmetryTransform()

template<... >

void radialSymmetryTransform | ( |  | ... | ) |

Find centers of radial symmetry in an image.

This algorithm implements the Fast Radial Symmetry Transform according to [G. Loy, A. Zelinsky: "A Fast Radial Symmetry Transform for Detecting Points of Interest", in: A. Heyden et al. (Eds.): Proc. of 7th European Conf. on Computer Vision, Part 1, pp. 358-368, Springer LNCS 2350, 2002]. Minima of the algorithm response mark dark blobs, maxima correspond to light blobs. The "radial strictness parameter" is fixed at `alpha` = 2.0, the spatial spreading of the raw response is done by a Gaussian convolution at `0.25*scale` (these values are recommendations from the paper). Loy and Zelinsky additionally propose to add the operator response from several scales (see usage example below).

Declarations:

pass 2D array views:

namespace vigra {
template <class T1, class S1,
class T2, class S2>
void
radialSymmetryTransform(MultiArrayView<2, T1, S1> const & src,
MultiArrayView<2, T2, S2> dest,
double scale);
}
vigra::radialSymmetryTransform
void radialSymmetryTransform(...)
Find centers of radial symmetry in an image.

show deprecated declarations

pass Image Iterators and Data Accessors :
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor>
void
radialSymmetryTransform(SrcIterator sul, SrcIterator slr, SrcAccessor as,
DestIterator dul, DestAccessor ad,
double scale)
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor>
inline
void radialSymmetryTransform(
triple<SrcIterator, SrcIterator, SrcAccessor> src,
pair<DestIterator, DestAccessor> dest,
double scale)
}

Usage:

#include <vigra/symmetry.hxx>
Namespace: vigra

MultiArray<2, unsigned char> src(w,h), centers(w,h);
MultiArray<2, float> symmetry(w,h);
// use edge detection filters at various scales
for(double scale = 2.0; scale <= 8.0; scale *= 2.0)
{
MultiArray<2, float> tmp(w,h);
// find centers of symmetry
radialSymmetryTransform(src, tmp, scale);
symmetry += tmp;
}
// mark centers of symmetry
centers.init(128);
localMinima(symmetry, centers, 0);
localMaxima(symmetry, centers, 255);

show deprecated examples

vigra::BImage src(w,h), centers(w,h);
vigra::FImage symmetry(w,h);
// empty result image
centers.init(128);
symmetry.init(0.0);
// input width of edge detection filter
for(double scale = 2.0; scale <= 8.0; scale *= 2.0)
{
vigra::FImage tmp(w,h);
// find centers of symmetry
radialSymmetryTransform(srcImageRange(src), destImage(tmp), scale);
combineTwoImages(srcImageRange(symmetry), srcImage(tmp), destImage(symmetry),
std::plus<float>());
}
localMinima(srcImageRange(symmetry), destImage(centers), 0);
localMaxima(srcImageRange(symmetry), destImage(centers), 255);
Required Interface:
SrcImageIterator src_upperleft, src_lowerright;
DestImageIterator dest_upperleft;
SrcAccessor src_accessor;
DestAccessor dest_accessor;
// SrcAccessor::value_type must be a built-in type
SrcAccessor::value_type u = src_accessor(src_upperleft);
dest_accessor.set(u, dest_upperleft);

## ◆ vectorToTensor()

template<... >

void vectorToTensor | ( |  | ... | ) |

Calculate the tensor (outer) product of a 2D vector with itself.

This function is useful to transform vector images into a tensor representation that can be used as input to tensor based processing and analysis functions (e.g. tensor smoothing). The input pixel type must be vectors of length 2, whereas the output must contain vectors of length 3 which will represent the tensor components in the order t11, t12 (== t21 due to symmetry), t22.

Note: In order to account for the left-handedness of the image coordinate system, the second tensor component (t12) can be negated by setting `negateComponent2 = false`. Angles will then be interpreted counter-clockwise rather than clockwise. By default, this behavior is switched off.

Declarations:

pass 2D array views:

namespace vigra {
template <class T1, class S1,
class T2, class S2>
void
vectorToTensor(MultiArrayView<2, T1, S1> const & src,
MultiArrayView<2, T2, S2> dest,
bool negateComponent2 = false);
}

show deprecated declarations

pass Image Iterators and Data Accessors :
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor>
void vectorToTensor(SrcIterator sul, SrcIterator slr, SrcAccessor src,
DestIterator dul, DestAccessor dest,
bool negateComponent2 = false);
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor>
void vectorToTensor(triple<SrcIterator, SrcIterator, SrcAccessor> s,
pair<DestIterator, DestAccessor> d,
bool negateComponent2 = false);
}

Usage:

#include <vigra/tensorutilities.hxx>
Namespace: vigra

MultiArray<2, float> img(w,h);
MultiArray<2, TinyVector<float, 2> > gradient(w,h);
MultiArray<2, TinyVector<float, 3> > tensor(w,h);
...
gaussianGradient(img, gradient, 2.0);
vectorToTensor(gradient, tensor);

show deprecated examples

FImage img(w,h);
FVector2Image gradient(w,h);
FVector3Image tensor(w,h);
gaussianGradient(srcImageRange(img), destImage(gradient), 2.0);
vectorToTensor(srcImageRange(gradient), destImage(tensor));

## ◆ tensorEigenRepresentation()

template<... >

void tensorEigenRepresentation | ( |  | ... | ) |

Calculate eigen representation of a symmetric 2x2 tensor.

This function turns a 3-band image representing the tensor components t11, t12 (== t21 due to symmetry), t22 into the a 3-band image holding the eigen representation e1, e2, and angle, where e1 > e2. When the tensor is defined in a left-handed coordinate system (the default on images), the angle will then be given in clockwise orientation, starting at the x-axis. Otherwise, it will be given in counter-clockwise orientation.

Declarations:

pass 2D array views:

namespace vigra {
template <class T1, class S1,
class T2, class S2>
void
tensorEigenRepresentation(MultiArrayView<2, T1, S1> const & src,
MultiArrayView<2, T2, S2> dest);
}
vigra::tensorEigenRepresentation
void tensorEigenRepresentation(...)
Calculate eigen representation of a symmetric 2x2 tensor.

show deprecated declarations

pass Image Iterators and Data Accessors :
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor>
void tensorEigenRepresentation(SrcIterator sul, SrcIterator slr, SrcAccessor src,
DestIterator dul, DestAccessor dest);
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor>
void tensorEigenRepresentation(triple<SrcIterator, SrcIterator, SrcAccessor> s,
pair<DestIterator, DestAccessor> d);
}

Usage:

#include <vigra/tensorutilities.hxx>
Namespace: vigra

MultiArray<2, TinyVector<float, 3> > tensor(w,h),
eigen(w,h);
tensorEigenRepresentation(tensor, eigen);

show deprecated examples

FVector3Image tensor(w,h);
FVector3Image eigen(w,h);
tensorEigenRepresentation(srcImageRange(tensor), destImage(eigen));

## ◆ tensorTrace()

template<... >

void tensorTrace | ( |  | ... | ) |

Calculate the trace of a 2x2 tensor.

This function turns a 3-band image representing the tensor components t11, t12 (== t21 due to symmetry), t22 into the a 1-band image holding the tensor trace t11 + t22.

Declarations:

pass 2D array views:

namespace vigra {
template <class T1, class S1,
class T2, class S2>
void
tensorTrace(MultiArrayView<2, T1, S1> const & src,
MultiArrayView<2, T2, S2> dest);
}
vigra::tensorTrace
void tensorTrace(...)
Calculate the trace of a 2x2 tensor.

show deprecated declarations

pass Image Iterators and Data Accessors :
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor>
void tensorTrace(SrcIterator sul, SrcIterator slr, SrcAccessor src,
DestIterator dul, DestAccessor dest);
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor>
void tensorTrace(triple<SrcIterator, SrcIterator, SrcAccessor> s,
pair<DestIterator, DestAccessor> d);
}

Usage:

#include <vigra/tensorutilities.hxx>
Namespace: vigra

MultiArray<2, TinyVector<float, 3> > tensor(w,h);
MultiArray<2, float> trace(w,h);
tensorTrace(tensor, trace);

show deprecated examples

FVector3Image tensor(w,h);
FImage trace(w,h);
tensorTrace(srcImageRange(tensor), destImage(trace));

## ◆ tensorToEdgeCorner()

template<... >

void tensorToEdgeCorner | ( |  | ... | ) |

Decompose a symmetric 2x2 tensor into its edge and corner parts.

This function turns a 3-band image representing the tensor components t11, t12 (== t21 due to symmetry), t22 into the a 2-band image holding the tensor's edgeness (difference of the tensor's eigenvalues) and orientation, and a 1-band image representing its corner part (equal to the twice the small eigen value). The original tensor must be positive definite and defined in a right-handed coordinate system (e.g. the tensor resulting from boundaryTensor()).

Declarations:

pass 2D array views:

namespace vigra {
template <class T1, class S1,
class T21, class S21,
class T22, class S22>
void
tensorToEdgeCorner(MultiArrayView<2, T1, S1> const & src,
MultiArrayView<2, T21, S21> edge,
MultiArrayView<2, T22, S22> corner);
}
vigra::tensorToEdgeCorner
void tensorToEdgeCorner(...)
Decompose a symmetric 2x2 tensor into its edge and corner parts.

show deprecated declarations

pass Image Iterators and Data Accessors :
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class DestIterator1, class DestAccessor1,
class DestIterator2, class DestAccessor2>
void tensorToEdgeCorner(SrcIterator sul, SrcIterator slr, SrcAccessor src,
DestIterator1 edgeul, DestAccessor1 edge,
DestIterator2 cornerul, DestAccessor2 corner);
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class DestIterator1, class DestAccessor1,
class DestIterator2, class DestAccessor2>
void tensorToEdgeCorner(triple<SrcIterator, SrcIterator, SrcAccessor> s,
pair<DestIterator1, DestAccessor1> edge,
pair<DestIterator2, DestAccessor2> corner);
}

Usage:

#include <vigra/tensorutilities.hxx>
Namespace: vigra

MultiArray<2, TinyVector<float, 3> > tensor(w,h);
MultiArray<2, TinyVector<float, 2> > edgePart(w,h);
MultiArray<2, float> cornerPart(w,h);
...
tensorTrace(tensor, edgePart, cornerPart);

show deprecated examples

FVector3Image tensor(w,h);
FVector2Image edgePart(w,h);
FImage cornerPart(w,h);
tensorTrace(srcImageRange(tensor), destImage(edgePart), destImage(cornerPart));

## ◆ parallel_foreach()

template<... >

void parallel_foreach | ( |  | ... | ) |

Apply a functor to all items in a range in parallel.

Declarations:

namespace vigra {
// pass the desired number of threads or ParallelOptions::Auto
// (creates an internal thread pool accordingly)
template<class ITER, class F>
void parallel_foreach(int64_t nThreads,
ITER begin, ITER end,
F && f,
const uint64_t nItems = 0);
// use an existing thread pool
template<class ITER, class F>
void parallel_foreach(ThreadPool & pool,
ITER begin, ITER end,
F && f,
const uint64_t nItems = 0);
// pass the integers from 0 ... (nItems-1) to the functor f,
// using the given number of threads or ParallelOptions::Auto
template<class F>
void parallel_foreach(int64_t nThreads,
uint64_t nItems,
F && f);
// likewise with an existing thread pool
template<class F>
void parallel_foreach(ThreadPool & threadpool,
uint64_t nItems,
F && f);
}
vigra::ThreadPool
Thread pool class to manage a set of parallel workers.
Definition threadpool.hxx:148
vigra::parallel_foreach
void parallel_foreach(...)
Apply a functor to all items in a range in parallel.

Create a thread pool (or use an existing one) to apply the functor

- f to all items in the range `[begin, end)` in parallel.
- f must be callable with two arguments of type `size_t` and `T`, where the first argument is the thread index (starting at 0) and T is convertible from the iterator's `reference_type` (i.e. the result of `*begin`).

If the iterators are forward iterators (`std::forward_iterator_tag`), you can provide the optional argument `nItems` to avoid the a `std::distance(begin, end)` call to compute the range's length.

Parameter `nThreads` controls the number of threads. `parallel_foreach` will split the work into about three times as many parallel tasks. If `nThreads = ParallelOptions::Auto`, the number of threads is set to the machine default (`std::thread::hardware_concurrency()`).

If `nThreads = 0`, the function will not use threads, but will call the functor sequentially. This can also be enforced by setting the preprocessor flag `VIGRA_SINGLE_THREADED`, ignoring the value of `nThreads` (useful for debugging).

Usage:

#include <iostream>
#include <algorithm>
#include <vector>
#include <vigra/threadpool.hxx>
using namespace std;
using namespace vigra;
int main()
{
size_t const n_threads = 4;
size_t const n = 2000;
vector<int> input(n);
auto iter = input.begin(),
end = input.end();
// fill input with 0, 1, 2, ...
iota(iter, end, 0);
// compute the sum of the elements in the input vector.
// (each thread computes the partial sum of the items it sees
// and stores the sum at the appropriate index of 'results')
vector<int> results(n_threads, 0);
parallel_foreach(n_threads, iter, end,
// the functor to be executed, defined as a lambda function
// (first argument: thread ID, second argument: result of *iter)
[&results](size_t thread_id, int items)
{
results[thread_id] += items;
}
);
// collect the partial sums of all threads
int sum = accumulate(results.begin(), results.end(), 0);
cout << "The sum " << sum << " should be equal to " << (n*(n-1))/2 << endl;
}
vigra::sum
NumericTraits< V >::Promote sum(TinyVectorBase< V, SIZE, D1, D2 > const &l)
sum of the vector's elements
Definition tinyvector.hxx:2073

## ◆ importTiffImage()

template<... >

void importTiffImage | ( |  | ... | ) |

Read a given TIFF image.

This function calls tiffToScalarImage() or tiffToRGBImage(), depending on the destinations's value_type. Usually, it is better to use importImage(). importTiffImage() should only be used if explicit access to the TIFF object `TiffImage` is required.

Declarations:

pass 2D array views:

namespace vigra {
template <class T, class S>
void
importTiffImage(TiffImage * tiff, MultiArrayView<2, T, S> dest);
}
vigra::importTiffImage
void importTiffImage(...)
Read a given TIFF image.

show deprecated declarations

pass Image Iterators and Data Accessors :
namespace vigra {
template <class ImageIterator, class Accessor>
void
importTiffImage(TiffImage * tiff, ImageIterator iter, Accessor a)
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
template <class ImageIterator, class Accessor>
void
importTiffImage(TiffImage * tiff, pair<ImageIterator, Accessor> dest)
}

Usage:

#include <vigra/tiff.hxx>
Namespace: vigra

uint32 w, h;
TiffImage * tiff = TIFFOpen("tiffimage.tiff", "r");
TIFFGetField(tiff, TIFFTAG_IMAGEWIDTH, &w);
TIFFGetField(tiff, TIFFTAG_IMAGELENGTH, &h);
MultiArray<2, unsigned char> img(w,h);
importTiffImage(tiff, img);
TIFFClose(tiff);

Required Interface:

see tiffToScalarImage() and tiffToRGBImage()

Preconditions:

see tiffToScalarImage() and tiffToRGBImage()

## ◆ tiffToScalarImage()

template<... >

void tiffToScalarImage | ( |  | ... | ) |

Convert single-band TiffImage to scalar image.

Note that unexpected results can occur when the destination pixel type is weaker than the pixel type in the file (e.g. when a `float` file is imported into a `unsigned char` image).

Declarations:

pass 2D array views:

namespace vigra {
template <class ImageIterator, class Accessor>
void
tiffToScalarImage(TiffImage * tiff, ImageIterator iter, Accessor a)
}
vigra::tiffToScalarImage
void tiffToScalarImage(...)
Convert single-band TiffImage to scalar image.

show deprecated declarations

pass Image Iterators and Data Accessors :
namespace vigra {
template <class ImageIterator, class Accessor>
void
tiffToScalarImage(TiffImage * tiff, ImageIterator iter, Accessor a)
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
template <class ImageIterator, class Accessor>
void
tiffToScalarImage(TiffImage * tiff, pair<ImageIterator, Accessor> dest)
}

Usage:

#include <vigra/tiff.hxx>
Namespace: vigra

uint32 w, h;
uint16 photometric;
TiffImage * tiff = TIFFOpen("tiffimage.tiff", "r");
TIFFGetField(tiff, TIFFTAG_IMAGEWIDTH, &w);
TIFFGetField(tiff, TIFFTAG_IMAGELENGTH, &h);
TIFFGetField(tiff_, TIFFTAG_PHOTOMETRIC, &photometric);
if(photometric != PHOTOMETRIC_MINISWHITE &&
photometric != PHOTOMETRIC_MINISBLACK)
{
// not a scalar image - handle error
}
MultiArray<2, unsigned char> img(w,h);
tiffToScalarImage(tiff, img);
TIFFClose(tiff);

show deprecated examples

uint32 w, h;
uint16 photometric;
TiffImage * tiff = TIFFOpen("tiffimage.tiff", "r");
TIFFGetField(tiff, TIFFTAG_IMAGEWIDTH, &w);
TIFFGetField(tiff, TIFFTAG_IMAGELENGTH, &h);
TIFFGetField(tiff_, TIFFTAG_PHOTOMETRIC, &photometric);
if(photometric != PHOTOMETRIC_MINISWHITE &&
photometric != PHOTOMETRIC_MINISBLACK)
{
// not a scalar image - handle error
}
vigra::BImage img(w,h);
vigra::tiffToScalarImage(tiff, destImage(img));
TIFFClose(tiff);
Required Interface:
ImageIterator upperleft;
<unsigned char, short, long, float, double> value;
Accessor accessor;
accessor.set(value, upperleft);

Preconditions:

The output array must have the correct shape.

uint16 sampleFormat, samplesPerPixel, bitsPerSample, photometric;
TIFFGetField(tiff, TIFFTAG_SAMPLEFORMAT, &sampleFormat);
TIFFGetField(tiff, TIFFTAG_SAMPLESPERPIXEL, &samplesPerPixel);
TIFFGetField(tiff, TIFFTAG_BITSPERSAMPLE, &bitsPerSample);
TIFFGetField(tiff, TIFFTAG_PHOTOMETRIC, &photometric);
sampleFormat != SAMPLEFORMAT_VOID
samplesPerPixel == 1
photometric == PHOTOMETRIC_MINISWHITE || photometric == PHOTOMETRIC_MINISBLACK
bitsPerSample == 1 ||
bitsPerSample == 8 ||
bitsPerSample == 16 ||
bitsPerSample == 32 ||
bitsPerSample == 64

## ◆ tiffToRGBImage()

template<... >

void tiffToRGBImage | ( |  | ... | ) |

Import a RGB (3-band or color-mapped) TiffImage into a RGB image.

Note that unexpected results can occur when the destination pixel type is weaker than the pixel type in the file (e.g. when a `float` file is imported into a `unsigned char` image).

Declarations:

pass 2D array views:

namespace vigra {
template <class RGBImageIterator, class RGBAccessor>
void
tiffToRGBImage(TiffImage * tiff, RGBImageIterator iter, RGBAccessor a)
}
vigra::RGBAccessor
Definition rgbvalue.hxx:987
vigra::tiffToRGBImage
void tiffToRGBImage(...)
Import a RGB (3-band or color-mapped) TiffImage into a RGB image.

show deprecated declarations

pass Image Iterators and Data Accessors :
namespace vigra {
template <class RGBImageIterator, class RGBAccessor>
void
tiffToRGBImage(TiffImage * tiff, RGBImageIterator iter, RGBAccessor a)
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
template <class RGBImageIterator, class RGBAccessor>
void
tiffToRGBImage(TiffImage * tiff, pair<RGBImageIterator, RGBAccessor> dest)
}

Usage:

#include <vigra/tiff.hxx>
Namespace: vigra

uint32 w, h;
uint16 photometric
TiffImage * tiff = TIFFOpen("tiffimage.tiff", "r");
TIFFGetField(tiff, TIFFTAG_IMAGEWIDTH, &w);
TIFFGetField(tiff, TIFFTAG_IMAGELENGTH, &h);
TIFFGetField(tiff_, TIFFTAG_PHOTOMETRIC, &photometric);
if(photometric != PHOTOMETRIC_RGB &&
photometric != PHOTOMETRIC_PALETTE)
{
// not an RGB image - handle error
}
MultiArray<2, RGBValue<unsigned char> > img(w, h);
tiffToRGBImage(tiff, img);
TIFFClose(tiff);

show deprecated examples

uint32 w, h;
uint16 photometric
TiffImage * tiff = TIFFOpen("tiffimage.tiff", "r");
TIFFGetField(tiff, TIFFTAG_IMAGEWIDTH, &w);
TIFFGetField(tiff, TIFFTAG_IMAGELENGTH, &h);
TIFFGetField(tiff_, TIFFTAG_PHOTOMETRIC, &photometric);
if(photometric != PHOTOMETRIC_RGB &&
photometric != PHOTOMETRIC_PALETTE)
{
// not an RGB image - handle error
}
vigra::BRGBImage img(w, h);
vigra::tiffToRGBImage(tiff, destImage(img));
TIFFClose(tiff);
Required Interface:
ImageIterator upperleft;
<unsigned char, short, long, float, double> rvalue, gvalue, bvalue;
RGBAccessor accessor;
accessor.setRed(rvalue, upperleft);
accessor.setGreen(gvalue, upperleft);
accessor.setBlue(bvalue, upperleft);
vigra::RGBAccessor::setRed
void setRed(V value, RGBIterator const &rgb) const
Definition rgbvalue.hxx:1011
vigra::RGBAccessor::setGreen
void setGreen(V value, RGBIterator const &rgb) const
Definition rgbvalue.hxx:1045
vigra::RGBAccessor::setBlue
void setBlue(V value, RGBIterator const &rgb) const
Definition rgbvalue.hxx:1079

Preconditions:

The destination image must have the appropriate size.

uint16 sampleFormat, samplesPerPixel, bitsPerSample, photometric;
TIFFGetField(tiff, TIFFTAG_SAMPLEFORMAT, &sampleFormat);
TIFFGetField(tiff, TIFFTAG_SAMPLESPERPIXEL, &samplesPerPixel);
TIFFGetField(tiff, TIFFTAG_BITSPERSAMPLE, &bitsPerSample);
TIFFGetField(tiff, TIFFTAG_PHOTOMETRIC, &photometric);
sampleFormat != SAMPLEFORMAT_VOID
samplesPerPixel == 3 // unless photometric == PHOTOMETRIC_PALETTE
photometric == PHOTOMETRIC_RGB ||
photometric == PHOTOMETRIC_PALETTE
bitsPerSample == 1 ||
bitsPerSample == 8 ||
bitsPerSample == 16 ||
bitsPerSample == 32 ||
bitsPerSample == 64

## ◆ createTiffImage()

template<... >

void createTiffImage | ( |  | ... | ) |

Create a TiffImage from the given iterator range.

Type and size of the TiffImage are determined by the input image. Currently, the function can create scalar images and RGB images of type unsigned char, short, int, float, and double.

Usually, it is better to use exportImage(). createTiffImage() should only be used if explicit access to the TIFF object `TiffImage` is required.

Declarations:

pass 2D array views:

namespace vigra {
template <class T, class S>
void
createTiffImage(MultiArrayView<2, T, S> const & src, TiffImage * tiff);
}
vigra::createTiffImage
void createTiffImage(...)
Create a TiffImage from the given iterator range.

show deprecated declarations

pass Image Iterators and Data Accessors :
namespace vigra {
template <class ImageIterator, class Accessor>
TiffImage *
createTiffImage(ImageIterator upperleft, ImageIterator lowerright,
Accessor a)
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
template <class ImageIterator, class Accessor>
TiffImage *
createTiffImage(triple<ImageIterator, ImageIterator, Accessor> src)
}

Usage:

#include <vigra/tiff.hxx>
Namespace: vigra

MultiArray<2, float> img(width, height);
...
TiffImage * tiff = TIFFOpen(("tiffimage.tiff", "w");
createTiffImage(img, tiff);
TIFFClose(tiff); // implicitly writes the image to the disk

show deprecated examples

vigra::BImage img(width, height);
...
TiffImage * tiff = TIFFOpen(("tiffimage.tiff", "w");
vigra::createTiffImage(srcImageRange(img), tiff);
TIFFClose(tiff); // implicitly writes the image to the disk
Required Interface:
ImageIterator upperleft;
Accessor accessor;
accessor(upperleft); // result written into TiffImage

## ◆ createScalarTiffImage()

template<... >

void createScalarTiffImage | ( |  | ... | ) |

Create a single-band TiffImage from the given scalar image.

Type and size of the TiffImage are determined by the input image (may be one of unsigned char, short, int, float, or double).

Declarations:

pass 2D array views:

namespace vigra {
template <class ImageIterator, class Accessor>
TiffImage *
createScalarTiffImage(ImageIterator upperleft, ImageIterator lowerright,
Accessor a)
}
vigra::createScalarTiffImage
void createScalarTiffImage(...)
Create a single-band TiffImage from the given scalar image.

show deprecated declarations

pass Image Iterators and Data Accessors :
namespace vigra {
template <class ImageIterator, class Accessor>
TiffImage *
createScalarTiffImage(ImageIterator upperleft, ImageIterator lowerright,
Accessor a)
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
template <class ImageIterator, class Accessor>
TiffImage *
createScalarTiffImage(triple<ImageIterator, ImageIterator, Accessor> src)
}

Usage:

#include <vigra/tiff.hxx>
Namespace: vigra

MultiArray<2, float> img(width, height);
...
TiffImage * tiff = TIFFOpen(("tiffimage.tiff", "w");
createScalarTiffImage(img, tiff);
TIFFClose(tiff); // implicitly writes the image to the disk

show deprecated examples

vigra::BImage img(width, height);
...
TiffImage * tiff = TIFFOpen(("tiffimage.tiff", "w");
vigra::createScalarTiffImage(srcImageRange(img), tiff);
TIFFClose(tiff); // implicitly writes the image to the disk
Required Interface:
ImageIterator upperleft;
Accessor accessor;
accessor(upperleft); // result written into TiffImage

## ◆ createRGBTiffImage()

template<... >

void createRGBTiffImage | ( |  | ... | ) |

Create a 3-band TiffImage from the given RGB image.

Type and size of the TiffImage are determined by the input image (may be one of unsigned char, int, float, or double).

Declarations:

pass 2D array views:

namespace vigra {
template <class RGBImageIterator, class RGBAccessor>
TiffImage *
createRGBTiffImage(RGBImageIterator upperleft, RGBImageIterator lowerright,
RGBAccessor a)
}
vigra::createRGBTiffImage
void createRGBTiffImage(...)
Create a 3-band TiffImage from the given RGB image.

show deprecated declarations

pass Image Iterators and Data Accessors :
namespace vigra {
template <class RGBImageIterator, class RGBAccessor>
TiffImage *
createRGBTiffImage(RGBImageIterator upperleft, RGBImageIterator lowerright,
RGBAccessor a)
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
template <class RGBImageIterator, class RGBAccessor>
TiffImage *
createRGBTiffImage(triple<RGBImageIterator, RGBImageIterator, RGBAccessor> src)
}

Usage:

#include <vigra/tiff.hxx>
Namespace: vigra

MultiArray<2, RGBValue<unsigned char> > img(width, height);
...
TiffImage * tiff = TIFFOpen(("tiffimage.tiff", "w");
createRGBTiffImage(img, tiff);
TIFFClose(tiff); // implicitly writes the image to the disk

show deprecated examples

vigra::BRGBImage img(width, height);
...
TiffImage * tiff = TIFFOpen(("tiffimage.tiff", "w");
vigra::createRGBTiffImage(srcImageRange(img), tiff);
TIFFClose(tiff); // implicitly writes the image to the disk
Required Interface:
ImageIterator upperleft;
RGBAccessor accessor;
accessor.red(upperleft); // result written into TiffImage
accessor.green(upperleft); // result written into TiffImage
accessor.blue(upperleft); // result written into TiffImage
vigra::RGBAccessor::blue
component_type const & blue(RGBIterator const &rgb) const
Definition rgbvalue.hxx:1070
vigra::RGBAccessor::red
component_type const & red(RGBIterator const &rgb) const
Definition rgbvalue.hxx:995
vigra::RGBAccessor::green
component_type const & green(RGBIterator const &rgb) const
Definition rgbvalue.hxx:1036

## ◆ operator-() [5/5]

template<class V , int SIZE, class D1 , class D2 >

TinyVector< V, SIZE > operator- | ( | TinyVectorBase< V, SIZE, D1, D2 > const & | v | ) |

Unary negation (construct TinyVector with negative values)

## ◆ ceil() [2/2]

template<class V , int SIZE, class D1 , class D2 >

TinyVector< V, SIZE > ceil | ( | TinyVectorBase< V, SIZE, D1, D2 > const & | v | ) |

Apply ceil() function to each vector component.

## ◆ floor() [2/2]

template<class V , int SIZE, class D1 , class D2 >

TinyVector< V, SIZE > floor | ( | TinyVectorBase< V, SIZE, D1, D2 > const & | v | ) |

Apply floor() function to each vector component.

## ◆ round() [2/2]

template<class V , int SIZE, class D1 , class D2 >

TinyVector< V, SIZE > round | ( | TinyVectorBase< V, SIZE, D1, D2 > const & | v | ) |

Apply round() function to each vector component.

## ◆ roundi() [2/2]

template<class V , int SIZE, class D1 , class D2 >

TinyVector< std::ptrdiff_t, SIZE > roundi | ( | TinyVectorBase< V, SIZE, D1, D2 > const & | v | ) |

Apply roundi() function to each vector component, i.e. return an integer vector.

## ◆ sqrt()

template<class V , int SIZE, class D1 , class D2 >

TinyVector< V, SIZE > sqrt | ( | TinyVectorBase< V, SIZE, D1, D2 > const & | v | ) |

Apply sqrt() function to each vector component.

## ◆ pow() [2/2]

template<class V , int SIZE, class D1 , class D2 , class E >

TinyVector< V, SIZE > pow | ( | TinyVectorBase< V, SIZE, D1, D2 > const & | v,
|  | E | exponent
| ) |  |

Apply pow() function to each vector component.

## ◆ transpose()

template<class V , int SIZE, class T >

TinyVector< V, SIZE > transpose | ( | TinyVector< V, SIZE > const & | t,
|  | TinyVector< T, SIZE > const & | permutation
| ) |  |

transposed copy

Elements are arranged such that `res[k] = t[permutation[k]]`.

## ◆ clipLower() [1/2]

template<class V , int SIZE>

TinyVector< V, SIZE > clipLower | ( | TinyVector< V, SIZE > const & | t | ) |

Clip negative values.

All elements smaller than 0 are set to zero.

## ◆ clipLower() [2/2]

template<class V , int SIZE>

TinyVector< V, SIZE > clipLower | ( | TinyVector< V, SIZE > const & | t,
|  | const V | val
| ) |  |

Clip values below a threshold.

All elements smaller than val are set to val.

## ◆ clipUpper()

template<class V , int SIZE>

TinyVector< V, SIZE > clipUpper | ( | TinyVector< V, SIZE > const & | t,
|  | const V | val
| ) |  |

Clip values above a threshold.

All elements bigger than val are set to val.

## ◆ clip() [1/2]

template<class V , int SIZE>

TinyVector< V, SIZE > clip | ( | TinyVector< V, SIZE > const & | t,
|  | const V | valLower,
|  | const V | valUpper
| ) |  |

Clip values to an interval.

All elements less than valLower are set to valLower, all elements bigger than valUpper are set to valUpper.

## ◆ clip() [2/2]

template<class V , int SIZE>

TinyVector< V, SIZE > clip | ( | TinyVector< V, SIZE > const & | t,
|  | TinyVector< V, SIZE > const & | valLower,
|  | TinyVector< V, SIZE > const & | valUpper
| ) |  |

Clip values to a vector of intervals.

All elements less than valLower are set to valLower, all elements bigger than valUpper are set to valUpper.

## ◆ linearIntensityTransform()

template<class Multiplier , class DestValueType >

LinearIntensityTransform< DestValueType, Multiplier > linearIntensityTransform | ( | Multiplier | scale,
|  | DestValueType | offset
| ) |  |

Apply a linear transform to the source pixel values.

Factory function for a functor that linearly transforms the source pixel values. The functor applies the transform '`destvalue = scale * (srcvalue + offset)`' to every pixel. This can, for example, be used to transform images into the visible range 0...255 or to invert an image.

If you leave out the second parameter / offset, you will get an optimized version of the functor which only scales by the given factor, however you have to make the template parameter (pixel type) explicit then.

Traits defined:

`FunctorTraits::isUnaryFunctor` is true (`VigraTrueType`)

Declaration:

namespace vigra {
template <class Multiplier, class DestValueType>
LinearIntensityTransform<DestValueType, Multiplier>
linearIntensityTransform(Multiplier scale, DestValueType offset);
template <class DestValueType, class Multiplier>
ScalarIntensityTransform<DestValueType, Multiplier>
linearIntensityTransform(Multiplier scale);
}
vigra::linearIntensityTransform
LinearIntensityTransform< DestValueType, Multiplier > linearIntensityTransform(Multiplier scale, DestValueType offset)
Apply a linear transform to the source pixel values.
Definition transformimage.hxx:800

Usage:

#include <vigra/transformimage.hxx>
Namespace: vigra

vigra::IImage src(width, height);
vigra::BImage dest(width, height);
...
vigra::FindMinMax<IImage::PixelType> minmax; // functor to find range
vigra::inspectImage(srcImageRange(src), minmax); // find original range
// transform to range 0...255
vigra::transformImage(srcImageRange(src), destImage(dest),
linearIntensityTransform(
255.0 / (minmax.max - minmax.min), // scaling
- minmax.min)); // offset

The one-parameter version can be used like this:

// scale from 0..255 to 0..1.0
FImage dest(src.size());
vigra::transformImage(srcImageRange(src), destImage(dest),
linearIntensityTransform<float>(1.0 / 255));

Required Interface:

The source and destination value types must be models of LinearSpace in both cases.

## ◆ linearRangeMapping()

template<class SrcValueType , class DestValueType >

LinearIntensityTransform< DestValueType, typename NumericTraits< DestValueType >::RealPromote > linearRangeMapping | ( | SrcValueType | src_min,
|  | SrcValueType | src_max,
|  | DestValueType | dest_min,
|  | DestValueType | dest_max
| ) |  |

Map a source intensity range linearly to a destination range.

Factory function for a functor that linearly transforms the source pixel values. The functor applies the transform '`destvalue = scale * (srcvalue + offset)`' to every pixel, where `scale = (dest_max - dest_min) / (src_max - src_min)` and `offset = dest_min / scale - src_min`. As a result, the pixel values `src_max`, `src_min` in the source image are mapped onto `dest_max`, `dest_min` respectively. This works for scalar as well as vector pixel types. Instead of `src_min` and `src_max`, you may also pass a functor FindMinMax.

Declaration:

namespace vigra {
template <class SrcValueType, class DestValueType>
LinearIntensityTransform<DestValueType, typename NumericTraits<DestValueType>::RealPromote>
linearRangeMapping(SrcValueType src_min, SrcValueType src_max,
DestValueType dest_min, DestValueType dest_max );
template <class SrcValueType, class DestValueType>
LinearIntensityTransform<DestValueType, typename NumericTraits<DestValueType>::RealPromote>
linearRangeMapping(SrcValueType src_min, SrcValueType src_max,
DestValueType dest_min, DestValueType dest_max );
}
vigra::linearRangeMapping
LinearIntensityTransform< DestValueType, typename NumericTraits< DestValueType >::RealPromote > linearRangeMapping(SrcValueType src_min, SrcValueType src_max, DestValueType dest_min, DestValueType dest_max)
Map a source intensity range linearly to a destination range.
Definition transformimage.hxx:882

Usage:

#include <vigra/transformimage.hxx>
Namespace: vigra

vigra::IImage src(width, height);
vigra::BImage dest(width, height);
...
vigra::FindMinMax<IImage::PixelType> minmax; // functor to find range
vigra::inspectImage(srcImageRange(src), minmax); // find original range
// transform to range 0...255
vigra::transformImage(srcImageRange(src), destImage(dest),
linearRangeMapping(
minmax.min, minmax.max, // src range
0, 255) // dest range
);
// equivalent, but shorter
vigra::transformImage(srcImageRange(src), destImage(dest),
linearRangeMapping(
minmax, // src range
0, 255) // dest range
);

Required Interface:

The source and destination value types must be models of LinearSpace in both cases.

## ◆ totalVariationFilter()

template<... >

void totalVariationFilter | ( |  | ... | ) |

Performs standard Total Variation Regularization.

The algorithm minimizes

where are the two dimensional noisy data, are the smoothed data, is the filter parameter and is the total variation semi-norm.

Declarations:

namespace vigra {
template <class stride1,class stride2>
void totalVariationFilter(MultiArrayView<2,double,stride1> data,
MultiArrayView<2,double,stride2> out,
double alpha,
int steps,
double eps=0);
void totalVariationFilter(MultiArrayView<2,double,stride1> data,
MultiArrayView<2,double,stride2> weight,
MultiArrayView<2,double,stride3> out,
double alpha,
int steps,
double eps=0);
}
vigra::totalVariationFilter
void totalVariationFilter(...)
Performs standard Total Variation Regularization.

totalVariationFilter() implements a primal-dual algorithm to solve (1).

Input:

data: | input data to be smoothed.
alpha: | smoothing parameter.
steps: | maximal number of iteration steps.
eps: | The algorithm stops, if the primal-dual gap is below the threshold eps.

Output:

out contains the filtered data.

In addition, a point-wise weight ( ) for the data term can be provided (overloaded function).

Usage:

#include <vigra/tv_filter.hxx>

MultiArray<2,double> data(Shape2(width,height)); // to be initialized
MultiArray<2,double> out(Shape2(width,height));
MultiArray<2,double> weight(Shape2(width,height))); //optional argument in overloaded function, to be initialized if used
int steps; // to be initialized
double alpha,eps; // to be initialized
totalVariationFilter(data,out,alpha,steps,eps);

or

totalVariationFilter(data,weight,out,alpha,steps,eps);

## ◆ getAnisotropy()

template<... >

void getAnisotropy | ( |  | ... | ) |

Sets up directional data for anisotropic regularization.

This routine provides a two-dimensional normalized vector field , which is normal to edges in the given data, found as the eigenvector of the structure tensor belonging to the largest eigenvalue. is encoded by a scalar field of angles, i.e. .

In addition, two scalar fields and are generated from scalar parameters and , such that

at edges,
in homogeneous regions,
.

Declarations:

namespace vigra {
void getAnisotropy(MultiArrayView<2,double,stride1> data,
MultiArrayView<2,double,stride2> phi,
MultiArrayView<2,double,stride3> alpha,
MultiArrayView<2,double,stride4> beta,
double alpha_par,
double beta_par,
double sigma_par,
double rho_par,
double K_par);
}
vigra::getAnisotropy
void getAnisotropy(...)
Sets up directional data for anisotropic regularization.

Output:

Three scalar fields phi, alpha and beta.

Input:

data: | two-dimensional scalar field.
alpha_par,beta_par: | two positive values for setting up the scalar fields alpha and beta
sigma_par: | non-negative parameter for presmoothing the data.
rho_par: | non-negative parameter for presmoothing the structure tensor.
K_par: | positive edge sensitivity parameter.

(see anisotropicTotalVariationFilter() and secondOrderTotalVariationFilter() for usage in an application).

## ◆ anisotropicTotalVariationFilter()

template<... >

void anisotropicTotalVariationFilter | ( |  | ... | ) |

Performs Anisotropic Total Variation Regularization.

The algorithm minimizes

where are the noisy data, are the smoothed data, is the image gradient in the sense of Total Variation and is a locally varying symmetric, positive definite 2x2 matrix.

Matrix is described by providing for each data point a normalized eigenvector (via angle ) and two eigenvalues and .

getAnisotropy() can be use to set up such data by providing a vector field normal to edges.

Declarations:

namespace vigra {
template <class stride1,class stride2,class stride3,class stride4,class stride5,class stride6>
void anisotropicTotalVariationFilter(MultiArrayView<2,double,stride1> data,
MultiArrayView<2,double,stride2> weight,
MultiArrayView<2,double,stride3> phi,
MultiArrayView<2,double,stride4> alpha,
MultiArrayView<2,double,stride5> beta,
MultiArrayView<2,double,stride6> out,
int steps);
}
vigra::anisotropicTotalVariationFilter
void anisotropicTotalVariationFilter(...)
Performs Anisotropic Total Variation Regularization.

anisotropicTotalVariationFilter() implements a primal-dual algorithm to solve (2).

Input:

data: | input data to be filtered.
steps: | iteration steps.
weight : | a point-wise weight ( ) for the data term.
phi,alpha and beta : | describe matrix , see above.

Output:

out : | contains filtered data.

Usage:

E.g. with a solution-dependent adaptivity cf. [1], by updating the matrix in an outer loop:

#include <vigra/tv_filter.hxx>

MultiArray<2,double> data(Shape2(width,height)); //to be initialized
MultiArray<2,double> out (Shape2(width,height));
MultiArray<2,double> weight(Shape2(width,height)); //to be initialized
MultiArray<2,double> phi (Shape2(width,height));
MultiArray<2,double> alpha(Shape2(width,height));
MultiArray<2,double> beta (Shape2(width,height));
double alpha0,beta0,sigma,rho,K; //to be initialized
int outer_steps,inner_steps;//to be initialized
out=data; // data serves as initial value
for (int i=0;i<outer_steps;i++){
getAnisotropy(out,phi,alpha,beta,alpha0,beta0,sigma,rho,K); // sets phi, alpha, beta
anisotropicTotalVariationFilter(data,weight,phi,alpha,beta,out,inner_steps);
}

[1] Frank Lenzen, Florian Becker, Jan Lellmann, Stefania Petra and Christoph Schnörr, A Class of Quasi-Variational Inequalities for Adaptive Image Denoising and Decomposition, Computational Optimization and Applications, Springer, 2012.

## ◆ secondOrderTotalVariationFilter()

template<... >

void secondOrderTotalVariationFilter | ( |  | ... | ) |

Performs Anisotropic Total Variation Regularization.

The algorithm minimizes

where are the noisy data, are the smoothed data, is the image gradient in the sense of Total Variation, is a locally varying symmetric, positive-definite 2x2 matrix and is the Frobenius norm of the Hessian of .

Matrix is described by providing for each data point a normalized eigenvector (via angle ) and two eigenvalues and . getAnisotropy() can be use to set up such data by providing a vector field normal to edges.

is the locally varying regularization parameter for second order.

Declarations:

namespace vigra {
template <class stride1,class stride2,...,class stride9>
void secondOrderTotalVariationFilter(MultiArrayView<2,double,stride1> data,
MultiArrayView<2,double,stride2> weight,
MultiArrayView<2,double,stride3> phi,
MultiArrayView<2,double,stride4> alpha,
MultiArrayView<2,double,stride5> beta,
MultiArrayView<2,double,stride6> gamma,
MultiArrayView<2,double,stride7> xedges,
MultiArrayView<2,double,stride8> yedges,
MultiArrayView<2,double,stride9> out,
int steps);
}
vigra::gamma
double gamma(double x)
The gamma function.
Definition mathutil.hxx:1587
vigra::secondOrderTotalVariationFilter
void secondOrderTotalVariationFilter(...)
Performs Anisotropic Total Variation Regularization.

secondOrderTotalVariationFilter() implements a primal-dual algorithm to solve (3).

Input:

data: | the input data to be filtered.
steps : | number of iteration steps.
out : | contains the filtered data.
weight : | point-wise weight ( ) for the data term.
phi,alpha,beta: | describe matrix , see above.
xedges and yedges : | binary arrays indicating the presence of horizontal (between (x,y) and (x+1,y)) and vertical edges (between (x,y) and (x,y+1)). These data are considered in the calculation of , such that finite differences across edges are artificially set to zero to avoid second order smoothing over edges.

Usage:

E.g. with a solution-dependent adaptivity (cf.[1]), by updating the matrix in an outer loop:

#include <vigra/tv_filter.hxx>

MultiArray<2,double> data(Shape2(width,height)); //to be initialized
MultiArray<2,double> out(Shape2(width,height));
MultiArray<2,double> weight(Shape2(width,height))); //to be initialized
MultiArray<2,double> phi(Shape2(width,height);
MultiArray<2,double> alpha(Shape2(width,height);
MultiArray<2,double> beta(Shape2(width,height));
MultiArray<2,double> gamma(Shape2(width,height)); //to be initialized
MultiArray<2,double> xedges(Shape2(width,height)); //to be initialized
MultiArray<2,double> yedges(Shape2(width,height)); //to be initialized
double alpha0,beta0,sigma,rho,K; //to be initialized
int outer_steps,inner_steps;//to be initialized
out=data; // data serves as initial value
for (int i=0;i<outer_steps;i++){
getAnisotropy(out,phi,alpha,beta,alpha0,beta0,sigma,rho,K); // sets phi, alpha, beta
secondOrderTotalVariationFilter(data,weight,phi,alpha,beta,gamma,xedges,yedges,out,inner_steps);
}

[1] Frank Lenzen, Florian Becker, Jan Lellmann, Stefania Petra and Christoph Schnörr, A Class of Quasi-Variational Inequalities for Adaptive Image Denoising and Decomposition, Computational Optimization and Applications, Springer, 2012.

## ◆ principalComponents()

template<class T , class C1 , class C2 , class C3 >

void principalComponents | ( | MultiArrayView< 2, T, C1 > const & | features,
|  | MultiArrayView< 2, T, C2 > | fz,
|  | MultiArrayView< 2, T, C3 > | zv
| ) |  |

Decompose a matrix according to the PCA algorithm.

This function implements the PCA algorithm (principal component analysis).

- features must be a matrix with shape `(numFeatures * numSamples)`, which is decomposed into the matrices
- fz with shape `(numFeatures * numComponents)` and
- zv with shape `(numComponents * numSamples)`

such that

(this formula requires that the features have been centered around the mean by `linalg::prepareRows&nbsp;(features, features, ZeroMean)`).

The shape parameter `numComponents` determines the complexity of the decomposition model and therefore the approximation quality (if `numComponents == numFeatures`, the representation becomes exact). Intuitively, `fz` is a projection matrix from the reduced space into the original space, and `zv` is the reduced representation of the data, using just `numComponents` features.

Declaration:

#include <vigra/unsupervised_decomposition.hxx>

namespace vigra {
template <class U, class C1, class C2, class C3>
void
principalComponents(MultiArrayView<2, U, C1> const & features,
MultiArrayView<2, U, C2> fz,
MultiArrayView<2, U, C3> zv);
}
vigra::principalComponents
void principalComponents(MultiArrayView< 2, T, C1 > const &features, MultiArrayView< 2, T, C2 > fz, MultiArrayView< 2, T, C3 > zv)
Decompose a matrix according to the PCA algorithm.
Definition unsupervised_decomposition.hxx:120

Usage:

Matrix<double> data(numFeatures, numSamples);
... // fill the input matrix
int numComponents = 3;
Matrix<double> fz(numFeatures, numComponents),
zv(numComponents, numSamples);
// center the data
prepareRows(data, data, ZeroMean);
// compute the reduced representation
principalComponents(data, fz, zv);
Matrix<double> model = fz*zv;
double meanSquaredError = squaredNorm(data - model) / numSamples;

## ◆ pLSA()

template<... >

void pLSA | ( |  | ... | ) |

Decompose a matrix according to the pLSA algorithm.

This function implements the pLSA algorithm (probabilistic latent semantic analysis) proposed in

T. Hofmann: "Probabilistic Latent Semantic Analysis", in: UAI'99, Proc. 15th Conf. on Uncertainty in Artificial Intelligence, pp. 289-296, Morgan Kaufmann, 1999

- features must be a matrix with shape `(numFeatures * numSamples)` and non-negative entries, which is decomposed into the matrices
- fz with shape `(numFeatures * numComponents)` and
- zv with shape `(numComponents * numSamples)`

such that

(this formula applies when pLSA is called with `PLSAOptions.normalizedComponentWeights(false)`. Otherwise, you must normalize the features by calling `linalg::prepareColumns&nbsp;(features, features, UnitSum)` to make the formula hold).

The shape parameter `numComponents` determines the complexity of the decomposition model and therefore the approximation quality. Intuitively, features are a set of words, and the samples a set of documents. The entries of the `features` matrix denote the relative frequency of the words in each document. The components represents a (presumably small) set of topics. The matrix `fz` encodes the relative frequency of words in the different topics, and the matrix `zv` encodes to what extend each topic explains the content of each document.

The option object determines the iteration termination conditions and the output normalization. In addition, you may pass a random number generator to pLSA() which is used to create the initial solution.

Declarations:

#include <vigra/unsupervised_decomposition.hxx>

namespace vigra {
template <class U, class C1, class C2, class C3, class Random>
void
pLSA(MultiArrayView<2, U, C1> const & features,
MultiArrayView<2, U, C2> & fz,
MultiArrayView<2, U, C3> & zv,
Random const& random,
PLSAOptions const & options = PLSAOptions());
template <class U, class C1, class C2, class C3>
void
pLSA(MultiArrayView<2, U, C1> const & features,
MultiArrayView<2, U, C2> & fz,
MultiArrayView<2, U, C3> & zv,
PLSAOptions const & options = PLSAOptions());
}
vigra::PLSAOptions
Option object for the pLSA algorithm.
Definition unsupervised_decomposition.hxx:159
vigra::pLSA
void pLSA(...)
Decompose a matrix according to the pLSA algorithm.

Usage:

Matrix<double> words(numWords, numDocuments);
... // fill the input matrix
int numTopics = 3;
Matrix<double> fz(numWords, numTopics),
zv(numTopics, numDocuments);
pLSA(words, fz, zv, PLSAOptions().normalizedComponentWeights(false));
Matrix<double> model = fz*zv;
double meanSquaredError = (words - model).squaredNorm() / numDocuments;

## ◆ asString()

template<class T >

std::string asString | ( | T | t | ) |

Convert a value to a string. Available for integral and floating point types and void *.

## ◆ tolower()

std::string tolower | ( | std::string | s | ) |

Convert string to lower case.

## ◆ normalizeString()

std::string normalizeString | ( | std::string const & | s | ) |

Convert string to lower case and remove any white space characters.

## ◆ for_each_in_tuple()

template<typename TPL , typename FUNCTOR >

void for_each_in_tuple | ( | TPL && | t,
|  | FUNCTOR && | f
| ) |  |

The for_each_in_tuple function calls the functor f on all elements of the tuple t. For each element type in the tuple, the functor must have an appropriate overload of operator().

Example:

#include <iostream>
#include <tuple>
#include <vigra/utilities.hxx>
struct print
{
template <typename T>
void operator()(T const & t) const
{
std::cout << t << std::endl;
}
};
struct add_one
{
template <typename T>
void operator()(T & t) const
{
t += 1;
}
};
int main()
{
std::tuple<int, double, size_t> tpl(-5, 0.4, 10);
vigra::for_each_in_tuple(tpl, add_one());
vigra::for_each_in_tuple(tpl, print());
}
vigra::for_each_in_tuple
void for_each_in_tuple(TPL &&t, FUNCTOR &&f)
Definition utilities.hxx:282
utilities.hxx

## ◆ separableVectorDistance()

template<... >

void separableVectorDistance | ( |  | ... | ) |

Compute the vector distance transform of a N-dimensional binary array.

Declarations:

namespace vigra {
template <unsigned int N, class T1, class S1,
class T2, class S2, class Array>
void
separableVectorDistance(MultiArrayView<N, T1, S1> const & source,
MultiArrayView<N, T2, S2> dest,
bool background,
Array const & pixelPitch=TinyVector<double, N>(1));
}
vigra::separableVectorDistance
void separableVectorDistance(...)
Compute the vector distance transform of a N-dimensional binary array.

This function works like separableMultiDistance() (see there for details), but returns in each pixel the vector to the nearest background pixel rather than the scalar distance. This enables much more powerful applications.

Usage:

#include <vigra/vector_distance.hxx>
Namespace: vigra

Shape3 shape(width, height, depth);
MultiArray<3, unsigned char> source(shape);
MultiArray<3, Shape3> dest(shape);
...
// For each background pixel, find the vector to the nearest foreground pixel.
separableVectorDistance(source, dest, true);

See also
  vigra::separableMultiDistance(), vigra::boundaryVectorDistance()

## ◆ boundaryVectorDistance()

template<... >

void boundaryVectorDistance | ( |  | ... | ) |

Compute the vector distance transform to the implicit boundaries of a multi-dimensional label array.

Declarations:

namespace vigra {
template <unsigned int N, class T1, class S1,
class T2, class S2,
class Array>
void
boundaryVectorDistance(MultiArrayView<N, T1, S1> const & labels,
MultiArrayView<N, T2, S2> dest,
bool array_border_is_active=false,
BoundaryDistanceTag boundary=OuterBoundary,
Array const & pixelPitch=TinyVector<double, N>(1));
}
vigra::OuterBoundary
@ OuterBoundary
Pixels just outside of each region.
Definition multi_distance.hxx:836
vigra::boundaryVectorDistance
void boundaryVectorDistance(...)
Compute the vector distance transform to the implicit boundaries of a multi-dimensional label array.

This function works like boundaryMultiDistance() (see there for details), but returns in each pixel the vector to the nearest boundary pixel rather than the scalar distance. This enables much more powerful applications. Additionally, it support a `pixelPitch` parameter which allows to adjust the distance calculations for anisotropic grid resolution.

Usage:

#include <vigra/vector_distance.hxx>
Namespace: vigra

Shape3 shape(width, height, depth);
MultiArray<3, UInt32> labels(shape);
MultiArray<3, Shape3> dest(shape);
...
// For each region, find the vectors to the nearest boundary pixel, including the
// outer border of the array.
boundaryVectorDistance(labels, dest, true);

See also
  vigra::boundaryMultiDistance(), vigra::separableVectorDistance()

## ◆ isAtVolumeBorder()

AtVolumeBorder isAtVolumeBorder | ( | int | x,
|  | int | y,
|  | int | z,
|  | int | width,
|  | int | height,
|  | int | depth
| ) |  |

Find out whether a voxel is at the volume border.

This function checks if x == 0 or x == width - 1 and y == 0 or y == height - 1 and so on and returns the appropriate value of vigra::AtVolumeBorder, or zero when the voxel is not at te volume border. The behavior of the function is undefined if (x,y,z) is not inside the volume.

## ◆ isAtVolumeBorderAntiCausal()

AtVolumeBorder isAtVolumeBorderAntiCausal | ( | int | x,
|  | int | y,
|  | int | z,
|  | int | width,
|  | int | height,
|  | int | depth
| ) |  |

Find out whether a voxel is at a scan-order relevant volume border. This function checks if x == 0 or y == 0 or z == 0 and returns the appropriate value of vigra::AtVolumeBorder, or zero when the voxel is not at te volume border. The behavior of the function is undefined if (x,y,z) is not inside the volume.

TODO: Write new comment

## ◆ generateWatershedSeeds()

template<... >

unsigned int generateWatershedSeeds | ( |  | ... | ) |

Generate seeds for watershed computation and seeded region growing.

The source image is a boundary indicator such as the gradient magnitude or the trace of the boundaryTensor(). Seeds are generally generated at locations where the boundaryness (i.e. the likelihood of the point being on the boundary) is very small. In particular, seeds can be placed by either looking for local minima (possibly including minimal plateaus) of the boundaryness, of by looking at level sets (i.e. regions where the boundaryness is below a threshold). Both methods can also be combined, so that only minima below a threshold are returned. The particular seeding strategy is specified by the `options` object (see SeedOptions).

The pixel type of the input image must be `LessThanComparable`. The pixel type of the output image must be large enough to hold the labels for all seeds. (typically, you will use `UInt32`). The function will label seeds by consecutive integers (starting from 1) and returns the largest label it used.

Pass IndirectNeighborhood or DirectNeighborhood (first form of the function) or vigra::EightNeighborCode or vigra::FourNeighborCode (second and third forms) to determine the neighborhood where pixel values are compared.

Declarations:

use arbitrary-dimensional arrays:

namespace vigra {
template <unsigned int N, class T, class S1,
class Label, class S2>
Label
generateWatershedSeeds(MultiArrayView<N, T, S1> const & data,
MultiArrayView<N, Label, S2> seeds,
NeighborhoodType neighborhood = IndirectNeighborhood,
SeedOptions const & options = SeedOptions());
}

show deprecated declarations

pass Image Iterators and Data Accessors :
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor,
class Neighborhood = EightNeighborCode>
unsigned int
generateWatershedSeeds(SrcIterator upperlefts, SrcIterator lowerrights, SrcAccessor sa,
DestIterator upperleftd, DestAccessor da,
Neighborhood neighborhood = EightNeighborCode(),
SeedOptions const & options = SeedOptions());
}
vigra::EightNeighborhood::NeighborCode
Encapsulation of direction management for the 8-neighborhood.
Definition pixelneighborhood.hxx:421
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor,
class Neighborhood = EightNeighborCode>
unsigned int
generateWatershedSeeds(triple<SrcIterator, SrcIterator, SrcAccessor> src,
pair<DestIterator, DestAccessor> dest,
Neighborhood neighborhood = EightNeighborCode(),
SeedOptions const & options = SeedOptions());
}

Usage:

#include <vigra/multi_watersheds.hxx> (MultiArray variant)
#include <vigra/watersheds.hxx> (deprecated variants)
Namespace: vigra

For detailed examples see watershedsMultiArray() and watershedsRegionGrowing().

## ◆ watershedsUnionFind()

template<... >

unsigned int watershedsUnionFind | ( |  | ... | ) |

Region segmentation by means of the union-find watershed algorithm.

Note: This function is largely obsolete, watershedsMultiArray() should be preferred unless top speed is required.

This function implements the union-find version of the watershed algorithms described as algorithm 4.7 in

J. Roerdink, R. Meijster: "The watershed transform: definitions, algorithms, and parallelization strategies", Fundamenta Informaticae, 41:187-228, 2000

The source image is a boundary indicator such as the gaussianGradientMagnitude() or the trace of the boundaryTensor(). Local minima of the boundary indicator are used as region seeds, and all other pixels are recursively assigned to the same region as their lowest neighbor. Pass vigra::EightNeighborCode or vigra::FourNeighborCode to determine the neighborhood where pixel values are compared. The pixel type of the input image must be `LessThanComparable`. The function uses accessors.

Note that VIGRA provides an alternative implementation of the watershed transform via watershedsRegionGrowing(). It is slower, but offers many more configuration options.

Declarations:

pass 2D array views:

namespace vigra {
template <class T1, class S1,
class T2, class S2,
class Neighborhood>
unsigned int
watershedsUnionFind(MultiArrayView<2, T1, S1> const & src,
MultiArrayView<2, T2, S2> dest,
Neighborhood neighborhood = EightNeighborCode());
}
vigra::watershedsUnionFind
unsigned int watershedsUnionFind(...)
Region segmentation by means of the union-find watershed algorithm.

show deprecated declarations

pass Image Iterators and Data Accessors :
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor,
class Neighborhood = EightNeighborCode>
unsigned int
watershedsUnionFind(SrcIterator upperlefts, SrcIterator lowerrights, SrcAccessor sa,
DestIterator upperleftd, DestAccessor da,
Neighborhood neighborhood = EightNeighborCode())
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor,
class Neighborhood = EightNeighborCode>
unsigned int
watershedsUnionFind(triple<SrcIterator, SrcIterator, SrcAccessor> src,
pair<DestIterator, DestAccessor> dest,
Neighborhood neighborhood = EightNeighborCode())
}

Usage:

#include <vigra/watersheds.hxx>
Namespace: vigra

Example: watersheds of the gradient magnitude.

MultiArray<2, float> in(w,h);
... // read input data
// compute gradient magnitude as boundary indicator
MultiArray<2, float> gradMag(w, h);
gaussianGradientMagnitude(src, gradMag, 3.0);
// the pixel type of the destination image must be large enough to hold
// numbers up to 'max_region_label' to prevent overflow
MultiArray<2, unsigned int> labeling(w,h);
unsigned int max_region_label = watershedsUnionFind(gradMag, labeling);

show deprecated examples

Example: watersheds of the gradient magnitude.
vigra::BImage in(w,h);
... // read input data
// compute gradient magnitude as boundary indicator
vigra::FImage gradMag(w, h);
gaussianGradientMagnitude(srcImageRange(src), destImage(gradMag), 3.0);
// the pixel type of the destination image must be large enough to hold
// numbers up to 'max_region_label' to prevent overflow
vigra::IImage labeling(w,h);
int max_region_label = watershedsUnionFind(srcImageRange(gradMag), destImage(labeling));
Required Interface:
SrcIterator src_upperleft, src_lowerright;
DestIterator dest_upperleft;
SrcAccessor src_accessor;
DestAccessor dest_accessor;
// compare src values
src_accessor(src_upperleft) <= src_accessor(src_upperleft)
// set result
int label;
dest_accessor.set(label, dest_upperleft);

## ◆ watershedsRegionGrowing()

template<... >

unsigned int watershedsRegionGrowing | ( |  | ... | ) |

Region segmentation by means of a flooding-based watershed algorithm.

Note: This function is largely obsolete, watershedsMultiArray() should be preferred unless top speed is required.

This function implements variants of the watershed algorithm described in

L. Vincent and P. Soille: "Watersheds in digital spaces: An efficient algorithm based on immersion simulations", IEEE Trans. Patt. Analysis Mach. Intell. 13(6):583-598, 1991

The source image is a boundary indicator such as the gaussianGradientMagnitude() or the trace of the boundaryTensor(), and the destination is a label image designating membership of each point in one of the regions. Plateaus in the boundary indicator (i.e. regions of constant gray value) are handled via a Euclidean distance transform by default.

By default, the destination image is assumed to hold seeds for a seeded watershed transform. Seeds may, for example, be created by means of generateWatershedSeeds(). Note that the seeds will be overridden with the final watershed segmentation.

Alternatively, you may provide SeedOptions in order to instruct watershedsRegionGrowing() to generate its own seeds (it will call generateWatershedSeeds() internally). In that case, the destination image should be zero-initialized.

You can specify the neighborhood system to be used by passing FourNeighborCode or EightNeighborCode (default).

Further options to be specified via WatershedOptions are:

- Whether to keep a 1-pixel-wide contour (with label 0) between regions or perform complete grow (i.e. all pixels are assigned to a region).
- Whether to stop growing when the boundaryness exceeds a threshold (remaining pixels keep label 0).
- Whether to use a faster, but less powerful algorithm ("turbo algorithm"). It is faster because it orders pixels by means of a BucketQueue (therefore, the boundary indicator must contain integers in the range `[0, ..., bucket_count-1]`, where `bucket_count` is specified in the options object), it only supports complete growing (no contour between regions is possible), and it handles plateaus in a simplistic way. It also saves some memory because it allocates less temporary storage.
- Whether one region (label) is to be preferred or discouraged by biasing its cost with a given factor (smaller than 1 for preference, larger than 1 for discouragement).

Note that VIGRA provides an alternative implementation of the watershed transform via watershedsUnionFind().

Declarations:

pass 2D array views:

namespace vigra {
template <class T1, class S1,
class T2, class S2,
class Neighborhood = EightNeighborCode>
unsigned int
watershedsRegionGrowing(MultiArrayView<2, T1, S1> const & src,
MultiArrayView<2, T2, S2> dest,
Neighborhood neighborhood = EightNeighborCode(),
WatershedOptions const & options = WatershedOptions());
template <class T1, class S1,
class T2, class S2>
unsigned int
watershedsRegionGrowing(MultiArrayView<2, T1, S1> const & src,
MultiArrayView<2, T2, S2> dest,
WatershedOptions const & options = WatershedOptions());
}
vigra::watershedsRegionGrowing
unsigned int watershedsRegionGrowing(...)
Region segmentation by means of a flooding-based watershed algorithm.

show deprecated declarations

pass Image Iterators and Data Accessors :
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor,
class Neighborhood = EightNeighborCode>
unsigned int
watershedsRegionGrowing(SrcIterator upperlefts, SrcIterator lowerrights, SrcAccessor sa,
DestIterator upperleftd, DestAccessor da,
Neighborhood neighborhood = EightNeighborCode(),
WatershedOptions const & options = WatershedOptions());
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor>
unsigned int
watershedsRegionGrowing(SrcIterator upperlefts, SrcIterator lowerrights, SrcAccessor sa,
DestIterator upperleftd, DestAccessor da,
WatershedOptions const & options = WatershedOptions());
}
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor,
class Neighborhood = EightNeighborCode>
unsigned int
watershedsRegionGrowing(triple<SrcIterator, SrcIterator, SrcAccessor> src,
pair<DestIterator, DestAccessor> dest,
Neighborhood neighborhood = EightNeighborCode(),
WatershedOptions const & options = WatershedOptions());
template <class SrcIterator, class SrcAccessor,
class DestIterator, class DestAccessor>
unsigned int
watershedsRegionGrowing(triple<SrcIterator, SrcIterator, SrcAccessor> src,
pair<DestIterator, DestAccessor> dest,
WatershedOptions const & options = WatershedOptions());
}

Usage:

#include <vigra/watersheds.hxx>
Namespace: vigra

Example: watersheds of the gradient magnitude.

MultiArray<2, float> src(w, h);
... // read input data
// compute gradient magnitude at scale 1.0 as a boundary indicator
MultiArray<2, float> gradMag(w, h);
gaussianGradientMagnitude(src, gradMag, 1.0);
// example 1
{
// the pixel type of the destination image must be large enough to hold
// numbers up to 'max_region_label' to prevent overflow
MultiArray<2, unsigned int> labeling(w, h);
// call watershed algorithm for 4-neighborhood, leave a 1-pixel boundary between regions,
// and autogenerate seeds from all gradient minima where the magnitude is below 2.0
unsigned int max_region_label =
watershedsRegionGrowing(gradMag, labeling,
FourNeighborCode(),
WatershedOptions().keepContours()
.seedOptions(SeedOptions().minima().threshold(2.0)));
}
// example 2
{
MultiArray<2, unsigned int> labeling(w, h);
// compute seeds beforehand (use connected components of all pixels
// where the gradient is below 4.0)
unsigned int max_region_label =
generateWatershedSeeds(gradMag, labeling,
SeedOptions().levelSets(4.0));
// quantize the gradient image to 256 gray levels
MultiArray<2, unsigned char> gradMag256(w, h);
FindMinMax<float> minmax;
inspectImage(gradMag, minmax); // find original range
transformImage(gradMag, gradMag256,
linearRangeMapping(minmax, 0, 255));
// call the turbo algorithm with 256 bins, using 8-neighborhood
watershedsRegionGrowing(gradMag256, labeling,
WatershedOptions().turboAlgorithm(256));
}
// example 3
{
MultiArray<2, unsigned int> labeling(w, h);
.. // get seeds from somewhere, e.g. an interactive labeling program,
// make sure that label 1 corresponds to the background
// bias the watershed algorithm so that the background is preferred
// by reducing the cost for label 1 to 90%
watershedsRegionGrowing(gradMag, labeling,
WatershedOptions().biasLabel(1, 0.9));
}

show deprecated examples

vigra::BImage src(w, h);
... // read input data
// compute gradient magnitude at scale 1.0 as a boundary indicator
vigra::FImage gradMag(w, h);
gaussianGradientMagnitude(srcImageRange(src), destImage(gradMag), 1.0);
// example 1
{
// the pixel type of the destination image must be large enough to hold
// numbers up to 'max_region_label' to prevent overflow
vigra::IImage labeling(w, h);
// call watershed algorithm for 4-neighborhood, leave a 1-pixel boundary between regions,
// and autogenerate seeds from all gradient minima where the magnitude is below 2.0
unsigned int max_region_label =
watershedsRegionGrowing(srcImageRange(gradMag), destImage(labeling),
FourNeighborCode(),
WatershedOptions().keepContours()
.seedOptions(SeedOptions().minima().threshold(2.0)));
}
// example 2
{
vigra::IImage labeling(w, h);
// compute seeds beforehand (use connected components of all pixels
// where the gradient is below 4.0)
unsigned int max_region_label =
generateWatershedSeeds(srcImageRange(gradMag), destImage(labeling),
SeedOptions().levelSets(4.0));
// quantize the gradient image to 256 gray levels
vigra::BImage gradMag256(w, h);
vigra::FindMinMax<float> minmax;
inspectImage(srcImageRange(gradMag), minmax); // find original range
transformImage(srcImageRange(gradMag), destImage(gradMag256),
linearRangeMapping(minmax, 0, 255));
// call the turbo algorithm with 256 bins, using 8-neighborhood
watershedsRegionGrowing(srcImageRange(gradMag256), destImage(labeling),
WatershedOptions().turboAlgorithm(256));
}
// example 3
{
vigra::IImage labeling(w, h);
.. // get seeds from somewhere, e.g. an interactive labeling program,
// make sure that label 1 corresponds to the background
// bias the watershed algorithm so that the background is preferred
// by reducing the cost for label 1 to 90%
watershedsRegionGrowing(srcImageRange(gradMag), destImage(labeling),
WatershedOptions().biasLabel(1, 0.9));
}
Required Interface:
SrcIterator src_upperleft, src_lowerright;
DestIterator dest_upperleft;
SrcAccessor src_accessor;
DestAccessor dest_accessor;
// compare src values
src_accessor(src_upperleft) <= src_accessor(src_upperleft)
// set result
int label;
dest_accessor.set(label, dest_upperleft);

## ◆ watersheds3D()

template<... >

unsigned int watersheds3D | ( |  | ... | ) |

Region Segmentation by means of the watershed algorithm.

This function is deprecated, use watershedsMultiArray() instead.

Declarations:

show deprecated declarations

pass MultiIterators and Data Accessors :
namespace vigra {
template <class SrcIterator, class SrcAccessor,class SrcShape,
class DestIterator, class DestAccessor,
class Neighborhood3D>
unsigned int watersheds3D(SrcIterator s_Iter, SrcShape srcShape, SrcAccessor sa,
DestIterator d_Iter, DestAccessor da,
Neighborhood3D neighborhood3D);
}
vigra::watersheds3D
unsigned int watersheds3D(...)
Region Segmentation by means of the watershed algorithm.
use argument objects in conjunction with Argument Object Factories :
namespace vigra {
template <class SrcIterator, class SrcAccessor,class SrcShape,
class DestIterator, class DestAccessor,
class Neighborhood3D>
unsigned int watersheds3D(triple<SrcIterator, SrcShape, SrcAccessor> src,
pair<DestIterator, DestAccessor> dest,
Neighborhood3D neighborhood3D);
}
use with 3D-Six-Neighborhood:
namespace vigra {
template <class SrcIterator, class SrcAccessor,class SrcShape,
class DestIterator, class DestAccessor>
unsigned int watersheds3DSix(triple<SrcIterator, SrcShape, SrcAccessor> src,
pair<DestIterator, DestAccessor> dest);
}
use with 3D-TwentySix-Neighborhood:
namespace vigra {
template <class SrcIterator, class SrcAccessor,class SrcShape,
class DestIterator, class DestAccessor>
unsigned int watersheds3DTwentySix(triple<SrcIterator, SrcShape, SrcAccessor> src,
pair<DestIterator, DestAccessor> dest);
}

This function implements the union-find version of the watershed algorithms as described in

J. Roerdink, R. Meijster: "The watershed transform: definitions, algorithms, and parallelization strategies", Fundamenta Informaticae, 41:187-228, 2000

The source volume is a boundary indicator such as the gradient magnitude of the trace of the boundaryTensor(). Local minima of the boundary indicator are used as region seeds, and all other voxels are recursively assigned to the same region as their lowest neighbor. Pass vigra::NeighborCode3DSix or vigra::NeighborCode3DTwentySix to determine the neighborhood where voxel values are compared. The voxel type of the input volume must be `LessThanComparable`.

Usage:

#include <vigra/watersheds3D.hxx>
Namespace: vigra

Example: watersheds3D of the gradient magnitude.

Shape3 shape(w, h, d);
MultiArray<3, float> src(shape), grad(shape);
...
double scale = 1;
gaussianGradientMagnitude(src, grad, scale);
MultiArray<3, int> labels(shape);
// find 6-connected regions
int max_region_label = watersheds3DSix(grad, labels);
// find 26-connected regions
max_region_label = watersheds3DTwentySix(grad, labels);

show deprecated examples

typedef vigra::MultiArray<3,int> IntVolume;
typedef vigra::MultiArray<3,double> DVolume;
DVolume src(DVolume::difference_type(w,h,d));
IntVolume dest(IntVolume::difference_type(w,h,d));
float gauss=1;
vigra::MultiArray<3, vigra::TinyVector<float,3> > temp(IntVolume::difference_type(w,h,d));
vigra::gaussianGradientMultiArray(srcMultiArrayRange(vol),destMultiArray(temp),gauss);
IntVolume::iterator temp_iter=temp.begin();
for(DVolume::iterator iter=src.begin(); iter!=src.end(); ++iter, ++temp_iter)
*iter = norm(*temp_iter);
// find 6-connected regions
int max_region_label = vigra::watersheds3DSix(srcMultiArrayRange(src), destMultiArray(dest));
// find 26-connected regions
max_region_label = vigra::watersheds3DTwentySix(srcMultiArrayRange(src), destMultiArray(dest));
Required Interface:
SrcIterator src_begin;
SrcShape src_shape;
DestIterator dest_begin;
SrcAccessor src_accessor;
DestAccessor dest_accessor;
// compare src values
src_accessor(src_begin) <= src_accessor(src_begin)
// set result
int label;
dest_accessor.set(label, dest_begin);

© Ullrich Köthe (ullrich.koethe@iwr.uni-heidelberg.de) Heidelberg Collaboratory for Image Processing, University of Heidelberg, Germany | html generated using doxygen and Python vigra 1.11.1