def to_contours(slice)
      raise ArgumentError, "Invalid argument 'slice. Expected Slice, got #{slice.class}." unless slice.is_a?(Slice)
      contours = Array.new
      # Iterate the extracted collection of contour indices and convert to Contour instances:
      contour_indices.each do |contour|
        # Convert column and row indices to X, Y and Z coordinates:
        x, y, z = coordinates_from_indices(NArray.to_na(contour.columns), NArray.to_na(contour.rows))
        # Convert NArray to Array and round the coordinate floats:
        x = x.to_a.collect {|f| f.round(1)}
        y = y.to_a.collect {|f| f.round(1)}
        z = z.to_a.collect {|f| f.round(3)}
        contours << Contour.create_from_coordinates(x, y, z, slice)
      end
      return contours
    end
def to_contours(slice)
      raise ArgumentError, "Invalid argument 'slice. Expected Slice, got #{slice.class}." unless slice.is_a?(Slice)
      contours = Array.new
      # Iterate the extracted collection of contour indices and convert to Contour instances:
      contour_indices.each do |contour|
        # Convert column and row indices to X, Y and Z coordinates:
        x, y, z = coordinates_from_indices(NArray.to_na(contour.columns), NArray.to_na(contour.rows))
        # Convert NArray to Array and round the coordinate floats:
        x = x.to_a.collect {|f| f.round(1)}
        y = y.to_a.collect {|f| f.round(1)}
        z = z.to_a.collect {|f| f.round(3)}
        contours << Contour.create_from_coordinates(x, y, z, slice)
      end
      return contours
    end
Creates an array of Contour instances from the segmentation of this BinImage.

 @param [Slice] slice the Slice instance which the created contours will be associated with
 @return [Array<Contour>] an array of contour instances (or an empty array if no contours are created)