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

[pixeldata] Handle empty NumberOfFrames tags #576

Merged
merged 1 commit into from
Oct 23, 2024
Merged
Changes from all commits
Commits
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
6 changes: 5 additions & 1 deletion pixeldata/src/attribute.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! Utility module for fetching key attributes from a DICOM object.

use dicom_core::{DataDictionary, Tag};
use dicom_core::{header::HasLength, DataDictionary, Tag};
use dicom_dictionary_std::tags;
use dicom_object::{mem::InMemElement, FileDicomObject, InMemDicomObject};
use snafu::{ensure, Backtrace, OptionExt, ResultExt, Snafu};
Expand Down Expand Up @@ -279,6 +279,10 @@ pub fn number_of_frames<D: DataDictionary + Clone>(
return Ok(1);
};

if elem.is_empty() {
return Ok(1);
}

let integer = elem.to_int::<i32>().context(ConvertValueSnafu { name })?;

ensure!(
Expand Down
Loading