Spectral Imaging Made Easy: A Powerful Python Library

62 points
1/21/1970
5 days ago
by janezla

Comments


__mharrison__

Hint. If your library is for creating images... Put an example image in the Readme.

3 days ago

tweakimp

I tried to understand what this library does, but without image examples its impossible for me. The docs almost seem to be unhelpful on purpose. Look at the use case description: "The functionality of the SiaPy library has been implemented in various use cases, demonstrating its capabilities and potential applications. The library's functionality is not limited to these examples and can be extended to other applications as well."

Are we living in the dead Internet already where everything is meaningless AI garbage?

3 days ago

Davidbrcz

Spectral images are images where there are several sensors into one image (think visible and infrared/thermal for instance). A good example would be Altum Pt camera (https://ageagle.com/drone-sensors/altum-pt-camera)

Then, this library can be used for instance (their word) - Display images from two cameras. - Co-register cameras and compute the transformation from one camera's space to another. - Select regions in images for training machine learning (ML) models. - Perform image segmentation using a pre-trained ML model. - Convert radiance images to reflectance by utilizing a reference panel. - Display spectral signatures for in-depth analysis.

3 days ago

janezla

Yes I know, but this is still my free time and effort I am putting in. I will try to add additional examples over time, but for now this was everything I managed to do :) For now I was a solo developer, it would be much easier if anyone would help me out

2 days ago

toxik

It is a by-product of a research project, its main connection is "these things were useful to the author while working on spectral images".

3 days ago

janezla

As you figured, I gathered and refactured multitude of the code that I mainly used in my research project. However, this is still not to say that someone cant find it useful :) I make a ton of effort to at least document the api and write at least some parts of the docs ;)

2 days ago

toxik

Oh I didn't mean to sound dismissive, it's just easier to understand it as a toolkit defined mostly by necessity.

a day ago

janezla

ok, just making sure that we are on the same page. Yeah, the inception was mostly organic, since in the last years I could not find a library that would enable me to easily do these things. Most of the code we use internally at the institute and I figured why not to share it with others. Maybe anyone will also get encouraged to help me with implementation of other useful features.

a day ago

janezla

Thanks, I agree, the problem is that I was a solo developer for the enitre time and with me understanding it entirely it is easy to forget that peaople have a hard time understanding it. Will correct it ASAP. Thanks for the suggestion :)

2 days ago

tomtom1337

If you’re looking to analyse your hyperspectral images (spectrum-images, image-images or n-dimensional- n-dimensional datasets), I can highly recommend hyperspy [1].

One of the brilliant ideas hyperspy incorporates is that we consider datasets to have a navigation dimension and a signal dimension (think, you measure a spectrum at each point on an image), and you can easily transpose between them. This means that you can «move around» on the image and see what the spectrum looks like, or transpose and see what the image looks like as a function of the spectrum.

In particular I think the model building, where you can fit components to your dataset, is really useful.

It works best with the Jedi LSP - pyright doesn’t support the way we added lazy loading / extensions to the base hyperspy package.

[1] https://hyperspy.org/

3 days ago

ptero

Hyperspy is great and the ability to "move around" n-dimensiobal datasets is a very powerful tool for the data visualization!

When I used it I missed two things compared to a similar superpower tool I used when I was working with multidimensional field test data in Matlab.

1. Ability to use "text dimensions", or non-uniformly spaced grid points.

2. Ability to select and filter on arbitrary expressions instead of by slice only.

The need for (2) is harder to grok (what's that going to do for a grid dataset???), but being able to apply a few arbitrary selection expressions is a superpower when analyzing messy 10+ dimensional data.

That, and the ability to add, on the fly, virtual dimensions for arbitrary expressions.

Someday, when I am ready to retire, I will take half a year to build this in python...

3 days ago

tomnicholas1

Interesting - I'm curious whether you feel that Xarray covers these use cases already?

https://xarray.dev/

Especially as I've said before that Hyperspy shares so many features in common with Xarray that Hyperspy should just use Xarray under the hood.

https://github.com/hyperspy/hyperspy/discussions/3405

3 days ago

janezla

Uh thanks, did realize that this library even existed. I will look into it ;)

2 days ago

janezla

I've created a Python library for working with spectral images. It started as a mix of work and personal interest. Since I work in research, I brought together a lot of useful code to make handling spectral images easier and packaged it into this library. I hope others find it helpful too! :blush:

Link to docs: https://siapy.github.io/siapy-lib/

5 days ago

fooblaster

what exactly does one do with hyperspectral images? Or what do you do with your library?

3 days ago

boccaff

There is a multitude of applications leveraging parts of the spectra different than the visible. I come from an agricultural background, and you can see examples from improving classification of land use, detection and classification of diseases, nutritional status assessment, indirect measurements of properties of plants and soil... it is endless, and every time any part of the tool stack gets cheaper, you have more and more potential applications. This comment [1] have a nice description for the library.

[1] https://news.ycombinator.com/item?id=42507805

3 days ago

BugsJustFindMe

I spent 20 minutes clicking through links and reading descriptions and I still can't tell whether this is for pictures of ghosts or something else.

3 days ago

janezla

It is for hyperspectral images for now :) I am aware that more visual representation should be added, but would require me to prolong showing it to wider public. I was hoping this would bost reputation and get any potential collaborators hooked to the project heh

2 days ago

[deleted]
a day ago

mturmon

Related: A python package for atmospheric correction of imaging spectroscopy (“hyperspectral”) radiance data: https://github.com/isofit/isofit

And a superset package, for the EMIT imaging spectroscopy investigation: https://github.com/emit-sds

3 days ago

janezla

Thanks, will check these ;)

2 days ago

janezla

Thanks, i am aware however that matlab have some tols that are worthwhile. But the main thing here is to have an utility lib for python so that you can use it with the entire python ecosystem :)

2 days ago

ipunchghosts

Someone ported this to python. Besides, an llm ca easily port the code as the value is in the algorithms not the source code.

20 hours ago

ulrischa

I made spectral image analysis at university. And there weren't good software Tools available

3 days ago

janezla

yeah, there still isnt a well established tool in a form of a py lib - at least that of what I am aware of

2 days ago

tocs3

I would like to know where to get a good hyperspectral imager.

3 days ago

momoschili

who out there actually has a consumer spectral imager these days? Cheapest ones I can find are ~10k USD....

3 days ago

janezla

these days, but maybe this will change in the future?

2 days ago

hoomanmo

is it compatible with Python 3.13?

3 days ago

KeplerBoy

Isn't pretty much everything compatible with 3.13?

The packages, which were affected by breaking changes (numpy, cython, scipy and so on) were patched months ago.

3 days ago

janezla

It should be. But I havent tested it specifically for 3.13. I plant to add such test in the future in ci worklow

2 days ago

adammarples

All that work and you can't put a description of what it does, an example, an image, something. 10'000 people click the link you posted, see nothing at all, and leave again.

3 days ago

janezla

gotcha, thanks for the feedback. This post provided me with feedback for the first time, before I was just developing the lib for myself. I will add additional info in the following days

2 days ago