@Override public NativeImg< T, ByteArray > createByteInstance( final long[] dimensions, final int entitiesPerPixel ) { if ( dimensions.length > 5 ) throw new RuntimeException( "Unsupported dimensionality: " + dimensions.length ); return new ByteImagePlus< T >( dimensions, entitiesPerPixel ); }
public static ByteImagePlus<UnsignedByteType> wrapByte( final ImagePlus imp ) { if ( imp.getType() != ImagePlus.GRAY8) return null; final ByteImagePlus< UnsignedByteType > container = new ByteImagePlus< UnsignedByteType >( imp ); // create a Type that is linked to the container final UnsignedByteType linkedType = new UnsignedByteType( container ); // pass it to the NativeContainer container.setLinkedType( linkedType ); return container; }