def match_image(plane)
      raise ArgumentError, "Invalid argument 'plane'. Expected Plane, got #{plane.class}." unless plane.is_a?(Plane)
      matching_image = nil
      planes_in_series = Array.new
      @images.each do |image|
        # Get three coordinates from the image:
        col_indices = NArray.to_na([0,image.columns/2, image.columns-1])
        row_indices = NArray.to_na([image.rows/2, image.rows-1, 0])
        x, y, z = image.coordinates_from_indices(col_indices, row_indices)
        coordinates = Array.new
        x.length.times do |i|
          coordinates << Coordinate.new(x[i], y[i], z[i])
        end
        # Determine the image plane:
        planes_in_series << Plane.calculate(coordinates[0], coordinates[1], coordinates[2])
      end
      # Search for a match amongst the planes of this series:
      index = plane.match(planes_in_series)
      matching_image = @images[index] if index
      return matching_image
    end
def match_image(plane)
      raise ArgumentError, "Invalid argument 'plane'. Expected Plane, got #{plane.class}." unless plane.is_a?(Plane)
      matching_image = nil
      planes_in_series = Array.new
      @images.each do |image|
        # Get three coordinates from the image:
        col_indices = NArray.to_na([0,image.columns/2, image.columns-1])
        row_indices = NArray.to_na([image.rows/2, image.rows-1, 0])
        x, y, z = image.coordinates_from_indices(col_indices, row_indices)
        coordinates = Array.new
        x.length.times do |i|
          coordinates << Coordinate.new(x[i], y[i], z[i])
        end
        # Determine the image plane:
        planes_in_series << Plane.calculate(coordinates[0], coordinates[1], coordinates[2])
      end
      # Search for a match amongst the planes of this series:
      index = plane.match(planes_in_series)
      matching_image = @images[index] if index
      return matching_image
    end
Analyses the images belonging to this ImageSeries to determine if there
 is any image with a geometry that matches the specified plane.

 @param [Plane] plane an image plane to be compared against the associated images
 @return [SliceImage, NilClass] the matched image (or nil if no image is matched)