How can i lengthen cylinder model by Long axis(Z axis)

I made the straight line created with Markups into a cylinder model using the Markups to model module, and I would like to increase the length of the cylinder in that state.

We are literally in a situation where we want to increase the length in the direction of the long axis of the cylinder, but if we apply Transform to the model to increase the size, the overall size, not the long axis, increases. help plz

Why not start from a longer markup?

By the way you can scale objects along one axis with the appropriate transform, you just need to add scaling only for the axis that you want to change the size of. If you rotated it before and hardened the transform, then you would need to create the object again because although you can find the principal axes, it seems an overkill.

I currently converted the red Markups line formed by two red dots into the yellow cylindrical model in the photo above using the Markups to model module.

It would be nice to make the Markups line longer, but the two red dots are important landmarks, so they must be fixed.

Is there a way to increase the length of the Markup line while maintaining these two points? Or is there a way to make sure the Markup line passes through two specific points?

I would recommend just making a new markups line based on the existing one, but at the length you want it, and then making the cylinder from that one.

1 Like

I agree. It would be very easy to create a new markup programmatically.

This code pasted in the Python console works for me:

mn = getNode('L')
mn2 = slicer.mrmlScene.AddNewNodeByClass('vtkMRMLMarkupsLineNode')
import numpy as np
p0 = np.zeros(3)
p1 = np.zeros(3)
mn2.GetNthControlPointPositionWorld(0, p0)
mn2.GetNthControlPointPositionWorld(1, p1)
axis = p1 - p0
p0a = p0 - axis / 4
p1a = p1 + axis / 4
mn2.SetNthControlPointPositionWorld(0, p0a)
mn2.SetNthControlPointPositionWorld(1, p1a)

You will need to replace 'L' with the actual name of your markups node.

1 Like