speed up io
Now we can use the 'concatenated' url in order to load a group of frame instead of one by one.
But this should be extend a bit like for the flat field correction and probably other thing.
For example in tomwer to compute a roi on projections we have to do something like this to load frames by group and avoid performances issue:
current_idx = 0
url_idxs = {v.path(): k for k, v in scan.projections.items()}
for proj_index in proj_indexes:
url = proj_compacted[proj_index]
if url_has_been_treated(url):
continue
append_url(url)
data = silx.io.get_data(url)
def retrieve_data_proj_indexes(url_):
urls = []
for slice in range(
url_.data_slice().start,
url_.data_slice().stop,
url_.data_slice().step or 1,
):
urls.append(
DataUrl(
file_path=url_.file_path(),
data_path=url_.data_path(),
scheme=url_.scheme(),
data_slice=slice,
)
)
# try to retrieve the index from the projections else
# keep the slice index as the frame index (should be the
# case in most case
res = []
for my_url in urls:
my_url_path = my_url.path()
if my_url_path in url_idxs:
res.append(url_idxs[my_url_path])
else:
_logger.warning(
"unable to retrieve frame index from url {}. "
"Take the slice index as frame index".format(
my_url_path
)
)
return res
data_indexes = retrieve_data_proj_indexes(url)