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

Feature/Value.IsZero method #196

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

bpeake-illuscio
Copy link
Contributor

Hello!

Opening this as a draft in case you feel it does not belong in the lib.

When extracting information from Dicom Element values, I often find it necessary to make sure that a value is not "empty" or "zero"; that is that the value provided is an actual value.

A few examples would be a PatientName value of "", a Rows or Columns value of 0, or a OB element with no actual bytes present.

This PR adds an IsZero() method to value that checks if the inner value is actually a zero-value.

Example Usage:

var patientName string
if element.Value.IsZero() {
	patientName = "[UNKNOWN]"
} else {
	patientName = element.Value.GetValue().([]string)[0]
}

This PR will likely have merge conflicts with #195 . If you end up liking both of them, feel free to merge either one, then I can update the other to resolve any merge conflicts that occur.

Thanks!

As a side note: a lot of these PRs are groundwork I am using for a value decoder helper-type I am using internally. If you would be interested in seeing what I am tinkering on there, I could open a draft PR with it, as I think it might make a nice addition to the lib. Let me know!

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.

None yet

2 participants