-
Notifications
You must be signed in to change notification settings - Fork 73
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
silx view: Added --slices
option
#3860
Changes from all commits
f2d16c3
fe1f491
4f0074c
41fa96c
bec1c64
c5d8f6b
14997f8
91a1991
2e3560b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,6 +38,7 @@ | |
from .Hdf5LoadingItem import Hdf5LoadingItem | ||
from . import _utils | ||
from ... import io as silx_io | ||
from ...io._sliceh5 import DatasetSlice | ||
|
||
import h5py | ||
|
||
|
@@ -61,6 +62,8 @@ def _createRootLabel(h5obj): | |
if path.startswith("/"): | ||
path = path[1:] | ||
label = "%s::%s" % (filename, path) | ||
if isinstance(h5obj, DatasetSlice): | ||
label += str(list(h5obj.indices)) | ||
Comment on lines
+65
to
+66
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not a fan of having specific code for |
||
return label | ||
|
||
|
||
|
@@ -573,9 +576,12 @@ def __areH5pyObjectEqual(obj1, obj2): | |
if not isinstance(obj2, type(obj1)): | ||
return False | ||
def key(item): | ||
if item.file is None: | ||
return item.name | ||
return item.file.filename, item.file.mode, item.name | ||
info = [item.name] | ||
if item.file is not None: | ||
info += [item.file.filename, item.file.mode] | ||
if isinstance(item, DatasetSlice): | ||
info.append(item.indices) | ||
Comment on lines
+582
to
+583
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same, it'd be best to avoid specific code here. |
||
return tuple(info) | ||
return key(obj1) == key(obj2) | ||
|
||
def h5pyObjectRow(self, h5pyObject): | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be better to use a real slice here
instead of
As we already have the parser from the DataUrl, it's costless, and it will support stuffs like
1::2,:10,...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
--slice 1 2 3
opens not just one slice (data[1,2,3]
) as a dataset but 3 slices as 3 different datasets:data[1]
,data[2]
,data[3]
.Maybe best to call it
--slices
.I haven't done it, but we could also support
--slice 1::4,:10,...,1 3:5,:,1
if needed.... but the current main need is to open slices in a 3D stack.