-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | PCD file loader.
--
-- Parser for PCD (point cloud data) formats. See
-- http://pointclouds.org/documentation/tutorials/pcd_file_format.php
-- for more information.
@package pcd-loader
@version 0.2.0
-- | Common types for dealing with PCD files.
module PCD.Internal.Types
-- | A 2-dimensional vector
data V2 a :: * -> *
V2 :: a -> a -> V2 a
-- | A 3-dimensional vector
data V3 a :: * -> *
V3 :: a -> a -> a -> V3 a
-- | A 4-dimensional vector.
data V4 a :: * -> *
V4 :: a -> a -> a -> a -> V4 a
type M44 a = V4 (V4 a)
data Quaternion a :: * -> *
Quaternion :: a -> {-# UNPACK #-} !(V3 a) -> Quaternion a
-- | Storable-based vectors
data Vector a :: * -> *
-- | 8-bit unsigned integer type
data Word8 :: *
-- | Define a data structure for a PCD file header and an associated
-- parser.
module PCD.Header
-- | Fields attached to a point may be signed integers (I), unsigned
-- integers (U), or floating point (F).
data DimType
I :: DimType
U :: DimType
F :: DimType
-- | The PCD format has both ASCII and binary variants.
data DataFormat
ASCII :: DataFormat
Binary :: DataFormat
data FieldType
TUchar :: {-# UNPACK #-} !Word8 -> FieldType
TChar :: {-# UNPACK #-} !Int8 -> FieldType
TUshort :: {-# UNPACK #-} !Word16 -> FieldType
TShort :: {-# UNPACK #-} !Int16 -> FieldType
TUint :: {-# UNPACK #-} !Word32 -> FieldType
TInt :: {-# UNPACK #-} !Int32 -> FieldType
TFloat :: {-# UNPACK #-} !Float -> FieldType
TDouble :: {-# UNPACK #-} !Double -> FieldType
class PCDType a
unsafeUnwrap :: PCDType a => FieldType -> a
-- | Construct a parser for a field based on its type and size.
fieldParser :: DimType -> Int -> Parser FieldType
sequence' :: Monad m => [m a] -> m [a]
-- | Assemble a parser for points by sequencing together all necessary
-- field parsers.
pointParser :: Header -> Parser [FieldType]
data Header
Header :: Text -> [Text] -> [Int] -> [DimType] -> [Int] -> Integer -> Int -> (V3 Double, Quaternion Double) -> Integer -> DataFormat -> Header
_version :: Header -> Text
_fields :: Header -> [Text]
_sizes :: Header -> [Int]
_dimTypes :: Header -> [DimType]
_counts :: Header -> [Int]
_width :: Header -> Integer
_height :: Header -> Int
_viewpoint :: Header -> (V3 Double, Quaternion Double)
_points :: Header -> Integer
_format :: Header -> DataFormat
width :: Lens Header Header Integer Integer
viewpoint :: Lens Header Header (V3 Double, Quaternion Double) (V3 Double, Quaternion Double)
version :: Lens Header Header Text Text
sizes :: Lens Header Header [Int] [Int]
points :: Lens Header Header Integer Integer
height :: Lens Header Header Int Int
format :: Lens Header Header DataFormat DataFormat
fields :: Lens Header Header [Text] [Text]
dimTypes :: Lens Header Header [DimType] [DimType]
counts :: Lens Header Header [Int] [Int]
defaultHeader :: Header
readVersion :: Parser Text
readFields :: Parser [Text]
readTypes :: Parser [DimType]
namedIntegral :: Integral a => Text -> Parser a
namedIntegrals :: Integral a => Text -> Parser [a]
readViewpoint :: Parser (V3 Double, Quaternion Double)
readFormat :: Parser DataFormat
-- | Get the next non-comment line.
nextLine :: Handle -> IO Text
-- | Parse a PCD header. Returns the Header and the rest of the file
-- contents.
readHeader :: Handle -> IO (Header, Maybe Text)
-- | Format a Header to be compatible with the PCD specification.
writeHeader :: Header -> Text
-- | Compute the number of bytes this point cloud would occupy if
-- serialized with the Binary encoding.
totalBinarySize :: Header -> Int
instance NFData Header
instance Eq DimType
instance Show DimType
instance Ord DimType
instance Eq DataFormat
instance Show DataFormat
instance Ord DataFormat
instance Show FieldType
instance Show Header
instance PCDType Double
instance PCDType Float
instance PCDType Int32
instance PCDType Word32
instance PCDType Int16
instance PCDType Word16
instance PCDType Int8
instance PCDType Word8
module PCD.Internal.StorableFieldType
data P a
P :: !FieldType -> {-# UNPACK #-} !(Ptr a) -> P a
-- | peek a Storable and advance the source pointer past this
-- datum.
peekStep :: Storable a => (a -> FieldType) -> Ptr b -> IO (P b)
parseBinaryField :: DimType -> Int -> Ptr a -> IO (P a)
parseBinaryPoints :: Header -> Handle -> IO (Vector (Vector FieldType))
parseBinaryFields :: Header -> Ptr a -> IO (Vector FieldType, Ptr a)
pokeStep :: Storable a => a -> Ptr b -> IO (Ptr b)
pokeBinaryField :: FieldType -> Ptr a -> IO (Ptr a)
pokeBinaryFields :: Ptr a -> Vector FieldType -> IO (Ptr a)
pokeBinaryPoints :: Ptr a -> Vector (Vector FieldType) -> IO ()
-- | Parser for PCD (point cloud data) files. Also provides a facility for
-- converting from ASCII to binary formatted point data.
module PCD.Data
data FieldType
TUchar :: {-# UNPACK #-} !Word8 -> FieldType
TChar :: {-# UNPACK #-} !Int8 -> FieldType
TUshort :: {-# UNPACK #-} !Word16 -> FieldType
TShort :: {-# UNPACK #-} !Int16 -> FieldType
TUint :: {-# UNPACK #-} !Word32 -> FieldType
TInt :: {-# UNPACK #-} !Int32 -> FieldType
TFloat :: {-# UNPACK #-} !Float -> FieldType
TDouble :: {-# UNPACK #-} !Double -> FieldType
unsafeUnwrap :: PCDType a => FieldType -> a
-- | Parse every field of every point in a PCD file. Returns a function
-- that may be used to project out a named field.
loadAllFields :: FilePath -> IO (Text -> Vector FieldType)
-- | Read a PCD file consisting of floating point XYZW coordinates for each
-- point (where the final "W" field may be an RGB triple encoded as a
-- float).
loadXyzw :: (Fractional a, Storable a) => FilePath -> IO (Vector (V4 a))
-- | Read a PCD file consisting of floating point XYZ coordinates for each
-- point.
loadXyz :: (Fractional a, Storable a) => FilePath -> IO (Vector (V3 a))
-- | asciiToBinary inputFile outputFile converts a PCD file from
-- ASCII to Binary.
asciiToBinary :: FilePath -> FilePath -> IO ()