code: def test_dilation(create_files_in_directory_plus_output_type):
      (
          files,
          testdir,
          out_ext,
      ) = create_files_in_directory_plus_output_type
  
      # Get the command
      diller = fsl.DilateImage(in_file="a.nii", out_file="b.nii")
  
      # Test the underlying command
      assert diller.cmd == "fslmaths"
  
      # Test that the dilation operation is mandatory
      with pytest.raises(ValueError):
          diller.run()
  
      # Test the different dilation operations
      for op in ["mean", "modal", "max"]:
          cv = dict(mean="M", modal="D", max="F")
          diller.inputs.operation = op
          assert diller.cmdline == f"fslmaths a.nii -dil{cv[op]} b.nii"
  
      # Now test the different kernel options
      for k in ["3D", "2D", "box", "boxv", "gauss", "sphere"]:
          for size in [1, 1.5, 5]:
              diller.inputs.kernel_shape = k
              diller.inputs.kernel_size = size
              assert (
                  diller.cmdline
                  == f"fslmaths a.nii -kernel {k} {size:.4f} -dilF b.nii"
              )
  
      # Test that we can use a file kernel
      f = open("kernel.txt", "w").close()
      del f  # Shut pyflakes up
      diller.inputs.kernel_shape = "file"
      diller.inputs.kernel_size = Undefined
      diller.inputs.kernel_file = "kernel.txt"
      assert (
          diller.cmdline
          == "fslmaths a.nii -kernel file kernel.txt -dilF b.nii"
      )
  
      # Test that we don't need to request an out name
      dil = fsl.DilateImage(in_file="a.nii", operation="max")
      assert dil.cmdline == "fslmaths a.nii -dilF {}".format(
          os.path.join(testdir, f"a_dil{out_ext}")
      )
  
imports: import os
  import numpy
  from nipype.interfaces.base import Undefined
  import nipype.interfaces.fsl.maths
  from nipype.interfaces.fsl import no_fsl
  import pytest
  from nipype.testing.fixtures import create_files_in_directory_plus_output_type
label_desc: Use image node_id 9 for calling a global function with example usage: test_dilation(create_files_in_directory_plus_output_type) without return types