def write(dcm)
      if @write_path
        # The DICOM object is to be written to a separate directory. If the
        # original and the new directories have a common root, this is taken into
        # consideration when determining the object's write path:
        path = destination(dcm)
        if @random_file_name
          file_name = "#{SecureRandom.hex(16)}.dcm"
        else
          file_name = File.basename(dcm.source)
        end
        dcm.write(File.join(path, file_name))
      else
        # The original DICOM file is overwritten with the anonymized DICOM object:
        dcm.write(dcm.source)
      end
    end
def write(dcm)
      if @write_path
        # The DICOM object is to be written to a separate directory. If the
        # original and the new directories have a common root, this is taken into
        # consideration when determining the object's write path:
        path = destination(dcm)
        if @random_file_name
          file_name = "#{SecureRandom.hex(16)}.dcm"
        else
          file_name = File.basename(dcm.source)
        end
        dcm.write(File.join(path, file_name))
      else
        # The original DICOM file is overwritten with the anonymized DICOM object:
        dcm.write(dcm.source)
      end
    end
Writes a DICOM object to file.

 @param [DObject] dcm a DICOM object