def __getitem__(self, index: int) -> VideoItem:
        """Get the dataset item for the index.

        Args:
            index (int): Index of the item to be returned.

        Returns:
            VideoItem: Dataset item containing the mask, clip and file system
                information.

        Raises:
            TypeError: If ``self.indexer`` is not an instance of ``ClipsIndexer``.
        """
        if not isinstance(self.indexer, ClipsIndexer):
            msg = "self.indexer must be an instance of ClipsIndexer."
            raise TypeError(msg)
        item = self.indexer.get_item(index)
        item.image = to_dtype_video(video=item.image, scale=True)
        # include the untransformed image for visualization
        item.original_image = to_dtype(item.image, torch.uint8, scale=True)

        # apply transforms
        if item.gt_mask is not None:
            if self.augmentations:
                item.image, item.gt_mask = self.augmentations(item.image, Mask(item.gt_mask))
            item.gt_label = torch.Tensor([1 in frame for frame in item.gt_mask]).int().squeeze(0)
        elif self.augmentations:
            item.image = self.augmentations(item.image)

        # squeeze temporal dimensions in case clip length is 1
        item.image = item.image.squeeze(0)

        # include only target frame in gt
        if self.clip_length_in_frames > 1 and self.target_frame != VideoTargetFrame.ALL:
            item = self._select_targets(item)

        return item
Get the dataset item for the index.

        Args:
            index (int): Index of the item to be returned.

        Returns:
            VideoItem: Dataset item containing the mask, clip and file system
                information.

        Raises:
            TypeError: If ``self.indexer`` is not an instance of ``ClipsIndexer``.
        
src/anomalib/data/datasets/base/video.py