-
Notifications
You must be signed in to change notification settings - Fork 57
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
[BUG] Projecting neurons in the Landmarks Widget results in incorrect transformation #2285
Comments
Perhaps related: the "brain hemisphere right" landmark group of volume 1099 has an extra unnamed landmark that can't be deleted, throws this error:
|
I deleted the whole landmarks group and recreated it, but the transform error still continues. |
We found that "MB Vertical / Medial Lobe Intersection" is a landmark that exists both in 1099 and in Seymour, but a break at While on the break, I tested whether The end result is that it uses only 3 landmarks to define a 3D transform, and therefore it's very wrong. |
For testing I am using annotation "thermo-KC right" from Seymour, so only 4 KCs are loaded. The 1099 volume has project_id=4. What I did: login via psql to the catmaid_fibsem database and update the string in the class)_instance table:
And finally:
And now 4 landmarks are used. There must have been an encoding error in the string, entirely invisible to the naked eye but javascript compared the two and returned false. |
An issue persists, though: while 4 landmakrs are now being used, the transformation is OK in the antero-posterior axis but is messed up medio-laterally: inverted or worse. |
Further testing shows that when projecting neurons in Seymour's annotation "thermo-KC right" using Seymour's landmark group "brain hemisphere right" to 1099's landmark group "brain hemisphere left" then the transformation is largely correct, barring differences in the individual landmark positions. Whereas when projecting to 1099's "brain hemisphere right" then the neurons are medio-laterally flipped. I have run out of clues to follow to figure this out. |
Here is a view of Seymour's annotation "thermo-KC right" projected to 1099 via "brain hemisphere right" (yellow) landmark group, and to "brain hemisphere left" (orange) landmark group. Notice how the right-to-right is medio-laterally flipped, whereas the right-to-left looks about correct: |
To further add: I projected one KC from the left hemisphere of 1099 (annotation "KC left" with one neuron) to the right hemisphere, and the transformation is correct. So the issue is likely related to projecting across projects: the landmark names and matching work fine locally across the hemispheres of 1099. |
More issues: when transforming right to right, I see at the end only 6 matches, where there should be 8. |
Found the cause: for the second pair, Turns out, there is only 1 landmark under "MB medial lobe tip", assigned to Seymour's "brain hemisphere left" but not to right. This is what has caused so much trouble when matching with other volumes too. |
Finally, |
To add that the GABA FIBSEM volume with pid=7 also seems to have problems: when projecting "thermo-KC right" from "brain hemisphere right" to "brain hemisphere right", one of the landmarks that matches by name somehow is not used. Another issue is that the resulting transformation is rather wrong. May have to do with the landmarks themselves though, again. |
Thanks for the server update. I just started looking into this again and to me it looks like your last example works now: if I add a transformation in the GABA FIBSEM volume from Seymour's "thermo-KC right" from its "brain hemisphere right" group to the FIBSEM's volume "brain hemisphere right" group, the resulting neurons look plausible to me in the 3D viewer. All four landmarks that match by name seem to be used in the MLS transform. Could you please try and see if this looks okay to you now? I saw the wrongly transformed last week as well and I am not sure any recent change by me fixed this. However the landmarks don't seem to have changed in either CATMAID instance either (as far as I can tell from the Landmarks widget). Did you change anything? |
I noticed that the right-to-right transform of "thermo-KC right" from Seymour to 1099 looks correct if "Use reverse point matches" is unchecked. The problem is likely that both source and target space overlap and that reverse matches will then cause "unlogical" mappings within the source space. This is likely only a problem in transformations between projects (since overlapping landmark groups don't happen usually within a project, it seems). The spaces don't overlap for the right-to-left transform, which is why the transformation is correct. So far I assumed there is no harm to have "reverse matches" enabled by default, but given this error case, users should at least be warned: I could add a warning to the UI if "reverse matches" are enabled and the bounding boxes of all source landmarks and all target landmarks overlap. |
…t BBs If source and target bounding boxes overlap or touch, wrong or rather surprising transformations can be the result if reverse matches are enabled. This commit adds a warning for this situation to the displayed list of current matches so that the user is aware about this. See #2285
The Landmark Widget now displays a warning in the list of current matches, if reverse matches is enabled and the source and target bounding boxes overlap. Do you think this should be taken care of additionally in another way? Is there anything else unexplained in this issue or can we mark this as done? |
Thanks Tom for all the fixes. When I project "thermo-KC right", I choose as the source group "brain hemispheres right" and I get an error message that there isn't a matching group, yet there is. Are the two strings not written in the same encoding? Why does the comparison fail? Such an error was happening too among landmark names and was only resolved by updating the string directly in the database via psql. |
Are you getting this error in 1099? If I select Seymour/L1 as source project and select "brain hemispheres right" as source group, "brain hemisphere right" is selected automatically as target group (if no target group was set manually before). |
It's in the 1128 (GABA) volume. |
Indeed, the landmark groups "brain hemisphere left" and "brain hemisphere right" have a a TAB character as the first character ("\t"). We should probably trim all spaces around the group name during creation---I'll add that change. |
Otherwise accidental tabs and whitespaces can prevent matching of groups. See #2285
For the landmarks themselves the user input was already trimmed. It should be quick to add a button that will trim all landmarks and groups (or you do this again in the DB). |
Goodness, well spotted. Perhaps a button is best - would be dangerous to write many individual UPDATE commands in psql. |
This button will instruct the back-end to ensure all landmark names and landmark group names don't have any leading or trailing whitespace. See #2285
I have added such a button to the Landmarks tab. It's called "Normalize names" and will ensure no leading or trailing whitespace is used in landmark names and landmark group names. |
In volume 1099, we attempted to use the 4 landmarks of the right mushroom body, which we checked are named correctly, and the 3D viewer shows them at the correct 3D location relative to traced Kenyon cells.
When we load neurons from Seymour using the latter's "Kenyon Cell right" annotation, or any other annotation, the transformed neurons are shown in the 3D viewer with an inverted anterior-posterior axis, and overly stretched long that same axis.
This image shows the incorrectly transformed Kenyon cells and the volume of the landmarks used:
And this is how they should look like: in blue, the locally partially traced Kenyon cells:
The text was updated successfully, but these errors were encountered: