Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
tomwer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Olof Svensson
tomwer
Commits
2c42df9b
Commit
2c42df9b
authored
5 years ago
by
payno
Browse files
Options
Downloads
Patches
Plain Diff
[scan] add function getDefaultRadiosForAxisCalc to deduce radios to be used for axis calculation
parent
02f43201
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
tomwer/core/scan/edfscan.py
+25
-0
25 additions, 0 deletions
tomwer/core/scan/edfscan.py
tomwer/core/scan/scanbase.py
+7
-0
7 additions, 0 deletions
tomwer/core/scan/scanbase.py
tomwer/gui/ftserie/axis/axis.py
+3
-9
3 additions, 9 deletions
tomwer/gui/ftserie/axis/axis.py
with
35 additions
and
9 deletions
tomwer/core/scan/edfscan.py
+
25
−
0
View file @
2c42df9b
...
...
@@ -44,6 +44,8 @@ from tomwer.core.process.reconstruction.darkref.settings import REFHST_PREFIX, \
from
tomwer.core.utils
import
getScanRange
from
tomwer.core.utils
import
getTomo_N
from
tomwer.core.utils.ftseriesutils
import
orderFileByLastLastModification
from
silx.io.url
import
DataUrl
from
silx.io
import
utils
as
silx_io_utils
from
.scanbase
import
TomoBase
_logger
=
TomwerLogger
(
__name__
)
...
...
@@ -511,3 +513,26 @@ class EDFTomoScan(TomoBase):
return
self
load_from_dict
.
__doc__
=
TomoBase
.
load_from_dict
.
__doc__
def
getDefaultRadiosForAxisCalc
(
self
):
"""
Try to find a couple of `opposite` radios that can be used for axis
calculation.
:return: tuple (radio0, radio1), radios of angles (0, 180) if found,
else (90, 270), else (None, None)
:rtype: tuple
"""
radios_with_angle
=
self
.
getSampleEvolScan
()
for
couple
in
((
'
0
'
,
'
180
'
),
(
'
90
'
,
'
270
'
)):
if
couple
[
0
]
in
radios_with_angle
and
couple
[
1
]
in
radios_with_angle
:
def
load_data_and_ff_cor
(
file_path
):
url_radio
=
DataUrl
(
file_path
=
file_path
,
scheme
=
'
fabio
'
)
radio
=
silx_io_utils
.
get_data
(
url_radio
)
return
self
.
flatFieldCorrection
(
radio
)
radio_0
=
load_data_and_ff_cor
(
file_path
=
radios_with_angle
[
couple
[
0
]])
radio_1
=
load_data_and_ff_cor
(
file_path
=
radios_with_angle
[
couple
[
1
]])
return
radio_0
,
radio_1
return
None
,
None
This diff is collapsed.
Click to expand it.
tomwer/core/scan/scanbase.py
+
7
−
0
View file @
2c42df9b
...
...
@@ -151,6 +151,13 @@ class TomoBase(ScanBase):
def
getReconstructedFilesFromParFile
(
self
,
with_index
):
raise
NotImplementedError
(
'
Base class
'
)
def
getDefaultRadiosForAxisCalc
(
self
):
"""
Try to find two well adapted radios for Axis calculation
:return: tuple(numpy.array, numpy.array)
"""
raise
NotImplementedError
(
'
Base class
'
)
def
getFlat
(
self
,
index
):
"""
Return the flat file of given index
"""
raise
NotImplementedError
(
'
Base class
'
)
...
...
This diff is collapsed.
Click to expand it.
tomwer/gui/ftserie/axis/axis.py
+
3
−
9
View file @
2c42df9b
...
...
@@ -190,15 +190,9 @@ class AxisWindow(qt.QMainWindow):
'
file/dir path or an instance of ScanBase
'
%
(
scan
,
type
(
scan
)))
assert
isinstance
(
_scan
,
ScanBase
)
# TODO: get evolution and select two from there to be displayed.
radios_with_angle
=
_scan
.
getSampleEvolScan
()
if
'
0
'
in
radios_with_angle
and
'
180
'
in
radios_with_angle
:
def
load_data_and_ff_cor
(
file_path
):
url_radio
=
DataUrl
(
file_path
=
file_path
,
scheme
=
'
fabio
'
)
radio
=
silx_io_utils
.
get_data
(
url_radio
)
return
_scan
.
flatFieldCorrection
(
radio
)
radio_0
=
load_data_and_ff_cor
(
file_path
=
radios_with_angle
[
'
0
'
])
radio_180
=
load_data_and_ff_cor
(
file_path
=
radios_with_angle
[
'
180
'
])
self
.
setImages
(
imgA
=
radio_0
,
imgB
=
radio_180
)
radio_a
,
radio_b
=
_scan
.
getDefaultRadiosForAxisCalc
()
if
radio_a
and
radio_b
:
self
.
setImages
(
imgA
=
radio_a
,
imgB
=
radio_b
)
else
:
_logger
.
error
(
'
fail to find radios for angle 0 and 180. Unable to
'
'
update axis gui
'
)
...
...
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