# Saving Markups Scalar values to a file

**URL:** <https://discourse.slicer.org/t/saving-markups-scalar-values-to-a-file/21287>\
**Category:** Support\
**Tags:** markups-fiducials, markups\
**Created:** [December 31, 2021, 6:58am UTC](https://discourse.slicer.org/t/saving-markups-scalar-values-to-a-file/21287 "2021-12-31T06:58:51Z")\
**Posts on this page:** 19\
**Page:** 1

<div class="post-metadata">

**Author:** ![Shambhavi\_Malik](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/shambhavi_malik/32/12961_2.png) [@Shambhavi\_Malik](https://discourse.slicer.org/u/Shambhavi_Malik)\
**Post date:** [December 31, 2021, 6:58am UTC](https://discourse.slicer.org/t/saving-markups-scalar-values-to-a-file/21287/1 "2021-12-31T06:58:51Z")

</div>

I am using the Markups and VMTK module for blood vessel centerline extraction. In the markups module, is there a method to save the blood vessel radius at each node to a file such as JSON or fcsv? In the scalars section, by selecting the radius, I get a color gradient in the 3D view so can I save the node-specific values to a file?

 ![Screenshot (52)](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/9/b/9b43ee1172ed822ea857950a65cdeaa622d2394b.png)

Upon saving the centerline fcsv file the Control Points table values are saved. So is there a way to incorporate the radius at each node also in this file?

---

<div class="post-metadata">

**Author:** ![chir.set](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/chir.set/32/66982_2.png) [@chir.set](https://discourse.slicer.org/u/chir.set)\
**Post date:** [December 31, 2021, 4:45pm UTC](https://discourse.slicer.org/t/saving-markups-scalar-values-to-a-file/21287/2 "2021-12-31T16:45:05Z")

</div>

> [@Shambhavi\_Malik](#):
>
> is there a way to incorporate the radius at each node also in this file?

You can get the diameter at each curve/model point with ‘Cross-section analysis’ module. It allows to show a table widget where you can select and copy data of your interest. Please note that each line corresponds to data measured at each curve/model point, not at curve control points.

If you really need these in the markups storage file, you would need to write some Python code for this specific task. I don’t think it would be wise to expect the markups module to do that, markups being context and purpose agnostic.

---

<div class="post-metadata">

**Author:** ![Shambhavi\_Malik](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/shambhavi_malik/32/12961_2.png) [@Shambhavi\_Malik](https://discourse.slicer.org/u/Shambhavi_Malik)\
**Post date:** [December 31, 2021, 4:48pm UTC](https://discourse.slicer.org/t/saving-markups-scalar-values-to-a-file/21287/3 "2021-12-31T16:48:36Z")

</div>

@chir.set Ok, thanks a lot I’ll try this out. Also, I have noticed that while saving a centerline curve as JSON, the radius values in the file do not accommodate for point resampling. For example, if a curve had 50 points initially and I resample to 20, the generated JSON file still shows the data for the original 50 points in regards to the radius. I don’t know if it’s some mistake that I’m making. I’m not able to figure this out.

---

<div class="post-metadata">

**Author:** ![chir.set](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/chir.set/32/66982_2.png) [@chir.set](https://discourse.slicer.org/u/chir.set)\
**Post date:** [December 31, 2021, 5:05pm UTC](https://discourse.slicer.org/t/saving-markups-scalar-values-to-a-file/21287/4 "2021-12-31T17:05:16Z")

</div>

> [@Shambhavi\_Malik](#):
>
> the radius values in the file

Ha, this discussion shows me that the radius at each control point is already saved in the JSON file, so you don’t have any problem with your initial question :

> [@Shambhavi\_Malik](#):
>
> So is there a way to incorporate the radius at each node also in this file?

> [@Shambhavi\_Malik](#):
>
> the generated JSON file still shows the data for the original 50 points in regards to the radius

I cannot confirm that. I just tried resampling a centerline curve from 22 to 15, 20, 5 control points and saved it each time. The JSON file remains coherent each time regarding the radius. Try with latest nightly build.

---

<div class="post-metadata">

**Author:** ![Shambhavi\_Malik](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/shambhavi_malik/32/12961_2.png) [@Shambhavi\_Malik](https://discourse.slicer.org/u/Shambhavi_Malik)\
**Post date:** [December 31, 2021, 5:13pm UTC](https://discourse.slicer.org/t/saving-markups-scalar-values-to-a-file/21287/5 "2021-12-31T17:13:41Z")

</div>

@chir.set ok I’ll try in that version. From where can I download it? On the website I only see stable and preview releases.

---

<div class="post-metadata">

**Author:** ![chir.set](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/chir.set/32/66982_2.png) [@chir.set](https://discourse.slicer.org/u/chir.set)\
**Post date:** [December 31, 2021, 5:17pm UTC](https://discourse.slicer.org/t/saving-markups-scalar-values-to-a-file/21287/6 "2021-12-31T17:17:47Z")

</div>

> [@Shambhavi\_Malik](#):
>
> preview releases.

It’s labelled ‘Preview’ indeed, dinos called it ‘Nightly’ long ago, sorry for the confusion.

---

<div class="post-metadata">

**Author:** ![Shambhavi\_Malik](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/shambhavi_malik/32/12961_2.png) [@Shambhavi\_Malik](https://discourse.slicer.org/u/Shambhavi_Malik)\
**Post date:** [January 1, 2022, 6:50am UTC](https://discourse.slicer.org/t/saving-markups-scalar-values-to-a-file/21287/7 "2022-01-01T06:50:32Z")

</div>

@chir.set thanks a lot! It works now. I was initially using the 4.11.20210226 version and facing problems. The latest preview release works just fine.

---

<div class="post-metadata">

**Author:** ![Shambhavi\_Malik](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/shambhavi_malik/32/12961_2.png) [@Shambhavi\_Malik](https://discourse.slicer.org/u/Shambhavi_Malik)\
**Post date:** [January 2, 2022, 8:06am UTC](https://discourse.slicer.org/t/saving-markups-scalar-values-to-a-file/21287/8 "2022-01-02T08:06:22Z")

</div>

Hi @chir.set while downsampling works just fine, upon upsampling I lose all the radius data. By upsampling from 20 to 25 control points if I save the JSON file, no radius values are given. Also upon running Cross-Sectional Analysis on the upsampled 25 points, only the point coordinates are displayed. The MIS diameter field remains blank.

 ![Screenshot (53)](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/d/3/d37becedb1c272b5bce07544e62972aa773fe41b.png)

Is there any way to solve this?  
I have tried Cross-Sectional Analysis on downsampled points and it works just fine. I’m using the latest preview version.

Also when I close 3D slicer I get such errors.  
 ![Screenshot (54)](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/3/f/3f4f8a0b28847cf5f88c4ca354e7d5ab02a5df5c.png)

---

<div class="post-metadata">

**Author:** ![chir.set](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/chir.set/32/66982_2.png) [@chir.set](https://discourse.slicer.org/u/chir.set)\
**Post date:** [January 2, 2022, 10:32am UTC](https://discourse.slicer.org/t/saving-markups-scalar-values-to-a-file/21287/9 "2022-01-02T10:32:30Z")

</div>

> [@Shambhavi\_Malik](#):
>
> while downsampling works just fine, upon upsampling I lose all the radius data. By upsampling from 20 to 25 control points if I save the JSON file, no radius values are given. Also upon running Cross-Sectional Analysis on the upsampled 25 points, only the point coordinates are displayed.

I’m afraid I have not observed this. I just tried resampling a 63 control points markups curve to 100, after re-applying in ‘Cross-section analysis’, all metrics are rightly displayed. Using 4.13.0-2021-12-31 r30519 / 5ea103f.

> [@Shambhavi\_Malik](#):
>
> Also when I close 3D slicer I get such errors.

This probably has other sources.

---

<div class="post-metadata">

**Author:** ![Shambhavi\_Malik](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/shambhavi_malik/32/12961_2.png) [@Shambhavi\_Malik](https://discourse.slicer.org/u/Shambhavi_Malik)\
**Post date:** [January 3, 2022, 7:41am UTC](https://discourse.slicer.org/t/saving-markups-scalar-values-to-a-file/21287/10 "2022-01-03T07:41:02Z")

</div>

@chir.set if possible could you upload screenshots of the process, maybe I’m going wrong somewhere.

---

<div class="post-metadata">

**Author:** ![chir.set](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/chir.set/32/66982_2.png) [@chir.set](https://discourse.slicer.org/u/chir.set)\
**Post date:** [January 3, 2022, 4:07pm UTC](https://discourse.slicer.org/t/saving-markups-scalar-values-to-a-file/21287/11 "2022-01-03T16:07:34Z")

</div>

> [@Shambhavi\_Malik](#):
>
> if possible could you upload screenshots of the process, maybe I’m going wrong somewhere.

It would be wiser for you to send a link to a video of what you’re doing. A larger audience may study your workflow and advise.

---

<div class="post-metadata">

**Author:** ![Shambhavi\_Malik](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/shambhavi_malik/32/12961_2.png) [@Shambhavi\_Malik](https://discourse.slicer.org/u/Shambhavi_Malik)\
**Post date:** [January 4, 2022, 7:34am UTC](https://discourse.slicer.org/t/saving-markups-scalar-values-to-a-file/21287/12 "2022-01-04T07:34:50Z")

</div>

Yes sure here is the workflow.  
[https://drive.google.com/file/d/1eZ-Cya0U5n1CujF7r7ZJpz1m4phuUWsp/view?usp=sharing](https://drive.google.com/file/d/1eZ-Cya0U5n1CujF7r7ZJpz1m4phuUWsp/view?usp=sharing)

---

<div class="post-metadata">

**Author:** ![Shambhavi\_Malik](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/shambhavi_malik/32/12961_2.png) [@Shambhavi\_Malik](https://discourse.slicer.org/u/Shambhavi_Malik)\
**Post date:** [January 5, 2022, 8:01am UTC](https://discourse.slicer.org/t/saving-markups-scalar-values-to-a-file/21287/13 "2022-01-05T08:01:22Z")

</div>

@chir.set could you please take a look at the workflow and let me know where I’m going wrong.

---

<div class="post-metadata">

**Author:** ![chir.set](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/chir.set/32/66982_2.png) [@chir.set](https://discourse.slicer.org/u/chir.set)\
**Post date:** [January 5, 2022, 11:14am UTC](https://discourse.slicer.org/t/saving-markups-scalar-values-to-a-file/21287/14 "2022-01-05T11:14:37Z")

</div>

> [@Shambhavi\_Malik](#):
>
> could you please take a look at the workflow and let me know where I’m going wrong.

1. I didn’t find anything wrong in the workflow itself. Repeating the same steps, I could not confirm your findings with an input model surface. The MIS diameter is always reported when the input curve is over sampled, or down sampled.

2. But I did found another problem. The module’s logic assumes that the input surface is always a segmentation node, while you are using an input model surface. This is a separate problem, I’ll fix it ASAP.

---

<div class="post-metadata">

**Author:** ![Shambhavi\_Malik](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/shambhavi_malik/32/12961_2.png) [@Shambhavi\_Malik](https://discourse.slicer.org/u/Shambhavi_Malik)\
**Post date:** [January 5, 2022, 12:36pm UTC](https://discourse.slicer.org/t/saving-markups-scalar-values-to-a-file/21287/15 "2022-01-05T12:36:02Z")

</div>

Ok, thanks for letting me know @chir.set. Is there any work around this issue that I’m facing?

---

<div class="post-metadata">

**Author:** ![Shambhavi\_Malik](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/shambhavi_malik/32/12961_2.png) [@Shambhavi\_Malik](https://discourse.slicer.org/u/Shambhavi_Malik)\
**Post date:** [January 5, 2022, 4:07pm UTC](https://discourse.slicer.org/t/saving-markups-scalar-values-to-a-file/21287/16 "2022-01-05T16:07:52Z")

</div>

Also, I have noticed that the centerline curves with sharp nodes such as those in Centerline Curve (1) have this issue of not generating radius upon upsampling.  
I don’t know how but the Centerline Curve (0) has curved changes at nodes and this one works fine upon upsampling as you had mentioned. So is there a method to convert the sharp nodes of Centerline Curve (1) to be the same as those of Centerline Curve (0)? I don’t see any differences in their properties.

 ![Screenshot (55)](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/5/d/5d66166291b19b895ec0682551677a3d2132c1d6.png)

---

<div class="post-metadata">

**Author:** ![chir.set](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/chir.set/32/66982_2.png) [@chir.set](https://discourse.slicer.org/u/chir.set)\
**Post date:** [January 5, 2022, 4:42pm UTC](https://discourse.slicer.org/t/saving-markups-scalar-values-to-a-file/21287/17 "2022-01-05T16:42:54Z")

</div>

> [@Shambhavi\_Malik](#):
>
> Is there any work around this issue that I’m facing?

Not to my knowledge unfortunately.

---

<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:** [January 5, 2022, 9:16pm UTC](https://discourse.slicer.org/t/saving-markups-scalar-values-to-a-file/21287/18 "2022-01-05T21:16:59Z")

</div>

If you can upload an example file where scalar (static control point measurement) interpolation does not work as expected then I can have a look.

---

<div class="post-metadata">

**Author:** ![Shambhavi\_Malik](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/shambhavi_malik/32/12961_2.png) [@Shambhavi\_Malik](https://discourse.slicer.org/u/Shambhavi_Malik)\
**Post date:** [January 13, 2022, 6:15am UTC](https://discourse.slicer.org/t/saving-markups-scalar-values-to-a-file/21287/19 "2022-01-13T06:15:07Z")

</div>

Hi @lassoan. Apologies for the delayed response. The problem does not occur when I separately load a centerline curve file. Upon loading the files separately, each centerline curve has non-static control points. But if I perform Centerline Extraction and then immediately try to modify the control points, I face this issue. Only the 0th centerline curve is non-static and works as it is supposed to. The rest are composed of static control points and show problems. Then when I save these files and load them again, they all are non-static and work fine.
