class_docstr: An internal class to manage filters/algorithms for uniform grid datasets.
class_docstr_tok: ["An","internal","class","to","manage","filters\/algorithms","for","uniform","grid","datasets","."]
docstr: Dilates one value and erodes another.
  
  ``image_dilate_erode`` will dilate one value and erode another. It uses
  an elliptical footprint, and only erodes/dilates on the boundary of the
  two values. The filter is restricted to the X, Y, and Z axes for now.
  It can degenerate to a 2 or 1-dimensional filter by setting the kernel
  size to 1 for a specific axis.
  
  Parameters
  ----------
  dilate_value : float, default: 1.0
      Dilate value in the dataset.
  
  erode_value : float, default: 0.0
      Erode value in the dataset.
  
  kernel_size : sequence[int], default: (3, 3, 3)
      Determines the size of the kernel along the three axes.
  
  scalars : str, optional
      Name of scalars to process. Defaults to currently active scalars.
  
  progress_bar : bool, default: False
      Display a progress bar to indicate progress.
  
  Returns
  -------
  pyvista.ImageData
      Dataset that has been dilated/eroded on the boundary of the specified scalars.
  
  Notes
  -----
  This filter only supports point data. Consider converting any cell data
  to point data using the :func:`cell_data_to_point_data()
  <pyvista.DataSetFilters.cell_data_to_point_data>` filter to convert ny
  cell data to point data.
  
  Examples
  --------
  Demonstrate image dilate/erode on an example dataset. First, plot
  the example dataset with the active scalars.
  
  >>> from pyvista import examples
  >>> uni = examples.load_uniform()
  >>> uni.plot()
  
  Now, plot the image threshold with ``threshold=[400, 600]``. Note how
  values within the threshold are 1 and outside are 0.
  
  >>> ithresh = uni.image_threshold([400, 600])
  >>> ithresh.plot()
  
  Note how there is a hole in the thresholded image. Apply a dilation/
  erosion filter with a large kernel to fill that hole in.
  
  >>> idilate = ithresh.image_dilate_erode(kernel_size=[5, 5, 5])
  >>> idilate.plot()
