Replies: 1 comment 4 replies
-
The library does not guarantee that reading a DICOM file and writing it back will result in an identical copy of the original file. Depending on some factors, it may choose to change file meta information based on the implementation and tweak elements such as re-encode data element lengths (e.g. rounding to the next even, or going from defined length sequence to undefined length SQs). On the other hand, that sample code exhibits at least two concerns:
My quick analysis of those files:
I'm not sure if this answers the question, but we can try to narrow the problem down a bit more to specific cases and see what can be done better in those. I greatly appreciate your effort so far in finding these cases, so that the software can be more robust over time. |
Beta Was this translation helpful? Give feedback.
-
I recently tried reading a file to myself and saving it, just to see if the resulting file was identical.
In many cases it turned out to be identical, but not always.
Code which I used:
There are 3 places which may panic:
let res2 = from_reader(std::io::Cursor::new(item_to_dump.clone())).unwrap();
- will panic if cannot read file, saved by dicom-rsassert_eq!(hash_map.len(), hash_map2.len(), "DIFFERENT CONTENT, Different number of items");
- will panic if there is tag mismatchassert_eq!(item.value(), item2.value(), "DIFFERENT CONTENT, tag: {:?}", tag);
- will panic if tags have different contentFor first item I found this file - compressed.zip
which properly loads at first time, but after saving via dicom-rs, fails to load
For second item(removed tag) I found this file - compressed.zip
For third item, I found such files - compressed.zip
or
or
Are these bugs, or does this library allow you to remove changing some of the tags on import/save?
Beta Was this translation helpful? Give feedback.
All reactions