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
tomwer
Commits
59d53b1b
Commit
59d53b1b
authored
Apr 05, 2022
by
payno
Committed by
Henri Payno
May 03, 2022
Browse files
normalization: fix providing a scalar value
parent
80b55ad0
Changes
3
Hide whitespace changes
Inline
Side-by-side
orangecontrib/tomwer/widgets/reconstruction/NormIOW.py
View file @
59d53b1b
...
...
@@ -233,8 +233,10 @@ class NormIOW(WidgetLongProcessing, SuperviseOW):
},
process_index
=
scan
.
pop_process_index
(),
)
if
tomwer_processing_res_code
is
True
:
# if defined by manual scalar we need to set the value
if
extra_infos
.
get
(
"source"
,
None
)
==
_ValueSource
.
MANUAL_SCALAR
.
value
:
extra_infos
[
"value"
]
=
self
.
getCurrentlyDefinedValues
()
self
.
notify_succeed
(
scan
=
scan
)
elif
tomwer_processing_res_code
is
False
:
self
.
notify_failed
(
scan
=
scan
)
...
...
@@ -255,9 +257,11 @@ class NormIOW(WidgetLongProcessing, SuperviseOW):
"dataset_url"
:
self
.
_window
.
_optsWidget
.
_datasetWidget
.
getDatasetUrl
().
path
(),
}
else
:
extra_infos
=
{
"value"
:
self
.
getCurrentlyDefinedValues
()}
extra_infos
=
{
"value"
:
self
.
getCurrentlyDefinedValues
(),
"source"
:
self
.
getCurrentSource
(),
}
self
.
notify_succeed
(
scan
=
scan
)
# clear flag
scan
.
intensity_normalization
.
set_extra_infos
(
extra_infos
)
...
...
tomwer/core/process/reconstruction/nabu/nabucommon.py
View file @
59d53b1b
...
...
@@ -579,10 +579,12 @@ class _NabuBaseReconstructor:
def
dump_normalization_array_for_nabu
(
scan
:
TomwerScanBase
,
output_file
:
str
,
array
:
numpy
.
ndarray
scan
:
TomwerScanBase
,
output_file
:
str
,
array
:
Union
[
numpy
.
ndarray
,
float
,
int
]
)
->
DataUrl
:
if
not
isinstance
(
array
,
numpy
.
ndarray
):
raise
TypeError
(
f
"array is expected to be a numpy array and not
{
type
(
array
)
}
"
)
if
not
isinstance
(
array
,
(
numpy
.
ndarray
,
float
,
int
)):
raise
TypeError
(
f
"array is expected to be a numpy array or a scalar and not
{
type
(
array
)
}
"
)
# save the value to a dedicated path in "nabu_tomwer_serving_hatch"
if
isinstance
(
scan
,
HDF5TomoScan
):
entry_path
=
scan
.
entry
...
...
@@ -596,11 +598,18 @@ def dump_normalization_array_for_nabu(
while
serving_hatch_data_path
is
None
or
serving_hatch_data_path
in
h5f
:
serving_hatch_data_path
=
"/"
.
join
([
entry_path
,
str
(
uuid
.
uuid1
())])
# adapt value to what nabues expects.
if
(
isinstance
(
array
,
numpy
.
ndarray
)
and
array
.
ndim
==
1
)
or
isinstance
(
array
,
(
tuple
,
list
)
if
isinstance
(
array
,
(
float
,
int
))
or
(
isinstance
(
array
,
numpy
.
ndarray
)
and
array
.
ndim
==
1
and
len
(
array
)
==
1
):
dim_1
=
scan
.
dim_1
array
=
numpy
.
asarray
(
numpy
.
asarray
([
array
]
*
len
(
scan
.
projections
)
*
dim_1
)
)
array
=
array
.
reshape
(
len
(
scan
.
projections
),
dim_1
)
elif
isinstance
(
array
,
numpy
.
ndarray
)
and
array
.
ndim
==
1
:
dim_1
=
scan
.
dim_1
array
=
numpy
.
repeat
(
array
,
dim_1
).
reshape
(
len
(
array
),
dim_1
)
h5f
[
serving_hatch_data_path
]
=
array
file_path
=
os
.
path
.
join
(
settings
.
NABU_CFG_FILE_FOLDER
,
settings
.
NABU_TOMWER_SERVING_HATCH
...
...
tomwer/gui/reconstruction/normalization/intensity.py
View file @
59d53b1b
...
...
@@ -151,6 +151,7 @@ class NormIntensityWindow(qt.QMainWindow):
extra_info
.
update
(
{
"tomwer_processing_res_code"
:
True
,
"source"
:
source
.
value
,
}
)
scan
.
intensity_normalization
.
set_extra_infos
(
extra_info
)
...
...
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