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


Java ARGBType.set方法代码示例

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


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

示例1: convert

import net.imglib2.type.numeric.ARGBType; //导入方法依赖的package包/类
protected void convert( final LabelMultisetType input, final ARGBType output )
{
	double a = 0;
	double r = 0;
	double g = 0;
	double b = 0;
	double alphaCountSize = 0;

	for ( final Entry< Label > entry : input.entrySet() )
	{
		final int argb = argbStream.argb( entry.getElement().id() );
		final double alpha = ARGBType.alpha( argb );
		final double alphaCount = alpha * iFF * entry.getCount();
		a += alphaCount * alpha;
		r += alphaCount * ARGBType.red( argb );
		g += alphaCount * ARGBType.green( argb );
		b += alphaCount * ARGBType.blue( argb );
		alphaCountSize += alphaCount;
	}
	final double iAlphaCountSize = 1.0 / alphaCountSize;
	final int aInt = Math.min( 255, ( int ) ( a * iAlphaCountSize ) );
	final int rInt = Math.min( 255, ( int ) ( r * iAlphaCountSize ) );
	final int gInt = Math.min( 255, ( int ) ( g * iAlphaCountSize ) );
	final int bInt = Math.min( 255, ( int ) ( b * iAlphaCountSize ) );
	output.set( ( ( ( ( ( aInt << 8 ) | rInt ) << 8 ) | gInt ) << 8 ) | bInt );
}
 
开发者ID:saalfeldlab,项目名称:bigcat,代码行数:27,代码来源:PairLabelMultisetLongARGBConverter.java

示例2: compose

import net.imglib2.type.numeric.ARGBType; //导入方法依赖的package包/类
@Override
public void compose( final ARGBType a, final ARGBType b )
{
	final int argbA = a.get();
	final int argbB = b.get();

	final int rA = ARGBType.red( argbA );
	final int rB = ARGBType.red( argbB );
	final int gA = ARGBType.green( argbA );
	final int gB = ARGBType.green( argbB );
	final int bA = ARGBType.blue( argbA );
	final int bB = ARGBType.blue( argbB );

	final double aA = ARGBType.alpha( argbA ) / 255.0;
	final double aB = ARGBType.alpha( argbB ) / 255.0;

	final double aTarget = aA + aB - aA * aB;

	final int rTarget = Math.min( 255, ( int )Math.round( ( rB - rA ) * aB + rA ) );
	final int gTarget = Math.min( 255, ( int )Math.round( ( gB - gA ) * aB + gA ) );
	final int bTarget = Math.min( 255, ( int )Math.round( ( bB - bA ) * aB + bA ) );

	a.set( ARGBType.rgba( rTarget, gTarget, bTarget, ( int )( aTarget * 255 ) ) );
}
 
开发者ID:saalfeldlab,项目名称:bigcat,代码行数:25,代码来源:ARGBCompositeAlpha.java

示例3: compose

import net.imglib2.type.numeric.ARGBType; //导入方法依赖的package包/类
@Override
public void compose( final ARGBType a, final ARGBType b )
{
	final int argbA = a.get();
	final int argbB = b.get();

	final int rA = ARGBType.red( argbA );
	final int rB = ARGBType.red( argbB );
	final int gA = ARGBType.green( argbA );
	final int gB = ARGBType.green( argbB );
	final int bA = ARGBType.blue( argbA );
	final int bB = ARGBType.blue( argbB );

	final int rTarget = Math.max( rA, rB );
	final int gTarget = Math.max( gA, gB );
	final int bTarget = Math.max( bA, bB );

	a.set( ARGBType.rgba( rTarget, gTarget, bTarget, 255 ) );
}
 
开发者ID:saalfeldlab,项目名称:bigcat,代码行数:20,代码来源:ARGBCompositeMax.java

示例4: compose

import net.imglib2.type.numeric.ARGBType; //导入方法依赖的package包/类
@Override
	public void compose( final ARGBType a, final ARGBType b )
	{
		final int argbA = a.get();
		final int argbB = b.get();

		final int rA = ARGBType.red( argbA );
		final int rB = ARGBType.red( argbB );
		final int gA = ARGBType.green( argbA );
		final int gB = ARGBType.green( argbB );
		final int bA = ARGBType.blue( argbA );
		final int bB = ARGBType.blue( argbB );

		final double aA = ARGBType.alpha( argbA ) / 255.0;
		final double aB = ARGBType.alpha( argbB ) / 255.0;
//		final double aB = ( rB == gB || gB == bB ) ? ARGBType.alpha( argbB ) / 255.0 : ARGBType.alpha( argbB ) / 255.0 * 0.125;

		final double aTarget = aA + aB - aA * aB;

		final int rTarget = Math.min( 255, ( int )Math.round( rA + rB * aB ) );
		final int gTarget = Math.min( 255, ( int )Math.round( gA + gB * aB ) );
		final int bTarget = Math.min( 255, ( int )Math.round( bA + bB * aB ) );

		a.set( ARGBType.rgba( rTarget, gTarget, bTarget, ( int )( aTarget * 255 ) ) );
	}
 
