-
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
Conversation
if isinstance(h5obj, DatasetSlice): | ||
label += str(list(h5obj.indices)) |
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'm not a fan of having specific code for DatasetSlice
here, but I couldn't find a better way, except maybe adding this in the silx.io.commonh5
API...
if isinstance(item, DatasetSlice): | ||
info.append(item.indices) |
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.
Same, it'd be best to avoid specific code here.
I wanted to rework the way to check equality, but that's complex changes
CI fails a lot on Windows with python3.7 and pyside6, with exceptions like:
|
type=int, | ||
nargs='+', | ||
help='List of slice indices to open (Only for dataset)', | ||
) |
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
--slice 1,2,3
instead of
--slice 1 2 3
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.
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.
work smoothly on my datasets
80690f7
to
b3f1b69
Compare
--slice
option--slices
option
33cc2cd
to
823b573
Compare
Finally ready for review/merge |
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.
still fine with me.
Maybe we could add an example on how to use it on the PR and on the text documentation (view.rst/ Examples of usage
) as well like:
# open specific dataset
silx view 5.06_crayon_W150_60_Al2_W0.25_xc1000_.nx::entry/instrument/detector/data
# open specific set of dataset from name / location
silx view 5.06_crayon_W150_60_Al2_W0.25_xc1000_.nx::entry/*/data
# open specific set of datasets slices (first and last on this example)
silx view 5.06_crayon_W150_60_Al2_W0.25_xc1000_.nx::entry/*/data --slices 0 -1
commonh5.Dataset
823b573
to
2e3560b
Compare
I added your examples (reworked a bit) to the doc, including
I also fixed an (unrelated) issue with building the doc |
This PR adds the option to pass multiple integers for displaying slices with
silx view
through a--slice
option.To do so, it adds a
DatasetSlice
class to expose the opened slice as a dataset and makes the necessary changes to make it work.The content of this PR is adapted from PR #3677 (which was hard to rebase).
It is a simpler version of PR #3677 since it only provides
--slice
and not URL#fragment
support which could be added later if needed.