# Generate tubes with markups to model

**URL:** <https://discourse.slicer.org/t/generate-tubes-with-markups-to-model/33542>\
**Category:** Support\
**Created:** [December 28, 2023, 10:24am UTC](https://discourse.slicer.org/t/generate-tubes-with-markups-to-model/33542 "2023-12-28T10:24:23Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![SANTIAGO\_PENDON\_MING](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/santiago_pendon_ming/32/66060_2.png) [@SANTIAGO\_PENDON\_MING](https://discourse.slicer.org/u/SANTIAGO_PENDON_MING)\
**Post date:** [December 28, 2023, 10:24am UTC](https://discourse.slicer.org/t/generate-tubes-with-markups-to-model/33542/1 "2023-12-28T10:24:23Z")

</div>

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:

 ![Captura de pantalla 2023-12-28 093520](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/3/7/37d57cad5461ac4d5eec4753ccfca84ff9a255ec.png)

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

 ![Captura de pantalla 2023-12-28 111957](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/f/0/f01934344d7077a577b85a4a0548b9d112b3437a.png)

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](https://github.com/lassoan/SlicerSegmentEditorExtraEffects/blob/master/SegmentEditorDrawTube/SegmentEditorDrawTubeLib/SegmentEditorEffect.py) in lines:

```auto
    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 🙂

---

<div class="post-metadata">

**Author:** ![chir.set](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/chir.set/32/66982_2.png) [@chir.set](https://discourse.slicer.org/u/chir.set)\
**Post date:** [December 28, 2023, 10:45am UTC](https://discourse.slicer.org/t/generate-tubes-with-markups-to-model/33542/2 "2023-12-28T10:45:50Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![SANTIAGO\_PENDON\_MING](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/santiago_pendon_ming/32/66060_2.png) [@SANTIAGO\_PENDON\_MING](https://discourse.slicer.org/u/SANTIAGO_PENDON_MING)\
**Post date:** [December 28, 2023, 10:51am UTC](https://discourse.slicer.org/t/generate-tubes-with-markups-to-model/33542/3 "2023-12-28T10:51:09Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![chir.set](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/chir.set/32/66982_2.png) [@chir.set](https://discourse.slicer.org/u/chir.set)\
**Post date:** [December 28, 2023, 6:07pm UTC](https://discourse.slicer.org/t/generate-tubes-with-markups-to-model/33542/4 "2023-12-28T18:07:10Z")

</div>

> [@SANTIAGO\_PENDON\_MING](#):
>
> the method to do regular tubes with segment editor

This can be done using the [vtkTubeFilter](https://vtk.org/doc/nightly/html/classvtkTubeFilter.html) class. The VTK project has many many  
[example](https://examples.vtk.org/site/Python/PolyData/TubeFilter/) pages.
