Commit cf1aee29 authored by payno's avatar payno
Browse files

[image from file] If no information and is a .hdf5 file try to investigate,...

[image from file] If no information and is a .hdf5 file try to investigate, this is probably a file from nabu
parent 1bc74dc2
......@@ -32,6 +32,7 @@ __date__ = "06/08/2018"
import functools
import logging
import os
import h5py
from silx.gui import qt
from import DataUrl
......@@ -64,18 +65,31 @@ class ImageFromFile(_Image):
self.url = url
assert isinstance(_file, str)
data_path = None
if _file.lower().endswith('.edf'):
scheme = 'fabio'
elif _file.lower().endswith(('.npy', '.npz')):
scheme = 'numpy'
def get_nabu_entry():
with h5py.File(_file, mode='r') as h5s:
for node in h5s:
if 'reconstruction' in h5s[node]:
return '/'.join((node, 'reconstruction', 'results', 'data'))
except Exception as e:
data_path = get_nabu_entry() or None
scheme = 'silx'
if index is not None:
data_slice = (index,)
data_slice = None
self.url = DataUrl(file_path=_file, data_slice=data_slice,
scheme=scheme, data_path=data_path)
self._status = 'not loaded' if data is None else 'loaded'
self.url_path = self.url.path()
if _load is True:
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