Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
tomotools
Nabu
Commits
530807b9
Commit
530807b9
authored
May 02, 2022
by
Pierre Paleo
Browse files
Handle NaN in FlatField class
parent
56adb16a
Changes
1
Hide whitespace changes
Inline
Side-by-side
nabu/preproc/flatfield.py
View file @
530807b9
...
...
@@ -190,6 +190,12 @@ class FlatFieldArrays:
self
.
_dark
=
dark
return
self
.
_dark
def
remove_invalid_values
(
self
,
img
):
if
self
.
nan_value
is
None
:
return
invalid_mask
=
np
.
logical_not
(
np
.
isfinite
(
img
))
img
[
invalid_mask
]
=
self
.
nan_value
def
normalize_radios
(
self
,
radios
):
"""
Apply a flat-field normalization, with the current parameters, to a stack
...
...
@@ -211,6 +217,7 @@ class FlatFieldArrays:
if
do_flats_distortion_correction
:
flat
=
self
.
distortion_correction
.
estimate_and_correct
(
flat
,
radio_data
)
radios
[
i
]
=
radio_data
/
flat
self
.
remove_invalid_values
(
radios
[
i
])
return
radios
...
...
@@ -225,6 +232,7 @@ class FlatFieldArrays:
if
self
.
distortion_correction
is
not
None
:
flat
=
self
.
distortion_correction
.
estimate_and_correct
(
flat
,
radio
)
radio
/=
flat
self
.
remove_invalid_values
(
radio
)
return
radio
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment