Expand description
This crate implements a fits image parser
§Examples
Basic usage:
use std::fs::File;
use std::io::BufReader;
use fitsrs::{fits::Fits, hdu::HDU};
use fitsrs::hdu::data::iter;
let f = File::open("samples/fits.gsfc.nasa.gov/HST_FOC.fits").unwrap();
let mut reader = BufReader::new(f);
let Fits { mut hdu } = Fits::from_reader(&mut reader).unwrap();
let xtension = hdu.get_header().get_xtension();
let naxis1 = *xtension.get_naxisn(1).unwrap() as usize;
let naxis2 = *xtension.get_naxisn(2).unwrap() as usize;
if let iter::Data::F32(it) = hdu.get_data_mut() {
let data = it.collect::<Vec<_>>();
assert_eq!(data.len(), naxis1 * naxis2);
} else {
panic!("expected data block containing f32");
}