Class ImgFactory<T>

java.lang.Object
net.imglib2.img.ImgFactory<T>
Direct Known Subclasses:
ListImgFactory, NativeImgFactory

public abstract class ImgFactory<T> extends Object
TODO
  • Field Details

    • type

      private T type
  • Constructor Details

    • ImgFactory

      public ImgFactory(T type)
    • ImgFactory

      @Deprecated public ImgFactory()
      Deprecated.
  • Method Details

    • type

      public T type()
    • create

      public abstract Img<T> create(long... dimensions)
      Create an Img<T> with the specified dimensions.
      Returns:
      new image with the specified dimensions.
    • create

      public Img<T> create(Dimensions dimensions)
      Create an Img<T> with the specified dimensions.
      Returns:
      new image with the specified dimensions.
    • create

      public Img<T> create(int[] dimensions)
      Create an Img<T> with the specified dimensions.

      Note: This is not a vararg function because the underlying int[] based methods already copies the int[] dimensions into a disposable long[] anyways. This would be an unnecessary copy for int... varargs.

      Returns:
      new image with the specified dimensions.
    • imgFactory

      public abstract <S> ImgFactory<S> imgFactory(S type) throws IncompatibleTypeException
      Creates the same ImgFactory for a different generic parameter if possible. If the type "S" does not suit the needs of the ImgFactory (for example implement NativeType in all NativeImgFactory, this method will throw an IncompatibleTypeException.
      Type Parameters:
      S - the new type
      Parameters:
      type - an instance of S
      Returns:
      ImgFactory of type S
      Throws:
      IncompatibleTypeException - if type S is not compatible
    • imgFactory

      public <S> ImgFactory<S> imgFactory(Supplier<S> typeSupplier) throws IncompatibleTypeException
      Creates the same ImgFactory for a different generic parameter if possible. If the supplied type "S" does not suit the needs of the ImgFactory (for example implement NativeType in all NativeImgFactory, this method will throw an IncompatibleTypeException.
      Type Parameters:
      S - the new type
      Parameters:
      typeSupplier - a supplier of S
      Returns:
      ImgFactory of type S
      Throws:
      IncompatibleTypeException - if type S is not compatible
    • create

      @Deprecated public abstract Img<T> create(long[] dim, T type)
      Deprecated.
    • create

      @Deprecated public Img<T> create(Dimensions dim, T type)
      Deprecated.
    • create

      @Deprecated public Img<T> create(int[] dim, T type)
      Deprecated.
    • create

      @Deprecated public Img<T> create(Supplier<T> typeSupplier, long... dim)
      Deprecated.
    • create

      @Deprecated public Img<T> create(Supplier<T> typeSupplier, Dimensions dim)
      Deprecated.
    • create

      @Deprecated public Img<T> create(Supplier<T> typeSupplier, int[] dim)
      Deprecated.
    • cache

      @Deprecated protected void cache(T type)
      Deprecated.
      If the cached type instance was previously null, the given type becomes the cached instance. In this way, if the factory was created using one of the deprecated typeless constructor signatures, but then one of the deprecated create methods is called (i.e.: a method which provides a type instance as an argument), the provided type becomes the cached type instance so that subsequent invocations of the typeless create methods will work as desired.
      Parameters:
      type - The type to cache if needed.