# Calculate thickness of thin muscle

**URL:** <https://discourse.slicer.org/t/calculate-thickness-of-thin-muscle/13444>\
**Category:** Support\
**Created:** [September 11, 2020, 5:42pm UTC](https://discourse.slicer.org/t/calculate-thickness-of-thin-muscle/13444 "2020-09-11T17:42:43Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![lmach](https://avatars.discourse-cdn.com/v4/letter/l/ecae2f/32.png) [@lmach](https://discourse.slicer.org/u/lmach)\
**Post date:** [September 11, 2020, 5:42pm UTC](https://discourse.slicer.org/t/calculate-thickness-of-thin-muscle/13444/1 "2020-09-11T17:42:43Z")

</div>

![thickness_all3steps](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/f/a/fa42ad9e73a2e539bc2cc575a90ff27ad4293559.png)

Hi!

I want to measure the thickness/distance between the inner and outer boundary of a muscle that I have segmented. I have followed the workflow from this link: [How to analyze the thickness of the model](https://discourse.slicer.org/t/how-to-analyze-the-thickness-of-the-model/2735)

Now, I am not sure of how to interpret my result… Does the different colours illustrate different thicknesses, e.g. the red color is the thickest and the blur color is the thinnest?

I also want to know the specific thickness (as a value, not a colour) in a certain position in the muscle, how can I achieve this?

Thanks in advance!

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [September 11, 2020, 7:35pm UTC](https://discourse.slicer.org/t/calculate-thickness-of-thin-muscle/13444/2 "2020-09-11T19:35:58Z")

</div>

Coloring does not seem to correspond to thickness.

Which method did you try? (several workflows are described in the referenced page)

If you compute a skeleton labelmap: Since the segmented structure is very thin compared to its extent, you probably need to use a finer resolution labelmap than the one generated by default.

You may also give VMTK extension’s centerline extraction a try (as a preprocessing step, it extracts Voronoi diagram, which is a kind of medial surface and its thickness).

You can get numerical reading from values associated with scalar points with a short Python code snippet as shown [here](https://www.slicer.org/wiki/Documentation/Nightly/ScriptRepository#Get_scalar_values_at_surface_of_a_model).

---

<div class="post-metadata">

**Author:** ![lmach](https://avatars.discourse-cdn.com/v4/letter/l/ecae2f/32.png) [@lmach](https://discourse.slicer.org/u/lmach)\
**Post date:** [September 14, 2020, 10:48am UTC](https://discourse.slicer.org/t/calculate-thickness-of-thin-muscle/13444/3 "2020-09-14T10:48:38Z")

</div>

Thanks for your reply, and sorry for the unclearness. I tried your described workflow here:

> [@How to analyze the thickness of the model](https://discourse.slicer.org/t/how-to-analyze-the-thickness-of-the-model/2735/2):
>
> “Thickness” is not a very well defined term for models (surface meshes), but for shell-like meshes it is probably not too difficult to estimate it robustly and accurately. Potential approaches: A. Extract medial surface and estimate thickness as 2x of distance from medial surface. There are various ways of computing these in Slicer. One possible workflow: Compute medial surface using Simple Filters module - BinaryThinningImageFilter. Compute distance map using Simple Filters module - Daniels…

And since I followed your method, I got similar results as in your example, except for the thin green line that your example has but not mine… I suppose that is the actual medial surface? If so, what does the colours red, green and blue illustrate?

I will look into your tips, thanks!

---

<div class="post-metadata">

**Author:** ![lmach](https://avatars.discourse-cdn.com/v4/letter/l/ecae2f/32.png) [@lmach](https://discourse.slicer.org/u/lmach)\
**Post date:** [September 16, 2020, 6:47am UTC](https://discourse.slicer.org/t/calculate-thickness-of-thin-muscle/13444/4 "2020-09-16T06:47:42Z")

</div>

Hi, I am still trying to figuring out what my result of your workflow ([How to analyze the thickness of the model](https://discourse.slicer.org/t/how-to-analyze-the-thickness-of-the-model/2735/2)) means… What does the colours mean and how do I get the exact medial surface (that I assume is the thin green line in your example) ?

I am also trying to compute a skeleton labelmap, but I can’t find it in “Representations” under Segmentations-module, even if I have installed SlicerRT to get additional representations. How can I add this skeleton labelmap?

Thanks!

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [September 21, 2020, 4:42am UTC](https://discourse.slicer.org/t/calculate-thickness-of-thin-muscle/13444/5 "2020-09-21T04:42:02Z")

</div>

> [@lmach](#):
>
> except for the thin green line that your example has but not mine… I suppose that is the actual medial surface?

The green points are voxels of the skeletonized labelmap, which are indeed points of the medial surface (points that are at the same distance from nearest boundary points). You can show them by displaying the “Extract skeleton” module’s “Output Image” in a slice view.

---

<div class="post-metadata">

**Author:** ![lmach](https://avatars.discourse-cdn.com/v4/letter/l/ecae2f/32.png) [@lmach](https://discourse.slicer.org/u/lmach)\
**Post date:** [September 22, 2020, 10:04am UTC](https://discourse.slicer.org/t/calculate-thickness-of-thin-muscle/13444/6 "2020-09-22T10:04:40Z")

</div>

Thanks for your reply, I sort of managed to get the skeleton but I do not get a complete curve of the skeleton (I just get these dots) with these parameters in “Extract skeleton” module:  
Skeleton type: 1D  
Do not prune branches: yes  
Number of points: 9000000

 ![thickness_skeleton](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/e/d/edd7b9ee8d4123d939b06eeaf3f112c4b300e608.png)

How do I get a complete curve?  
And if I achieve this curve, how do I get the thickness in your described way?  
You mentioned:

> [@How to analyze the thickness of the model](https://discourse.slicer.org/t/how-to-analyze-the-thickness-of-the-model/2735/2):
>
> Extract medial surface and estimate thickness as 2x of distance from medial surface

Am I supposed to use the Ruler and just measure the distance, or is there a more accurate way to measure the thickness?

---

<div class="post-metadata">

**Author:** ![lmach](https://avatars.discourse-cdn.com/v4/letter/l/ecae2f/32.png) [@lmach](https://discourse.slicer.org/u/lmach)\
**Post date:** [September 20, 2020, 4:08pm UTC](https://discourse.slicer.org/t/calculate-thickness-of-thin-muscle/13444/7 "2020-09-20T16:08:54Z")

</div>

![thickness_all3steps](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/f/a/fa42ad9e73a2e539bc2cc575a90ff27ad4293559.png)

Hi, I have previously posted a question about how to measure the thickness ([Calculate thickness of thin muscle](https://discourse.slicer.org/t/calculate-thickness-of-thin-muscle/13444)) but did not come to any solution. I have followed this workflow: [How to analyze the thickness of the model - #2 by lassoan](https://discourse.slicer.org/t/how-to-analyze-the-thickness-of-the-model/2735/2) and I got the result as in the attached image. It seems like the inner and outer boundary are colored, but where is the medial surface? I need it so that I can measure the thickness (distance between inner and outer boundary) of this segment. After following the workflow, what does the colors indicate?

Thanks in advance!

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [September 21, 2020, 4:54am UTC](https://discourse.slicer.org/t/calculate-thickness-of-thin-muscle/13444/8 "2020-09-21T04:54:46Z")

</div>

If you just need surface thickness then using the method described [here](https://discourse.slicer.org/t/how-to-analyze-the-thickness-of-the-model/2735/2) should work (probably you just need to increase resolution of your distance map).

If you need medial surface then there are a few options, for example:

- you can get approximate medial surface (Voronoi diagram) from “Extract Centerline” module in [SlicerVMTK extension](https://github.com/vmtk/SlicerExtension-VMTK)
- try S-reps in SlicerSalt extension: see [this page](https://salt.slicer.org/documentation/), for tutorial on “[Shape analysis via skeletal models](http://bit.ly/30MiJ6v)”

---

<div class="post-metadata">

**Author:** ![lmach](https://avatars.discourse-cdn.com/v4/letter/l/ecae2f/32.png) [@lmach](https://discourse.slicer.org/u/lmach)\
**Post date:** [September 22, 2020, 11:29am UTC](https://discourse.slicer.org/t/calculate-thickness-of-thin-muscle/13444/9 "2020-09-22T11:29:03Z")

</div>

> [@lassoan](#):
>
> If you just need surface thickness then using the method described [here](https://discourse.slicer.org/t/how-to-analyze-the-thickness-of-the-model/2735/2) should work (probably you just need to increase resolution of your distance map).

Yes, that is the exact method that I have used and what is shown in the image in my first post.

Now I want to get a value of the thickness, which I tried to do with your suggestion:

> [@lassoan](#):
>
> You can get numerical reading from values associated with scalar points with a short Python code snippet as shown [here](https://www.slicer.org/wiki/Documentation/Nightly/ScriptRepository#Get_scalar_values_at_surface_of_a_model).

And I got these values:

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/8/a/8aae523eec86fc2aa3ad94b62b81ed5f15d90a2c.png)

The values does not make sense; there are three values and some of them are negative. I just thought I would get exact one value for the thickness? How are the printed values related to the thickness?

Thanks for the help!

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [September 22, 2020, 12:13pm UTC](https://discourse.slicer.org/t/calculate-thickness-of-thin-muscle/13444/10 "2020-09-22T12:13:46Z")

</div>

Your mesh can contain many different arrays associated with points and cells. The [example](https://www.slicer.org/wiki/Documentation/Nightly/ScriptRepository#Get_scalar_values_at_surface_of_a_model) prints out surface normal direction - see this line:

```auto
...
modelPointValues = modelNode.GetPolyData().GetPointData().GetArray("Normals")
...

```

If you want to print the surface thickness, change `Normals` to the array name that contains distance. You can see list of available arrays in Models module / Display / Scalars / Active Scalar.

---

<div class="post-metadata">

**Author:** ![lmach](https://avatars.discourse-cdn.com/v4/letter/l/ecae2f/32.png) [@lmach](https://discourse.slicer.org/u/lmach)\
**Post date:** [September 22, 2020, 12:58pm UTC](https://discourse.slicer.org/t/calculate-thickness-of-thin-muscle/13444/11 "2020-09-22T12:58:29Z")

</div>

Thank you very much for your help, I changed the array name to what I think contains the distance (array name:“ImageScalars”) and now the values makes more sense. However, I am not sure if the printed value is the actual thickness. If I move the cursor in range A, then then value is 6.7 and if the cursor is in range B, then the value is 7.4. None of these values are close to the actual distance, which I measure with the Ruler to be 0.8811mm.

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/e/5/e5e4537dd6bbefe10a5332638d0b178cb5191d95.png)

Do you have any idea why these values are so off from the measured distance? Is it correct if range A is the distance between the medial surface to outer boundary while range B is the distance between the medial surface and the inner boundary?

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [September 22, 2020, 10:06pm UTC](https://discourse.slicer.org/t/calculate-thickness-of-thin-muscle/13444/12 "2020-09-22T22:06:30Z")

</div>

> [@lmach](#):
>
> Do you have any idea why these values are so off from the measured distance?

Yes. As I wrote before, in the other topic that you opened on this question, you need to increase the resolution of the segmentation (default resolution is not enough for your model, as it is very thin relative to how large its extents are). See step step-by-step instructions here: [Segmentations — 3D Slicer documentation](https://slicer.readthedocs.io/en/latest/user_guide/modules/segmentations.html#import-an-existing-segmentation-from-model-surface-mesh-file) (“If the model contains very thin and delicate structures…”).

For accurate thickness estimation, spacing of the internal binary labelmap representation of the segmentation should be at least 5-10x smaller than the thickness of your surface.

If you find that oversampling value that gives you accurate enough results surpasses capabilities of your computer then you can use other proposed approaches (VMTK’s Extract Centerline or SlicerSALT’s skeletal representation), which do not require rasterization of the model.

---

<div class="post-metadata">

**Author:** ![lmach](https://avatars.discourse-cdn.com/v4/letter/l/ecae2f/32.png) [@lmach](https://discourse.slicer.org/u/lmach)\
**Post date:** [September 23, 2020, 6:39pm UTC](https://discourse.slicer.org/t/calculate-thickness-of-thin-muscle/13444/13 "2020-09-23T18:39:53Z")

</div>

Thank you, I really appreciate all the help that I have got from you. I will now try to increase the resolution of the segmentation with your suggestions!

---

<div class="post-metadata">

**Author:** ![Randika\_Perera](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/randika_perera/32/15308_2.png) [@Randika\_Perera](https://discourse.slicer.org/u/Randika_Perera)\
**Post date:** [May 16, 2022, 11:01am UTC](https://discourse.slicer.org/t/calculate-thickness-of-thin-muscle/13444/14 "2022-05-16T11:01:45Z")

</div>

Hi @lassoan , apparently the link which describes surface thickness measuring method using python, is no longer working. Could you please attach the updated link? really appreciate the help.

---

<div class="post-metadata">

**Author:** ![mikebind](https://avatars.discourse-cdn.com/v4/letter/m/71e660/32.png) [@mikebind](https://discourse.slicer.org/u/mikebind)\
**Post date:** [May 16, 2022, 9:28pm UTC](https://discourse.slicer.org/t/calculate-thickness-of-thin-muscle/13444/15 "2022-05-16T21:28:12Z")

</div>

It is at the updated page that link points to:

[https://slicer.readthedocs.io/en/latest/developer\_guide/script\_repository.html#get-scalar-values-at-surface-of-a-model](https://slicer.readthedocs.io/en/latest/developer_guide/script_repository.html#get-scalar-values-at-surface-of-a-model)
