A rust NITF file interface
Current project goals are
- Finish implementing version 2.1 reading (maybe writing)
- Verify header/subheader field entries (see NitfField
- Implement logic for various header/subheader inputs
- For example, return data from an image segment as an array with the appropriate format (right now only Complex32
supported)
- Expand with features for various applications of the standard (SICD as a first step)
In your Cargo.toml
, include nitf-rs
as a dependency, or, for the 'latest-and-greatest' features..
toml
nitf-rs = {git="https://github.com/holmesv3/nitf-rs.git"}
```rust use nitfrs::readnitf; use std::path::Path; // Define a string which is the path to some nitf file let nitffile: String = getnitffile(); let nitfpath = Path::new(&nitf_file);
// Read the file and print all metadata let nitf = readnitf(nitfpath); println!("{}", &nitf);
// Read image data, check that the dimensions are what we expect let imseg = &nitf.imagesegments[0]; let data = imseg.datatoarray(); println!("Meta NROWS: {}, data.nrows(): {}", imseg.meta.NROWS.val, data.nrows()); println!("Meta NCOLS: {}, data.ncols(): {}", im_seg.meta.NCOLS.val, data.ncols());
// If you have a SICD file, parse and print the metadata let sicdmeta = &nitf.parsesicdmeta().unwrap(); println!("{:#?}", sicdmeta); ```
In my own testing, I have only been able to find files to verify parsing for: - Header - Image Segments - Data Extension Segments - Sicd xml metadata parsing
To the best of my knowledge, these function as expected.
There is no logic built around the inputs yet (in progress)
sicd
metadata parsing capabilityIf you have questions, would like to contribute, or would like to request something be added, you can ask on this Discord server, or create an issue.
enum
/struct
's are in place, can begin to define within interface functions
P
IMODE valueIMODE