is there a pythonic way to replace one or more of the scalar values in UKF fiberbundle, eg FA1 or trace1 for example, with external data or better yet a volume node or a multivolume node for a movie preserving spacial registration between vtk and vol?
You can do this by creating your own extension using Extension Wizard.
We had a tutorial in the last month at MICCAI for teaching how to build a new extension. You can find the materials online at: https://projects.iq.harvard.edu/slicerdmri2018
The third hands-on tutorial talks about creating extensions. For your problem, the third part “Module: tractography processing” is the most related.
Hi this is a python module that contains example code. No need to build anything. Using the extension wizard module, you just click some buttons and your new module appears. This takes maybe two minutes. Then in the new module there are buttons to open the code in a text editor and also to reload the code, so it’s easy to play with changing the functionality to do what you want.
hi lauren, ok i’ll bite a little, cause i have a little more time:
1st question is we have a UKF vtk file and an RAS+ volume in the same space. outside slicer it seems the x
coordinate on the vtk is revesed or swapped. is that true?
how would you recommend getting a one to one matching coordinate between the vtk in mm and RAS+
volume?
when we do it outside slicer the x values get wrong offsets.
jeff
You need to use the ijktoRAS transform in Slicer to convert between image and world space (fiber tract) coordinates. There are multiple modules that do this so you can look at the code. There is one module that makes a mask image from fiber tracts, and another that selects fibers based on an image ROI. I’m on the phone now so I don’t have the exact module names but they should be easy to find on the diffusion menu. Please reply if this is not clear and we can take a more specific look tomorrow.
Internally, Slicer stores data in RAS coordinate system (due to historical reasons). However, Slicer writes most data types in LPS coordinate system for maximum compatibility, as LPS is used by DICOM and by most medical image computing software nowadays.
Slicer still writes model nodes in RAS coordinate system instead of LPS, but you can detect this (if you find SPACE=RAS in file comment) and compensate for it by applying ijkToRas transform (diag(-1.0, -1.0, 1.0, 1.0) transformation matrix) to the point coordinates. Within a year, we will change Slicer so that model files are saved in LPS coordinate system by default (you’ll find SPACE=LPS in the header so you will know that no RAS->LPS transformation is necessary).