in ez_wsi_dicomweb/local_dicom_slide_cache.py [0:0]
def _total_frame_bytes_read(self, dicom_frames: List[bytes]) -> int:
"""Returns total number of bytes in list of frames."""
total_frame_bytes_read = 0
for frame_bytes in dicom_frames:
total_frame_bytes_read += len(frame_bytes)
if (
self._max_cache_frame_memory_lru_cache_size_bytes is not None
and total_frame_bytes_read
> self._max_cache_frame_memory_lru_cache_size_bytes
and self.lru_caching_enabled
):
self._get_logger().warning(
'The maximum size in bytes of the LRU cache is smaller than the '
f'total size in bytes of the block of {len(dicom_frames)} DICOM '
'frame(s) that was added to the cache in a single cache miss event; '
'LRU maximum cache size (bytes): '
f'{self._max_cache_frame_memory_lru_cache_size_bytes}; '
f'Total size in bytes of DICOM frame(s): {total_frame_bytes_read}. '
'For optimal performance LRU cache size should be be increased to a '
'size much larger than the total number of frame bytes read at a '
'single cache miss event.'
)
return total_frame_bytes_read