<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _sample_slices_in_dim(self, view, num_slices, non_empty_slices):
 """Samples the slices in the given dimension according the chosen strategy."""


        if self._sampling_method == 'linear':
            return self._linear_selection(non_empty_slices=non_empty_slices, num_slices=num_slices)
        elif self._sampling_method == 'percentage':
            return self._percent_selection(non_empty_slices=non_empty_slices)
        elif self._sampling_method == 'callable':
            return self._selection_by_callable(view=view, non_empty_slices=non_empty_slices,
                                               num_slices=num_slices)
        else:
            raise NotImplementedError('Invalid state for the class!')