当前位置: 首页>>代码示例>>Java>>正文


Java UnsignedByteType类代码示例

本文整理汇总了Java中net.imglib2.type.numeric.integer.UnsignedByteType的典型用法代码示例。如果您正苦于以下问题:Java UnsignedByteType类的具体用法?Java UnsignedByteType怎么用?Java UnsignedByteType使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


UnsignedByteType类属于net.imglib2.type.numeric.integer包,在下文中一共展示了UnsignedByteType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: convertToGenericTexture

import net.imglib2.type.numeric.integer.UnsignedByteType; //导入依赖的package包/类
public static GenericTexture convertToGenericTexture( Dataset d ) {
    long width = d.getWidth();
    long height = d.getHeight();

    GLVector dims = new GLVector( width, height, 1 );
    int nChannels = 3;

    ByteBuffer bb = BufferUtils.BufferUtils.allocateByte((int) (width * height * nChannels));

    System.out.println("Size:" + width + " " +  height + " " + nChannels);

    Cursor cur = d.cursor();
    while( cur.hasNext() ) {
        cur.fwd();
        int val = ((UnsignedByteType) cur.get()).get();
        //System.out.println( (byte)val );
        bb.put( (byte) val );
        //bb.put((byte)(Math.random()*255));
    }
    bb.flip();

    return new GenericTexture("neverUsed", dims, nChannels, GLTypeEnum.UnsignedByte, bb, true, true, false);
}
 
开发者ID:scenerygraphics,项目名称:SciView,代码行数:24,代码来源:Main.java

示例2: KnossosUnsignedByteImageLoader

import net.imglib2.type.numeric.integer.UnsignedByteType; //导入依赖的package包/类
public KnossosUnsignedByteImageLoader(
		final KnossosConfig config,
		final String urlFormat,
		final VolatileGlobalCellCache cache )
{
	super(
			config,
			urlFormat,
			new UnsignedByteType(),
			new VolatileUnsignedByteType(),
			new KnossosUnsignedByteVolatileArrayLoader(
					config.baseUrl,
					urlFormat,
					config.experimentName,
					config.format ),
			cache );
}
 
开发者ID:saalfeldlab,项目名称:bigcat,代码行数:18,代码来源:KnossosUnsignedByteImageLoader.java

示例3: H5UnsignedByteSetupImageLoader

import net.imglib2.type.numeric.integer.UnsignedByteType; //导入依赖的package包/类
public H5UnsignedByteSetupImageLoader(
		final IHDF5Reader reader,
		final String dataset,
		final int setupId,
		final int[] blockDimension,
		final double[] resolution,
		final VolatileGlobalCellCache cache ) throws IOException
{
	super(
			reader,
			dataset,
			setupId,
			blockDimension,
			resolution,
			readOffset( reader, dataset ),
			new UnsignedByteType(),
			new VolatileUnsignedByteType(),
			new H5ByteArrayLoader( reader, dataset ),
			cache );
}
 
开发者ID:saalfeldlab,项目名称:bigcat,代码行数:21,代码来源:H5UnsignedByteSetupImageLoader.java

示例4: createUnsignedByteInstance

import net.imglib2.type.numeric.integer.UnsignedByteType; //导入依赖的package包/类
@SuppressWarnings( "unchecked" )
public static BigWarpImageStackImageLoader< UnsignedByteType, ByteArray > createUnsignedByteInstance( final ImagePlus imp, int[] ids )
{
	return new BigWarpImageStackImageLoader< UnsignedByteType, ByteArray >( new UnsignedByteType(), imp, ids )
	{
		@Override
		protected ByteArray wrapPixels( final Object array )
		{
			return new ByteArray( ( byte[] ) array );
		}

		@Override
		protected void linkType( final PlanarImg< UnsignedByteType, ByteArray > img )
		{
			img.setLinkedType( new UnsignedByteType( img ) );
		}
	};
}
 
开发者ID:saalfeldlab,项目名称:bigwarp,代码行数:19,代码来源:BigWarpImageStackImageLoader.java

