docstr: Return an array containing the indices of objects to keep
  
  workspace - workspace passed into Run
  src_objects - the Objects instance to be filtered
docstr_tok: ["Return","an","array","containing","the","indices","of","objects","to","keep","workspace","-","workspace","passed","into","Run","src_objects","-","the","Objects","instance","to","be","filtered"]
code: def discard_border_objects(self, src_objects):
      """Return an array containing the indices of objects to keep
  
      workspace - workspace passed into Run
      src_objects - the Objects instance to be filtered
      """
      labels = src_objects.segmented
  
      if (
          src_objects.has_parent_image
          and src_objects.parent_image.has_mask
      ):
          mask = src_objects.parent_image.mask
  
          interior_pixels = scipy.ndimage.binary_erosion(mask)
  
      else:
          interior_pixels = scipy.ndimage.binary_erosion(
              numpy.ones_like(labels)
          )
  
      border_pixels = numpy.logical_not(interior_pixels)
  
      border_labels = set(labels[border_pixels])
  
      if (
          border_labels == {0}
          and src_objects.has_parent_image
          and src_objects.parent_image.has_mask
      ):
          # The assumption here is that, if nothing touches the border,
          # the mask is a large, elliptical mask that tells you where the
          # well is. That's the way the old Matlab code works and it's duplicated here
          #
          # The operation below gets the mask pixels that are on the border of the mask
          # The erosion turns all pixels touching an edge to zero. The not of this
          # is the border + formerly masked-out pixels.
  
          mask = src_objects.parent_image.mask
  
          interior_pixels = scipy.ndimage.binary_erosion(mask)
  
          border_pixels = numpy.logical_not(interior_pixels)
  
          border_labels = set(labels[border_pixels])
  
      return list(set(labels.ravel()).difference(border_labels))
  
imports: from cellprofiler_core.constants.measurement import M_LOCATION_CENTER_X, M_LOCATION_CENTER_Y, C_CHILDREN, C_PARENT, C_LOCATION, C_NUMBER, FTR_OBJECT_NUMBER, C_COUNT, FTR_CENTER_X, FTR_CENTER_Y, FTR_CENTER_Z
  from cellprofiler_core.module.image_segmentation import ObjectProcessing
  from cellprofiler_core.preferences import DEFAULT_INPUT_FOLDER_NAME, ABSOLUTE_FOLDER_NAME, DEFAULT_INPUT_SUBFOLDER_NAME, DEFAULT_OUTPUT_SUBFOLDER_NAME
  from cellprofiler_core.setting import Divider, HiddenCount, SettingsGroup, Measurement, Binary, ValidationError
  from cellprofiler_core.setting.choice import Choice
  from cellprofiler_core.setting.do_something import DoSomething, RemoveSettingButton
  from cellprofiler_core.setting.subscriber import LabelSubscriber
  from cellprofiler_core.setting.text import Directory, Filename, Float, LabelName
  from cellprofiler.modules import _help
  import logging
  import os
  import numpy
  import scipy
  import scipy.ndimage
  import scipy.sparse
  import cellprofiler.gui.help
  import cellprofiler_core.object
  from cellprofiler.utilities.rules import Rules
label_desc: Use image node_id 17 for calling the FilterObjects obj's underlying member method code with example usage: obj.discard_border_objects(src_objects) and returns: list