本文整理汇总了Java中net.imglib2.type.numeric.ARGBType类的典型用法代码示例。如果您正苦于以下问题:Java ARGBType类的具体用法?Java ARGBType怎么用?Java ARGBType使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ARGBType类属于net.imglib2.type.numeric包,在下文中一共展示了ARGBType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: visualizeVisibleIds
import net.imglib2.type.numeric.ARGBType; //导入依赖的package包/类
/**
* Visualization to test how it works.
*
* @param screenLabels
*/
@SuppressWarnings( "unused" )
public static void visualizeVisibleIds(
final RandomAccessibleInterval< Pair< LabelMultisetType, LongType > > screenLabels )
{
final GoldenAngleSaturatedARGBStream argbStream =
new GoldenAngleSaturatedARGBStream(
new FragmentSegmentAssignment(
new LocalIdService() ) );
final RandomAccessibleInterval< ARGBType > convertedScreenLabels =
Converters.convert(
screenLabels,
new PairLabelMultisetLongARGBConverter( argbStream ),
new ARGBType() );
ImageJFunctions.show( convertedScreenLabels );
}
示例2: 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 );
}
示例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 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 ) ) );
}
示例4: createAccumulateProjector
import net.imglib2.type.numeric.ARGBType; //导入依赖的package包/类
@Override
public AccumulateProjectorCompositeARGB createAccumulateProjector(
ArrayList< VolatileProjector > sourceProjectors,
ArrayList< Source< ? > > sources,
ArrayList< ? extends RandomAccessible< ? extends ARGBType > > sourceScreenImages,
RandomAccessibleInterval< ARGBType > targetScreenImage,
int numThreads,
ExecutorService executorService )
{
return new AccumulateProjectorCompositeARGB(
sourceProjectors,
sourceScreenImages,
targetScreenImage,
numThreads,
executorService );
}
示例5: 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 ) );
}
示例6: 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 ) ) );
}
示例7: LabelblkSetupImageLoader
import net.imglib2.type.numeric.ARGBType; //导入依赖的package包/类
private LabelblkSetupImageLoader(
final ConstructorParameters parameters,
final int setupId,
final int argbMask ) throws JsonSyntaxException, JsonIOException, IOException
{
super(
setupId,
new ARGBType(),
new VolatileARGBType(),
parameters,
new LabelblkVolatileArrayLoader(
parameters.apiUrl,
parameters.nodeId,
parameters.dataInstanceId,
parameters.cellDimensions,
argbMask ) );
}
示例8: transferChannelSettings
import net.imglib2.type.numeric.ARGBType; //导入依赖的package包/类
protected void transferChannelSettings( final CompositeImage ci, final SetupAssignments setupAssignments, final VisibilityAndGrouping visibility )
{
final int nChannels = ci.getNChannels();
final int mode = ci.getCompositeMode();
final boolean transferColor = mode == IJ.COMPOSITE || mode == IJ.COLOR;
for ( int c = 0; c < nChannels; ++c )
{
final LUT lut = ci.getChannelLut( c + 1 );
final ConverterSetup setup = setupAssignments.getConverterSetups().get( c );
if ( transferColor )
setup.setColor( new ARGBType( lut.getRGB( 255 ) ) );
setup.setDisplayRange( (int)lut.min, (int)lut.max );
}
if ( mode == IJ.COMPOSITE )
{
final boolean[] activeChannels = ci.getActiveChannels();
visibility.setDisplayMode( DisplayMode.FUSED );
for ( int i = 0; i < activeChannels.length; ++i )
visibility.setSourceActive( i, activeChannels[ i ] );
}
else
visibility.setDisplayMode( DisplayMode.SINGLE );
visibility.setCurrentSource( ci.getChannel() - 1 );
}
示例9: initSetupsARGBTypeNonVolatile
import net.imglib2.type.numeric.ARGBType; //导入依赖的package包/类
private static void initSetupsARGBTypeNonVolatile(
final AbstractSpimData< ? > spimData,
final ARGBType type,
final List< ConverterSetup > converterSetups,
final List< SourceAndConverter< ? > > sources )
{
final AbstractSequenceDescription< ?, ?, ? > seq = spimData.getSequenceDescription();
for ( final BasicViewSetup setup : seq.getViewSetupsOrdered() )
{
final ScaledARGBConverter.ARGB converter = new ScaledARGBConverter.ARGB( 0, 255 );
final int setupId = setup.getId();
final String setupName = createSetupName( setup );
final SpimSource< ARGBType > s = new SpimSource< ARGBType >( spimData, setupId, setupName );
// Decorate each source with an extra transformation, that can be
// edited manually in this viewer.
final TransformedSource< ARGBType > ts = new TransformedSource< ARGBType >( s );
final SourceAndConverter< ARGBType > soc = new SourceAndConverter< ARGBType >( ts, converter );
sources.add( soc );
converterSetups.add( new RealARGBColorConverterSetup( setupId, converter ) );
}
}
示例10: createARGBInstance
import net.imglib2.type.numeric.ARGBType; //导入依赖的package包/类
@SuppressWarnings( "unchecked" )
public static BigWarpImageStackImageLoader< ARGBType, IntArray > createARGBInstance( final ImagePlus imp, int[] ids )
{
return new BigWarpImageStackImageLoader< ARGBType, IntArray >( new ARGBType(), imp, ids )
{
@Override
protected IntArray wrapPixels( final Object array )
{
return new IntArray( ( int[] ) array );
}
@Override
protected void linkType( final PlanarImg< ARGBType, IntArray > img )
{
img.setLinkedType( new ARGBType( img ) );
}
};
}
示例11: addWarpMagnitudeSource
import net.imglib2.type.numeric.ARGBType; //导入依赖的package包/类
/**
*
* @param sources the source list
* @param converterSetups the converterSetups
* @param name a name of the new source
* @param data the BigWarpData
* @return the index into sources where this source was added
*/
private static int addWarpMagnitudeSource( final ArrayList< SourceAndConverter< ? > > sources, final ArrayList< ConverterSetup > converterSetups, final String name, final BigWarpData data )
{
// TODO think about whether its worth it to pass a type parameter.
// or should we just stick with Doubles?
final WarpMagnitudeSource< FloatType > magSource = new WarpMagnitudeSource< FloatType >( name, data, new FloatType() );
final RealARGBColorConverter< VolatileFloatType > vconverter = new RealARGBColorConverter.Imp0< VolatileFloatType >( 0, 512 );
vconverter.setColor( new ARGBType( 0xffffffff ) );
final RealARGBColorConverter< FloatType > converter = new RealARGBColorConverter.Imp1< FloatType >( 0, 512 );
converter.setColor( new ARGBType( 0xffffffff ) );
converterSetups.add( new RealARGBColorConverterSetup( WARPMAG_SOURCE_ID, converter, vconverter ) );
final SourceAndConverter< FloatType > soc = new SourceAndConverter< FloatType >( magSource, converter, null );
sources.add( soc );
return sources.size() - 1;
}
示例12: addGridSource
import net.imglib2.type.numeric.ARGBType; //导入依赖的package包/类
/**
*
* @param sources the source list
* @param converterSetups the converterSetups
* @param name a name of the new source
* @param data the BigWarpData
* @return the index into sources where this source was added
*/
private static int addGridSource( final ArrayList< SourceAndConverter< ? > > sources, final ArrayList< ConverterSetup > converterSetups, final String name, final BigWarpData data )
{
// TODO think about whether its worth it to pass a type parameter.
// or should we just stick with Floats?
final GridSource< FloatType > magSource = new GridSource< FloatType >( name, data, new FloatType(), null );
final RealARGBColorConverter< VolatileFloatType > vconverter = new RealARGBColorConverter.Imp0< VolatileFloatType >( 0, 512 );
vconverter.setColor( new ARGBType( 0xffffffff ) );
final RealARGBColorConverter< FloatType > converter = new RealARGBColorConverter.Imp1< FloatType >( 0, 512 );
converter.setColor( new ARGBType( 0xffffffff ) );
converterSetups.add( new RealARGBColorConverterSetup( GRID_SOURCE_ID, converter, vconverter ) );
final SourceAndConverter< FloatType > soc = new SourceAndConverter< FloatType >( magSource, converter, null );
sources.add( soc );
return sources.size() - 1;
}
示例13: 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 ] );
}
}
示例14: 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 );
}
示例15: newColor
import net.imglib2.type.numeric.ARGBType; //导入依赖的package包/类
public int newColor(){
int N = 1000;
int i = 0;
int argb = 0;
while( i < N )
{
argb = ARGBType.rgba(
(int)Math.min( 255, 255 * Math.random() ),
(int)Math.min( 255, 255 * Math.random() ),
(int)Math.min( 255, 255 * Math.random() ),
128 );
if( !colorset.contains( argb ))
{
return argb;
}
i++;
}
return argb;
}