Giter Site home page Giter Site logo

Comments (9)

gofal avatar gofal commented on June 20, 2024 1

I would prefer that variant, that is dicom-conform but also makes sure that the generated data can be processed correctly.
If you generate a file with only the dot as a DS value and then open this file in other tools/applications, are they then able to parse this value, or would it cause issues. I will give it a try.

from fo-dicom.

mrbean-bremen avatar mrbean-bremen commented on June 20, 2024

I think you are right - I could not find any mention that this is not allowed, and any regex that checks for floating point numbers I could find allows for leading zeros.
Quite easy to fix...

from fo-dicom.

gofal avatar gofal commented on June 20, 2024

Well, I also agree, that this seems to be a valid DS.

from fo-dicom.

gofal avatar gofal commented on June 20, 2024

I will move comment from the PR to this issue:
The definition of DS says "A fixed point number shall contain only the characters 0-9 with an optional leading "+" or "-" and an optional "." to mark the decimal point". it does not say that it shall contain at least one character 0-9. So would the text "." be a valid DS?

from fo-dicom.

mrbean-bremen avatar mrbean-bremen commented on June 20, 2024

That is a good question. I would say no by gut feeling, but still couldn't find an official definition. Unofficially, there are several regexes that do not allow this, for example this one which has a good explanation in the comments.
Our own regex is more permissive and allows that, but I would tend to change that...

from fo-dicom.

mrbean-bremen avatar mrbean-bremen commented on June 20, 2024

After more reading and thinking, I actually changed my mind.
I'm now inclined to remain more permissive. There seems to be no real standard in the textual representation of floating point numbers, at least concerning the presence of digits around the dot. The representation I linked does not allow for something like 123., which I would consider valid. Given that all these strings (including a single dot) unambiguously define numbers, and the DICOM standard says nothing about it, I think we can leave the regex as permissive as it is now.

from fo-dicom.

mrbean-bremen avatar mrbean-bremen commented on June 20, 2024

@gofal: I suggest to either leave the regex as is in the PR, or change the first part from "^[+-]?((\d*)([.]\d*)?|[.]\d+) to something like "^[+-]?((\d+(\.\d*)?)|(\.\d+)), which would not allow a single dot, but would allow a leading or trailing dot. What do you think?

from fo-dicom.

gofal avatar gofal commented on June 20, 2024

I tried Orthanc, ClearCanvas and MicroDicom, they all three do not parse "." as a valid DS number.
e.g. if I set a value to "0.0" or "0." or ".0", then the value is displayed as "0". but if I set the value to ".", then microdicom only shows "."
Orthanc refuses to process a file where I set the WindowCenter to "." and want to upload it via OrthancExplorer.
And ClearCanvas ignores the WindowCenter "." and estimates the Windowing from histrogram.

I stop evaluating now, and I would recommand, to throw a validation exception, if a user wants to add "." as a DS value.

from fo-dicom.

mrbean-bremen avatar mrbean-bremen commented on June 20, 2024

Ok, thanks - I will change the regex as proposed above.

from fo-dicom.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.