Class ListImg<T>

Type Parameters:
T - The value type of the pixels. You can us Types or arbitrary Objects. If you use non-Type pixels, note, that you cannot use Type.set(Type) to change the value stored in every reference. Instead, you can use the ListCursor.set(Object) and ListRandomAccess.set(Object) methods to alter the underlying ArrayList.
All Implemented Interfaces:
Iterable<T>, Dimensions, EuclideanSpace, Img<T>, Interval, IterableInterval<T>, IterableRealInterval<T>, RandomAccessible<T>, RandomAccessibleInterval<T>, RealInterval, Typed<T>

public class ListImg<T> extends AbstractListImg<T>
This Img stores an image in a single linear ArrayList. Each pixel is stored as an individual object, so ListImg should only be used for images with relatively few pixels. In principle, the number of entities stored is limited to Integer.MAX_VALUE.
  • Field Details

    • pixels

      private final List<T> pixels
    • type

      private final T type
  • Constructor Details

    • ListImg

      public ListImg(long[] dim, T type)
    • ListImg

      public ListImg(T type, Collection<T> collection, long... dim)
    • ListImg

      public ListImg(Collection<T> collection, long... dim)
    • ListImg

      private ListImg(List<T> pixels, boolean dummy, long... dim)
  • Method Details

    • get

      protected T get(int index)
      Specified by:
      get in class AbstractListImg<T>
    • getType

      public T getType()
      Description copied from interface: Typed
      Get an instance of T.

      It should not be assumed that the returned T instance is an independent copy. In particular, repeated calls to getType() may return the same instance.

      Returns:
      an instance of T
    • set

      protected void set(int index, T value)
      Specified by:
      set in class AbstractListImg<T>
    • copyWithType

      private static <A extends Type<A>> ListImg<A> copyWithType(ListImg<A> img)
    • copy

      public ListImg<T> copy()
      Returns:
      - A copy of the current Img instance, all pixels are duplicated
    • wrap

      public static <T> ListImg<T> wrap(List<T> pixels, long... dim)