Skip to content

Commit

Permalink
Merge pull request #576 from abustany/pixeldata-empty-number-of-frames
Browse files Browse the repository at this point in the history
[pixeldata] Handle empty NumberOfFrames tags
  • Loading branch information
Enet4 authored Oct 23, 2024
2 parents c522fc1 + 955a652 commit dee9a34
Showing 1 changed file with 5 additions and 1 deletion.
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

0 comments on commit dee9a34

Please sign in to comment.