修改该了关于info信息为json内部管理 该项目只适用于windows或linux 修改了c++及相应的rust代码 不适用于arm

This commit is contained in:
xin
2025-06-27 15:46:42 +08:00
parent ae30c24a8f
commit 613a219a49
8 changed files with 215 additions and 19 deletions

View File

@ -1,8 +1,6 @@
use iris_rust::examples::{
spectral_data_roundtrip,
image_info_roundtrip,
read_iris_file_example
};
use iris_converter::{examples::{
image_info_roundtrip, read_iris_file_example, spectral_data_roundtrip
}, explortirisdatatocsv, explortirisdatatojson};
fn main() {
// println!("Running iris_rust examples...");
@ -19,8 +17,66 @@ fn main() {
// println!("\nTesting image info...");
// image_info_roundtrip();
println!("\nReading IRIS file...");
// println!("\nReading IRIS file...");
read_iris_file_example();
//explortirisdatatojson(&"iris_data_example.iris".to_string());
// explortirisdatatocsv( &"iris_data_example.iris".to_string());
println!("\nAll examples completed successfully!");
}
}
use std::env; // 引入 env 模块以访问命令行参数
// fn main() {
// // 收集所有命令行参数
// let args: Vec<String> = env::args().collect();
// // 检查参数数量
// // 程序的第一个参数是它自己的名称,所以我们期望至少有两个参数 (程序名 + 文件路径)
// // 最多三个参数 (程序名 + 文件路径 + 转换类型)
// if args.len() < 2 || args.len() > 3 {
// println!("Usage: {} <file_path> [output_type (json|csv)]", args[0]);
// println!(" output_type defaults to 'csv'");
// return; // 参数数量不正确,打印使用说明并退出
// }
// // 获取文件路径 (第二个参数)
// let file_path = &args[1];
// // 检查文件路径是否以 ".iris" 结尾
// if !file_path.ends_with(".iris") {
// println!("Error: The file path must end with '.iris'.");
// println!("Usage: {} <file_path> [output_type (json|csv)]", args[0]);
// return; // 文件路径不正确,打印错误信息并退出
// }
// // 获取转换类型 (第三个参数,如果存在)
// // 如果没有提供第三个参数,则 output_type_str 为 None
// let output_type_str = if args.len() == 3 {
// Some(args[2].as_str()) // 将 String 转换为 &str
// } else {
// None // 没有提供转换类型
// };
// // 根据转换类型执行相应的导出函数
// match output_type_str {
// Some("json") => {
// println!("Exporting '{}' to JSON...", file_path);
// explortirisdatatojson(file_path);
// },
// // 如果是 "csv" 或没有指定类型,则默认为 CSV
// Some("csv") | None => {
// println!("Exporting '{}' to CSV (default)...", file_path);
// explortirisdatatocsv(file_path);
// },
// _ => {
// // 处理无效的转换类型
// println!("Error: Invalid output type. Please use 'json' or 'csv'.");
// println!("Usage: {} <file_path> [output_type (json|csv)]", args[0]);
// }
// }
// println!("\nAll operations completed successfully!");
// }