Saving Markups Scalar values to a file

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?

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?

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.

@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.

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 :

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.

@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.

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

@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.

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.

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)

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.

This probably has other sources.

@chir.set 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.

Yes sure here is the workflow.

@chir.set 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.

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

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.

Not to my knowledge unfortunately.

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.

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.