示例5: chooseBestType

import net.imglib2.type.numeric.integer.UnsignedByteType; //导入依赖的package包/类
static private final <R extends IntegerType<R> & NativeType<R>> R chooseBestType(final int nBits) {
	
	if (nBits < 9) return (R)(Object) new UnsignedByteType();
	else if (nBits< 13) return (R)(Object) new Unsigned12BitType();
	else if (nBits < 17) return (R)(Object) new UnsignedShortType();
	else if (nBits < 33) return (R)(Object) new UnsignedIntType();
	else if (nBits < 65) return (R)(Object) new LongType();
	else throw new IllegalArgumentException("Cannot do an histogram of " + nBits + " bits.");
	/*
	switch (nBits) {
		case 8:
			return (R) new UnsignedByteType();
		case 12:
			return (R) new Unsigned12BitType();
		case 16:
			return (R) new UnsignedShortType();
		case 32:
			return (R) new UnsignedIntType();
		case 64:
			return (R) new LongType();
		default:
			return (R) new UnsignedAnyBitType(nBits);
	}
	*/
}
 
开发者ID:imglib,项目名称:imglib2-script,代码行数:26,代码来源:IntegralHistogram.java

示例6: predicateCursorTest

import net.imglib2.type.numeric.integer.UnsignedByteType; //导入依赖的package包/类
/**
 * Tests a PredicateCursor by checking if all visited values are "true".
 * @throws MissingPreconditionException
 */
@Test
public void predicateCursorTest() throws MissingPreconditionException {
	// load a 3D test image
	RandomAccessibleInterval<UnsignedByteType> img = positiveCorrelationImageCh1;
	long[] roiOffset = createRoiOffset(img);
	long[] roiSize = createRoiSize(img);
	long[] dim = new long[ img.numDimensions() ];
	img.dimensions(dim);
	RandomAccessibleInterval<BitType> mask = MaskFactory.createMask(dim,
			roiOffset, roiSize);

	// create cursor to walk an image with respect to a mask
	final Predicate<BitType> predicate = new MaskPredicate();
	Cursor<BitType> roiCursor
		= new PredicateCursor<BitType>(
				Views.iterable(mask).localizingCursor(), predicate);

	// test if all visited voxels are "true"
	while (roiCursor.hasNext()) {
		roiCursor.fwd();
		assertTrue(roiCursor.get().get());
	}
}
 
开发者ID:fiji,项目名称:Colocalisation_Analysis,代码行数:28,代码来源:MaskAndRoiTest.java

示例7: getConstantUnsignedByteImg

import net.imglib2.type.numeric.integer.UnsignedByteType; //导入依赖的package包/类
/**
 * @param dim a long array with the desired dimensions of the image
 * @param constValue constant image value
 * @return an {@link Img} of {@link UnsignedByteType} filled with a constant
 *         value.
 */
public Img<UnsignedByteType> getConstantUnsignedByteImg(final long[] dim,
	final int constValue)
{
	final ArrayImg<UnsignedByteType, ByteArray> img = ArrayImgs.unsignedBytes(
		dim);

	final UnsignedByteType type = img.firstElement();
	if (constValue < type.getMinValue() || constValue >= type.getMaxValue()) {
		throw new IllegalArgumentException("Can't create image for constant [" +
			constValue + "]");
	}

	final ArrayCursor<UnsignedByteType> cursor = img.cursor();
	while (cursor.hasNext()) {
		cursor.next().set(constValue);
	}

	return img;
}
 
开发者ID:imagej,项目名称:imagej-ops,代码行数:26,代码来源:AbstractFeatureTest.java

示例8: testDefaultASCII

import net.imglib2.type.numeric.integer.UnsignedByteType; //导入依赖的package包/类
@Test
public void testDefaultASCII() {
	// character set used in DefaultASCII, could be updated if necessary
	final String CHARS = "#O*o+-,. ";
	final int len = CHARS.length();
	final int width = 10;
	final int offset = 47;
	final byte[] array = new byte[width * len];
	for (int i = 0; i < len; i++) {
		for (int j = 0; j < width; j++) {
			array[i * width + j] = (byte) (offset + i * width + j);
		}
	}
	final Img<UnsignedByteType> img = ArrayImgs.unsignedBytes(array, width,
		len);
	final String ascii = (String) ops.run(DefaultASCII.class, img);
	for (int i = 0; i < len; i++) {
		for (int j = 0; j < width; j++) {
			assertTrue(ascii.charAt(i * (width + 1) + j) == CHARS.charAt(i));
		}
		assertTrue(ascii.charAt(i * (width + 1) + width) == '\n');
	}
}
 
开发者ID:imagej,项目名称:imagej-ops,代码行数:24,代码来源:ASCIITest.java

示例9: main

import net.imglib2.type.numeric.integer.UnsignedByteType; //导入依赖的package包/类
static public final void main(String[] args) {
	
	new ImageJ();
	
	try {
		String src = "http://imagej.nih.gov/ij/images/bat-cochlea-volume.zip";
		//String src = "/home/albert/Desktop/t2/bat-cochlea-volume.tif";	
		Img<UnsignedByteType> img = ImgLib.open(src);
		
		Img<UnsignedByteType> s = new SliceXY<UnsignedByteType>(img, 23);

		ImgLib.wrap(s, "23").show();
		ImgLib.wrap(img, "bat").show();

	} catch (Exception e) {
		e.printStackTrace();
	}
}
 
开发者ID:imglib,项目名称:imglib2-script,代码行数:19,代码来源:Slices.java

示例10: convert

import net.imglib2.type.numeric.integer.UnsignedByteType; //导入依赖的package包/类
public void convert( final Img< UnsignedByteType > in,  final Img< ARGBType > out )
	{
		final CompositeXYProjector< UnsignedByteType > projector = new CompositeXYProjector< UnsignedByteType >( in, out, ChannelARGBConverter.converterListRGBA, 2 );
		projector.setComposite( true );
//		projector.setComposite( 0, false );
//		projector.setComposite( 1, true );
//		projector.setComposite( 2, false );
		for ( int iteration = 0; iteration < 10; ++iteration )
		{
			final long start = System.currentTimeMillis();
			for ( int i = 0; i < 10; ++i )
				projector.map();
			final long end = System.currentTimeMillis();
			System.out.println( ( end - start ) + " ms (iteration " + iteration + ")" );
		}
	}
 
开发者ID:imglib,项目名称:imglib2-tests,代码行数:17,代码来源:CompositeXYProjectorBenchmark.java

示例11: copyRAINoOutputTest

import net.imglib2.type.numeric.integer.UnsignedByteType; //导入依赖的package包/类
@Test
public void copyRAINoOutputTest() {
	@SuppressWarnings("unchecked")
	final RandomAccessibleInterval<UnsignedByteType> output =
		(RandomAccessibleInterval<UnsignedByteType>) ops.run(CopyRAI.class,
			input);

	final Cursor<UnsignedByteType> inc = input.localizingCursor();
	final RandomAccess<UnsignedByteType> outRA = output.randomAccess();

	while (inc.hasNext()) {
		inc.fwd();
		outRA.setPosition(inc);
		assertEquals(inc.get().get(), outRA.get().get());
	}
}
 
开发者ID:imagej,项目名称:imagej-ops,代码行数:17,代码来源:CopyRAITest.java

示例12: copyRAIDifferentSizeTest

import net.imglib2.type.numeric.integer.UnsignedByteType; //导入依赖的package包/类
@Test
@SuppressWarnings({ "unchecked", "rawtypes" })
public void copyRAIDifferentSizeTest() {

	// create a copy op
	final UnaryHybridCF<IntervalView<UnsignedByteType>, RandomAccessibleInterval<UnsignedByteType>> copy =
		(UnaryHybridCF) Hybrids.unaryCF(ops, CopyRAI.class,
			RandomAccessibleInterval.class, IntervalView.class);

	assertNotNull(copy);

	final Img<UnsignedByteType> out = ops.create().img(new FinalDimensions(
		size2), new UnsignedByteType());

	// copy view to output and assert that is equal to the mean of the view
	copy.compute(view, out);
	assertEquals(ops.stats().mean(out).getRealDouble(), 100.0, delta);

	// also try with a planar image
	final Img<UnsignedByteType> outFromPlanar = ops.create().img(
		new FinalDimensions(size2), new UnsignedByteType());

	copy.compute(viewPlanar, outFromPlanar);
	assertEquals(ops.stats().mean(outFromPlanar).getRealDouble(), 100.0, delta);

}
 
开发者ID:imagej,项目名称:imagej-ops,代码行数:27,代码来源:CopyRAITest.java

示例13: initImg

import net.imglib2.type.numeric.integer.UnsignedByteType; //导入依赖的package包/类
@Before
public void initImg() {
	in = generateUnsignedByteArrayTestImg(false, 10, 10, 10);

	final RandomAccess<UnsignedByteType> randomAccess = in.randomAccess();

	// at each x,y,z fill with x+y
	for (int x = 0; x < 10; x++) {
		for (int y = 0; y < 10; y++) {
			for (int z = 0; z < 10; z++) {
				randomAccess.setPosition(new long[] { x, y, z });
				randomAccess.get().setReal(x + y);
			}
		}
	}

	out1 = generateUnsignedByteArrayTestImg(false, 10, 10);
	out2 = generateUnsignedByteArrayTestImg(false, 10, 10);

	op = Computers.unary(ops, Ops.Stats.Sum.class, UnsignedByteType.class,
		out1);
}
 
开发者ID:imagej,项目名称:imagej-ops,代码行数:23,代码来源:ProjectTest.java

示例14: createUnsignedByteInstance

import net.imglib2.type.numeric.integer.UnsignedByteType; //导入依赖的package包/类
public static ImageStackImageLoader< UnsignedByteType, ByteArray > createUnsignedByteInstance( final ImagePlus imp )
{
	return new ImageStackImageLoader< UnsignedByteType, ByteArray >( new UnsignedByteType(), imp )
	{
		@Override
		protected ByteArray wrapPixels( final Object array )
		{
			return new ByteArray( ( byte[] ) array );
		}

		@Override
		protected void linkType( final PlanarImg< UnsignedByteType, ByteArray > img )
		{
			img.setLinkedType( new UnsignedByteType( img ) );
		}
	};
}
 
开发者ID:bigdataviewer,项目名称:bigdataviewer_fiji,代码行数:18,代码来源:ImageStackImageLoader.java

示例15: createCellImage

import net.imglib2.type.numeric.integer.UnsignedByteType; //导入依赖的package包/类
private CellImg<UnsignedByteType, ByteArray> createCellImage() {
	final UnsignedByteType type = new UnsignedByteType();
	final int cellSize = ( int ) Math.pow( Integer.MAX_VALUE / type.getEntitiesPerPixel().getRatio(), 1.0 / numDimensions );

	// test whether there were rounding errors and cellSize is actually too big
	long t = 1;
	for ( int d = 0; d < numDimensions; ++d )
		t *= cellSize;
	t *= type.getEntitiesPerPixel().getNumerator();
	t /= type.getEntitiesPerPixel().getDenominator();
	if ( t > Integer.MAX_VALUE )
		throw new RuntimeException( "there were rounding errors and cellSize is actually too big" );

	@SuppressWarnings( "unchecked" )
	final
	CellImg<UnsignedByteType, ByteArray> cellContainer = ( CellImg<UnsignedByteType, ByteArray> ) createImage( dimensions, new CellImgFactory< UnsignedByteType >( cellSize ) );
	return cellContainer;
}
 
开发者ID:imglib,项目名称:imglib2-tests,代码行数:19,代码来源:ImglibBenchmark.java


注:本文中的net.imglib2.type.numeric.integer.UnsignedByteType类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。