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

Revamp DICOM datetime #453

Merged
merged 23 commits into from
Mar 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
125 changes: 125 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ keywords = ["dicom"]
readme = "README.md"

[dependencies]
chrono = { version = "0.4.31", default-features = false, features = ["std"] }
chrono = { version = "0.4.31", default-features = false, features = ["std", "clock"] }
itertools = "0.12"
num-traits = "0.2.12"
safe-transmute = "0.11.0"
Expand Down
15 changes: 4 additions & 11 deletions core/src/header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ use crate::value::{
CastValueError, ConvertValueError, DataSetSequence, DicomDate, DicomDateTime, DicomTime,
InMemFragment, PrimitiveValue, Value, C,
};
use chrono::FixedOffset;
use num_traits::NumCast;
use snafu::{ensure, Backtrace, Snafu};
use std::borrow::Cow;
Expand Down Expand Up @@ -503,11 +502,8 @@ where
///
/// Returns an error if the value is not primitive.
///
pub fn to_datetime(
&self,
default_offset: FixedOffset,
) -> Result<DicomDateTime, ConvertValueError> {
self.value().to_datetime(default_offset)
pub fn to_datetime(&self) -> Result<DicomDateTime, ConvertValueError> {
self.value().to_datetime()
}

/// Retrieve and convert the primitive value into a sequence of date-times.
Expand All @@ -517,11 +513,8 @@ where
///
/// Returns an error if the value is not primitive.
///
pub fn to_multi_datetime(
&self,
default_offset: FixedOffset,
) -> Result<Vec<DicomDateTime>, ConvertValueError> {
self.value().to_multi_datetime(default_offset)
pub fn to_multi_datetime(&self) -> Result<Vec<DicomDateTime>, ConvertValueError> {
self.value().to_multi_datetime()
}

/// Retrieve the items stored in a sequence value.
Expand Down
1 change: 1 addition & 0 deletions core/src/prelude.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@

pub use crate::{dicom_value, DataElement, DicomValue, Tag, VR};
pub use crate::{header::HasLength as _, DataDictionary as _};
pub use crate::value::{AsRange as _, DicomDate, DicomTime, DicomDateTime};
Loading
Loading