def binary_image(coords_x, coords_y, coords_z)
      # FIXME: Should we test whether the coordinates go outside the bounds of this image, and
      # give a descriptive warning/error instead of letting the code crash with a more cryptic error?!
      raise ArgumentError, "Invalid argument 'coords_x'. Expected at least 3 elements, got #{coords_x.length}" unless coords_x.length >= 3
      raise ArgumentError, "Invalid argument 'coords_y'. Expected at least 3 elements, got #{coords_y.length}" unless coords_y.length >= 3
      raise ArgumentError, "Invalid argument 'coords_z'. Expected at least 3 elements, got #{coords_z.length}" unless coords_z.length >= 3
      # Values that will be used for image geometry:
      empty_value = 0
      line_value = 1
      fill_value = 2
      # Convert physical coordinates to image indices:
      column_indices, row_indices = coordinates_to_indices(NArray.to_na(coords_x), NArray.to_na(coords_y), NArray.to_na(coords_z))
      # Create an empty array and fill in the gathered points:
      empty_array = NArray.byte(@columns, @rows)
      delineated_array = draw_lines(column_indices.to_a, row_indices.to_a, empty_array, line_value)
      # Establish starting point indices for the coming flood fill algorithm:
      # (Using a rather simple approach by finding the average column and row index among the selection of indices)
      start_col = column_indices.mean
      start_row = row_indices.mean
      # Perform a flood fill to enable us to extract all pixels contained in a specific ROI:
      filled_array = flood_fill(start_col, start_row, delineated_array, fill_value)
      # Extract the indices of 'ROI pixels':
      if filled_array[0,0] != fill_value
        # ROI has been filled as expected. Extract indices of value line_value and fill_value:
        filled_array[(filled_array.eq line_value).where] = fill_value
        indices = (filled_array.eq fill_value).where
      else
        # An inversion has occured. The entire image except our ROI has been filled. Extract indices of value line_value and empty_value:
        filled_array[(filled_array.eq line_value).where] = empty_value
        indices = (filled_array.eq empty_value).where
      end
      # Create binary image:
      bin_image = NArray.byte(@columns, @rows)
      bin_image[indices] = 1
      return bin_image
    end
def binary_image(coords_x, coords_y, coords_z)
      # FIXME: Should we test whether the coordinates go outside the bounds of this image, and
      # give a descriptive warning/error instead of letting the code crash with a more cryptic error?!
      raise ArgumentError, "Invalid argument 'coords_x'. Expected at least 3 elements, got #{coords_x.length}" unless coords_x.length >= 3
      raise ArgumentError, "Invalid argument 'coords_y'. Expected at least 3 elements, got #{coords_y.length}" unless coords_y.length >= 3
      raise ArgumentError, "Invalid argument 'coords_z'. Expected at least 3 elements, got #{coords_z.length}" unless coords_z.length >= 3
      # Values that will be used for image geometry:
      empty_value = 0
      line_value = 1
      fill_value = 2
      # Convert physical coordinates to image indices:
      column_indices, row_indices = coordinates_to_indices(NArray.to_na(coords_x), NArray.to_na(coords_y), NArray.to_na(coords_z))
      # Create an empty array and fill in the gathered points:
      empty_array = NArray.byte(@columns, @rows)
      delineated_array = draw_lines(column_indices.to_a, row_indices.to_a, empty_array, line_value)
      # Establish starting point indices for the coming flood fill algorithm:
      # (Using a rather simple approach by finding the average column and row index among the selection of indices)
      start_col = column_indices.mean
      start_row = row_indices.mean
      # Perform a flood fill to enable us to extract all pixels contained in a specific ROI:
      filled_array = flood_fill(start_col, start_row, delineated_array, fill_value)
      # Extract the indices of 'ROI pixels':
      if filled_array[0,0] != fill_value
        # ROI has been filled as expected. Extract indices of value line_value and fill_value:
        filled_array[(filled_array.eq line_value).where] = fill_value
        indices = (filled_array.eq fill_value).where
      else
        # An inversion has occured. The entire image except our ROI has been filled. Extract indices of value line_value and empty_value:
        filled_array[(filled_array.eq line_value).where] = empty_value
        indices = (filled_array.eq empty_value).where
      end
      # Create binary image:
      bin_image = NArray.byte(@columns, @rows)
      bin_image[indices] = 1
      return bin_image
    end
Creates a new SliceImage instance. The SOP Instance UID tag value is
 used to uniquely identify an image.

 @param [String] sop_uid the SOP Instance UID value
 @param [String] pos_slice the slice position of this image
 @param [Series] series the Series instance which this SliceImage is associated with
 @raise [ArgumentError] if the referenced series doesn't have a slice image type modality

 Creates a filled, binary NArray image ('segmented' image) based on the
 provided contour coordinates.

 @param [Array, NArray] coords_x the contour's x coordinates
 @param [Array, NArray] coords_y the contour's y coordinates
 @param [Array, NArray] coords_z the contour's z coordinates
 @return [BinImage] a filled, binary image
 @raise [ArgumentError] if any of the coordinate arrays have less than 3 elements