How to translate bone models?


I recently had a question about displaying iv files on to slicer. This was solved with the amazing help of @lassoan (source). He made an iv file displayer in the sandbox extension which works perfectly. I currently want to learn how to allow the user to transform the bones in the x, y, or z axis. I was wondering what the best way to go about this would be. I was going to create a new module to help me accomplish this but am struggling as to how I would access the polydata that is in the sandbox extension that displays the iv files right now.

PS: This might seem like a basic question but I am incredibly new to slicer and don’t understand its architecture that well so any advice/materials that could help me understand the big-level architecture would be much appreciated too

Thank you in advance.

Hi all,

Any thoughts about the question posted above? Replying to the post for visibility purposes. Thank you in advance.

You can apply a transform to the model node to transform it. You can enable interactive editing of the transform in 3D views, but I would recommend to position/orient it using landmark registration.

Hi Andras,

Thank you for your response. If I were to create my own module, how would I be able to access the modelNode located on the file on the new module python script?

I notice that I am able to apply a transformation matrix via the transform tab but I want our lab to be able to feed our own specific transformation files that will manipulate the bones in the motions we want. I saw this function on the docs and was wondering if it would be useful for my purposes modelNode = slicer.util.getNode(“MyModel”)

Any thoughts?

My question may be more specific and answerable if I give some context to the problem I am trying to solve. I am trying to transform 15 nodes (bones) by passing in a file that has their respective transformation matrix. An example of the .dat file that stores the 15 transformation matrix can be found here: 14727_Motion01R.dat - Google Drive

We have 10 other .dat files that house their own set of 15 transformation matrices. Together, the files and the matrices housed within them represent a full movement. Ultimately, I would like to be able to insert these 10 files and then be able to visualize the movement in slicer. I have played around with the transforms module, however, I do not believe that this module has the features I am looking for.

Any help would be much appreciated. Thank you in advance.

You can already load/save/record/replay transformation sequences and apply them to model nodes. We use the sequence file format for this, which is a simple text file that you should be able to create from your .dat file. The specification is available here.

Example file: test.igs.nrrd

dimension: 3
kinds: domain domain list
sizes: 0 0 5
space dimension: 2
Seq_Frame0000_StylusToReferenceTransform:=1 0 0 0 0 1 0 0 0 0 1 5.645142857142858 0 0 0 1
Seq_Frame0001_StylusToReferenceTransform:=1 0 0 0 0 1 0 0 0 0 1 6.143761904761904 0 0 0 1
Seq_Frame0002_StylusToReferenceTransform:=1 0 0 0 0 1 0 0 0 0 1 6.487333333333334 0 0 0 1
Seq_Frame0003_StylusToReferenceTransform:=1 0 0 0 0 1 0 0 0 0 1 6.760428571428571 0 0 0 1
Seq_Frame0004_StylusToReferenceTransform:=1 0 0 0 0 1 0 0 0 0 1 6.92252380952381 0 0 0 1

The .igsio.nrrd file reader and other useful modules for calibration and tracking provided by SlicerIGT extension.

@Sunderlandkyl When I read the file above then an empty image file is added to the scene as well. Is it possible to prevent that by changing the .igs.nrrd file content or it would need a change in the reader?

Probably it would need a change in the reader.