Question on "export segments to models"

Hi,

This is related to my earlier post: Filters and parameters used in "export visible segments to model".

I’m trying to do the following: I have a binary labelmap that I load into Slicer. Then I click on the segment and select “Export visible segments to models”. In the model node, on its color box, I right click and select the checkbox for 2D visibility. The application then shows the segment as a thin contour in the 2D views. It seems to be smoother than the binary labelmap by default (see attached picture).

I’m trying to replicate this workflow from python - given a labelmap, I would like to process it to be able to get these contours. Does anyone have some suggestions on how I might be able to do this? If the specific VTK filters, parameters and code are available somewhere, can that be linked here?

Any help would be appreciated.

Thanks,
Chaitanya

It is smoother because the closed surface conversion does some smoothing after the triangle creation (according to a parameter that is easy to change), so that the object approximate better the reality. The vertices in the closed surface representation have an infinite accuracy as opposed to the fixed sized voxels of the binary labelmap, so it makes sense to try to make it more realistic.

The visualization pipeline is in the displayable manager, and in that there is a cutter filter that creates the 2D contours from the 3D surface based on the slice plane:

1 Like

Thanks, this helps. Is this the function that does the binary labelmap to closed surface conversion? Are these the primary variables that control smoothing?

  • smoothingFactor
  • jointSmoothing
  • decimationFactor

What I posted is the displayable manager that creates the 2D contours for the slice. It has nothing to do with internal conversion within segmentations, which is 3D->3D.

I’m sorry, maybe I wasn’t clear. I was referring to the code snippet I posted in my response. I’m looking at this function.

bool vtkBinaryLabelmapToClosedSurfaceConversionRule::Convert(vtkSegment* segment)

Is that the place where the conversion from binary labelmap to closed surface happens? I see some variables there that seem to control smoothing (smoothingFactor, jointSmoothing, decimationFactor) - were those the parameters you were referring to? Are those parameters available to change from Slicer’s UI?