Object
ConvertToImg

public class ConvertToImg extends Object
Converts the Voxels and VoxelBuffer data-types used in Anchor to the Img used in ImgLib2.
Author:
Owen Feehan
  • Method Details

    • from

      public static net.imglib2.img.Img<? extends net.imglib2.type.numeric.RealType<?>> from(VoxelsUntyped voxels)
      Converts from a VoxelsUntyped (Anchor structure) to a Img (ImgLib2 structure).

      The voxel buffers are reused (without duplication).

      Parameters:
      voxels - the voxels to convert.
      Returns:
      an Img object reusing the buffers of voxels.
    • fromSlice

      public static net.imglib2.img.Img<? extends net.imglib2.type.numeric.RealType<?>> fromSlice(VoxelsUntyped voxels, int sliceIndex)
      Creates an Img from a single z-slice of a VoxelsUntyped.
      Parameters:
      voxels - the voxels to extract z-slice from to create a Img.
      sliceIndex - the index of the slice in the z dimension.
      Returns:
      a newly created Img, either reusing the memory in voxels or else a copy of it.
    • fromByte

      public static net.imglib2.img.Img<net.imglib2.type.numeric.integer.UnsignedByteType> fromByte(VoxelBuffer<UnsignedByteBuffer> buffer, Extent extent)
      Creates an Img from a VoxelBuffer with an unsigned byte data-type.
      Parameters:
      buffer - the buffer to use for the voxels in the Img.
      extent - the size of the image, whose volume should match buffer's size exactly.
      Returns:
      the newly created Img, either reusing the memory in buffer or else a copy of it.
    • fromShort

      public static net.imglib2.img.Img<net.imglib2.type.numeric.integer.UnsignedShortType> fromShort(VoxelBuffer<UnsignedShortBuffer> buffer, Extent extent)
      Creates an Img from a VoxelBuffer with an unsigned short data-type.
      Parameters:
      buffer - the buffer to use for the voxels in the Img.
      extent - the size of the image, whose volume should match buffer's size exactly.
      Returns:
      the newly created Img, either reusing the memory in buffer or else a copy of it.
    • fromFloat

      public static net.imglib2.img.Img<net.imglib2.type.numeric.real.FloatType> fromFloat(VoxelBuffer<FloatBuffer> buffer, Extent extent)
      Creates an Img from a VoxelBuffer with a float data-type.
      Parameters:
      buffer - the buffer to use for the voxels in the Img.
      extent - the size of the image, whose volume should match buffer's size exactly.
      Returns:
      the newly created Img,either reusing the memory in buffer or else a copy of it.
    • fromByte

      public static net.imglib2.img.Img<net.imglib2.type.numeric.integer.UnsignedByteType> fromByte(Voxels<UnsignedByteBuffer> voxels)
      Creates an Img from Voxels with an unsigned byte data-type.
      Parameters:
      voxels - the voxels to use in the Img.
      Returns:
      the newly created Img, either reusing the memory in voxels or else a copy of it.
    • fromShort

      public static net.imglib2.img.Img<net.imglib2.type.numeric.integer.UnsignedShortType> fromShort(Voxels<UnsignedShortBuffer> voxels)
      Creates an Img from Voxels with an unsigned short data-type.
      Parameters:
      voxels - the voxels to use in the Img.
      Returns:
      the newly created Img, either reusing the memory in voxels or else a copy of it.
    • fromFloat

      public static net.imglib2.img.Img<net.imglib2.type.numeric.real.FloatType> fromFloat(Voxels<FloatBuffer> voxels)
      Creates an Img from Voxels with a float data-type.
      Parameters:
      voxels - the voxels to use in the Img.
      Returns:
      the newly created Img, either reusing the memory in voxels or else a copy of it.