Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ Support reading multi-band GeoTIFF files #13

Merged
merged 6 commits into from
Mar 25, 2024
Merged

✨ Support reading multi-band GeoTIFF files #13

merged 6 commits into from
Mar 25, 2024

Conversation

weiji14
Copy link
Owner

@weiji14 weiji14 commented Mar 17, 2024

Count the number of bands or channels in the GeoTIFF file when decoding by looking at ColorType.

Note that this relies on a patch to image-tiff that has been submitted as a pull request at image-rs/image-tiff#224

TODO:

Pulling from the `multi-band-geotiff` branch from my personal fork, that is currently in a pull request at image-rs/image-tiff#224.
Count the number of bands or channels in the GeoTIFF file when decoding by looking at the ColorType. E.g. Gray = 1 band, Multiband = N bands. Added a unit test to read a 2-band float32 GeoTIFF file.
@weiji14 weiji14 added the feature New feature or request label Mar 17, 2024
@weiji14 weiji14 added this to the 0.1.0 milestone Mar 17, 2024
@weiji14 weiji14 self-assigned this Mar 17, 2024
Ensure that reading a multi-band GeoTIFF file from a remote URL works.
Also clarify that the roadmap item on reading single-band GeoTIFFs is for different dtypes.
The Multi-band PR at image-rs/image-tiff#224 has been merged, so updating to use the main branch instead.
Copy link

codspeed-hq bot commented Mar 24, 2024

CodSpeed Performance Report

Merging #13 will improve performances by 5.97%

Comparing multi-band (ae35a13) with main (b23a973)

Summary

⚡ 1 improvements
✅ 1 untouched benchmarks

🆕 1 new benchmarks

Benchmarks breakdown

Benchmark main multi-band Change
🆕 test_read_geotiff_multi_band N/A 121.6 ms N/A
test_read_geotiff_remote 49.6 ms 46.8 ms +5.97%

Replace `unimplemented!` with a recoverable TiffError::UnsupportedError instead to allow for better exception handling. Moved the band counting logic in the ndarray method above the image dimension line, and added a unit test to ensure unsupported ColorType TIFFs are handled properly.
@weiji14 weiji14 marked this pull request as ready for review March 25, 2024 04:15
@weiji14 weiji14 enabled auto-merge (squash) March 25, 2024 04:20
@weiji14 weiji14 merged commit 0f5df6e into main Mar 25, 2024
13 checks passed
@weiji14 weiji14 deleted the multi-band branch March 25, 2024 04:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant