本文整理汇总了Java中net.imglib2.type.numeric.ARGBType.red方法的典型用法代码示例。如果您正苦于以下问题:Java ARGBType.red方法的具体用法?Java ARGBType.red怎么用?Java ARGBType.red使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.imglib2.type.numeric.ARGBType
的用法示例。
在下文中一共展示了ARGBType.red方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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 );
}
示例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 ) ) );
}
示例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 ) );
}
示例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 ) ) );
}
示例5: convertColor
import net.imglib2.type.numeric.ARGBType; //导入方法依赖的package包/类
int convertColor( final int color )
{
final int a = ARGBType.alpha( color );
int r = ARGBType.red( color );
int g = ARGBType.green( color );
int b = ARGBType.blue( color );
// final int v = Math.min( 255, Math.max( 0, (int)( scaleR * r + scaleG * g + scaleB * b ) / 3 ) );
final int v = ( r + 256 * g + 512 * b );
int argb = -1;
if( !map.containsKey( v ))
{
map.put( v, newColor() );
}
if( argb >= 0 )
return argb;
else
return map.get( v );
}
示例6: 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 ) );
}
示例7: convertValid
import net.imglib2.type.numeric.ARGBType; //导入方法依赖的package包/类
protected void convertValid( final VolatileLabelMultisetType input, final VolatileARGBType output )
{
double a = 0;
double r = 0;
double g = 0;
double b = 0;
double alphaCountSize = 0;
for ( final Entry< Label > entry : input.get().entrySet() )
{
final int argb = argbSource.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.setValid( true );
output.set( ( ( ( ( ( aInt << 8 ) | rInt ) << 8 ) | gInt ) << 8 ) | bInt );
// output.set( ARGBType.rgba( rInt, gInt, bInt, aInt ) );
}
示例8: convertValid
import net.imglib2.type.numeric.ARGBType; //导入方法依赖的package包/类
protected void convertValid( final VolatileLabelMultisetType input, final VolatileARGBType output )
{
double a = 0;
double r = 0;
double g = 0;
double b = 0;
double alphaCountSize = 0;
for ( final Entry< Label > entry : input.get().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.setValid( true );
output.set( ( ( ( ( ( aInt << 8 ) | rInt ) << 8 ) | gInt ) << 8 ) | bInt );
}
示例9: 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 ) ) );
}
示例10: convert
import net.imglib2.type.numeric.ARGBType; //导入方法依赖的package包/类
@Override
public void convert( ARGBType input, FloatType output )
{
int v = input.getIndex();
float r = ARGBType.red( v );
float g = ARGBType.green( v );
float b = ARGBType.blue( v );
output.set( r + g + b );
}
示例11: 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 ) );
}
示例12: 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 ) ) );
}