def contour_indices
      # Create the array to be returned:
      contours = Array.new
      # Initialize the contour extraction process if indicated:
      if @narray.segmented?
        # Initialize some variables used by the contour algorithm:
        initialize_contour_reorder_structures unless @reorder
        # The contour algorithm needs the image to be padded with a border of zero-pixels:
        original_image = @narray
        padded_image = NArray.byte(columns + 2, rows + 2)
        padded_image[1..-2, 1..-2] = @narray
        # Temporarily replace our instance image with the padded image:
        self.narray = padded_image
        # Get the contours:
        padded_contours = extract_contours
        # Convert from padded indices to proper indices:
        padded_contours.each do |padded_contour|
          padded_contour.shift_and_crop(-1, -1)
          contours << padded_contour
        end
        # Restore the instance image:
        self.narray = original_image
      end
      return contours
    end
def contour_indices
      # Create the array to be returned:
      contours = Array.new
      # Initialize the contour extraction process if indicated:
      if @narray.segmented?
        # Initialize some variables used by the contour algorithm:
        initialize_contour_reorder_structures unless @reorder
        # The contour algorithm needs the image to be padded with a border of zero-pixels:
        original_image = @narray
        padded_image = NArray.byte(columns + 2, rows + 2)
        padded_image[1..-2, 1..-2] = @narray
        # Temporarily replace our instance image with the padded image:
        self.narray = padded_image
        # Get the contours:
        padded_contours = extract_contours
        # Convert from padded indices to proper indices:
        padded_contours.each do |padded_contour|
          padded_contour.shift_and_crop(-1, -1)
          contours << padded_contour
        end
        # Restore the instance image:
        self.narray = original_image
      end
      return contours
    end
Extracts the contour indices of the (filled) structures contained in the
 BinImage, by performing a contour tracing algorithm on the binary image.

 @see The contours are established using a contour tracing algorithm called "Radial Sweep":
   http://www.imageprocessingplace.com/downloads_V3/root_downloads/tutorials/contour_tracing_Abeer_George_Ghuneim/ray.html

 @note Does not detect inner contour of hollow structures (holes).
 @return [Array<Selection>] an array filled with contour Selection instances (the length of the array equals the number of separate structures in the image)