Page MenuHomePhabricator

3D interpolation mesh has inverted normals
Open, LowPublic


The mesh automatically generated during 3D interpolation of segmentations seems to have inverted normals. Tested on Ubuntu 20.04 MITK commit hash 1c4db16fd159fc20a3938e16cadcb2b0a8cdcb00 (current develop).

Found this bug when using vtkImplicitPolyDataDistance to calculate distances from points to the segmentation surface in MITK Diffusion, which means that it is probably only reproducible using MITK Diffusion (MitkCalculateDistanceToSegmentation cmdapp). Downloadable here:

Test Data:

To reproduce, save AF_left_TDI and the respective surface. Call the command line app with these two items as input. The output is a distance map from each non-zero voxel in the AF_left_TDI image to the surface. If everything is fine, the values of the resulting distance map image inside of the surface should be <0 and outside >0. For the interpolation surface it is the other way round.

Event Timeline

kislinsk triaged this task as Normal priority.
kislinsk added a subscriber: kislinsk.

Can confirm. To reproduce, it is enough to switch on the Surface.2D.Normals.Draw Normals property and check in any 2-d render window. Meshes generated from segmentations in the Data Manager context-menu have correctly oriented normals in contrast.

So, this is not a straight forward fix since other interpolations I tested have correct results. Maybe VTK provides a smart filter for determining the outside that can be used.

kislinsk lowered the priority of this task from Normal to Low.Nov 30 2021, 11:25 AM
kislinsk removed kislinsk as the assignee of this task.EditedNov 30 2021, 11:52 AM

I experimented a little with changing the order of filters and using other filters (clean poly data before normal generation, PCA normals estimation) but nothing produced consistent results. So I propose to at least implement a simple flip normals action for the DataManager context menu.