Skip to content
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

Export issue when using anisotropic data #53

Open
androst opened this issue Oct 21, 2021 · 5 comments
Open

Export issue when using anisotropic data #53

androst opened this issue Oct 21, 2021 · 5 comments

Comments

@androst
Copy link
Collaborator

androst commented Oct 21, 2021

Spline segmentation exporter does not work as intended (?).

When using anisotropic data the data is converted to isotropic for display, and the annotated points are saved in that space to the database. During spline segmentation export, the images are copied from disk (as anisotropic) and the segmentation mask is created with the anisotropic image shape while the point coordinates are isotropic. This will cause a shift that badly effects the segmentation mask.

Some potential solutions:

  • Check if image is anisotropic on export, and convert coordinates
  • Convert image from anisotropic to isotropic when exporting
@smistad
Copy link
Owner

smistad commented Oct 21, 2021

I see what you mean, quite a serious bug, but I wonder why have we not seen this before then? Have we just worked with isotropic data until now?

@androst
Copy link
Collaborator Author

androst commented Oct 21, 2021

I noticed it when the pixel spacing was significantly different between directions. Seems quite hard to spot otherwise, and perhaps most tasks have involved isotropic (or close to isotropic) data.

@smistad
Copy link
Owner

smistad commented Oct 21, 2021

The cardiac task has a fix for this: https://github.com/smistad/annotationweb/blob/master/exporters/cardiac_segmentation_exporter.py#L180
But I think it might be better to draw in isotropic space, which is what the user saw, and then resample the segmentation to the original anistropic space afterwards. Otherwise the splines might not be drawn in the exact same way the user saw it.

@androst
Copy link
Collaborator Author

androst commented Oct 21, 2021

Yep, agree! Also good that cardiac exporter has a fix for this.

@jpdefrutos
Copy link
Collaborator

I fixed this issue (see https://github.com/jpdefrutos/annotationweb/commit/13795d14bbb0993cb725ba488562449c7f8ca971). I can PR the solution.
The fix included what you mentioned on the cardiac_segmentation_exporter, and also exposing the attribute 'Offset' on the MetaImage object to correctly align the segmentation and the image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants