Page MenuHomePhabricator

surface normals not computed / rendered
Closed, ResolvedPublic

Description

If I create a surface with ManualSegmentationToSurfaceFilter then the surface normals are not computed, or at least they are not rendered correctly.

Reproducing the issue:

  • Build the example plugins.
  • Open a 3D image and calculate the surface with the ISO Surface view.
  • Rotate the surface by mouse dragging in the 3D render window.

You will see that the dark and light side of the object remains the same, although the object should be enlightened from the front always.

However, if you save the surface in stl format and then open the file, the surface is rendered correctly.

Saving the image in vtk/vtp format did not solve the problem, I attached a fix for this. (It also fixes a potential memory leak, a Delete() invocation was put in a wrong place.)

But I could not figure out how to display the correct surface without saving and reopening the image.

Event Timeline

Removed release as target milestone because this view is not part of the release.

The component of this bug is unclear. Miklos used the example view to reproduce this issue.

Todo: Check where exactly the problem is.

We created a surface using the ISO Surface view. The image was "Pic3D.nrrd" from the MITK-data repository. Threshold -500. There was no problem with the surface normals in this case. We also saved/loaded the surface (stl format) and it looked exactly the same. I'll attach a screenshot of the surface.

Setting the bug to "works for me". Please reopen if there is still a problem. Best is to also provide test data.

Hi there,
this bug is still present in our latest MITK fork, with upstream merged in December.

As before, the surface normals are still incorrect which results in the lights and shades being "stuck", so they does not follow the camera rotation. However if we save the surface to stl and load it back again it works perfectly while saving it to vtk format preserves the issue.

I am attaching a vtk example file which appears to be incorrect.

Ok, the file was too large for attaching here, please find it on SendSpace:
http://www.sendspace.com/file/it377p

Cheers

I see the problem in the data gzombori attached to this bug and try to reproduce the actual issue.

@ Miklos and gzombori: As Alfred I cannot reproduce the problem from Miklos description. I see the problem in the .vtk data you attached to this bug, can you attach the source data the surface was generated from together with a detailed description of the parameters you used to generate the surface.
Did you use the 12-12 release or do you compile MITK from the current git repository?

We use our MITK fork that has been updated to the upstream after the 12.12 release. Earlier I tried to use the "official" MITK from your git repo, but the result was the same.

Please download a sample image from here:
http://www.sendspace.com/file/dj9fld

(Max. attachment size here is 1MB.)

The easiest way to reproduce the problem is if you enable the examples in CMake, as I wrote in my first comment.

Thanks Miklos for the data, I can reproduce the error now. Seems to be a problem that occurs exclusively at MR data, or did you made other experiences?

Hi,
I have tested on a CT dataset which appeared to be OK, but when I rendered the attached set (output of freesurfer) it also fails.

The problem is solved. The normals are now calculated upon generation of the surface in the mitkImageToSurfaceFilter - IO should work now. After adding the unit test for this class the solution will be committed.

New remote branch pushed: bug-12815-NormalCalculationForSurfaces

[d74532]: Merge branch 'bug-12815-NormalCalculationForSurfaces'

Merged commits:

2013-02-20 16:44:15 Sven Mersmann [4ca673]
Added some exception handling in the class and wrote unit test for mitkImageToSurfaceFilter.


2013-02-13 17:59:43 Sven Mersmann [28fc56]
Added unit test for mitkImageToSurfaceFilter class to test the made changes.


2013-02-13 16:56:42 Sven Mersmann [651456]
Normals of the surface points are calculated directly after generation of the surface. This is important for saving surfaces as .vtk and .vtp files.

The bug fix is committed and should work now, set this bug on resolved fixed.