Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add some robustness in meta file group reading #29

Merged
merged 2 commits into from
Dec 27, 2019
Merged

Conversation

Enet4
Copy link
Owner

@Enet4 Enet4 commented Dec 19, 2019

Resolves #28.

  • allow file meta group attributes in arbitrary order
  • allow missing File Meta Information Version (the default is (00H, 01H))

CC @ibaryshnikov

- allow file meta group attributes in arbitrary order
- allow missing information version
@Enet4 Enet4 changed the title [object] #28 Robustness in meta file group Add some robustness in meta file group reading Dec 19, 2019
Comment on lines 199 to +200
// unknown tag, do nothing
// could be an unsupported or non-standard attribute
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small nit, they're reserved
Values of all Tags (0002,xxxx) are reserved for use by this Standard and later versions of DICOM.
which mentioned below the table on http://dicom.nema.org/medical/dicom/current/output/chtml/part10/chapter_7.html#table_7.1-1

Copy link
Owner Author

@Enet4 Enet4 Dec 19, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well yes, but with this comment I am keeping two possible cases in mind:

  • the standard is extended to admit more file meta attributes, but the library does not know them yet;
  • a pseudo-DICOM producer invents its own attribute within the same group.

In either case, nothing happens, but in the future we might be interested in logging it differently from the case below this one.

@@ -372,7 +345,10 @@ impl FileMetaTableBuilder {
.ok_or_else(|| Error::InvalidFormat)?;
let information_version = self
.information_version
.ok_or_else(|| Error::InvalidFormat)?;
.or_else(|| {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unwrap_or_else may be handy here

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed, thanks! For some reason my IDE did not suggest me that method.

@ibaryshnikov
Copy link
Contributor

Awesome work! I'm going to try this branch, will share the results soon

@ibaryshnikov
Copy link
Contributor

I've just tested it, #28 is fixed in this pr

to provide a default file meta information version
@Enet4
Copy link
Owner Author

Enet4 commented Dec 19, 2019

Thank you for testing, @ibaryshnikov!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Handling Tag(0x0002, 0x0002) in FileMetaTable
2 participants