code: def test_valid(self, pipeline):
      if self.size is None:
          raise ValidationError(
              "Missing structuring element size. Please enter a positive integer.",
              self,
          )
  
      if self.size <= 0:
          raise ValidationError(
              "Structuring element size must be a positive integer. You provided {}.".format(
                  self.size
              ),
              self,
          )
  
      if pipeline.volumetric():
          if (
              self.shape in ["diamond", "disk", "square", "star"]
              and not self.__allow_planewise
          ):
              raise ValidationError(
                  "A 3 dimensional struturing element is required. You selected {}."
                  ' Please select one of "ball", "cube", or "octahedron".'.format(
                      self.shape
                  ),
                  self,
              )
      else:
          if self.shape in ["ball", "cube", "octahedron"]:
              raise ValidationError(
                  "A 2 dimensional structuring element is required. You selected {}."
                  ' Please select one of "diamond", "disk", "square", "star".'.format(
                      self.shape
                  ),
                  self,
              )
  
file_path: CellProfiler/src/subpackages/core/cellprofiler_core/setting/_structuring_element.py
imports: import skimage.morphology
  from ._setting import Setting
  from ._validation_error import ValidationError
label_desc: Use image node_id 9 for calling the StructuringElement obj's underlying member method code with example usage: obj.test_valid(pipeline) without return types