Comments (9)
@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.
from dicom.
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.
@suyashkumar As a potential fix like you described above, what do you think about:
- Adding a force boolean to the parser struct which can be set through a setter function (or directly, whichever is preferred)
- Adding a default value of the force boolean as false with something like this implementation
- 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.
@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.
@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.
@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.
cc: @wkoszek in case you may have the citation handy
from dicom.
@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.
Closing this out due to the fixes in #127. Let me know if we're missing anything here!
from dicom.
Related Issues (20)
- File with dicom seg throws an error - writing dicom file: unsupported BitsPerSample value
- Converting DICOM to Image results into "blacked" image HOT 4
- using dicom.Parse function ,unexpected EOF HOT 1
- Write element with sequence item or nested sequence HOT 2
- The reason why the converted DICOM displays as blank after converting from RAW format might be attributed to the following factors: HOT 1
- Rewrite & Update README
- Remove Mocks
- Refactor internal-only packages into internal/
- Refactor PixelDataInfo API
- Remove dicomio.Reader interface in favor of dicomio.Reader direct struct
- Consider deprecating top level bytesLimit in Parse() API in favor of always parsing until EOF.
- Write API: When using WriteElement API, ensure proper transfer syntax is used to encode the data (Write() works fine)
- Support deflate transfer syntax writes
- Add write benchmarks
- Consider Parse API refactor HOT 1
- Improve support for non-compliant DICOM and edge cases HOT 8
- write: option to override default missing transfer syntax in dicom (mostly useful for testing, since users could just update the uid in the dataset)
- For missing Transfer Syntax UID fallback, should we also try reading with a deflated syntax?
- Error when parsing with Little Endian Explicit transfer syntax HOT 2
- Support for RGB for pixeldata HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dicom.