-
Notifications
You must be signed in to change notification settings - Fork 1
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
Make Import Spots handling single pixels and planar pixels properly #105
Conversation
…in one plane and thus have zero values on the diagonal * The goal that resulting ellipoids are at least 1pixel wide in each dimension
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 PR successfully achieves the goal of supporting single pixel segments and planar segments in the "import spots from label image" plugins. How the code changes are very verbose and should be made more concise.
Additionally I noticed that the plugin produces wrong results when there is a non diagonal transform matrix in the image dataset:
The non diagonal transform matrix in the dataset.xml:
(The transform matrices are non diagonal for all dataset that use some kind of 3d registration that also allows rotation)
How can the code be made less verbose and more concise:
The three classes CircleRenderer, SphereRenderer and LineRenderer could be replaced by a single EllipsoidRenderer, which again could maybe be reduced to a private method in the LabelImageUtilsTest. This "EllipsoidRenderer" could be based on EllipsoidIterable class in Mastodon.
A line could be renderer for example using an "EllipsoidRenderer" by providing a covariance matrix with one large eigenvalue (semiaxis) and two sufficiently small eigenvalues (semiaxis).
src/test/java/org/mastodon/mamut/io/importer/labelimage/LabelImageUtilsTest.java
Outdated
Show resolved
Hide resolved
src/test/java/org/mastodon/mamut/io/importer/labelimage/LabelImageUtilsTest.java
Outdated
Show resolved
Hide resolved
src/test/java/org/mastodon/mamut/io/importer/labelimage/LabelImageUtilsTest.java
Outdated
Show resolved
Hide resolved
src/test/java/org/mastodon/mamut/io/importer/labelimage/LabelImageUtilsTest.java
Outdated
Show resolved
Hide resolved
140be57
to
9072165
Compare
Here is dataset with a non diagonal transformation matrix that I used for my test and the screenshot above. |
e235bc0
to
20c5797
Compare
* Since single pixels are not filtered anymore, they are now all converted to a spot in the graph
* test importing a sphere * test importing a circle in only one plane * test importing a single pixel * test importing a line
* Build job had 2GB before * Now both jobs have more consistently the same setting
* Reduces code duplication
…system * Replaces scaling the center with voxel dimensions * Replaces scaling the covariance matrix with voxel dimensions * Required, since besides scaling, also rotation, translation and shearing may exist in the images
20c5797
to
22302a3
Compare
Quality Gate passedIssues Measures |
Thanks for noticing this. The transform matrices are taken into account via 9e77262
Thanks for this idea. I introduced a class SpotRenderer that is able to render spheres, circles and lines using the EllipsoidIterable. However, this approach brings some difficulties, since the EllipsoidIterable inflate the ellipsoid by half a pixel, which makes it harder to use in the unit tests, since the results are less obvious. I thus kept the original renderers |
This PR introduces that during the import of label images as ellipsoids some edge case are handled properly.
Import result before PR (the upper row shows circles/line that are only in the x-y plane, the lower row shows spheres):
Import result after PR (the upper row shows circles/line that are only in the x-y plane, the lower row shows spheres):