-
Notifications
You must be signed in to change notification settings - Fork 140
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
poi manager: z-position from the scanner is not saved #647
base: master
Are you sure you want to change the base?
Conversation
#512 (comment) This bug is affected because POI on the confocal image only saves the x, y position into the roi_origin, and since, by default, the values are set to zero. Since the z position is not saved into the POI file (which should be a fixed value) and take it from ROI origin. So simply adding new_pos[2] = self.poimanagerlogic().scanner_position[2] line 629 "gui/poimanger/poimangui.py" will fix this bug.
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.
Looks good to me. I will test it soon.
The question remains if this is a nice solution or if it is better to save the z-position of the scan as well and work (as I assume it is supposed to) with the sample shift (roi_origin
) in z. In any case this is a working solution and perfectly fine for me.
gui/poimanager/poimangui.py
Outdated
@@ -626,6 +626,8 @@ def create_poi_from_click(self, button, pos): | |||
new_pos = self.poimanagerlogic().roi_origin |
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 line is not needed anymore. Either initialize an empty array here or define the new position in one line like
new_pos = np.array([pos.x(), pos.y(), self.poimanagerlogic().scanner_position[2]])
@NicolasStaudenmaier You have recognized the problem here. The ROI origin is the anchor for all POIs registered. So in the beginning the "offset" introduced by sample shift etc. is zero, so the absolute position of an POI is simply the POI initial position. If you now moved the ROI (e.g. by tracking a POI or updating the ROI origin manually), the POI position will become the sum of the POI initial position and the ROI origin (now different from [0, 0, 0]). In any case please do not introduce a new absolute coordinate (for Z) to be handled by the POI manager. This is conceptually not needed. |
It behaves well when adding POIs by mouse clicks, introducing a sample shift and repeating the procedure. When creating an POI the anchor position is calculated by subtracting the shift from the absolute position. So to fix the issue without introducing an absolute z-coordinate in the POI manager, I believe that the |
The idea was to solve this issue. The roi_origin is related to another issue (shift of each track ->update POI). Still, in this case, it gets a bit confused because the POI's shift will be in 3D, and when you select the POI's, you click them in a 2D confocal image, so in principle, the Z position is fixed. So I updated as @NicolasStaudenmaier @Neverhorst suggest 625 # Z position from scanner, X and Y positions from click event
626 new_pos = np.array([pos.x(), pos.y(), self.poimanagerlogic().scanner_position[2]]) |
Z-position from the scanner is not saved when you add a point of interest (POI)
Description
This bug is affected because POI on the confocal image only saves the x, y position into the roi_origin, and since, by default, the values are set to zero. Since the z position is not saved into the POI file (which should be a fixed value) and take it from ROI origin.
So simply adding
new_pos[2] = self.poimanagerlogic().scanner_position[2]
in line 629 "gui/poimanger/poimangui.py" will fix this bug.Motivation and Context
The main motivation to fix this problem is to have the right focal plane for your POI file. This bug is caused when you select a point by clicking into the poi_manager, by default, the values before clicking are set to zero (np.zeros(3)), so when you select more than one POI the Z position is not stored.
So simply adding new_pos[2] = self.poimanagerlogic().scanner_position[2] line 629 "gui/poimanger/poimangui.py" will fix this bug.
#512 (comment)
How Has This Been Tested?
This has been tested by me in two different confocal setups
You can test this by adding more than one POI and checking the file in the console
and the last value should be different from zero (e.g. 5 points same Z pos value).
Screenshots (only if appropriate, delete if not):
Types of changes
Checklist:
documentation/changelog.md
)