开发者ID:saalfeldlab,项目名称:bigcat,代码行数:26,代码来源:ARGBCompositeAlphaAdd.java

示例5: convert

import net.imglib2.type.numeric.ARGBType; //导入方法依赖的package包/类
@Override
public void convert( final R input, final ARGBType output )
{
	final int v = (int) Math.round( scale * (input.getRealDouble() - min) );
	if ( v < 0 )
	{
		output.set( black );
	} else if ( v > lut.length - 1 )
	{
		output.set( lut[ lut.length - 1 ] );
	} else
	{
		final int index = (int) Math.round( v );
		output.set( lut[ index ] );
	}
}
 
开发者ID:saalfeldlab,项目名称:bigwarp,代码行数:17,代码来源:RealLUTARGBColorConverter.java

示例6: updateCompositeProjector

import net.imglib2.type.numeric.ARGBType; //导入方法依赖的package包/类
private void updateCompositeProjector(final IntervalView in, final Img< ARGBType > out)
    {
//        final UnsignedShortType min = new UnsignedShortType();
//        final UnsignedShortType max = new UnsignedShortType();
//        computeMinMax(in, min, max);
//
//        converterListARGB.set(0,  new RealARGBConverter< UnsignedShortType >( min.get(), max.get() * 0.1 ));

        projector = new CompositeXYRandomAccessibleProjector( in, out, converterListARGB, 2 );

        projector.setComposite( true );
        projector.setComposite( 0, cbCh0.isSelected() );
        projector.setComposite( 1, cbCh1.isSelected() );
        projector.setComposite( 2, cbCh2.isSelected() );
        projector.setComposite( 3, cbCh3.isSelected() );

        projector.map();

        final ARGBType t = new ARGBType();
        t.set(150 << 16 | 150 << 8 | 150);
        currentInteractiveViewer2D.updateIntervalSource(Views.extendValue(out, t));
    }
 
开发者ID:fjug,项目名称:IDDEA,代码行数:23,代码来源:InteractiveDisplayView.java

示例7: accumulate

import net.imglib2.type.numeric.ARGBType; //导入方法依赖的package包/类
@Override
protected void accumulate( final Cursor< ? extends ARGBType >[] accesses, final ARGBType target )
{
	int aMax = 0, rMax = 0, gMax = 0, bMax = 0;
	for ( final Cursor< ? extends ARGBType > access : accesses )
	{
		final int value = access.get().get();
		final int a = ARGBType.alpha( value );
		final int r = ARGBType.red( value );
		final int g = ARGBType.green( value );
		final int b = ARGBType.blue( value );
		
		aMax = Math.max( aMax, a );
		rMax = Math.max( rMax, r );
		gMax = Math.max( gMax, g );
		bMax = Math.max( bMax, b );
	}
	
	if ( aMax > 255 )
		aMax = 255;
	if ( rMax > 255 )
		rMax = 255;
	if ( gMax > 255 )
		gMax = 255;
	if ( bMax > 255 )
		bMax = 255;
	
	
	target.set( ARGBType.rgba( rMax, gMax, bMax, aMax ) );
}
 
开发者ID:PreibischLab,项目名称:BigStitcher,代码行数:31,代码来源:MaximumProjectorARGB.java

示例8: compose

import net.imglib2.type.numeric.ARGBType; //导入方法依赖的package包/类
@Override
public void compose( final ARGBType a, final ARGBType b )
{
	final int argbA = a.get();
	final int argbB = b.get();

	final double rA = ARGBType.red( argbA ) / 255.0;
	final double rB = ARGBType.red( argbB ) / 255.0;
	final double gA = ARGBType.green( argbA ) / 255.0;
	final double gB = ARGBType.green( argbB ) / 255.0;
	final double bA = ARGBType.blue( argbA ) / 255.0;
	final double bB = ARGBType.blue( argbB ) / 255.0;

	final double aA = ARGBType.alpha( argbA ) / 255.0;
	final double aB = ARGBType.alpha( argbB ) / 255.0;

	final double aTarget = aA + aB - aA * aB;

	final double rTarget = rA - rA * aB + rA * rB * aB;
	final double gTarget = gA - gA * aB + gA * gB * aB;
	final double bTarget = bA - bA * aB + bA * bB * aB;

	a.set( ARGBType.rgba(
			Math.max( 0,  Math.min( 255, ( int )Math.round( rTarget * 255 ) ) ),
			Math.max( 0,  Math.min( 255, ( int )Math.round( gTarget * 255 ) ) ),
			Math.max( 0,  Math.min( 255, ( int )Math.round( bTarget * 255 ) ) ),
			( int )( aTarget * 255 ) ) );
}
 
开发者ID:saalfeldlab,项目名称:bigcat,代码行数:29,代码来源:ARGBCompositeAlphaMultiply.java

示例9: accumulate

import net.imglib2.type.numeric.ARGBType; //导入方法依赖的package包/类
@Override
protected void accumulate( final Cursor< ? extends ARGBType >[] accesses, final ARGBType target )
{
	// TODO This is bad, we want to be able to paint on top of arbitrary background, e.g.
	// the sky line of NY or some sort of eye pleasing gradient, the outside code should
	// take care for clearing/ preparing the background and not leave it as is.
	target.set( 0xff000000 );

	for ( final Cursor< ? extends ARGBType > access : accesses )
		composite.compose( target, access.get() );
}
 
开发者ID:saalfeldlab,项目名称:bigcat,代码行数:12,代码来源:AccumulateProjectorCompositeARGB.java

示例10: paint

import net.imglib2.type.numeric.ARGBType; //导入方法依赖的package包/类
static void paint( final Iterable< ? extends RealLocalizable > points, final Img< ARGBType > output, final ARGBType color )
{
	final int radius = 2;
	final RandomAccess< Neighborhood< ARGBType > > na = new HyperSphereShape( radius ).neighborhoodsRandomAccessible( Views.extendZero( output ) ).randomAccess();
	final Round< RandomAccess< Neighborhood< ARGBType > > > rna = new Round< RandomAccess< Neighborhood< ARGBType > > >( na );
	for ( final RealLocalizable l : points )
	{
		rna.setPosition( l );
		for ( final ARGBType t : na.get() )
			t.set( color );
	}
}
 
开发者ID:imglib,项目名称:imglib2-tests,代码行数:13,代码来源:SplitHyperPlaneKDTreeExample.java

示例11: createCompositeProjector

import net.imglib2.type.numeric.ARGBType; //导入方法依赖的package包/类
private void createCompositeProjector( final IntervalView in, final Img< ARGBType > out )
    {
//        final UnsignedShortType min = new UnsignedShortType();
//        final UnsignedShortType max = new UnsignedShortType();
//        computeMinMax(Views.hyperSlice(in, 2, 0), min, max);

        converterListARGB = new ArrayList< Converter< UnsignedShortType, ARGBType > >();
        converterListARGB.add( new RealARGBConverter< UnsignedShortType >( 0, 10000 ) );
//        converterListARGB.add( new RealARGBConverter< UnsignedShortType >( min.get(), max.get() * 0.1 ) );
        converterListARGB.add( new ChannelARGBConverter( G ) );
        converterListARGB.add( new ChannelARGBConverter( R ) );
        converterListARGB.add( new ChannelARGBConverter( B ) );

        projector = new CompositeXYRandomAccessibleProjector( in, out, converterListARGB, 2 );

        projector.setComposite( true );
//		projector.setComposite( 0, false );
//		projector.setComposite( 1, true );
//		projector.setComposite( 2, false );
        projector.map();

        currentInteractiveViewer2D.getJHotDrawDisplay().setImageDim(new Dimension((int)in.max(0), (int)in.max(1)));
        currentInteractiveViewer2D.updateConverter(new TypeIdentity<ARGBType>());
        final ARGBType t = new ARGBType();
        t.set(150 << 16 | 150 << 8 | 150);
        currentInteractiveViewer2D.updateIntervalSource(Views.extendValue(out, t));
        currentInteractiveViewer2D.getJHotDrawDisplay().resetTransform();
    }
 
开发者ID:fjug,项目名称:IDDEA,代码行数:29,代码来源:InteractiveDisplayView.java

示例12: mapARGB

import net.imglib2.type.numeric.ARGBType; //导入方法依赖的package包/类
final static protected < T extends RealType< T > > void mapARGB(
		final IterableInterval< ARGBType > image,
		final IterableInterval< RealComposite< T > > coefficients )
{
	final Cursor< ARGBType > cs = image.cursor();
	final Cursor< RealComposite< T > > ct = coefficients.cursor();

	while ( cs.hasNext() )
	{
		final RealComposite< T > t = ct.next();
		final double alpha = t.get( 0 ).getRealDouble();
		final double beta = t.get( 1 ).getRealDouble();

		final ARGBType s = cs.next();
		final int argb = s.get();
		final int a = ( ( argb >> 24 ) & 0xff );
		final double r = ( ( argb >> 16 ) & 0xff ) * alpha + beta;
		final double g = ( ( argb >> 8 ) & 0xff ) * alpha + beta;
		final double b = ( argb & 0xff ) * alpha + beta;

		s.set(
				( a << 24 ) |
				( ( r < 0 ? 0 : r > 255 ? 255 : ( int )( r + 0.5 ) ) << 16 ) |
				( ( g < 0 ? 0 : g > 255 ? 255 : ( int )( g + 0.5 ) ) << 8 ) |
				( b < 0 ? 0 : b > 255 ? 255 : ( int )( b + 0.5 ) ) );
	}
}
 
开发者ID:trakem2,项目名称:TrakEM2,代码行数:28,代码来源:LinearIntensityMap.java

示例13: accumulate

import net.imglib2.type.numeric.ARGBType; //导入方法依赖的package包/类
@Override
protected void accumulate( final Cursor< ? extends ARGBType >[] accesses, final ARGBType target )
{
	int aSum = 0, rSum = 0, gSum = 0, bSum = 0;
	int nonZeroAccesses = 0;
	for ( final Cursor< ? extends ARGBType > access : accesses )
	{
		final int value = access.get().get();
		final int a = ARGBType.alpha( value );
		final int r = ARGBType.red( value );
		final int g = ARGBType.green( value );
		final int b = ARGBType.blue( value );
		
		if (a>0 || r>0 || g>0 || b>0)
			nonZeroAccesses++;
		
		aSum += a;
		rSum += r;
		gSum += g;
		bSum += b;
	}
	
	nonZeroAccesses = nonZeroAccesses > 0 ? nonZeroAccesses : 1;
	
	aSum /= nonZeroAccesses;
	rSum /= nonZeroAccesses;
	gSum /= nonZeroAccesses;
	bSum /= nonZeroAccesses;
	
	if ( aSum > 255 )
		aSum = 255;
	if ( rSum > 255 )
		rSum = 255;
	if ( gSum > 255 )
		gSum = 255;
	if ( bSum > 255 )
		bSum = 255;
	
	
	target.set( ARGBType.rgba( rSum, gSum, bSum, aSum ) );
}
 
开发者ID:PreibischLab,项目名称:BigStitcher,代码行数:42,代码来源:AveragingProjectorARGB.java

示例14: compose

import net.imglib2.type.numeric.ARGBType; //导入方法依赖的package包/类
@Override
	public void compose( final ARGBType a, final ARGBType b )
	{
		final int argbA = a.get();
		final int argbB = b.get();

		final double rA = ARGBType.red( argbA ) / 255.0;
		final double rB = ARGBType.red( argbB ) / 255.0;
		final double gA = ARGBType.green( argbA ) / 255.0;
		final double gB = ARGBType.green( argbB ) / 255.0;
		final double bA = ARGBType.blue( argbA ) / 255.0;
		final double bB = ARGBType.blue( argbB ) / 255.0;

		final double aA = ARGBType.alpha( argbA ) / 255.0;
		final double aB = ARGBType.alpha( argbB ) / 255.0;
//		final double aB = ( rB == gB || gB == bB ) ? ARGBType.alpha( argbB ) / 255.0 * 0.5 : ARGBType.alpha( argbB ) / 255.0 * 0.125;

		final double aTarget = aA + aB - aA * aB;

		final double yA = rgb2y( rA, gA, bA );
		final double cbA = rgb2cb( rA, gA, bA );
		final double crA = rgb2cr( rA, gA, bA );

		final double cbB = rgb2cb( rB, gB, bB );
		final double crB = rgb2cr( rB, gB, bB );

		final double aBInv = 1.0 - aB;

		final double cbTarget = cbA * aBInv + cbB * aB;
		final double crTarget = crA * aBInv + crB * aB;

		final double rTarget = ycbcr2r( yA, cbTarget, crTarget );
		final double gTarget = ycbcr2g( yA, cbTarget, crTarget );
		final double bTarget = ycbcr2b( yA, cbTarget, crTarget );

		a.set( ARGBType.rgba(
				Math.max( 0,  Math.min( 255, ( int )Math.round( rTarget * 255 ) ) ),
				Math.max( 0,  Math.min( 255, ( int )Math.round( gTarget * 255 ) ) ),
				Math.max( 0,  Math.min( 255, ( int )Math.round( bTarget * 255 ) ) ),
				( int )( aTarget * 255 ) ) );
	}
 
开发者ID:saalfeldlab,项目名称:bigcat,代码行数:42,代码来源:ARGBCompositeAlphaYCbCr.java

示例15: convert

import net.imglib2.type.numeric.ARGBType; //导入方法依赖的package包/类
@Override
public void convert( final ARGBType input, final ARGBType output )
{
	output.set( convertColor( input.get() ));
}
 
开发者ID:saalfeldlab,项目名称:bigwarp,代码行数:6,代码来源:ARGBtoRandomARGBColorConverter.java


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