/tags /simplified-tags shows numeric values as quotes strings

Hi!

This is my first time here in this forum. Many kudos to the developers / support community of this great project!

I’ve noticed that Orthanc’s REST API endpoints such as /tags or /simplified-tags returns a lot of numeric values as “string”.

/tags

  • 0028,1050:

    {- Name: “WindowCenter”,

    • Type: “String”,

    • Value: “6806”
      },

  • 0028,1051:

    {- Name: “WindowWidth”,

    • Type: “String”,

    • Value: “13611”
      },

/simplified-tags

  • WindowCenter: “6806”,

  • WindowWidth: “13611”

Some dicom header parsing tools (like nodejs’s dicom.decoder) converts vr:DS values as either JSON “Number”. Guessing from the “Type: String” listed in the /tags output, Orthanc treats vr:DS as a just plain “string”.

Is it possible to treat vr:DS (and other similar numeric-like values) as numeric value, and output as JSON Number values? This allows me to feed most of data directly to Javascript libraries like Highchart which expects “data” values as Javascript Number.

Thank you!
Soichi

The problem with this is that you hide the original value from the caller. The original value could be an empty string “” or a string that doesn’t convert to a number. Doesn’t Highchart let you specify a function which can do this conversion for you?

Chris

Chris,

Thanks for your response. Yes, I am basically converting them to the number (for fields that I know that should be number) before passing it to Highchart. I don’t think Highchart takes non-numeric data for numerical graphs though - it’s not really about formatting of the data in this case.

For the original “string” representation, I think user can still use /tags API to get to the (raw) original values. For /simplified-tags though, if the field is expected to be numeric (as suggested by vr:DS field type), then it should be converted to numeric - just like other dicom header parsing libraries do.

Thanks!

Soichi

Hello,

As the value representation “DS” encodes a string [1], Orthanc sticks to the standard and returns a string. It is up to the client to make the conversion (e.g. with parseFloat() in JavaScript).

I know that, depending on personal preferences, one might expect an automatic conversion, but the choice of the Orthanc project is to be the least intrusive as possible.

Thanks for the feedback,
Sébastien-

[1] http://medical.nema.org/dicom/2013/output/chtml/part05/sect_6.2.html