def select_k_slices(self, beta):
        """
        Select the K dictionary slices most similar to the target slice

        :param beta: Dictionary similarities

        :return selected: numpy array of segmentation of the selected dictionary slices
        """

        kept_slice_index = []

        if isinstance(beta[0], (list, np.ndarray)):
            for beta_slice in beta:
                selected_index = beta_slice > self.epsilon
                '''
                if poped is not None:
                    selected_index = np.delete(selected_index, poped)
                '''
                # kept_seg_slices.append(segmentation_slices[selected_index])
                kept_slice_index.append(selected_index)

        else:
            kept_slice_index = beta > self.epsilon
            '''
            if poped is not None:
                selected_index = np.delete(selected_index, poped)
            '''
            # kept_seg_slices = segmentation_slices[selected_index]

        return np.asarray(kept_slice_index)
dataset/ETHPy150Open neuropoly/spinalcordtoolbox/dev/sct_segment_gray_matter_asman/sct_asman_old.py/TargetSegmentationPairwise.select_k_slices/original