# Measuring angles from vector field

**URL:** <https://discourse.slicer.org/t/measuring-angles-from-vector-field/12299>\
**Category:** Support\
**Created:** [June 30, 2020, 3:01pm UTC](https://discourse.slicer.org/t/measuring-angles-from-vector-field/12299 "2020-06-30T15:01:28Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Yordano\_Jimenez](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/yordano_jimenez/32/5858_2.png) [@Yordano\_Jimenez](https://discourse.slicer.org/u/Yordano_Jimenez)\
**Post date:** [June 30, 2020, 3:01pm UTC](https://discourse.slicer.org/t/measuring-angles-from-vector-field/12299/1 "2020-06-30T15:01:28Z")

</div>

Hi all,

I am vertebrate morphologist using Slicer to segment bones and muscles (from contrast-stained specimens).

I am currently in need of help with the following: I have segmented a chunk of muscle, analyzed its fiber tracks in a software by Heiko Stark ([https://stark-jena.de/research-interests/software/](https://stark-jena.de/research-interests/software/)), and now have an output file with a vector field. Is there a way to measure these angles in bulk fashion relative to custom planes and not relative to CT space?

I should also mention that I have the vector field data in multiple file formats (txt, obj, track, etc.), but I don’t know which would be best for taking my measurements.

Any help would be greatly appreciated!!

 ![myomere1_fibers_JUN29](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/4/8/483669e47f473b44010c04a726eaa7bb744b0716.png)

---

<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:** [June 30, 2020, 3:19pm UTC](https://discourse.slicer.org/t/measuring-angles-from-vector-field/12299/2 "2020-06-30T15:19:00Z")

</div>

Is the vector field specified on a point set (points of a surface mesh or unstructured volumetric mesh) or a volume (dense rectilinear grid)?

Once you have loaded the data, computation of an angle between a plane and vectors is trivial, it should be just a couple of lines of Python script.

---

<div class="post-metadata">

**Author:** ![Yordano\_Jimenez](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/yordano_jimenez/32/5858_2.png) [@Yordano\_Jimenez](https://discourse.slicer.org/u/Yordano_Jimenez)\
**Post date:** [June 30, 2020, 3:34pm UTC](https://discourse.slicer.org/t/measuring-angles-from-vector-field/12299/3 "2020-06-30T15:34:48Z")

</div>

It is specified on a volume, I think.

How would I go about extracting the position of the desired plane in order to perform the calculations in Python? For example, I would like to import a scene with the entire scan and then measure angles relative to the frontal plane and sagittal plane.

One final question, is it possible to measure relative to a curved plane? The CT scan has a fish in a bent position, so a straight reference plane would yield undesired measurements.

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

---

<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:** [June 30, 2020, 9:19pm UTC](https://discourse.slicer.org/t/measuring-angles-from-vector-field/12299/4 "2020-06-30T21:19:00Z")

</div>

> [@Yordano\_Jimenez](#):
>
> One final question, is it possible to measure relative to a curved plane? The CT scan has a fish in a bent position, so a straight reference plane would yield undesired measurements.

This should be no problem at all. I would straighten the volume using Curved Planar Reformatting module (in Sandbox extension) and then compute everything on the straightened volume. See for example this post:

> [@How to implement CPR (curved planar reconstruction) from centerline?](https://discourse.slicer.org/t/how-to-implement-cpr-curved-plannar-reconstruction-from-centerline/9456/7):
>
> Hi Andras, Sometimes people end up having to scan coiled snakes, or fish that are in little jars. Depending on what they need to do with it, they may have to ‘straighten’ the specimen. Is there a way this CPR can be generalized for such use cases? [image] [image]
