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

Java ImgOpener类代码示例

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

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



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

示例1: testUnsignedAnyBitImg

import io.scif.img.ImgOpener; //导入依赖的package包/类
public void testUnsignedAnyBitImg() {
	try {
		Img<UnsignedByteType> img1 = (Img<UnsignedByteType>) new ImgOpener().openImgs("/home/albert/Desktop/t2/bridge-crop.tif").get(0);
		
		Img<UnsignedVariableBitLengthType> img2 = new UnsignedVariableBitLengthType(10).createSuitableNativeImg(new ArrayImgFactory<UnsignedVariableBitLengthType>(), Intervals.dimensionsAsLongArray(img1));

		Cursor<UnsignedByteType> c1 = img1.cursor();
		Cursor<UnsignedVariableBitLengthType> c2 = img2.cursor();
		
		while (c1.hasNext()) {
			c1.fwd();
			c2.fwd();
			c2.get().set(c1.get().getIntegerLong());
		}
		
		new ImageJ();
		ImgLib.wrap(img2, "copy").show();
		
	} catch (Exception e) {
		e.printStackTrace();
	}
}
 
开发者ID:imglib,项目名称:imglib2-script,代码行数:23,代码来源:IntegralHistogramExpectationChecking.java


示例2: main

import io.scif.img.ImgOpener; //导入依赖的package包/类
final static public void main( final String[] args )
{
	new ImageJ();
	
	Img< FloatType > img = null;
	try
	{
		ImgFactory< FloatType > imgFactory = new CellImgFactory<FloatType>( new int[] {64, 64} );
		final ImgOpener io = new ImgOpener();
		img = io.openImg( "/home/tobias/workspace/data/73_float.tif", imgFactory, new FloatType() );
	}
	catch ( Exception e )
	{
		e.printStackTrace();
		return;
	}

	ImageJFunctions.show( img );
}
 
开发者ID:imglib,项目名称:imglib2-tests,代码行数:20,代码来源:OpenAndDisplayWithCellContainer.java


示例3: loadImage

import io.scif.img.ImgOpener; //导入依赖的package包/类
private static <T extends RealType<T> & NativeType<T>> ImgPlus<T> loadImage(
	final String url)
{
	try {
		final ImgOpener imgOpener = new ImgOpener();
		System.out.println("Downloading " + url);
		final ImgUtilityService imgUtilityService =
			imgOpener.getContext().getService(ImgUtilityService.class);
		final String id = imgUtilityService.cacheId(url);
		System.out.println("Opening " + id);
		return (ImgPlus<T>) imgOpener.openImg(id);
	}
	catch (final ImgIOException e) {
		e.printStackTrace();
	}
	return null;
}
 
开发者ID:imglib,项目名称:imglib2-tests,代码行数:18,代码来源:ImgPanel.java


示例4: RealARGBConverterBenchmark

import io.scif.img.ImgOpener; //导入依赖的package包/类
public RealARGBConverterBenchmark( final String filename ) throws ImgIOException, IncompatibleTypeException
{
	// open with ImgOpener using an ArrayImgFactory
	final ArrayImgFactory< UnsignedByteType > factory = new ArrayImgFactory< UnsignedByteType >();
	img = new ImgOpener().openImg( filename, factory, new UnsignedByteType() );
	argbImg = new ArrayImgFactory< ARGBType >().create( img, new ARGBType() );

	BenchmarkHelper.benchmarkAndPrint( 15, true, new Runnable()
	{
		@Override
		public void run()
		{
			for ( int i = 0; i < 10; ++i )
				convert( img, argbImg );
		}
	} );

	ImageJFunctions.show( argbImg );
}
 
开发者ID:imglib,项目名称:imglib2-tests,代码行数:20,代码来源:RealARGBConverterBenchmark.java


示例5: main

import io.scif.img.ImgOpener; //导入依赖的package包/类
final static public void main( final String[] args )
{
	new ImageJ();

	Img< FloatType > img = null;
	try
	{
		final ImgFactory< FloatType > imgFactory = new ArrayImgFactory< FloatType >();
		final ImgOpener io = new ImgOpener();
		img = io.openImg( "/home/tobias/workspace/data/73_float.tif", imgFactory, new FloatType() );
	}
	catch ( final Exception e )
	{
		e.printStackTrace();
		return;
	}

	final RandomAccessibleInterval< FloatType > view = Views.hyperSlice( img, 2, 10 );

	ImageJFunctions.show( view );
}
 
开发者ID:imglib,项目名称:imglib2-tests,代码行数:22,代码来源:OpenAndDisplaySliceView.java


示例6: main

import io.scif.img.ImgOpener; //导入依赖的package包/类
public static <T extends RealType<T> & NativeType< T >> void  main(final String[] args) throws ImgIOException, IncompatibleTypeException {

//		File file = new File( "E:/Users/JeanYves/Desktop/Data/Y.tif");
		final File file = new File( "/home/tobias/Desktop/Y.tif");
		final int niter = 1000;

		// Open file in imglib2
		final ImgFactory< ? > imgFactory = new ArrayImgFactory< T >();
		final Img< T > image = (Img< T >) new ImgOpener().openImg( file.getAbsolutePath(), imgFactory );

		// Display it via ImgLib using ImageJ
		new ImageJ();
		ImageJFunctions.show( image );

		benchmark( IterationMethod.TRANSLATE_VIEW, "With translated views:", niter, image );
		benchmark( IterationMethod.TRANSLATE_VIEW_CURSOR, "With translated views (Cursors only):", niter, image );
		benchmark( IterationMethod.TRANSLATE_VIEW_SPLIT, "With translated views (split into center and borders):", niter, image );
		benchmark( IterationMethod.RANDOM_ACCESS, "With random access:", niter, image );
		benchmark( IterationMethod.RANDOM_ACCESS_SPLIT, "With random access  (split into center and borders):", niter, image );
		benchmark( IterationMethod.RANDOM_ACCESS_NO_EXTEND, "With random access, no out of bounds access:", niter, image );
	}
 
开发者ID:imglib,项目名称:imglib2-tests,代码行数:22,代码来源:TestRelativeIterationPerformance.java


示例7: main

import io.scif.img.ImgOpener; //导入依赖的package包/类
public static void main( final String[] args ) throws ImgIOException
	{
		final String fn = "/home/tobias/workspace/data/DrosophilaWing.tif";
		final int span = 3;

		final ArrayImgFactory< FloatType > factory = new ArrayImgFactory< FloatType >();
		final FloatType type = new FloatType();
		final Img< FloatType > imgInput = new ImgOpener().openImg( fn, factory, type );
		final Img< FloatType > imgOutput = factory.create( imgInput, type );

		final Interval computationInterval = Intervals.expand( imgInput, -span );
		final RandomAccessibleInterval< FloatType > input = Views.interval( imgInput, computationInterval );
		final RandomAccessibleInterval< FloatType > output = Views.interval( imgOutput, computationInterval );

		minFilter( input, output, new RectangleShape( span, false ) );
//		minFilter( input, output, new HyperSphereShape( span ) );

		ImageJFunctions.show( imgInput, "input" );
		ImageJFunctions.show( imgOutput, "min filtered" );
	}
 
开发者ID:imglib,项目名称:imglib2-tests,代码行数:21,代码来源:MinFilterExample.java


示例8: main

import io.scif.img.ImgOpener; //导入依赖的package包/类
final static public void main( final String[] args ) throws ImgIOException
{
	new ImageJ();

	final ImgFactory< FloatType > imgFactory = new ArrayImgFactory< FloatType >();

	// load image
	final Img< FloatType > img = new ImgOpener().openImg( "/home/tobias/workspace/HisYFP/blob.tif", imgFactory, new FloatType() );

	// detect edgels
	final ArrayList< Edgel > edgels = SubpixelEdgelDetection.getEdgels( img, imgFactory, 2 );
	final ImagePlus imp = ImageJFunctions.show( img );
	imp.setOverlay( paintEdgels( edgels, 0.05 ) );

	for (int i = 0; i<7; ++i) IJ.run("In");
}
 
开发者ID:imglib,项目名称:imglib2-tests,代码行数:17,代码来源:EdgelDetectionExample.java


示例9: main

import io.scif.img.ImgOpener; //导入依赖的package包/类
public static void main( final String[] args ) throws ImgIOException
	{
		final String fn = "/home/tobias/workspace/data/DrosophilaWing.tif";
		final Img< FloatType > img = new ImgOpener().openImg( fn, new ArrayImgFactory< FloatType >(), new FloatType() );

		final long[] dims = new long[ img.numDimensions() ];
		img.dimensions( dims );
		final Img< FloatType > convolved = ArrayImgs.floats( dims );

		try
		{
			Gauss3.gauss( 3, Views.extendMirrorSingle( img ), convolved );
//			Gauss3.gauss( 5, img, Views.interval( convolved, Intervals.createMinSize( 200, 100, 200, 150 ) ) );
		}
		catch ( final IncompatibleTypeException e )
		{
			e.printStackTrace();
		}
		ImageJFunctions.show( convolved );
	}
 
开发者ID:imglib,项目名称:imglib2-tests,代码行数:21,代码来源:Gauss3Example.java


示例10: loadTiffFromJar

import io.scif.img.ImgOpener; //导入依赖的package包/类
/**
	 * Loads a Tiff file from within the jar to use as a mask Cursor.
	 * So we use Img<T> which has a cursor() method. 
	 * The given path is treated
	 * as relative to this tests-package (i.e. "Data/test.tiff" refers
	 * to the test.tiff in sub-folder Data).
	 *
	 * @param <T> The wanted output type.
	 * @param relPath The relative path to the Tiff file.
	 * @return The file as ImgLib image.
	 */
	private <T extends RealType<T> & NativeType<T>> Img<T> loadTiffFromJar(
		final String relPath)
	{
//		InputStream is = TestImageAccessor.class.getResourceAsStream(relPath);
//		BufferedInputStream bis = new BufferedInputStream(is);

		final ImgOpener opener = new ImgOpener(context);

		// HACK: Read data from file system for now.
		// Until this is fixed, the test will not pass when run from a JAR file.
		String source = "src/test/resources/net/imagej/ops/coloc/" + relPath;
		try {
			return (Img) opener.openImgs(source).get(0);
		}
		catch (final ImgIOException exc) {
			throw new IllegalStateException("File " + relPath +
				" is unexpectedly inaccessible?");
		}
	}
 
开发者ID:imagej,项目名称:imagej-ops,代码行数:31,代码来源:ColocalisationTest.java


示例11: open

import io.scif.img.ImgOpener; //导入依赖的package包/类
@Override
public Dataset open(final String source, final SCIFIOConfig config)
	throws IOException
{
	final ImgOpener imageOpener = new ImgOpener(getContext());
	try {
		// TODO openImgs we are only using the first image index in the
		// SCIFIOConfig.imgOpenerGetRange - so this image index corresponds to the
		// first ImgPlus in the list returned by the ImgOpener. See
		// https://github.com/scifio/scifio/issues/259

		final SCIFIOImgPlus<?> imgPlus =
			imageOpener.openImgs(source, config).get(0);

		@SuppressWarnings({ "rawtypes", "unchecked" })
		final Dataset dataset = datasetService.create((ImgPlus) imgPlus);

		final ImageMetadata imageMeta = imgPlus.getImageMetadata();
		updateDataset(dataset, imageMeta);
		return dataset;
	}
	catch (final ImgIOException exc) {
		throw new IOException(exc);
	}
}
 
开发者ID:scifio,项目名称:scifio,代码行数:26,代码来源:DefaultDatasetIOService.java


示例12: openAll

import io.scif.img.ImgOpener; //导入依赖的package包/类
@Override
public List<net.imagej.Dataset> openAll(String source, SCIFIOConfig config)
        throws IOException
{
        final ArrayList<Dataset> datasetList = new ArrayList<>();

        final ImgOpener imageOpener = new ImgOpener(getContext());
        try {
            final List<SCIFIOImgPlus<?>> openImgs = imageOpener.openImgs(source, config);
            for (int imgId = 0; imgId != openImgs.size(); imgId++) {
                
                final SCIFIOImgPlus<?> imgPlus = openImgs.get(imgId);
                
                @SuppressWarnings({"rawtypes", "unchecked"})
                final Dataset dataset = datasetService.create((ImgPlus) imgPlus);

                final ImageMetadata imageMeta = imgPlus.getImageMetadata();
                updateDataset(dataset, imageMeta);
                datasetList.add(dataset);
            }

        } catch (final ImgIOException exc) {
            throw new IOException(exc);
        }
        return datasetList;
}
 
开发者ID:scifio,项目名称:scifio,代码行数:27,代码来源:DefaultDatasetIOService.java


示例13: run

import io.scif.img.ImgOpener; //导入依赖的package包/类
public void run(String arg0)
{
	// get the current ImageJ ImagePlus
	ImagePlus imp = WindowManager.getCurrentImage();
	
	Img<FloatType> img;
	
	// test if an image is open, otherwise load blobs
	if ( imp == null )
	{
		// create the ImgOpener
        ImgOpener imgOpener = new ImgOpener();

        // load the image as FloatType using the ArrayImg
        try 
        {
			img = imgOpener.openImg( getClass().getResource( "/Drosophila.tif.zip" ).getFile(), new ArrayImgFactory<FloatType>(), new FloatType() );
		} 
        catch (ImgIOException e) 
        {
			e.printStackTrace();
			return;
		}
        
        // display the image
        ImageJFunctions.show( img );
	}
	else
	{
		// wrap it into an ImgLib2 Img (no copying)
		img = ImageJFunctions.wrapFloat( imp );	
	}

	// process wrapped image with ImgLib2
	process( img );
}
 
开发者ID:StephanPreibisch,项目名称:imglib2-introduction,代码行数:37,代码来源:ImgLib2_Transform.java


示例14: main

import io.scif.img.ImgOpener; //导入依赖的package包/类
@SuppressWarnings("unused")
static public final void main(String[] arg) {
	try {
		// Open an image
		String src;
		long[] radius1, radius2;
		switch (1) {
		case 1:
			src = "/home/albert/lab/TEM/abd/microvolumes/Seg/180-220-int/180-220-int-00.tif"; // 2d
			radius1 = new long[]{5, 5};
			radius2 = new long[]{10, 10};
			break;
		case 2:
			src = "/home/albert/Desktop/t2/bridge.tif"; // 2d
			radius1 = new long[]{5, 5};
			radius2 = new long[]{10, 10};
			break;
		case 3:
			src = "/home/albert/Desktop/t2/bat-cochlea-volume.tif"; // 3d
			radius1 = new long[]{5, 5, 5};
			radius2 = new long[]{10, 10, 10};
			break;
		case 4:
		default:
			src = "/home/albert/Desktop/t2/bat-cochlea-volume-s26.tif"; // 2d binary, 0 or 255
			radius1 = new long[]{5, 5};
			radius2 = new long[]{10, 10};
			break;
		}
		Img<UnsignedByteType> img = new ImgOpener().openImg(src, new ArrayImgFactory<UnsignedByteType>(), new UnsignedByteType());
		UnsignedByteType min = new UnsignedByteType(0);
		UnsignedByteType max = new UnsignedByteType(255);
		new ExampleIntegralHistograms<UnsignedByteType>(img, min, max, radius1, radius2);
	} catch (Exception e) {
		e.printStackTrace();
	}
}
 
开发者ID:imglib,项目名称:imglib2-script,代码行数:38,代码来源:ExampleIntegralHistograms.java


示例15: testFeatures

import io.scif.img.ImgOpener; //导入依赖的package包/类
public void testFeatures() {
	try {
		Img<UnsignedByteType> img = (Img<UnsignedByteType>) new ImgOpener().openImgs("/home/albert/Desktop/t2/bridge-crop-streched-smoothed.tif").get(0);
		ImgLib.wrap(img, "Original");
		long[] radius = new long[]{10, 10}; // radius=1 is equivalent to ImageJ's radius=1 in RankFilters
		LinearHistogram<UnsignedByteType> lh = new LinearHistogram<UnsignedByteType>(256, img.numDimensions(), new UnsignedByteType(0), new UnsignedByteType(255));
		Img<UnsignedShortType> integralHistogram = IntegralHistogram.create(img, lh, new UnsignedShortType());
		HistogramFeatures<UnsignedByteType, UnsignedShortType> features = new HistogramFeatures<UnsignedByteType, UnsignedShortType>(img, integralHistogram, lh, radius);
		ImgLib.wrap(features, "Features for " + radius[0] + "x" + radius[1]);
	} catch (Exception e) {
		e.printStackTrace();
	}
}
 
开发者ID:imglib,项目名称:imglib2-script,代码行数:14,代码来源:TestHistograms.java


示例16: CompositeXYProjectorBenchmark

import io.scif.img.ImgOpener; //导入依赖的package包/类
public CompositeXYProjectorBenchmark( final String filename ) throws ImgIOException, IncompatibleTypeException
{
	// open with ImgOpener using an ArrayImgFactory
	final ArrayImgFactory< UnsignedByteType > factory = new ArrayImgFactory< UnsignedByteType >();
	img = new ImgOpener().openImg( filename, factory, new UnsignedByteType() );
	final long[] dim = new long[ img.numDimensions() - 1 ];
	for ( int d = 0; d < dim.length; ++d )
		dim[ d ] = img.dimension( d );
	argbImg = new ArrayImgFactory< ARGBType >().create( dim, new ARGBType() );
	convert( img, argbImg );

	ImageJFunctions.show( argbImg );
}
 
开发者ID:imglib,项目名称:imglib2-tests,代码行数:14,代码来源:CompositeXYProjectorBenchmark.java


示例17: RandomAccessibleProjector2DBenchmark

import io.scif.img.ImgOpener; //导入依赖的package包/类
public RandomAccessibleProjector2DBenchmark( final String filename ) throws ImgIOException, IncompatibleTypeException
{
	// open with ImgOpener using an ArrayImgFactory
	final ArrayImgFactory< UnsignedByteType > factory = new ArrayImgFactory< UnsignedByteType >();
	img = new ImgOpener().openImg( filename, factory, new UnsignedByteType() );
	argbImg = new ArrayImgFactory< ARGBType >().create( img, new ARGBType() );
	convert( img, argbImg );

	ImageJFunctions.show( argbImg );
}
 
开发者ID:imglib,项目名称:imglib2-tests,代码行数:11,代码来源:RandomAccessibleProjector2DBenchmark.java


示例18: main

import io.scif.img.ImgOpener; //导入依赖的package包/类
final static public void main( final String[] args )
	throws ImgIOException
{
	new ImageJ();

	final ImgOpener io = new ImgOpener();
	final RandomAccessibleInterval< FloatType > img = io.openImg( "/home/tobias/workspace/data/73_float.tif", new ArrayImgFactory<FloatType>(), new FloatType());

	final ARGBScreenImage screenImage = new ARGBScreenImage( ( int )img.dimension( 0 ), ( int )img.dimension( 1 ) );
	final IterableIntervalProjector2D< FloatType, ARGBType > projector = new IterableIntervalProjector2D< FloatType, ARGBType >(0, 1, img, screenImage, new RealARGBConverter< FloatType >( 0, 127 ) );

	final ColorProcessor cp = new ColorProcessor( screenImage.image() );
	final ImagePlus imp = new ImagePlus( "argbScreenProjection", cp );
	imp.show();

	for ( int k = 0; k < 3; ++k )
		for ( int i = 0; i < img.dimension( 2 ); ++i )
		{
			projector.setPosition( i, 2 );
			projector.map();
			final ColorProcessor cpa = new ColorProcessor( screenImage.image() );
			imp.setProcessor( cpa );
			imp.updateAndDraw();
		}

	projector.map();

	projector.setPosition( 40, 2 );
	projector.map();
}
 
开发者ID:imglib,项目名称:imglib2-tests,代码行数:31,代码来源:OpenAndDisplayScreenImage.java


示例19: IterableIntervalProjector2DBenchmark

import io.scif.img.ImgOpener; //导入依赖的package包/类
public IterableIntervalProjector2DBenchmark( final String filename ) throws ImgIOException, IncompatibleTypeException
{
	// open with ImgOpener using an ArrayImgFactory
	final ArrayImgFactory< UnsignedByteType > factory = new ArrayImgFactory< UnsignedByteType >();
	img = new ImgOpener().openImg( filename, factory, new UnsignedByteType() );
	argbImg = new ArrayImgFactory< ARGBType >().create( img, new ARGBType() );
	convert( img, argbImg );

	ImageJFunctions.show( argbImg );
}
 
开发者ID:imglib,项目名称:imglib2-tests,代码行数:11,代码来源:IterableIntervalProjector2DBenchmark.java


示例20: CompositeXYRandomAccessibleProjectorBenchmark

import io.scif.img.ImgOpener; //导入依赖的package包/类
public CompositeXYRandomAccessibleProjectorBenchmark( final String filename ) throws ImgIOException, IncompatibleTypeException
{
	// open with ImgOpener using an ArrayImgFactory
	final ArrayImgFactory< UnsignedByteType > factory = new ArrayImgFactory< UnsignedByteType >();
	img = new ImgOpener().openImg( filename, factory, new UnsignedByteType() );
	final long[] dim = new long[ img.numDimensions() - 1 ];
	for ( int d = 0; d < dim.length; ++d )
		dim[ d ] = img.dimension( d );
	argbImg = new ArrayImgFactory< ARGBType >().create( dim, new ARGBType() );
	convert( img, argbImg );

	ImageJFunctions.show( argbImg );
}
 
开发者ID:imglib,项目名称:imglib2-tests,代码行数:14,代码来源:CompositeXYRandomAccessibleProjectorBenchmark.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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