Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
D
DITB
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Issue analytics
Insights
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
DISCO Beamline
DITB
Commits
fe69da08
Commit
fe69da08
authored
6 months ago
by
Hugo chauvet
Browse files
Options
Downloads
Patches
Plain Diff
WTF, when their is a visible channel in the White, try to add that option
parent
91891f60
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
ditb/exposure/darkwhite_correction.py
+21
-9
21 additions, 9 deletions
ditb/exposure/darkwhite_correction.py
pyproject.toml
+1
-1
1 addition, 1 deletion
pyproject.toml
with
22 additions
and
10 deletions
ditb/exposure/darkwhite_correction.py
+
21
−
9
View file @
fe69da08
...
@@ -72,7 +72,7 @@ def correct_dark_white(images: str, dark: str = '', white: str = '' ,
...
@@ -72,7 +72,7 @@ def correct_dark_white(images: str, dark: str = '', white: str = '' ,
white
=
mmzarr_read
(
str
(
whitein
))
white
=
mmzarr_read
(
str
(
whitein
))
meta_white
=
read_mmzarr_metadata
(
str
(
whitein
))
meta_white
=
read_mmzarr_metadata
(
str
(
whitein
))
dofwhite
=
mmzarr_read
(
str
(
darkofwhitein
))
dofwhite
=
mmzarr_read
(
str
(
darkofwhitein
))
white_ch_names
=
get_channel_names
(
meta_white
)
images
=
mmzarr_read
(
str
(
imagesin
))
images
=
mmzarr_read
(
str
(
imagesin
))
meta
=
read_mmzarr_metadata
(
str
(
imagesin
))
meta
=
read_mmzarr_metadata
(
str
(
imagesin
))
...
@@ -286,8 +286,16 @@ def correct_dark_white(images: str, dark: str = '', white: str = '' ,
...
@@ -286,8 +286,16 @@ def correct_dark_white(images: str, dark: str = '', white: str = '' ,
if
version
==
2
:
if
version
==
2
:
print
(
'
Two steps normalisation: Spectral power from the mean, then spatial variation of the white
'
)
print
(
'
Two steps normalisation: Spectral power from the mean, then spatial variation of the white
'
)
assert
original_white
is
not
None
,
"
Please provide a non-smoothed white
"
assert
original_white
is
not
None
,
"
Please provide a non-smoothed white
"
# Estimation of the power
# Estimation of the power
owhite
=
mmzarr_read
(
str
(
original_white
))[
0
,
0
,
:,
zpos
].
map_blocks
(
img_as_float
)
owhite
=
mmzarr_read
(
str
(
original_white
))[
0
,
0
,
:,
zpos
].
map_blocks
(
img_as_float
)
# Fin the position of the white
i_viswhite
=
[
i
for
i
,
wchname
in
enumerate
(
white_ch_names
)
if
'
vis
'
in
wchname
]
if
len
(
i_viswhite
)
>
0
:
print
(
"
Their is a visible channel in white, I remove it !
"
)
owhite
=
dask
.
array
.
delete
(
owhite
,
i_viswhite
[
0
])
whiteMean
=
owhite
.
mean
(
axis
=
(
-
2
,
-
1
))
whiteMean
=
owhite
.
mean
(
axis
=
(
-
2
,
-
1
))
powerEstimation
=
whiteMean
/
whiteMean
.
max
()
powerEstimation
=
whiteMean
/
whiteMean
.
max
()
powerEstimation
=
powerEstimation
.
compute
()
powerEstimation
=
powerEstimation
.
compute
()
...
@@ -359,7 +367,11 @@ def correct_dark_white(images: str, dark: str = '', white: str = '' ,
...
@@ -359,7 +367,11 @@ def correct_dark_white(images: str, dark: str = '', white: str = '' ,
diff_im_darks
[
diff_im_darks
<
0
]
=
0
diff_im_darks
[
diff_im_darks
<
0
]
=
0
if
version
==
2
:
if
version
==
2
:
# Need to find the visible to put it's power to one
powerEallfilter
=
np
.
copy
(
powerEstimation
)
# Check if the white has the same number of filter that the images
if
diff_im_darks
.
shape
[
2
]
!=
len
(
powerEstimation
):
# If not Need to find the visible to put it's power to one
i_vis
=
0
i_vis
=
0
for
chan
in
range
(
diff_im_darks
.
shape
[
2
]):
for
chan
in
range
(
diff_im_darks
.
shape
[
2
]):
if
'
vis
'
in
img_ch_names
[
chan
].
lower
():
if
'
vis
'
in
img_ch_names
[
chan
].
lower
():
...
...
This diff is collapsed.
Click to expand it.
pyproject.toml
+
1
−
1
View file @
fe69da08
...
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
...
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
[project]
[project]
name
=
"DITB"
name
=
"DITB"
version
=
"20250115rc
3
"
version
=
"20250115rc
4
"
readme
=
"README.md"
readme
=
"README.md"
requires-python
=
">
=
3.11
"
requires-python
=
">
=
3.11
"
authors
=
[
{
name
=
"Hugo Chauvet"
,
email
=
"hugo.chauvet@synchrotron-soleil.fr"
}
]
authors
=
[
{
name
=
"Hugo Chauvet"
,
email
=
"hugo.chauvet@synchrotron-soleil.fr"
}
]
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment