Skip to content
GitLab
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
e66e295c
Commit
e66e295c
authored
Mar 09, 2020
by
payno
Browse files
[tomohdf5tonx] add `x_magnified_pixel_size` and `y_magnified_pixel_size` properties
parent
e9995eed
Pipeline
#22620
failed with stages
in 2 minutes and 20 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
tomoscan/esrf/hdf5scan.py
View file @
e66e295c
...
...
@@ -91,6 +91,10 @@ class HDF5TomoScan(TomoScanBase):
_Y_PIXEL_SIZE_PATH
=
'instrument/detector/y_pixel_size'
_X_PIXEL_MAG_SIZE_PATH
=
'instrument/detector/x_magnified_pixel_size'
_Y_PIXEL_MAG_SIZE_PATH
=
'instrument/detector/y_magnified_pixel_size'
_DISTANCE_PATH
=
'instrument/detector/distance'
_ENERGY_PATH
=
'beam/incident_energy'
...
...
@@ -186,6 +190,8 @@ class HDF5TomoScan(TomoScanBase):
self
.
_dim_1
,
self
.
_dim_2
=
None
,
None
self
.
_x_pixel_size
=
None
self
.
_y_pixel_size
=
None
self
.
_x_magnified_pixel_size
=
None
self
.
_y_magnified_pixel_size
=
None
self
.
_rotation_angles
=
None
self
.
_distance
=
None
self
.
_image_keys_control
=
None
...
...
@@ -485,6 +491,14 @@ class HDF5TomoScan(TomoScanBase):
_y_pixel_size
=
self
.
_get_value
(
y_pixel_dataset
,
default_unit
=
'micrometer'
)
return
_x_pixel_size
,
_y_pixel_size
def
_get_x_y_magnified_pixel_values
(
self
):
with
h5py
.
File
(
self
.
master_file
,
'r'
)
as
h5_file
:
x_m_pixel_dataset
=
h5_file
[
self
.
_entry
][
self
.
_X_PIXEL_MAG_SIZE_PATH
]
_x_m_pixel_size
=
self
.
_get_value
(
x_m_pixel_dataset
,
default_unit
=
'micrometer'
)
y_m_pixel_dataset
=
h5_file
[
self
.
_entry
][
self
.
_Y_PIXEL_MAG_SIZE_PATH
]
_y_m_pixel_size
=
self
.
_get_value
(
y_m_pixel_dataset
,
default_unit
=
'micrometer'
)
return
_x_m_pixel_size
,
_y_m_pixel_size
def
_get_dim1_dim2
(
self
):
if
self
.
master_file
and
os
.
path
.
exists
(
self
.
master_file
):
if
self
.
projections
is
not
None
:
...
...
@@ -498,6 +512,20 @@ class HDF5TomoScan(TomoScanBase):
self
.
_x_pixel_size
,
self
.
_y_pixel_size
=
self
.
_get_x_y_pixel_values
()
return
self
.
_y_pixel_size
@
property
def
x_magnified_pixel_size
(
self
)
->
typing
.
Union
[
None
,
float
]:
if
(
self
.
_x_magnified_pixel_size
is
None
and
self
.
master_file
and
os
.
path
.
exists
(
self
.
master_file
)):
self
.
_x_magnified_pixel_size
,
self
.
_y_magnified_pixel_size
=
self
.
_get_x_y_magnified_pixel_values
()
return
self
.
_x_magnified_pixel_size
@
property
def
y_magnified_pixel_size
(
self
)
->
typing
.
Union
[
None
,
float
]:
if
(
self
.
_y_magnified_pixel_size
is
None
and
self
.
master_file
and
os
.
path
.
exists
(
self
.
master_file
)):
self
.
_x_magnified_pixel_size
,
self
.
_y_magnified_pixel_size
=
self
.
_get_x_y_magnified_pixel_values
()
return
self
.
_y_magnified_pixel_size
@
property
def
distance
(
self
)
->
typing
.
Union
[
None
,
float
]:
if
(
self
.
_distance
is
None
and
self
.
master_file
and
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment