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

Implement mask for bilinear interpolation #3286

Merged
merged 4 commits into from
Dec 11, 2020

Conversation

kif
Copy link
Member

@kif kif commented Nov 25, 2020

Provide a mask in the numerical kernel in charge of bilinear interpolation.
Returns Nan when no underlying pixel is unmasked. Interpolates approximately then 1, 2 or 3 underlying pixels are masked.

This is part of #3285

@kif kif requested a review from t20100 November 25, 2020 10:41
@kif
Copy link
Member Author

kif commented Nov 25, 2020

In [1]: %pylab
Using matplotlib backend: TkAgg
Populating the interactive namespace from numpy and matplotlib

In [2]: import fabio, silx.image.bilinear

In [3]: f=fabio.open("/mnt/data/eiger/Eiger_raw/x1_insu_0p05d_0p05s_0p01beam_data_000002.h5")

In [4]: c = silx.image.bilinear.BilinearImage(f.data, mask=f.data==65535)

In [5]: plot(c.profile_line((0,0), (1000,1000)))
Out[5]: [<matplotlib.lines.Line2D at 0x7fc564c01630>]

@kif
Copy link
Member Author

kif commented Nov 25, 2020

profile

@vallsv
Copy link
Contributor

vallsv commented Nov 25, 2020

This makes me think what about an option to return nan instead of 0 when there is a mask.
The rendering of the profile could be more understandable.

@kif
Copy link
Member Author

kif commented Nov 26, 2020

This sounds like a good idea. I did not even notice.
if cnt is null, set the value to NAN.

@kif kif added this to the 0.15 milestone Dec 9, 2020
silx/image/bilinear.pyx Outdated Show resolved Hide resolved
silx/image/bilinear.pyx Outdated Show resolved Hide resolved
@t20100 t20100 merged commit bbdb78a into silx-kit:master Dec 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants