Class ImgUtil


  • public class ImgUtil
    extends java.lang.Object
    This class contains static methods for copying image data to and from Img instances. It was developed to support access to imglib from applications that can't rely on JIT compilation and that access imglib via the JVM or through JNI (specifically CellProfiler).
    Author:
    Tobias Pietzsch, Stephan Preibisch, Stephan Saalfeld, Lee Kamentsky
    • Constructor Summary

      Constructors 
      Constructor Description
      ImgUtil()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static <T extends BooleanType<T>>
      void
      copy​(boolean[] src, int offset, int[] stride, Img<T> dest)  
      static <T extends RealType<T>>
      void
      copy​(double[] src, int offset, int[] stride, Img<T> dest)
      Copy a flat array of doubles into an Img.
      static <T extends RealType<T>>
      void
      copy​(float[] src, int offset, int[] stride, Img<T> dest)  
      static <T extends IntegerType<T>>
      void
      copy​(int[] src, int offset, int[] stride, Img<T> dest)  
      static <T extends IntegerType<T>>
      void
      copy​(long[] src, int offset, int[] stride, Img<T> dest)  
      static <T extends BooleanType<T>>
      void
      copy​(Img<T> src, boolean[] dest, int offset, int[] stride)  
      static <T extends RealType<T>>
      void
      copy​(Img<T> src, double[] dest, int offset, int[] stride)
      Copy the contents of an Img to a double array
      static <T extends RealType<T>>
      void
      copy​(Img<T> src, float[] dest, int offset, int[] stride)  
      static <T extends IntegerType<T>>
      void
      copy​(Img<T> src, int[] dest, int offset, int[] stride)  
      static <T extends IntegerType<T>>
      void
      copy​(Img<T> src, long[] dest, int offset, int[] stride)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ImgUtil

        public ImgUtil()
    • Method Detail

      • copy

        public static <T extends RealType<T>> void copy​(double[] src,
                                                        int offset,
                                                        int[] stride,
                                                        Img<T> dest)
        Copy a flat array of doubles into an Img. The flat array should be visualized as a series of concatenated rasters. Each raster element has an associated coordinate location. The stride array provides the address of that element: multiply the coordinate at each dimension by its corresponding stride and sum the result to get the address of the raster element. For instance, a 10 x 10 raster image has a stride of { 1, 10 }.
        Type Parameters:
        T - - the type of the destination image data
        Parameters:
        src - - the source of the data. This array must be large enough to encompass all addressed elements.
        offset - - the offset to the element at the origin
        stride - - for each dimension, the multiplier in that dimension to address an axis element in that dimension
        dest - - the destination for the copy
      • copy

        public static <T extends RealType<T>> void copy​(Img<T> src,
                                                        double[] dest,
                                                        int offset,
                                                        int[] stride)
        Copy the contents of an Img to a double array
        Type Parameters:
        T - the Img's type
        Parameters:
        src - copy data from this Img
        dest - the destination array
        offset - the offset to the origin element in the destination array
        stride - the stride into the destination array for each dimension
        See Also:
        for a more comprehensive description of addressing