Skip to content

Commit 64a2c86

Browse files
committed
improve extended offset table handling
1 parent 9f3d922 commit 64a2c86

File tree

3 files changed

+44
-1
lines changed

3 files changed

+44
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
- improve handling of OV and OL [jcupitt]
66
- better frame data print [jcupitt]
7+
- improve ExtendedOffsetTable handling [jcupitt]
78

89
## 1.0.2, 5/10/23
910

src/dicom-file.c

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1068,6 +1068,44 @@ static bool read_skip_to_index(DcmError **error,
10681068
}
10691069

10701070

1071+
static bool parse_skip_to_pixel_data(void *client,
1072+
uint32_t tag,
1073+
DcmVR vr,
1074+
uint32_t length)
1075+
{
1076+
DcmFilehandle *filehandle = (DcmFilehandle *) client;
1077+
1078+
USED(vr);
1079+
USED(length);
1080+
1081+
filehandle->last_tag = tag;
1082+
1083+
return tag == TAG_PIXEL_DATA ||
1084+
tag == TAG_FLOAT_PIXEL_DATA ||
1085+
tag == TAG_DOUBLE_PIXEL_DATA;
1086+
}
1087+
1088+
1089+
static bool read_skip_to_pixel_data(DcmError **error,
1090+
DcmFilehandle *filehandle)
1091+
1092+
{
1093+
static DcmParse parse = {
1094+
.stop = parse_skip_to_pixel_data,
1095+
};
1096+
1097+
if (!dcm_parse_dataset(error,
1098+
filehandle->io,
1099+
filehandle->implicit,
1100+
&parse,
1101+
filehandle)) {
1102+
return false;
1103+
}
1104+
1105+
return true;
1106+
}
1107+
1108+
10711109
bool dcm_filehandle_prepare_read_frame(DcmError **error,
10721110
DcmFilehandle *filehandle)
10731111
{
@@ -1096,6 +1134,11 @@ bool dcm_filehandle_prepare_read_frame(DcmError **error,
10961134
return false;
10971135
}
10981136

1137+
// now skip over things like extended offset table
1138+
if (!read_skip_to_pixel_data(error, filehandle)) {
1139+
return false;
1140+
}
1141+
10991142
// and we must now be on pixel data
11001143
if (filehandle->last_tag != TAG_PIXEL_DATA &&
11011144
filehandle->last_tag != TAG_FLOAT_PIXEL_DATA &&

src/dicom-parse.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ typedef struct _DcmParseState {
4141
DcmDataSet *meta;
4242
int64_t offset;
4343
int64_t pixel_data_offset;
44-
uint64_t *extended_offset_table;
4544
} DcmParseState;
4645

4746

0 commit comments

Comments
 (0)