Vectors

A vector is a one-dimensional array of pixels (taken from an image profile or contour).

EVector .NET Python is the base class for all vectors. It contains all non-type-specific methods, mainly for counting elements and serialization.

../../../_images/plotofrgbvaluesprofile.webp

Profile in a C24 image, RGB values plot along profile and RGB values array (EC24Vector .NET Python)

A vector manages an array of elements. Memory allocation is transparent, so vectors can be resized dynamically. Whenever a function uses a vector, the vector type, size and structure are automatically adjusted to suit the function needs.

The use of vectors is quite straightforward:

  • To create a vector of the appropriate type:

    • Use its constructor and preallocate elements if required.

  • To fill a vector with values:

  • To access a vector element, either for reading or writing:

  • To determine the current number of elements:

  • To draw the vector:

    • A pixel vector is a plot of the element values as a function of the element index, so its graphical appearance depends on its type. You can draw a vector in a window. For legibility, the drawing should appear on a neutral background.

    • Drawing is done in the device context associated to the desired window. By default, curves are drawn in blue and annotations in black. You can define: graphicContext, width, height, originX, originY, color0, color1 and color2.

    • The EC24Vector .NET Python has three curves drawn instead of one, each corresponding to a color component. By default the red, blue and green pens are used.

Vector types