Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
astro-io
I/O operations for astronomical image formats.
Overview
astro-io provides functionality for loading and saving astronomical image formats, including FITS and XISF. It handles the low-level details of file I/O, image data extraction, and compression.
Features
- FITS file loading
- XISF file loading
- Efficient image data handling
- Support for various data types (8-bit, 16-bit, 32-bit float)
Windows FITS Path-Length Note
On Windows, FITS file access in AstroMuninn and the ravensky-astro FITS APIs depends on CFITSIO (via fitsio / fitsio-sys). CFITSIO currently opens disk files using its fopen-based path handling (file_openfile), which in this environment follows the classic Windows path-length boundary.
Use full FITS paths shorter than 260 characters (< 260). At 260 or more, FITS open calls may fail.
This limitation is specific to FITS access through CFITSIO. XISF handling is not affected.
Installation
Add to your Cargo.toml:
[]
= "0.4.0"
API Reference
FITS Module
/// Read a FITS file and return its pixel data, width, and height
- Parameters:
path: Path to the FITS file
- Returns:
- A tuple containing:
Vec<f32>: Pixel data as a flattened vector of 32-bit floatsusize: Width of the image in pixelsusize: Height of the image in pixels
- A tuple containing:
- Errors:
- If the file cannot be opened
- If the primary HDU is not an image
- If the image data cannot be read
- On Windows, FITS open may fail when the full pathname is 260 characters or longer due to CFITSIO
fopenpath handling.
/// Normalize pixel values to a 0.0-1.0 range
- Parameters:
pixels: Slice of pixel values
- Returns:
Vec<f32>: Normalized pixel values in the range 0.0-1.0
XISF Module
/// Read an XISF file and return its pixel data, width, and height
- Parameters:
path: Path to the XISF file
- Returns:
- A tuple containing:
Vec<f32>: Pixel data as a flattened vector of 32-bit floatsusize: Width of the image in pixelsusize: Height of the image in pixels
- A tuple containing:
- Errors:
- If the file cannot be opened
- If the XISF signature is invalid
- If the XML header cannot be parsed
- If the image data cannot be read
Usage Examples
Loading a FITS file
use fits;
use Path;
Loading an XISF file
use xisf;
use Path;
License
This project is dual-licensed under the MIT License or the Apache License, Version 2.0.