Crates.io | ix-match |
lib.rs | ix-match |
version | 0.3.1 |
source | src |
created_at | 2024-05-22 23:49:29.987642 |
updated_at | 2024-10-15 19:06:13.018894 |
description | A tool for matching and moving IIQ files so they can be easily imported into IX Capture. |
homepage | |
repository | https://github.com/HakaiInstitute/ix-match |
max_upload_size | |
id | 1248894 |
size | 72,682 |
IX-Match is a Rust CLI tool and library for matching RGB and NIR IIQ files from aerial surveys using PhaseOne cameras. It helps preprocess images for conversion with IX-Capture by moving unmatched images to a new subdirectory.
To install IX-Match, you need to have Rust and Cargo installed on your system. If you don't have them installed, you can get them from https://www.rust-lang.org/tools/install.
To install IX-Match as a CLI tool, use:
cargo install ix-match --features cli
To use IX-Match as a library in your Rust project, add the following to your Cargo.toml
:
[dependencies]
ix-match = "0.2.4"
ix-match [OPTIONS] [IIQ_DIR]
Arguments:
IIQ_DIR
: Directory containing the RGB and NIR subdirectories (default: current directory)Options:
-d, --dry-run
: Perform a dry run without moving files-r, --rgb-pattern <RGB_PATTERN>
: Pattern for finding the RGB directory (default: "C*_RGB")-n, --nir-pattern <NIR_PATTERN>
: Pattern for finding the NIR directory (default: "C*_NIR")-t, --thresh <THRESH>
: Threshold for matching images in milliseconds (default: 500)-v, --verbose
: Enable verbose output-h, --help
: Print help-V, --version
: Print versionTo use IX-Match as a library, you can import and use its functions in your Rust code:
use ix_match::{find_dir_by_pattern, process_images};
use std::path::Path;
use std::time::Duration;
fn main() -> Result<(), Box<dyn std::error::Error>> {
let iiq_dir = Path::new("path/to/iiq/directory");
let rgb_dir = find_dir_by_pattern(iiq_dir, "C*_RGB").expect("RGB directory not found");
let nir_dir = find_dir_by_pattern(iiq_dir, "C*_NIR").expect("NIR directory not found");
let thresh = Duration::from_millis(500);
let dry_run = false;
let verbose = false;
let (rgb_count, nir_count, matched_count) = process_images(&rgb_dir, &nir_dir, thresh, dry_run, verbose)?;
println!("RGB: {}, NIR: {} ({} match)", rgb_count, nir_count, matched_count);
Ok(())
}
To make changes to IX-Match, follow these steps:
Clone the repository:
git clone https://github.com/HakaiInstitute/ix-match.git
cd ix-match
Make your changes to the source code. The main files to edit are:
src/main.rs
: Contains the CLI interface and main program logicsrc/lib.rs
: Contains the core functionality of the libraryCargo.toml
: Manage dependencies and project metadataBuild the project:
cargo build
Run tests:
cargo test
Run the program locally:
cargo run --features cli -- [OPTIONS] [IIQ_DIR]
To create a release build:
cargo build --release --features cli
Note: The cli
feature flag is required to build and run the CLI version of IX-Match.
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.