pub struct AsciiReader<'a> { /* private fields */ }
Expand description

PointReader implementation for ascii files

Implementations

Creates a new AsciiReader by opening the file at the given path. The delimiter string slice is the column seperation pattern. The format string slice coordinates the interpretation of each column. This functions just wraps a BufReader around a File and uses AsciiReader::from_read. For more information see AsciiReader::from_read.

Examples
use std::path::Path;
use anyhow::Result;
use pasture_io::ascii::AsciiReader;
fn main() -> Result<()> {
    let path = Path::new("foo.txt");
    let reader = AsciiReader::from_path(path, "xyzie", ", ")?;
    Ok(())
}
Errors

If path does not exist, cannot be opened or does not point to a valid file, an error is returned.

If format contains unrecoginzed literals, an error is returned.

Creates a new AsciiReader from the given read. The delimiter string slice is the column seperation pattern. The format string slice coordinates the interpretation of each column. The following literals can be interpreted from AsciiReader:

  • s → skip this column
  • x → x coordinate
  • y → y coordinate
  • z → z coordinate
  • i → intensity
  • r → ReturnNumber
  • n → number of returns of given pulse
  • c → classification
  • t → gps time
  • u → user data
  • p → point source ID
  • R → red channel of RGB color
  • G → green channel of RGB color
  • B → blue channel of RGB color
  • e → edge of flight line flag
  • d → direction of scan flag
  • a → scan angle rank
  • I → NIR channel
Examples

For the following data an AsciiReader should be created. The first three columns correspondens to the position attribute. The 4th column is the intensity attribute. and the 5th is the edge_of_line_flag.

use std::io::{BufReader};
use anyhow::Result;
use pasture_io::ascii::AsciiReader;
fn main() -> Result<()> {
    let data = "0.0, 1.0, 2.0, 11, 0\n1.0, -2.0, 2.0, 22, 0".as_bytes();
    let read = BufReader::new(data);
    let reader = AsciiReader::from_read(read, "xyzie", ", ")?;
    Ok(())
}
Errors

If the given Read does not represent a valid file, an error is returned.

If format contains unrecoginzed literals, an error is returned.

Trait Implementations

Read count points from this PointReader. Returns an opaque PointBuffer type filled with the read points in the default PointLayout of this PointReader. Read more

Read count points from this PointReader into the given PointBuffer. Uses the PointLayout of the given PointBuffer for reading. If no conversion from the default PointLayout to this new layout are possible, an error is returned. On success, returns the number of points that were read. Read more

Returns the Metadata of the associated PointReader

Returns the default PointLayout of the associated PointReader

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The alignment of pointer.

The type for initializers.

Initializes a with the given initializer. Read more

Dereferences the given pointer. Read more

Mutably dereferences the given pointer. Read more

Drops the object pointed to by the given pointer. Read more

Should always be Self

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more

Checks if self is actually part of its subset T (and can be converted to it).

Use with care! Same as self.to_subset but without any property checks. Always succeeds.

The inclusion map: converts self to the equivalent element of its superset.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.