Rotation in DICOM data

Hi:)
Is it possible to set in DICOM data two points to get a line and then rotate around this line?
Best Regards,
Ole

If you need to rotate slice views (for example, to explore structures around a tool trajectory): you can install SlicerIGT extension and use Volume reslice driver or PathExplorer modules. These modules are not trivial to use, so if you need help with then let us know.

If you need to rotate images or structures (change their physical orientation): you can follow these instructions. You can put the code snippet into a scripted module to make it more user-friendly (to not require typing and copy/pasting into the Python console).

Thank you very much for you information… i try a little bit its not so easy :wink:

again one question… where i found a Surface Registration?
I will merge a STL model on a cbct data set…

Thank you in advance,
Ole

Are you interested in rotating slice views or you need to change physical position/orientation of images?

Would you mind posting this in a separate topic? (this will be a start of a new discussion, unrelated to image or view rotation)

interested in rotating slice views (rotate around a bone)

thank you

In recent Slicer Preview Releases, you can easily rotate slice views by showing slice intersections (using dropdown menu of crosshair button in the toolbar), setting slice intersection position using Shift + mouse-move, then rotate slices using Ctrl + Alt + left-click-and-drag.

You can copy-paste this code snippet into the Python interactor for initial alignment based on a markups line:

lineNode = getNode('L')

# Get direction vector of the line
import numpy as np
p1 = np.zeros(3)
p2 = np.zeros(3)
lineNode.GetNthControlPointPositionWorld(0, p1)
lineNode.GetNthControlPointPositionWorld(1, p2)
directionVector = p2-p1

# Position/orient slice views based on line position and direction
for axisIndex, viewName in enumerate(['Red', 'Green', 'Yellow']):
  sliceNode = slicer.app.layoutManager().sliceWidget(viewName).mrmlSliceNode()
  sliceNode.SetSliceToRASByNTP(directionVector[0], directionVector[1], directionVector[2], 1,0,0, p1[0], p1[1], p1[2], axisIndex)

Sorry its dont work… is a other way available?

I’ve tested this yesterday with a recent Slicer Preview Release and it worked well. If you have any trouble then please provide step-by-step description (or screen capture) of what you did, what you expected to happen, and what happened instead.

Ohhh yessss with the Preview Release version it is works!!! i had the older version…

Thanks!

1 Like

How do I get the node ‘L’?
Sorry, I just started learning how to use 3DSlicer.

If you draw a line markup (choose to place a Line in the toolbar) then by default its name will be ‘L’. The code snippet uses that line as rotation axis.

Thank you very much :rofl:. I’ve looked at a number of script files that just use getNode () without explaining how Nodes are created.

You can learn Slicer programming basics from these tutorials.

ok. :grinning: Thank you for your help!!!