Skip to content

Commit

Permalink
improve frame parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
jcupitt committed Jan 14, 2025
1 parent ee3e401 commit cc15c98
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions src/dicom-file.c
Original file line number Diff line number Diff line change
Expand Up @@ -317,9 +317,11 @@ static bool get_frame_offset(DcmError **error,
const DcmDataSet *metadata,
uint32_t *frame_offset)
{
(void) error;

// optional, defaults to 0
int64_t value;
if (!get_tag_int(error,
if (!get_tag_int(NULL,
metadata, "ConcatenationFrameOffsetNumber", &value)) {
value = 0;
}
Expand Down Expand Up @@ -749,12 +751,16 @@ static bool set_pixel_description(DcmError **error,
}
desc->pixel_representation = (uint16_t) value;

element = dcm_dataset_get(error, metadata, 0x00280006);
if (element == NULL ||
!dcm_element_get_value_integer(error, element, 0, &value)) {
return false;
// required if samples per pixel > 1, defaults to 0 (interleaved)
desc->planar_configuration = 0;
if (desc->samples_per_pixel > 1) {
element = dcm_dataset_get(error, metadata, 0x00280006);
if (element == NULL ||
!dcm_element_get_value_integer(error, element, 0, &value)) {
return false;
}
desc->planar_configuration = (uint16_t) value;
}
desc->planar_configuration = (uint16_t) value;

element = dcm_dataset_get(error, metadata, 0x00280004);
if (element == NULL ||
Expand Down

0 comments on commit cc15c98

Please sign in to comment.