Commit 52f09cb1 authored by Pierre Paleo's avatar Pierre Paleo
Browse files

[hdf5tomoscan] convert to static method for re-usability

parent 6054c45f
Pipeline #22679 passed with stages
in 2 minutes
......@@ -615,13 +615,19 @@ class HDF5TomoScan(TomoScanBase):
return None
def _get_compacted_projections(self):
def _get_compacted_projections(projections):
Regroup urls to get the data more efficiently.
Build a structure mapping projections indices to information on
how to load the data: `{indices_set: data_location}`
where `data_location` contains contiguous indices.
projections: dict
Dictionary where the key is an integer and the value is a silx `DataUrl`.
merged_projections: dict
......@@ -645,9 +651,9 @@ class HDF5TomoScan(TomoScanBase):
def merge_slices(slice1, slice2):
return slice(slice1.start, slice2.stop)
sorted_files_indices = sorted(self.projections.keys())
sorted_files_indices = sorted(projections.keys())
idx0 = sorted_files_indices[0]
first_url = self.projections[idx0]
first_url = projections[idx0]
merged_indices = [
......@@ -662,7 +668,7 @@ class HDF5TomoScan(TomoScanBase):
pos = 0
curr_fp, curr_dp, curr_slice = data_location[pos]
for idx in sorted_files_indices[1:]:
url = self.projections[idx]
url = projections[idx]
next_slice = _convert_to_slice(url.data_slice())
if (url.file_path() == curr_fp) and (url.data_path() == curr_dp) and is_contiguous_slice(curr_slice, next_slice):
......@@ -695,7 +701,7 @@ class HDF5TomoScan(TomoScanBase):
is the corresponding `` with merged data_slice
if self._projections_compacted is None:
self._projections_compacted = self._get_compacted_projections()
self._projections_compacted = self._get_compacted_projections(self.projections)
return self._projections_compacted
def __str__(self):
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment