Skip to content

Add ImageClass.OpticalFilters (2.1.0) - #13

Open
cthvideometer wants to merge 1 commit into
mainfrom
feature/onnx-multispectral-update
Open

cthvideometer wants to merge 1 commit into
mainfrom
feature/onnx-multispectral-update

Conversation

@cthvideometer

Copy link
Copy Markdown

Each band's optical filter as a dict (type, pass band), or None for a plain reflectance band. reduceBands keeps it aligned. Needed by the ONNX model contract to tell filtered from unfiltered bands.

Each band's optical filter as a dict (type, pass band), or None for a
plain reflectance band. reduceBands keeps it aligned. Needed by the
ONNX model contract to tell filtered from unfiltered bands.
@cthvideometer

Copy link
Copy Markdown
Author

@henrikh
Kontekst:
ImageClass har fået OpticalFilters: hvert bånds optiske filter som dict (type, pasbånd), eller None for et almindeligt bånd.

Review:
Lille ændring i hips.py (18 linjer). Tjek at dict-formen passer med optical_filter i ONNX-kontrakten, og at ingen eksisterende adfærd ændres. Testen dækker kun billeder uden filtre, fordi der ikke findes filtrerede testdata endnu.

@henrikh henrikh left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Additional test case needed to check that filtered bands are properly read.

Need an implementation of the OpticalFilters field for the Python backend (see _init_python

Comment thread src/videometer/hips.py
VMImageObject.StrobeTimesUniversal
)
self.OpticalFilters = [
self._opticalFilter2dict(VMImageObject.GetOpticalFilterForBand(band))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to also make sure this works with the Python backend.

Comment thread tests/test_imageClass.py
Comment on lines +10 to +18
def test_optical_filters_are_read_per_band():
# Plain reflectance bands have no optical filter (None); filtered bands give a dict
# with type and pass band (see ImageClass.OpticalFilters).
img = hips.ImageClass(r"TestData\1c8f82ed-2ede-48c7-a0be-4978f282a6ea.hips")
assert len(img.OpticalFilters) == img.Bands
assert all(f is None for f in img.OpticalFilters) # No optical filters

img.reduceBands([0, 2])
assert len(img.OpticalFilters) == 2 No newline at end of file

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be good to have a test of actually parsing an image with filtered bands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants