• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java Converters类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: visualizeVisibleIds

import net.imglib2.converter.Converters; //导入依赖的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 );
}
 
开发者ID:saalfeldlab,项目名称:bigcat,代码行数:23,代码来源:PairLabelMultiSetLongIdPicker.java


示例2: colorLabels

import net.imglib2.converter.Converters; //导入依赖的package包/类
private static < C extends Type< C >, L > void colorLabels(
		final ImgLabeling< L, ? > labeling,
		final Iterator< C > colors,
		final RandomAccessibleInterval< C > output )
{
	final HashMap< Set< ? >, C > colorTable = new HashMap< Set< ? >, C >();
	final LabelingMapping< ? > mapping = labeling.getMapping();
	final int numLists = mapping.numSets();
	final C color = Util.getTypeFromInterval( output ).createVariable();
	colorTable.put( mapping.labelsAtIndex( 0 ), color );
	for ( int i = 1; i < numLists; ++i )
	{
		final Set< ? > list = mapping.labelsAtIndex( i );
		colorTable.put( list, colors.next() );
	}
	final Iterator< C > o = Views.flatIterable( output ).iterator();
	for ( final C c : Converters.convert(
			Views.flatIterable( labeling ),
			new LabelingTypeConverter< C >( colorTable ),
			color ) )
		o.next().set( c );
}
 
开发者ID:imglib,项目名称:imglib2-tests,代码行数:23,代码来源:ConnectedComponentsExample.java


示例3: getImage

import net.imglib2.converter.Converters; //导入依赖的package包/类
@Override
public RandomAccessibleInterval< UnsignedShortType > getImage( final int timepointId, final ImgLoaderHint... hints )
{
	final Dimensions dimensions = getImageSize( timepointId );
	final Img< UnsignedShortType > img = factory.create( dimensions, type );

	for ( int z = 0; z < numSlices; ++z )
	{
		final RandomAccessibleInterval< T > slice = sliceLoader.load( String.format( pattern, timepointId, channelId, z ) );

		final Cursor< UnsignedShortType > d = Views.flatIterable( Views.hyperSlice( img, 2, z ) ).cursor();
		for ( final UnsignedShortType t : Converters.convert( Views.flatIterable( slice ), converter, type ) )
			d.next().set( t );
	}
	return img;
}
 
开发者ID:bigdataviewer,项目名称:bigdataviewer_fiji,代码行数:17,代码来源:FusionImageLoader.java


示例4: normalize

import net.imglib2.converter.Converters; //导入依赖的package包/类
private RandomAccessibleInterval<FloatType> normalize(final RandomAccessibleInterval<T> image) {
	// NB: Copied from previous Tensors class to give same results
	// NB: Theoretically unsound, but works in practice for needed
	// cases.
	final double min = image.randomAccess().get().getMinValue();
	final double max = image.randomAccess().get().getMaxValue();
	Converter<T, FloatType> normalizer = (input, output) -> output
			.setReal((input.getRealDouble() - min) / (max - min));
	return Converters.convert(image, normalizer, new FloatType());
}
 
开发者ID:fiji,项目名称:microscope-image-quality,代码行数:11,代码来源:MicroscopeImageFocusQualityClassifier.java


示例5: loadFromImgLib

import net.imglib2.converter.Converters; //导入依赖的package包/类
private static <T extends RealType<T>> Tensor loadFromImgLib(
	final RandomAccessibleInterval<T> image)
{
	// NB: Assumes XYC ordering. TensorFlow wants YXC.
	RealFloatConverter<T> converter = new RealFloatConverter<>();
	return Tensors.tensor(Converters.convert(image, converter, new FloatType()), new int[]{ 1, 0, 2 });
}
 
开发者ID:imagej,项目名称:imagej-tensorflow,代码行数:8,代码来源:LabelImage.java


示例6: getSource

import net.imglib2.converter.Converters; //导入依赖的package包/类
@Override
public RandomAccessibleInterval< VolatileARGBType > getSource( final int t, final int level )
{
	return Converters.convert(
			multisetImageLoader.getVolatileImage( t, level ),
			new VolatileLabelMultisetARGBConverter( argbStream ),
			new VolatileARGBType() );
}
 
开发者ID:saalfeldlab,项目名称:bigcat,代码行数:9,代码来源:ARGBConvertedLabelsSource.java


示例7: getSource

import net.imglib2.converter.Converters; //导入依赖的package包/类
@Override
public RandomAccessibleInterval< VolatileARGBType > getSource( final int t, final int level )
{
	return Converters.convert(
			// cast necessary for java-8-openjdk-amd64, version 1.8.0_66-internal, vendor: Oracle Corporation
			// to prevent
			// [ERROR] reference to convert is ambiguous both
			// [ERROR] method <A,B>convert(net.imglib2.RandomAccessibleInterval<A>,net.imglib2.converter.Converter<? super A,? super B>,B) in net.imglib2.converter.Converters and
			// [ERROR] method <A,B>convert(net.imglib2.IterableInterval<A>,net.imglib2.converter.Converter<? super A,? super B>,B) in net.imglib2.converter.Converters match
			( RandomAccessibleInterval< Pair< VolatileLabelMultisetType, LongType > > )Views.interval( source, interval ),
			//Views.interval( source, interval ),
			new PairVolatileLabelMultisetLongARGBConverter( argbStream ),
			new VolatileARGBType() );
}
 
开发者ID:saalfeldlab,项目名称:bigcat,代码行数:15,代码来源:ARGBConvertedLabelPairSource.java


示例8: getImage

import net.imglib2.converter.Converters; //导入依赖的package包/类
@Override
public RandomAccessibleInterval< T > getImage( final int timepointId, final ImgLoaderHint... hints )
{
	if ( loadercache != null )
		loadercache.clearCache();
	final RandomAccessibleInterval< S > img = loader.getImage( timepointId );
	return Converters.convert( img, converterFactory.< S >create( impMin, impMax ), type.createVariable() );
}
 
开发者ID:bigdataviewer,项目名称:bigdataviewer_fiji,代码行数:9,代码来源:ImagePlusImgLoader.java


示例9: getImage

import net.imglib2.converter.Converters; //导入依赖的package包/类
@Override
public RandomAccessibleInterval< UnsignedShortType > getImage( final ViewId view )
{
	final String fn = filenames.get( view );
	if ( useImageJOpener )
	{
		final ImagePlus imp = new ImagePlus( fn );
		if ( imp.getType() == ImagePlus.GRAY16 )
			return new ImgPlus<>( ImageJFunctions.wrapShort( imp ) );
		else if ( imp.getType() == ImagePlus.GRAY8 )
		{
			System.out.println( "wrapping" );
			return new ImgPlus<>(
				new ImgView<>(
						Converters.convert(
								( RandomAccessibleInterval<UnsignedByteType> ) ImageJFunctions.wrapByte( imp ),
								new Converter< UnsignedByteType, UnsignedShortType >() {
									@Override
									public void convert( final UnsignedByteType input, final UnsignedShortType output )
									{
										output.set( input.get() );
									}
								},
								new UnsignedShortType()
						), null ) );
		}
		else
			useImageJOpener = false;
	}

	try
	{
		return opener.openImg( fn, factory, type );
	}
	catch ( final ImgIOException e )
	{
		throw new RuntimeException( e );
	}
}
 
开发者ID:bigdataviewer,项目名称:bigdataviewer_fiji,代码行数:40,代码来源:LegacyStackImageLoader.java


示例10: convertToFloat

import net.imglib2.converter.Converters; //导入依赖的package包/类
@SuppressWarnings( "unchecked" )
public static RandomAccessibleInterval< FloatType > convertToFloat( SourceAndConverter< ? > source, int index )
{
	Object type = source.getSpimSource().getType();
	
	RandomAccessibleInterval< FloatType > out; // = Converters.convert( (RandomAccessibleInterval<RealType<?>>)img, converter, destType );
	if ( ByteType.class.isInstance( type ) )
	{
		 out = Converters.convert( 
				 ( RandomAccessibleInterval< ByteType > ) source.getSpimSource().getSource( 0, 0 ), 
				 new RealFloatConverter< ByteType >(),
				 new FloatType());
	}
	else if ( UnsignedByteType.class.isInstance( type ) )
	{
		 out = Converters.convert( 
				 ( RandomAccessibleInterval< UnsignedByteType > ) source.getSpimSource().getSource( 0, 0 ), 
				 new RealFloatConverter< UnsignedByteType >(),
				 new FloatType());
	}
	else if ( IntType.class.isInstance( type ) )
	{
		 out = Converters.convert( 
				 ( RandomAccessibleInterval< IntType > ) source.getSpimSource().getSource( 0, 0 ), 
				 new RealFloatConverter< IntType >(),
				 new FloatType());
	}
	else if ( FloatType.class.isInstance( type ) )
	{
		 out = ( RandomAccessibleInterval< FloatType > ) source.getSpimSource().getSource( 0, 0 );
	}
	else if ( DoubleType.class.isInstance( type ) )
	{
		 out = Converters.convert( 
				 ( RandomAccessibleInterval< DoubleType > ) source.getSpimSource().getSource( 0, 0 ), 
				 new RealFloatConverter< DoubleType >(),
				 new FloatType());
	}
	else if ( ARGBType.class.isInstance( type ) )
	{
		out = Converters.convert( 
				 ( RandomAccessibleInterval< ARGBType > ) source.getSpimSource().getSource( 0, 0 ), 
				 new ARGBFloatConverter(),
				 new FloatType());
	}
	else
	{
		System.err.println( "Can't convert type " + type.getClass() + " to FloatType" );
		return null;
	}
	
	return out;
}
 
开发者ID:saalfeldlab,项目名称:bigwarp,代码行数:54,代码来源:BigWarpRealExporter.java


示例11: mandersRealNoisyImagesTest

import net.imglib2.converter.Converters; //导入依赖的package包/类
/**
 * This method tests real experimental noisy but 
 * biologically perfectly colocalized test images, 
 * using previously calculated autothresholds (.above mode)
 * Amongst other things, hopefully it is sensitive to
 * choosing the wrong channel to test for above threshold
 */
@Test
public void mandersRealNoisyImagesTest() throws MissingPreconditionException {
	
	MandersColocalization<UnsignedByteType> mrnc = 
			new MandersColocalization<UnsignedByteType>();

	// test biologically perfect but noisy image coloc combination
	// this cast is bad, so use Views.iterable instead. 
	//Cursor<BitType> mask = Converters.convert((IterableInterval<UnsignedByteType>) positiveCorrelationMaskImage,
	Cursor<BitType> mask = Converters.convert(Views.iterable(positiveCorrelationMaskImage),
               new Converter<UnsignedByteType, BitType>() {

                   @Override
                   public void convert(UnsignedByteType arg0, BitType arg1) {
                       arg1.set(arg0.get() > 0);
                   }
               }, new BitType()).cursor();
	
	TwinCursor<UnsignedByteType> twinCursor;
	MandersResults r;
	// Manually set the thresholds for ch1 and ch2 with the results from a
	// Costes Autothreshold using bisection implementation of regression, of the images used
	UnsignedByteType thresholdCh1 = new UnsignedByteType();
	thresholdCh1.setInteger(70);
	UnsignedByteType thresholdCh2 = new UnsignedByteType();
	thresholdCh2.setInteger(53);
	//Set the threshold mode
	ThresholdMode tMode;
	tMode = ThresholdMode.Above;
	// Set the TwinCursor to have the mask image channel, and 2 images.
	twinCursor = new TwinCursor<UnsignedByteType>(
			positiveCorrelationImageCh1.randomAccess(),
			positiveCorrelationImageCh2.randomAccess(),
			mask);

	// Use the constructor that takes ch1 and ch2 autothresholds and threshold mode.
	r = mrnc.calculateMandersCorrelation(twinCursor, thresholdCh1, thresholdCh2, tMode);

	assertEquals(0.705665d, r.m1, 0.000001);
	assertEquals(0.724752d, r.m2, 0.000001);
}
 
开发者ID:fiji,项目名称:Colocalisation_Analysis,代码行数:49,代码来源:MandersColocalizationTest.java


示例12: getConvertedTransformedSource

import net.imglib2.converter.Converters; //导入依赖的package包/类
private static < T extends NumericType< T > > RandomAccessible< ARGBType > getConvertedTransformedSource( final ViewerState viewerState, final SourceState< T > source, final AffineTransform3D screenScaleTransform, final int mipmapIndex )
{
	return Converters.convert( getTransformedSource( viewerState, source.getSpimSource(), screenScaleTransform, mipmapIndex ), source.getConverter(), argbtype );
}
 
开发者ID:tpietzsch,项目名称:TileServer,代码行数:5,代码来源:TileRenderer.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Rectangle类代码示例发布时间:2022-05-22
下一篇:
Java ActorIdentity类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap