Calculating the displacement between two models

Operating system:Windows 10
Slicer version:4.8.1
Hi 3D slicer experts
I have CT images in 2 states of normal and free breathing. When the patient breathes deeply , the lung volume increases (like the following figure) . (lung volume in deep breathing: 1805 cm3 and the number of its points:2060 ; and the lung volume in normal breathing: 997cm3 , and the number of its points: 1698) . I want to calculate the lung displacement in deep breathing , relative to normal breathing. and for this purpose, can I use the model to model distance module?
thanks a lot
picture

Do you know what you would like to compute exactly?

Computing surface-to-surface distance assumes corresponding points in the two models are the ones that are closest to each other. Due to large displacements and shape of lungs, this may not be true everywhere.

If you are interested in the displacement field then performing registration may give more accurate results.

You can use Segment Registration extension to compute displacement field from two segmented models (if you have lungs in model nodes then you need to import model nodes into segmentation node).

You may be able to compute displacement field directly from the original CT volumes, using SlicerElastix extension.

If you have a sequence of several volumes (not just 2) then you can get the displacement field over the whole sequence using SequenceRegistration extension.

Hi
Thanks for your response.I used the Segment Registration extension to compute displacement field from two segmented models (Figure 1 in bottom) ; and I also used separately the SlicerElastix extension to compute the displacement field directly from the original CT volumes(Figure 2 in bottom) . but I want to calculate the amount of this displacement .
1- how I can calculate this amount?
2- What exactly does this displacement represent? and is this displacement the amount of displacement between two lung models?
thanks a lot
Figure%201

Figure2

Displacement field already contains displacement of corresponding points in the fixed and moving image, so you don’t need to compute anything.

You can see numerical value of displacement at current mouse position in Transforms module / Information section:

You can get all the displacement vectors (or their vector magnitudes) using Transforms module / Convert section:

Yes, it is the 3D displacement (position change) of each corresponding point between fixed and moving image. Note that you can invert the displacement field by a single click in Transforms module.

You can also select specific points (markup fiducials) that you would like to display the displacement of (Transforms mode: Display / Visualization / Advanced / Source points):

Finally, you can apply the computed transform to a set of markups fiducial points. You can use this to get original and displaced coordinates for the same anatomical points.

Hi
Thanks for your guidance, Idid the steps mentioned, but I still have a question ! Does the value of this displacement field be achieved for specific area such as lungs?(not the total volume or multiple points?)

Yes, sure, you can easily compute average displacements in designated areas:

  • export displacement field magnitude to scalar volume using Transforms module
  • compute average displacement in each segmented region using Segment Statistics module (you need to have the regions defined as segments in a segmentation node)

Hi
Thanks for your response. I am sorry !but How can I export displacement field magnitude to scalar volume using Transforms module?
Thanks a lot

You can convert any transform to a displacement field image or transform or magnitude image in “Convert” section of Transforms module.

Hi
Thank you very much for your guidance. If I want to show the values between the maximum and minimum values of the obtained displacement field in the scalar bar , is it possible? and how can I do it?
Thanks a lot

You can customize scalar bar in Colors module. The controls are not very intuitive, you may need to spend time with tuning the number of colors, labels, range, etc. to get what you need.

Hi
Thank you for your guidance. I was able to calculate the amoun of maximum displacement field for particular segment( left lung) , and I want to find this maximum value is for which displacement vector?
1- is it possible to get the displacement field for the maximum displacement field magnitude ?
2- although I was able to achieve the maximum displacement field magnitude for a particular segment (left lung) , but displacement fields still exist in all volume( like the following figure), and I want to have the displacement vectors only inside the left lung(and outside the left lung , displacement vectors be zero).how can I do this?
thanks a lot
Pictur%20e

You can highlight maximum displacement regions in 2D and 3D using “Contour” visualization method. You
can clone the transform node (using Data module / Subject hierarchy) and show one as “Glyph” and another as “Contour”.

You need to mask the displacement field image with segmentation. Steps:

  • Install SegmentEditorExtraEffects extension (it contains Mask volume effect that you’ll need to use) and restart Slicer
  • Export displacement field into a Volume node (“Displacement field”)
  • Create/import segment that contain the region where you want to keep the displacement values
  • Use Mask volume effect in Segment editor module to blank out regions of “Displacement field” volume (output volume: “Displacement Field masked”)
  • Save “Displacement Field masked” volume to nrrd file (this is needed because there is no graphical user interface available for directly converting a volume node into a grid transform node)
  • Load the just saved “Displacement Field masked” nrrd file as Transform => this transform has a displacement field that is set to 0 everywhere outside the masking segment

For future reference, if you manage to create visualizations that you needed, please post a few screenshots here.

Hi
Excuse me for my question ! but how can I Export displacement field into a Volume node (“Displacement field”) ?
thanks a lot

To export a transform to a displacement field, in Transforms module’s Convert section select a reference volume (e.g., your transformed CT), create a new Volume node for output, and click Create.

Hi
I want to load the displacement field masked in MATLAB to see the components of all displacement field masked in particular region( which was saved with nrrd format). Which format I can save it?( I could not save it with mat format!)
Thanks a lot

You can load displacement field from nrrd file to Matlab using nrrdread.m.

I would strongly encourage you to consider learning to do all processing using Python (and its many powerful libraries), instead of relying on proprietary tools such as Matlab. Until you are ready to switch, you can use MatlabBridge extension to run Matlab functions directly from Slicer.

Hi
Thank you very much for your advice. Can you guide me how to learn Python? so that I can use it in the slicer .
thanks a lot

There are many Python beginner tutorials out there, just spend a couple of days, randomly picking a few and complete them. This should help you get familiar with the syntax.

After that, you can use these training materials that are more specific to biomedical computing applications: A free biomedical image analysis and visualization 2-day course

Hi Andras,

Recently I want to combine image registration with finite element method. I intend to initially register two images (pre- and post-surgical breast mri) using intensity-based registration, and then create a cubic bounding box (an ROI extending 2~3cm on each side of the breast tumor, use segment editor module?) in the moving image.
I would like to export the dvf (generated by the intensity-based registration) of voxels right on the boundary of ROI and define them as boundary displacement constraints of fem.
I wonder how to get the dvf of specific contour (like boundary of the cubic box) of voxels. Could you give me some advice? Thank you very much.

Best regards,
Crayon