-
Notifications
You must be signed in to change notification settings - Fork 48
Open
Labels
bugSomething isn't workingSomething isn't working
Description
I was performing some testing on read time with the new version of Highdicom and found it's much slower. Here is the summary of my experiment.
import os
import timeit
import highdicom
import pydicom
from highdicom.io import ImageFileReader
file_path = "./99e90a87-e900-4e76-8805-eb0f785fba14.dcm"
print(f"highdicom.__version__: {highdicom.__version__}")
print(f"pydicom.__version__: {pydicom.__version__}")
ds = pydicom.dcmread(file_path)
original_file_size_mb = round(os.path.getsize(file_path) / 1024 / 1024, 2)
print(f"original file size: {original_file_size_mb}MB nb_frames: {ds.NumberOfFrames}")
def get_dicom_data_iter(fpath):
dcm = ImageFileReader(fpath)
dcm.open()
for i in range(dcm.number_of_frames):
frame = dcm.read_frame(i, correct_color=hasattr(dcm.metadata, "ICCProfile"))
yield frame
times = timeit.repeat(lambda: [frame for frame in get_dicom_data_iter(file_path)], repeat=3, number=1)
print(f"avg read time: {sum(times) / len(times):.6f}s")
And the reports
original file size: 136.58MB nb_frames: 714
highdicom.__version__: 0.22.0
pydicom.__version__: 2.4.4
no ICC Profile found in image metadata.
no ICC Profile found in image metadata.
no ICC Profile found in image metadata.
avg read time: 12.218269s
original file size: 136.58MB nb_frames: 714
highdicom.__version__: 0.25.1
pydicom.__version__: 3.0.1
no ICC Profile found in image metadata.
no ICC Profile found in image metadata.
no ICC Profile found in image metadata.
avg read time: 29.315099s
So a factor 3 on this large file. Is there anything I might be doing wrong? This was performed on python 3.10.17
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working