-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | Distance transform function.
--
-- An n-D distance transform that computes the Euclidean distance between
-- each element in a discrete field and the nearest cell containing a
-- zero.
--
-- The algorithm implemented is based off of Meijster et al., "A
-- general algorithm for computing distance transforms in linear
-- time." Parallel versions of both the Euclidean distance transform
-- and squared Euclidean distance transform are also provided.
@package DistanceTransform
@version 0.1.2
-- | Helpers for performing nested loop iteration. Includes variants for
-- parallel computation.
module DistanceTransform.Internal.Indexer
-- | We use a zipper on list to walk over dimensions of an array.
data Zipper a
Zip :: [a] -> a -> [a] -> Zipper a
-- | Create a Zipper from a non-empty list, with the cursor on the
-- leftmost element.
toZipper :: a -> [a] -> Zipper a
-- | Create a Zipper from a non-empty list, with the cursor on the
-- leftmost element. An exception is thrown if the given list is empty.
unsafeToZipper :: [a] -> Zipper a
-- | Convert a Zipper to a list.
fromZipper :: Zipper a -> [a]
-- | Move a Zipper to the left.
left :: Zipper a -> Maybe (Zipper a)
unsafeLeft :: Zipper a -> Zipper a
right :: Zipper a -> Maybe (Zipper a)
-- | Comonadic coreturn: produce the value a Zipper is currently
-- focused upon.
focus :: Zipper a -> a
-- | Slide a Zipper over until focused on its rightmost element.
rightmost :: Zipper a -> Zipper a
-- | Since we are using Zippers to track the size of
-- multidemensional arrays, the sum of all zipper elements gives the size
-- of the entire array.
zipSum :: Num a => Zipper a -> a
-- | Computes the step between consective elements at the currently focused
-- dimension. This involves stepping over all nested dimensions.
zipStep :: Num a => Zipper a -> a
-- | Computes the stride between rows at the currently focused dimension.
-- This involves stepping over the rest of the current row along all
-- nested dimensions.
zipStride :: Num a => Zipper a -> a
zipFoldM :: Monad m => Zipper Int -> (a -> Int -> m a) -> a -> [Int] -> m ()
parChunkMapM_ :: (a -> IO ()) -> [a] -> IO ()
parZipFoldM :: Zipper Int -> (a -> Int -> IO a) -> a -> [Int] -> IO ()
zipMapM_ :: Monad m => Zipper Int -> (Int -> m ()) -> [Int] -> m ()
zipFoldMAsYouDo :: Monad m => Zipper Int -> (Int -> Int -> m ()) -> m ()
parZipFoldMAsYouDo :: Zipper Int -> (Int -> Int -> IO ()) -> IO ()
-- | N-dimensional parallel Euclidean distance transform using an approach
-- derived from: Meijster et al., "A general algorithm for
-- computing distance transforms in linear time."
module DistanceTransform.Euclidean
-- | Compute the Euclidean distance transform of an N-dimensional array.
-- Dimensions given as [width,height,depth...]. The left-most
-- dimension is the inner-most. For an array representing a 2D collection
-- in row-major format, we would give [width,height] or
-- [columns,rows].
edt :: (Integral a, Floating b, Vector v a, Vector v b, Vector v Int) => [Int] -> v a -> v b
-- | Compute the Euclidean distance transform of an N-dimensional array
-- using multiple processor cores. Dimensions given as
-- [width,height,depth...]. The left-most dimension is the
-- inner-most. For an array representing a 2D collection in row-major
-- format, we would give [width,height] or
-- [columns,rows].
edtPar :: (Integral a, Floating b, Vector v a, Vector v b, Vector v Int) => [Int] -> v a -> v b
-- | Compute the squared Euclidean distance transform of an N-dimensional
-- array. Dimensions given as [width,height,depth...]. The
-- left-most dimension is the inner-most.
sedt :: (Vector v a, Vector v Int, Integral a) => [Int] -> v a -> v Int
-- | Compute the squared Euclidean distance transform of an N-dimensional
-- array using multiple processor cores. Dimensions given as
-- [width,height,depth...]. The left-most dimension is the
-- inner-most.
sedtPar :: (Vector v a, Vector v Int, Integral a) => [Int] -> v a -> v Int