Generate tubes with markups to model

Hi to everyone. At this moment I’m struggling with markupstomodel module, which implements some handsome functions as could be generate tubes from markups.

In my first attemp I achieve a fancy solution touching the parameters in:

markupsToModel.UpdateOutputCurveModel(guideListNode, guideModel,interpolationType, False, 0.18, 50,15,True, 1, slicer.vtkMRMLMarkupsToModelNode.RawIndices, None, polynomialFitType)

Obtaining this perfected fitted and smooth tube:

But when I try to do the same with a fiducial list much more dense as could be next pic, I obtain:

As you can see this curve is non-well fitted with data points and also is non-smooth (I can see the small cylinders that composes the structure)

I guess that the problem here are the parameters in UpdateOutputCurveModel. I try to find documentation about it, but only find this SlicerSegmentEditorExtraEffects/SegmentEditorDrawTube/SegmentEditorDrawTubeLib/SegmentEditorEffect.py at master · lassoan/SlicerSegmentEditorExtraEffects · GitHub in lines:

    markupsToModel = slicer.modules.markupstomodel.logic()
    # Create tube from points
    markupsToModel.UpdateOutputCurveModel( inputMarkup, outputModel,
      interpolationType, False, self.radius, 8, NumberOfLineSegmentsBetweenControlPoints, True, 3,
      slicer.vtkMRMLMarkupsToModelNode.RawIndices, self.curveGenerator,
      polynomialFitType )

Can somebody explain the parameters and what make each of them.

Thanks a lot :slight_smile:

If you want a regular tube, you can use the ‘Draw tube’ effect of the SegmentEditorExtraEffects extension.

If you want a tube with varying radius, you can use the ‘Shape’ custom markups of the ExtraMarkups extension.

You can install both using the ‘Extensions manager’. You would get more controllable tubes.

Hi chir.set, thanks.

Can you provide me an example of how to use the method to do regular tubes with segment editor? I’m doing it coding, not manually. Also, you know how works the function I mention in the original question?

Thanks for your help!

This can be done using the vtkTubeFilter class. The VTK project has many many
example pages.

1 Like