Skip to content

Commit 38fce1e

Browse files
committed
renames following review
rename dcm_filehandle_read_pixeldata() as dcm_filehandle_prepare_read_frame() rename dcm_filehandle_get_metadata() as dcm_filehandle_get_metadata_subset() revise docs and tests
1 parent 3d44c8a commit 38fce1e

File tree

4 files changed

+27
-20
lines changed

4 files changed

+27
-20
lines changed

doc/source/usage.rst

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ The `File Meta Information
1919
can be accessed via :c:func:`dcm_filehandle_get_file_meta()`.
2020

2121
The principal metadata of the Data Set can be accessed via
22-
:c:func:`dcm_filehandle_get_metadata()`. This function will stop read on tags
23-
which are likely to take a long time to process.
22+
:c:func:`dcm_filehandle_get_metadata_subset()`. This function will stop
23+
read on tags which are likely to take a long time to process.
2424

2525
You can read all metadata and control read stop using a sequence of calls to
2626
:c:func:`dcm_filehandle_read_metadata()`.
@@ -238,7 +238,8 @@ printing an element to standard output:
238238
return 1;
239239
}
240240
241-
const DcmDataSet *metadata = dcm_filehandle_get_metadata(&error, filehandle);
241+
const DcmDataSet *metadata =
242+
dcm_filehandle_get_metadata_subset(&error, filehandle);
242243
if (metadata == NULL) {
243244
dcm_error_log(error);
244245
dcm_error_clear(&error);

include/dicom/dicom.h

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1701,10 +1701,14 @@ DcmDataSet *dcm_filehandle_read_metadata(DcmError **error,
17011701
const uint32_t *stop_tags);
17021702

17031703
/**
1704-
* Get metadata from a File.
1704+
* Get a fast subset of metadata from a File.
17051705
*
1706-
* Gets the File's metadata and saves it in the File handle. Returns a
1707-
* reference to this internal copy of the File metadata.
1706+
* Gets a subset of the File's metadata and saves it in the File handle.
1707+
* Returns a reference to this internal copy of the File metadata.
1708+
*
1709+
* The subset is the part of the DICOM metadata that can be read quickly. It
1710+
* is missing tags such as PerFrameFunctionalGroupSequence. Use
1711+
* dcm_filehandle_read_metadata() if you need all file metadata.
17081712
*
17091713
* The return result must not be destroyed. Make a clone of it with
17101714
* :c:func:`dcm_dataset_clone()` if you need it to remain valid after
@@ -1721,8 +1725,8 @@ DcmDataSet *dcm_filehandle_read_metadata(DcmError **error,
17211725
* :return: metadata
17221726
*/
17231727
DCM_EXTERN
1724-
const DcmDataSet *dcm_filehandle_get_metadata(DcmError **error,
1725-
DcmFilehandle *filehandle);
1728+
const DcmDataSet *dcm_filehandle_get_metadata_subset(DcmError **error,
1729+
DcmFilehandle *filehandle);
17261730

17271731
/**
17281732
* Read everything necessary to fetch frames from the file.
@@ -1747,8 +1751,8 @@ const DcmDataSet *dcm_filehandle_get_metadata(DcmError **error,
17471751
* :return: true on success
17481752
*/
17491753
DCM_EXTERN
1750-
bool dcm_filehandle_read_pixeldata(DcmError **error,
1751-
DcmFilehandle *filehandle);
1754+
bool dcm_filehandle_prepare_read_frame(DcmError **error,
1755+
DcmFilehandle *filehandle);
17521756

17531757
/**
17541758
* Read an individual Frame from a File.

src/dicom-file.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -757,8 +757,8 @@ DcmDataSet *dcm_filehandle_read_metadata(DcmError **error,
757757
}
758758

759759

760-
const DcmDataSet *dcm_filehandle_get_metadata(DcmError **error,
761-
DcmFilehandle *filehandle)
760+
const DcmDataSet *dcm_filehandle_get_metadata_subset(DcmError **error,
761+
DcmFilehandle *filehandle)
762762
{
763763
// we stop on any of the tags that start a huge group that
764764
// would take a long time to parse
@@ -939,12 +939,12 @@ static bool read_skip_to_index(DcmError **error,
939939
}
940940

941941

942-
bool dcm_filehandle_read_pixeldata(DcmError **error,
943-
DcmFilehandle *filehandle)
942+
bool dcm_filehandle_prepare_read_frame(DcmError **error,
943+
DcmFilehandle *filehandle)
944944
{
945945
if (filehandle->offset_table == NULL) {
946946
// move to the first of our stop tags
947-
if (dcm_filehandle_get_metadata(error, filehandle) == NULL) {
947+
if (dcm_filehandle_get_metadata_subset(error, filehandle) == NULL) {
948948
return false;
949949
}
950950

@@ -1030,7 +1030,7 @@ DcmFrame *dcm_filehandle_read_frame(DcmError **error,
10301030
{
10311031
dcm_log_debug("Read frame number #%u.", frame_number);
10321032

1033-
if (!dcm_filehandle_read_pixeldata(error, filehandle)) {
1033+
if (!dcm_filehandle_prepare_read_frame(error, filehandle)) {
10341034
return NULL;
10351035
}
10361036

@@ -1091,7 +1091,7 @@ DcmFrame *dcm_filehandle_read_frame_position(DcmError **error,
10911091
{
10921092
dcm_log_debug("Read frame position (%u, %u)", column, row);
10931093

1094-
if (!dcm_filehandle_read_pixeldata(error, filehandle)) {
1094+
if (!dcm_filehandle_prepare_read_frame(error, filehandle)) {
10951095
return NULL;
10961096
}
10971097

tests/check_dicom.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -679,7 +679,8 @@ START_TEST(test_file_sm_image_metadata)
679679
free(file_path);
680680
ck_assert_ptr_nonnull(filehandle);
681681

682-
const DcmDataSet *metadata = dcm_filehandle_get_metadata(NULL, filehandle);
682+
const DcmDataSet *metadata =
683+
dcm_filehandle_get_metadata_subset(NULL, filehandle);
683684
ck_assert_ptr_nonnull(metadata);
684685

685686
// SOP Class UID
@@ -705,10 +706,11 @@ START_TEST(test_file_sm_image_frame)
705706
free(file_path);
706707
ck_assert_ptr_nonnull(filehandle);
707708

708-
const DcmDataSet *metadata = dcm_filehandle_get_metadata(NULL, filehandle);
709+
const DcmDataSet *metadata =
710+
dcm_filehandle_get_metadata_subset(NULL, filehandle);
709711
ck_assert_ptr_nonnull(metadata);
710712

711-
ck_assert_int_ne(dcm_filehandle_read_pixeldata(NULL, filehandle), 0);
713+
ck_assert_int_ne(dcm_filehandle_prepare_read_frame(NULL, filehandle), 0);
712714

713715
DcmFrame *frame = dcm_filehandle_read_frame(NULL,
714716
filehandle,

0 commit comments

Comments
 (0)