bauerdavid / napari-nD-annotator

BSD 3-Clause "New" or "Revised" License
28 stars 1 forks source link

Slice interpolation produces strange results #20

Closed bauerdavid closed 2 years ago

bauerdavid commented 2 years ago

Describe the bug Sometimes the slice interpolation fills in missing slices with masks which are not "proper" average of the labels they were interpolated from. This does not occur all the time, so I'm not sure what causes this.

To Reproduce Steps to reproduce the behavior:

  1. Download https://drive.google.com/file/d/1l47Qlao4ABr8B4Or2YVWjPou02auYNR0/view?usp=sharing
  2. Start napari
  3. Open the downloaded mask
  4. Start the 'Annotation plugin'
  5. Click 'Interpolate' in the 'Interpolation' tab
  6. See results.

Expected behavior The interpolated masks' shapes should be similar to the existing ones'.

Screenshots

napari info napari: 0.4.15 Platform: Windows-10-10.0.22621-SP0 Python: 3.9.10 (tags/v3.9.10:f2f3f53, Jan 17 2022, 15:14:21) [MSC v.1929 64 bit (AMD64)] Qt: 5.15.2 PyQt5: 5.15.6 NumPy: 1.22.4 SciPy: 1.8.1 Dask: 2022.05.2 VisPy: 0.9.6

OpenGL:

Screens:

Plugins:

jo-mueller commented 2 years ago

Hi @bauerdavid ,

I'm not sure whether this falls into the same category/is the same issue, but I am getting some weird results when using the slice interpolation for multiple labels.

To reproduce:

I'd expect the result from label 1 not to change, but this is the case.

bauerdavid commented 2 years ago

Hi @bauerdavid ,

I'm not sure whether this falls into the same category/is the same issue, but I am getting some weird results when using the slice interpolation for multiple labels.

To reproduce:

  • Take any 3D image data
  • annotate two slices with label 1 and interpolate
  • now annotate a second object with label 2 in any two slices and interpolate again.

I'd expect the result from label 1 not to change, but this is the case.

Hey @jo-mueller, I think I know what the problem is with that. The label 1 annotations are overwritten when the interpolation for the label 2 is stored in the layer (they are replaced with 0s, as they are not 2s). As this is an unrelated problem, I'll create a new issue for it. Thanks for the input!

As for the strange interpolation results, I think I found the solution, I will soon push the corrected version.

bauerdavid commented 2 years ago

resolved in ed69226