/** Returns {@code create(pointer, sizes, strides, true)} */ public static UByteIndexer create(BytePointer pointer, long[] sizes, long[] strides) { return create(pointer, sizes, strides, true); } /**
/** Returns {@code create(pointer, { pointer.limit() - pointer.position() }, { 1 }, true)} */ public static UByteIndexer create(BytePointer pointer) { return create(pointer, new long[] { pointer.limit() - pointer.position() }, ONE_STRIDE); }
@Override public UByteIndexer createIndexer(boolean direct) { int w = pixGetWidth((PIX)this); int h = pixGetHeight((PIX)this); int d = pixGetDepth((PIX)this); int wpl = pixGetWpl((PIX)this); long[] sizes = {h, w, d / 8}; long[] strides = {wpl * 4, d / 8, 1}; BytePointer data = new BytePointer(pixGetData((PIX)this)).capacity(h * wpl * 4); return UByteIndexer.create(data, sizes, strides, direct); }
switch (imageDepth) { case DEPTH_UBYTE: return array != null ? (I)UByteIndexer.create((byte[])array, sizes, strides).indexable(this) : direct ? (I)UByteIndexer.create((ByteBuffer)buffer, sizes, strides).indexable(this) : (I)UByteIndexer.create(new BytePointer((ByteBuffer)buffer), sizes, strides, false).indexable(this); case DEPTH_BYTE: return array != null ? (I)ByteIndexer.create((byte[])array, sizes, strides).indexable(this)
switch (imageDepth) { case DEPTH_UBYTE: return array != null ? (I)UByteIndexer.create((byte[])array, sizes, strides).indexable(this) : direct ? (I)UByteIndexer.create((ByteBuffer)buffer, sizes, strides).indexable(this) : (I)UByteIndexer.create(new BytePointer((ByteBuffer)buffer), sizes, strides, false).indexable(this); case DEPTH_BYTE: return array != null ? (I)ByteIndexer.create((byte[])array, sizes, strides).indexable(this)
case DT_BOOL: case DT_QUINT8: case DT_UINT8: return (I)UByteIndexer.create(ptr.capacity(size), sizes, strides, direct).indexable(this); case DT_QINT8: case DT_INT8: return (I)ByteIndexer.create(ptr.capacity(size), sizes, strides, direct).indexable(this);