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
External images plugin #58
Conversation
Only interactive mask drawing operations should cause a signal to be emitted. RGBWidget needs images as a 2D data array, not RGB.
I think lines 194, 196 and 197 of SilxExternalImagesPlugin.py need to be changed. |
196, 197 fixed. 194 seems to work, but i can replace |
Default McaIndex is -1, not 0
Undetected because test example was a square image
I plan to do ROIStackPlugin in the same PR. I believe there is not much left to do, I can reuse SilxExternalImageWindow and just add the filter and background features. |
bf7a856
to
7ef6955
Compare
7ef6955
to
e3ab4b6
Compare
Please, profit to use Roi instead of ROI in new classes and file names in order to be consistent with the CamelCase conventions. |
…n the main window (mask is reset to (0, 0) when image is changed in silx plot) Set title for ExternalImageWindow
…caGui/pymca/SilxExternalImagesWindow.py and SilxStackRoiWindow.py
- background - median
Slider is Hidden by default in base MaskImageWidget, but shown in ExternalImagesWindow
Most discussed features are implemented. The widgets still lack Y axis orientation synchronization with the existing PyMca widgets, and I haven't started working on the scatters. Regarding handling scatter data, in my proof of concepts I did a month ago, I chose to make two separate widgets for image data and scatter data. This made it a bit easier to set up the mask widgets, without needing to have two mask widgets and two sets of setters and getters for the mask in a single widget. On the other hand, juggling between two separate mutually exclusive widgets in a GUI is also challenging. So I'm not sure which way to go. I would recommend dealing with this question in a separate pull request, as the current PR does not affect the existing PyMca widgets while the scatter mask will probably require to have silx both in the main GUI and in the plugins. |
Since the underlying application does not support scatter yet, then just implement the functionality for images. If everything goes well, we'll be able to switch to using silx in the main GUI and in the plugins since the Silx Alternate ROI Window should be able to replace the widgets used in main window GUI. Just do not forget to remove the [WIP] flag when you feel ready. |
I just found: it did not take the origin into account and there was an unnecessary rounding of the image limits (expressed in plot coordinates). So basically the crop only worked when the origin was 0 and scale 1 (image size in pixels equal to the stack size). Now it should work. |
Looks good. Can you add the copy-to-clipboard action too? |
Done. |
Bug in the Silx Alternate ROI Window. To reproduce:
|
I have a feeling that it is related to something else that I'm working on with Thomas: silx-kit/silx#836 The funny thing is that if the mask is drawn on the PyMca side and as long as the mask widget is not opened in the silx widget, there is no bug. |
The bug is fixed. It was caused by removing the image before changing it, when the slider is moved. This caused the mask to be deleted in the silx widget. |
There is still a problem. When moving the slider in the Silx Alternative ROI, the existing mask, if any, is lost. |
I don't see this issue. But I noticed that the mask stays is not drawn in my widget until the mask icon is clicked for the first time. |
The problem happens if the ROI widget associated to the Silx window has not been shown. It seems a problem with some silx optimization at some point. As a workaround, for the time being you can systematically show it docked. |
I have a simple workaround for the error we saw when the mask widget send a maskUpdated signal with an empty mask at init. I just ignore empty mask (array of size 0) instead of making our widget emit the I also found the reason why the mask seems to be deleted when the slider is activated: the mask is not actually deleted, but the data image is redrawn on top of the mask, on the same layer z=1. This layer is hardcoded in the mask widget in silx. We could modify it to use When the widget is open, I guess the mask is redrawn after the image changes, so the problem is not visible. My workaround is to use z=-1 for the background and z=0 for the data. |
Well, it seems to work, but I still do not catch how then the external images work. In my view, both, the external image widget and the mask image widget should be able to accept a "background" image, an image and a mask and I would not like to test for the silx version in the immediate future. I do not think we are forcing z layer to be positive. Probably working with -1 for the background, 0 for the active image and 1 (hardcoded) for the mask should work. Please, can you give a try at that? If unsuccessful I will accept your pull request as it is. |
The external images are added as background images, underneath a tranparent stack data image. The mask stays therefore always on top of the visible image. I already tried what you suggest (z=-1 for bg and z=0 for data), and it works (1046178) |
Merged. I would like to get rid of all those warnings when fabIO is not installed. |
ExternalImagesPlugin version based on a silx PlotWidget.
The external image is not reduced in size to fit the stack image size (the scales are simply recalculated).
TODO: