-
Notifications
You must be signed in to change notification settings - Fork 6
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
Display QPI image data #146
base: master
Are you sure you want to change the base?
Display QPI image data #146
Conversation
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.
@paulmueller when you get a chance, pleae have a look at the changes :)
I tested that it works on normal rtdc files, and on rtdc files with qpi data.
Perhaps I need to add some tests?
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## master #146 +/- ##
==========================================
- Coverage 78.93% 78.71% -0.22%
==========================================
Files 63 63
Lines 6768 6807 +39
==========================================
+ Hits 5342 5358 +16
- Misses 1426 1449 +23 ☔ View full report in Codecov by Sentry. |
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.
The main issue that I see is that the current way contours are plotted is outdated and also does not work with phase data (changing pixels in an RGB image). So as far as I can see, there is no way around rewriting displaying the contour for phase and amplitude data.
Also, I believe there should be some way of setting the range for (at least) phase values. And phase values should always be centered at zero with the corresponding colormap showing white or no color. "coolwarm" from matplotlib is a good way of displaying phase, but you would have to copy-paste it to work with pyqtgraph, because I think it is not (yet) in pyqtgraph. "viridis" got ported to pyqtgraph, so it should be straight-forward.
shapeout2/gui/quick_view/qv_main.py
Outdated
return cellimg, imkw | ||
|
||
@staticmethod | ||
def display_contour(ds, event, state, cellimg): |
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.
In the future, we might want to change how we compute/display the contour, i.e. we are planning to use non-discrete contours (@SaraKaliman). So it might make sense to implement two functions add_contour_to_image
(for "image" data) and draw_contour_on_plot
(for float32 qpi data) which could then also be used later for non-discrete contours.
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.
Practically I want to use shapeout to visualise the image data so Kyoo can look at the data in one place. For that, what I have built right now is enough. The colormaps and contour issues will just hold that up. Could we put all that in a separate PR?
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.
If it is just for Kyoo, then you could just create a custom executable for him:
cd build_recipes
pip install -r win_build_requirements.txt
pyinstaller -y --log-level=WARN win_ShapeOut2.spec
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 would not like to merge an incomplete feature. Moreover, the grayscale colormap leads to ambiguities. This should not be used by the general crowd.
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.
If you think it isn't a complete feature then I understand. I'll try to implement the colorbar etc soon.
Thanks for the custom executable, much better... I was just gonna do the dev version. :)
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.
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.
cellimg[cont, 1] = int(imkw["levels"][0]) | ||
cellimg[cont, 2] = int(imkw["levels"][0]) | ||
else: | ||
# just 2D images (not RGB) |
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.
This is a work in progress (probably going to follow your idea of having specific methods for contour handling).
|
||
try: | ||
# if we have qpi data, image might be a different shape | ||
if "qpi_pha" in ds: |
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.
Maybe there should be a separate class entirely that handles image plotting? Generalization is not easy due to the different data types and requirements for visualization.
I think a simple method works for our use-case for image display. Could even make this into a method, seeing as we use it twice.
As described in (create issue) I want to see qpi data non-scalar features in shapeout2.