in ez_wsi_dicomweb/slide_level_map.py [0:0]
def get_instance_by_frame(self, frame_number: int) -> Optional[Instance]:
"""Gets the instance that contains the requested frame.
Args:
frame_number: The frame number of the frame to request. The frame number
of a frame is stored in the DICOM tag
CONCATENATION_FRAME_OFFSET_NUMBER('00209228').
Returns:
The instance that contains the requested frame, or None if the input frame
is out of range of any instance.
"""
for frame_offset, instance in self.instances.items():
if frame_number <= frame_offset:
break
if frame_number <= frame_offset + instance.frame_count:
return instance
return None