docstr_tok: ["Dilates","one","value","and","erodes","another",".","``","image_dilate_erode","``","will","dilate","one","value","and","erode","another",".","It","uses","an","elliptical","footprint",",","and","only","erodes\/dilates","on","the","boundary","of","the","two","values",".","The","filter","is","restricted","to","the","X",",","Y",",","and","Z","axes","for","now",".","It","can","degenerate","to","a","2","or","1-dimensional","filter","by","setting","the","kernel","size","to","1","for","a","specific","axis",".","Parameters","--","--","--","--","--","dilate_value",":","float",",","default",":","1.0","Dilate","value","in","the","dataset",".","erode_value",":","float",",","default",":","0.0","Erode","value","in","the","dataset",".","kernel_size",":","sequence","[","int","]",",","default",":","(","3",",","3",",","3",")","Determines","the","size","of","the","kernel","along","the","three","axes",".","scalars",":","str",",","optional","Name","of","scalars","to","process",".","Defaults","to","currently","active","scalars",".","progress_bar",":","bool",",","default",":","False","Display","a","progress","bar","to","indicate","progress",".","Returns","--","--","--","-","pyvista.ImageData","Dataset","that","has","been","dilated\/eroded","on","the","boundary","of","the","specified","scalars",".","Notes","--","--","-","This","filter","only","supports","point","data",".","Consider","converting","any","cell","data","to","point","data","using","the",":","func",":","`","cell_data_to_point_data","(",")","<","pyvista.DataSetFilters.cell_data_to_point_data",">","`","filter","to","convert","ny","cell","data","to","point","data",".","Examples","--","--","--","--","Demonstrate","image","dilate\/erode","on","an","example","dataset",".","First",",","plot","the","example","dataset","with","the","active","scalars",".",">",">",">","from","pyvista","import","examples",">",">",">","uni","=","examples.load_uniform","(",")",">",">",">","uni.plot","(",")","Now",",","plot","the","image","threshold","with","``","threshold=","[","400",",","600","]","``",".","Note","how","values","within","the","threshold","are","1","and","outside","are","0",".",">",">",">","ithresh","=","uni.image_threshold","(","[","400",",","600","]",")",">",">",">","ithresh.plot","(",")","Note","how","there","is","a","hole","in","the","thresholded","image",".","Apply","a","dilation\/","erosion","filter","with","a","large","kernel","to","fill","that","hole","in",".",">",">",">","idilate","=","ithresh.image_dilate_erode","(","kernel_size=","[","5",",","5",",","5","]",")",">",">",">","idilate.plot","(",")"]
code: def image_dilate_erode(
      self,
      dilate_value=1.0,
      erode_value=0.0,
      kernel_size=(3, 3, 3),
      scalars=None,
      progress_bar=False,
  ):
      """Dilates one value and erodes another.
  
      ``image_dilate_erode`` will dilate one value and erode another. It uses
      an elliptical footprint, and only erodes/dilates on the boundary of the
      two values. The filter is restricted to the X, Y, and Z axes for now.
      It can degenerate to a 2 or 1-dimensional filter by setting the kernel
      size to 1 for a specific axis.
  
      Parameters
      ----------
      dilate_value : float, default: 1.0
          Dilate value in the dataset.
  
      erode_value : float, default: 0.0
          Erode value in the dataset.
  
      kernel_size : sequence[int], default: (3, 3, 3)
          Determines the size of the kernel along the three axes.
  
      scalars : str, optional
          Name of scalars to process. Defaults to currently active scalars.
  
      progress_bar : bool, default: False
          Display a progress bar to indicate progress.
  
      Returns
      -------
      pyvista.ImageData
          Dataset that has been dilated/eroded on the boundary of the specified scalars.
  
      Notes
      -----
      This filter only supports point data. Consider converting any cell data
      to point data using the :func:`cell_data_to_point_data()
      <pyvista.DataSetFilters.cell_data_to_point_data>` filter to convert ny
      cell data to point data.
  
      Examples
      --------
      Demonstrate image dilate/erode on an example dataset. First, plot
      the example dataset with the active scalars.
  
      >>> from pyvista import examples
      >>> uni = examples.load_uniform()
      >>> uni.plot()
  
      Now, plot the image threshold with ``threshold=[400, 600]``. Note how
      values within the threshold are 1 and outside are 0.
  
      >>> ithresh = uni.image_threshold([400, 600])
      >>> ithresh.plot()
  
      Note how there is a hole in the thresholded image. Apply a dilation/
      erosion filter with a large kernel to fill that hole in.
  
      >>> idilate = ithresh.image_dilate_erode(kernel_size=[5, 5, 5])
      >>> idilate.plot()
  
      """
      alg = _vtk.vtkImageDilateErode3D()
      alg.SetInputDataObject(self)
      if scalars is None:
          set_default_active_scalars(self)
          field, scalars = self.active_scalars_info
          if field.value == 1:
              raise ValueError(
                  "If `scalars` not given, active scalars must be point array."
              )
      else:
          field = self.get_array_association(
              scalars, preference="point"
          )
          if field.value == 1:
              raise ValueError(
                  "Can only process point data, given `scalars` are cell data."
              )
      alg.SetInputArrayToProcess(
          0, 0, 0, field.value, scalars
      )  # args: (idx, port, connection, field, name)
      alg.SetKernelSize(*kernel_size)
      alg.SetDilateValue(dilate_value)
      alg.SetErodeValue(erode_value)
      _update_alg(alg, progress_bar, "Performing Dilation and Erosion")
      return _get_output(alg)
  
imports: import collections.abc
  from typing import Literal, Optional, cast
  import numpy
  import pyvista
  from pyvista.core import _vtk_core
  from pyvista.core.errors import AmbiguousDataError, MissingDataError
  from pyvista.core.filters import _get_output, _update_alg
  from pyvista.core.filters.data_set import DataSetFilters
  from pyvista.core.utilities.arrays import FieldAssociation, set_default_active_scalars
  from pyvista.core.utilities.helpers import wrap
  from pyvista.core.utilities.misc import abstract_class
label_desc: Use image node_id 4 for calling the ImageDataFilters obj's underlying member method code with example usage: obj.image_dilate_erode(dilate_value, erode_value, kernel_size, scalars, progress_bar) and returns: _get_output