Code Monkey home page Code Monkey logo

Comments (9)

IChocked avatar IChocked commented on August 20, 2024 2

@suyashkumar I've provided some test files from the dicom4android repo that I was able to reproduce this error with. They appear to have problems in addition to this error (for example, some are missing the header data and thus would invoke issue 53 because that tag wouldn't be there). However, we have DICOMs that conform to the standard except in the way described in this issue.

issue59.zip

from dicom.

suyashkumar avatar suyashkumar commented on August 20, 2024

Hm, this is an interesting one. Checking for this magic word is a good way to ensure you're actually reading a DICOM and that it isn't malformed. One option we can provide is a force option or flag that will not hard fail on this check, but might fail in other ways downstream since we don't have this magic word.

from dicom.

IChocked avatar IChocked commented on August 20, 2024

@suyashkumar As a potential fix like you described above, what do you think about:

  1. Adding a force boolean to the parser struct which can be set through a setter function (or directly, whichever is preferred)
  2. Adding a default value of the force boolean as false with something like this implementation
  3. Adding an && p.force == false case the if statement that throws the 'header not found' error, or some logic to log it as a non fatal error and not return. For example, inside of the if statement above, something like:
    if s := p.decoder.ReadString(4); s != "DICM" { if p.force { log error and continue } else { fatal error and return } }

from dicom.

suyashkumar avatar suyashkumar commented on August 20, 2024

@IChocked this approach seems reasonable to me, and thank you for raising this issue.

Regarding the default false value, the zero values for booleans is false anyway, so just adding it to the struct should be fine.

Note the following code after that if statement expects that the other preamble tags appear in a certain order. If this is not the case, that may lead to failures as well.

@IChocked are you interested in submitting a PR for this? If not I can take care of it as well!

from dicom.

IChocked avatar IChocked commented on August 20, 2024

@suyashkumar Yeah, I'd definitely be interested in submitting a PR for this! I'll get on it and submit something as soon as I can

from dicom.

suyashkumar avatar suyashkumar commented on August 20, 2024

@IChocked do you have a data citation for the files you uploaded earlier? I'd like to include them in the testfiles for this repo if possible :).

I think I have a semi-elegant fix for this in the v1.0 API

from dicom.

suyashkumar avatar suyashkumar commented on August 20, 2024

cc: @wkoszek in case you may have the citation handy

from dicom.

wkoszek avatar wkoszek commented on August 20, 2024

@suyashkumar We don't know where https://github.com/dragonlet/dicom4android took them from. I found this repo by accident, and it happened to have the exact same problem as the problem we had experienced in production.

from dicom.

suyashkumar avatar suyashkumar commented on August 20, 2024

Closing this out due to the fixes in #127. Let me know if we're missing anything here!

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