-
-
Notifications
You must be signed in to change notification settings - Fork 138
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/date time helper methods #189
base: main
Are you sure you want to change the base?
Feature/date time helper methods #189
Conversation
I've just pushed an update to this followup that tweaks and adds a couple methods so that you can form a few common interfaces between the dcmtime types. For instance, you can now write a helper function like this: // DCMTime is a common interface for dcmtime.Date, dcmtime.Time, and dcmtime.Datetime.
type DCMTime interface {
GetTime() time.Time
GetPrecision() dcmtime.PrecisionLevel
DCM() string
}
func InspectDICOMTimeVal(value DCMTime) error {
// Do something with this value
return nil
} The main addition here is adding a I realize that I am kind of bloating this PR, so let me know if you would like me to try and break this up into smaller PRs. |
Opening this as a draft, but if you like the API, I think it's ready to be a full PR.
This PR adds several helper methods to the Date, Time, and Datetime types. The work I do involves manipulating DICOM dates and times pretty frequently, so I thought it might be nice to add some quality-of-life features to follow up on the groundwork of #171
Since not all values on a given [Type].Time field are valid due to low precision of the source values, I've added methods for the relevant time values that also report their presence.
Each type has also received a general method to easily check whether a value has at least some precision value.
An example using Datetime:
A method has also been added to both the Date and Time types to combine a Date value and a Time value into a single Datetime value:
Both #186 and #188 have been merged into this branch already.