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
tomoscan
Commits
e70955e3
Commit
e70955e3
authored
Jul 29, 2020
by
payno
Browse files
Merge branch 'add_field_of_view' into '0.3'
add management of field of view See merge request
!18
parents
492285e8
323982d1
Pipeline
#30601
passed with stages
in 2 minutes and 5 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
tomoscan/esrf/edfscan.py
View file @
e70955e3
...
...
@@ -428,6 +428,15 @@ class EDFTomoScan(TomoScanBase):
else
:
return
self
.
__distance
*
MetricSystem
.
MILLIMETER
.
value
@
property
def
field_of_view
(
self
):
"""
:return: field of view of the scan. None if unknow else Full or Half
"""
# not managed for EDF files
return
None
@
property
@
docstring
(
TomoScanBase
.
energy
)
def
energy
(
self
):
...
...
tomoscan/esrf/hdf5scan.py
View file @
e70955e3
...
...
@@ -30,7 +30,7 @@ __license__ = "MIT"
__date__
=
"09/08/2018"
from
..scanbase
import
TomoScanBase
from
..scanbase
import
TomoScanBase
,
_FOV
import
json
import
io
import
os
...
...
@@ -100,6 +100,8 @@ class HDF5TomoScan(TomoScanBase):
_DISTANCE_PATH
=
'instrument/detector/distance'
_FOV_PATH
=
'instrument/detector/field_of_view'
_ENERGY_PATH
=
'beam/incident_energy'
_SCHEME
=
'silx'
...
...
@@ -169,6 +171,7 @@ class HDF5TomoScan(TomoScanBase):
self
.
_image_keys_control
=
None
self
.
_rotation_angles
=
None
self
.
_distance
=
None
self
.
_fov
=
None
self
.
_energy
=
None
@
staticmethod
...
...
@@ -204,6 +207,7 @@ class HDF5TomoScan(TomoScanBase):
self
.
_y_magnified_pixel_size
=
None
self
.
_rotation_angles
=
None
self
.
_distance
=
None
self
.
_fov
=
None
self
.
_image_keys_control
=
None
@
staticmethod
...
...
@@ -511,6 +515,14 @@ class HDF5TomoScan(TomoScanBase):
_y_m_pixel_size
=
self
.
_get_value
(
y_m_pixel_dataset
,
default_unit
=
'meter'
)
return
_x_m_pixel_size
,
_y_m_pixel_size
def
_get_fov
(
self
):
with
h5py
.
File
(
self
.
master_file
,
'r'
,
swmr
=
True
,
libver
=
'latest'
)
as
h5_file
:
if
self
.
_FOV_PATH
in
h5_file
[
self
.
_entry
]:
fov
=
h5_file
[
self
.
_entry
][
self
.
_FOV_PATH
][()]
return
_FOV
.
from_value
(
fov
)
else
:
return
None
def
_get_dim1_dim2
(
self
):
if
self
.
master_file
and
os
.
path
.
exists
(
self
.
master_file
):
if
self
.
projections
is
not
None
:
...
...
@@ -552,6 +564,16 @@ class HDF5TomoScan(TomoScanBase):
self
.
_distance
=
self
.
_get_value
(
distance_dataset
,
default_unit
=
'm'
)
return
self
.
_distance
@
property
def
field_of_view
(
self
):
"""
:return: field of view of the scan. None if unknow else Full or Half
"""
if
(
self
.
_fov
is
None
and
self
.
master_file
and
os
.
path
.
exists
(
self
.
master_file
)):
self
.
_fov
=
self
.
_get_fov
()
return
self
.
_fov
@
property
def
energy
(
self
)
->
typing
.
Union
[
None
,
float
]:
"""energy in keV"""
...
...
tomoscan/scanbase.py
View file @
e70955e3
...
...
@@ -33,10 +33,17 @@ import logging
from
typing
import
Union
from
collections
import
OrderedDict
from
.unitsystem.metricsystem
import
MetricSystem
from
silx.utils.enum
import
Enum
as
_Enum
logger
=
logging
.
getLogger
(
__name__
)
class
_FOV
(
_Enum
):
"""Possible existing field of view"""
FULL
=
'Full'
HALF
=
'Half'
class
TomoScanBase
:
"""
Base Class representing a scan.
...
...
@@ -189,6 +196,14 @@ class TomoScanBase:
"""
raise
NotImplementedError
(
'Base class'
)
@
property
def
field_of_view
(
self
):
"""
:return: field of view of the scan. None if unknow else Full or Half
"""
raise
NotImplementedError
(
'Base class'
)
def
get_distance
(
self
,
unit
=
'm'
)
->
Union
[
None
,
float
]:
"""
...
...
tomoscan/version.py
View file @
e70955e3
...
...
@@ -68,7 +68,7 @@ RELEASE_LEVEL_VALUE = {"dev": 0,
MAJOR
=
0
MINOR
=
3
MICRO
=
0
MICRO
=
1
RELEV
=
"final"
# <16
SERIAL
=
0
# <16
...
...
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