-
Notifications
You must be signed in to change notification settings - Fork 74
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
Issue #3942 - silx compare typo #3943
Conversation
Fix python set(3,4) command with set([3,4]).
@@ -138,7 +138,7 @@ def readData(self, urlPath: str): | |||
|
|||
if data.ndim == 2: | |||
return data | |||
if data.ndim == 3 and data.shape[0] in set(3, 4): | |||
if data.ndim == 3 and data.shape[0] in set([3, 4]): |
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.
Also, I guess this is to support RGB(A) images, and so checking the number of channels which is usually the last dimension:
if data.ndim == 3 and data.shape[0] in set([3, 4]): | |
if data.ndim == 3 and data.shape[2] in {3, 4}: |
attn @vallsv
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.
My use case was rather about comparing 2 (gray level) 3D volumes, possibly each of them with only one slice. Slice being the first index.
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.
OK, I don't think this is supported: It is meant to support comparing 2 images..
Otherwise the limit to 3 or 4 slices makes no sense, while it does for RGB(A).
What could be added for stack with only one slice could be:
if data.ndim == 3 and data.shape[0] == 1:
return data[0]
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.
What's loaded here is then passed to:
silx/src/silx/gui/plot/CompareImages.py
Lines 473 to 482 in e912d5e
def setImage1(self, image1, updateColormap="deprecated"): | |
"""Set image1 to be compared. | |
Images can contains floating-point or integer values, or RGB and RGBA | |
values, but should have comparable intensities. | |
RGB and RGBA images are provided as an array as `[width,height,channels]` | |
of unsigned integer 8-bits or floating-points between 0.0 to 1.0. | |
:param numpy.ndarray image1: The first image |
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.
OK. I probably need to be more precise on the issue. The error happened when with
silx compare "bambou_hercules_0001_rec_2040.800_00000.hdf5?path=/entry0000/reconstruction/results/data" "bambou_hercules_0001_rec_2058.800_00000.hdf5?path=/entry0000/reconstruction/results/data"
, i.e. with no slice number. But when the command
silx compare "bambou_hercules_0001_rec_2040.800_00000.hdf5?path=/entry0000/reconstruction/results/data&slice=0" "bambou_hercules_0001_rec_2058.800_00000.hdf5?path=/entry0000/reconstruction/results/data&slice=0"
is used (i.e. with slice number), then it works fine. That's why I thought stacks were possible....
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.
Yes, to support slicing with a slider for example, you better to create another dedicated issue.
I don't think we will have time to do it now.
Optionally you could try to see if slice=*
works, but i am pretty sure it is not supported.
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.
@t20100 i agree there is something weird with the shape index which is supposed to be ordered y,x,rgb[a]
. Ill check on my side.
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.
BTW, this shape[0]
is maybe the layout provided by fabio or another lib when we load a RGB image. I have to check.
I merge this PR for convenience. |
Fix python
set(3,4)
command withset([3,4])
.