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

Java ImgLibException类代码示例

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

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



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

示例1: main

import net.imglib2.exception.ImgLibException; //导入依赖的package包/类
static public final void main(String[] args) {
	try {
		FloatImage fi = new FloatImage(new long[]{10, 10, 10});
		Cursor<FloatType> c = fi.cursor();
		while (c.hasNext()) {
			c.next().set(1);
		}
		IntegralImage ig = new IntegralImage(fi);
		
		RandomAccess<DoubleType> p = ig.randomAccess();
		p.setPosition(new long[]{9, 9, 9});
		System.out.println("Test integral image passed: " + ((10 * 10 * 10) == p.get().get()));
		
		new ImageJ();
		ImgLib.show(ig, "Integral Image");
	} catch (ImgLibException e) {
		e.printStackTrace();
	}
}
 
开发者ID:imglib,项目名称:imglib2-script,代码行数:20,代码来源:TestIntegralImage.java


示例2: copyToFloatImagePlus

import net.imglib2.exception.ImgLibException; //导入依赖的package包/类
/** Copy the contents from img to an ImagePlus; assumes containers are compatible. */
static public ImagePlus copyToFloatImagePlus(final Img<? extends RealType<?>> img, final String title) {
	ImagePlusImgFactory<FloatType> factory = new ImagePlusImgFactory<FloatType>();
	ImagePlusImg<FloatType, ?> iml = factory.create(img, new FloatType());
	Cursor<FloatType> c1 = iml.cursor();
	Cursor<? extends RealType<?>> c2 = img.cursor();
	while (c1.hasNext()) {
		c1.fwd();
		c2.fwd();
		c1.get().set(c2.get().getRealFloat());
	}
	try {
		ImagePlus imp = iml.getImagePlus();
		imp.setTitle(title);
		return imp;
	} catch (ImgLibException e) {
		e.printStackTrace();
		return null;
	}
}
 
开发者ID:imglib,项目名称:imglib2-script,代码行数:21,代码来源:Benchmark.java


示例3: testIntegralHistogram2d

import net.imglib2.exception.ImgLibException; //导入依赖的package包/类
@Test
public <R extends IntegerType<R> & NativeType<R>> void testIntegralHistogram2d() {
	// Create a 2d image with values 0-9 in every dimension, so bottom right is 81.
	Img<UnsignedByteType> img =
			new UnsignedByteType().createSuitableNativeImg(
					new ArrayImgFactory<UnsignedByteType>(),
					new long[]{10, 10});
	long[] p = new long[2];
	Cursor<UnsignedByteType> c = img.cursor();
	while (c.hasNext()) {
		c.fwd();
		c.localize(p);
		c.get().setInteger(p[0] * p[1]);
	}
	// Create integral histogram with 10 bins
	LinearHistogram<UnsignedByteType> lh = new LinearHistogram<UnsignedByteType>(10, 2, new UnsignedByteType(0), new UnsignedByteType(81));
	Img<R> ih = IntegralHistogram.create(img, lh);
	new ImageJ();
	try {
		ImgLib.wrap((Img)ih, "histogram").show();
	} catch (ImgLibException e) {
		e.printStackTrace();
	}
}
 
开发者ID:imglib,项目名称:imglib2-script,代码行数:25,代码来源:IntegralHistogramExpectationChecking.java


示例4: wrap

import net.imglib2.exception.ImgLibException; //导入依赖的package包/类
@SuppressWarnings("rawtypes")
public static final Image< FloatType > wrap( final Img< net.imglib2.type.numeric.real.FloatType > i )
{
	if ( i instanceof ImagePlusImg )
	{
		try
		{
			return ImageJFunctions.wrapFloat( ((ImagePlusImg) i).getImagePlus() );
		}
		catch (ImgLibException e)
		{
			// TODO Auto-generated catch block
			e.printStackTrace();
			return null;
		}			
	}
	else
	{
		return ImgLib2.wrapFloatToImgLib1( i );
	}
}
 
开发者ID:fiji,项目名称:SPIM_Registration,代码行数:22,代码来源:LRFFT.java


示例5: copyToImageStack

import net.imglib2.exception.ImgLibException; //导入依赖的package包/类
public static < T extends NumericType< T > & NativeType< T > > ImagePlus copyToImageStack( final RealRandomAccessible< T > rai, final Interval itvl )
{
	final long[] dimensions = new long[ itvl.numDimensions() ];
	itvl.dimensions( dimensions );

	// create the image plus image
	final T t = rai.realRandomAccess().get();
	final ImagePlusImgFactory< T > factory = new ImagePlusImgFactory< T >();
	final ImagePlusImg< T, ? > target = factory.create( itvl, t );

	double k = 0;
	final long N = dimensions[ 0 ] * dimensions[ 1 ] * dimensions[ 2 ];

	final net.imglib2.Cursor< T > c = target.cursor();
	final RealRandomAccess< T > ra = rai.realRandomAccess();
	while ( c.hasNext() )
	{
		c.fwd();
		ra.setPosition( c );
		c.get().set( ra.get() );

		if ( k % 10000 == 0 )
		{
			IJ.showProgress( k / N );
		}
		k++;
	}

	IJ.showProgress( 1.1 );
	try
	{
		return target.getImagePlus();
	}
	catch ( final ImgLibException e )
	{
		e.printStackTrace();
	}

	return null;
}
 
开发者ID:saalfeldlab,项目名称:bigwarp,代码行数:41,代码来源:BigWarpRealExporter.java


示例6: wrap

import net.imglib2.exception.ImgLibException; //导入依赖的package包/类
/** Wrap an Imglib's {@link Img} as an ImageJ's {@link ImagePlus} of the appropriate type.
 * The data is not copied, but accessed with a special-purpose VirtualStack subclass. 
 * @throws ImgLibException */
static public final <T extends RealType<T>> ImagePlus wrap(final Img<T> img, final String title) throws ImgLibException {
	//ImagePlus imp = new ImagePlusImgFactory<T>().create(img, img.firstElement().createVariable()).getImagePlus();
	//imp.setTitle(title);
	//return imp;
	return ImageJFunctions.wrap(img, title);
}
 
开发者ID:imglib,项目名称:imglib2-script,代码行数:10,代码来源:ImgLib.java


示例7: save

import net.imglib2.exception.ImgLibException; //导入依赖的package包/类
/** Save an image in the appropriate file format according to
 * the filename extension specified in {@param path}. 
 * @throws ImgLibException */
public static final <T extends RealType<T> & NativeType<T>> boolean save(final Img<T> image, final String path) throws ImgLibException {
	final int dot = path.lastIndexOf('.');
	if (dot < 0 || path.length() - dot - 1 > 4)
		throw new RuntimeException("Could not infer file type from filename: " + path);
	return save(image, path.substring(dot + 1), path);
}
 
开发者ID:imglib,项目名称:imglib2-script,代码行数:10,代码来源:ImgLib.java


示例8: main

import net.imglib2.exception.ImgLibException; //导入依赖的package包/类
public static void main(String[] args) {
	
	Img<UnsignedByteType> img = ImgLib.wrap(IJ.openImage("/home/albert/Desktop/t2/bridge.gif"));
	
	Img<UnsignedByteType> multiPeriodic =
		new ROI<UnsignedByteType>(
			new ExtendPeriodic<UnsignedByteType>(img),
			new long[]{-512, -512},
			new long[]{1024, 1024});
	
	Img<UnsignedByteType> multiMirroredDouble =
		new ROI<UnsignedByteType>(
			new ExtendMirrorDouble<UnsignedByteType>(img),
			new long[]{-512, -512},
			new long[]{1024, 1024});
	
	Img<UnsignedByteType> multiMirroredSingle =
		new ROI<UnsignedByteType>(
			new ExtendMirrorSingle<UnsignedByteType>(img),
			new long[]{-512, -512},
			new long[]{1024, 1024});
	Img<UnsignedByteType> centered =
		new ROI<UnsignedByteType>(
				new Extend<UnsignedByteType>(img, 0),
				new long[]{-512, -512},
				new long[]{1024, 1024});
	
	// Above, notice the negative offsets. This needs fixing, it's likely due to recent change
	// in how offsets are used. TODO
	
	try {
		ImgLib.show(multiPeriodic, "periodic");
		ImgLib.show(multiMirroredDouble, "mirror double edge");
		ImgLib.show(multiMirroredSingle, "mirror single edge");
		ImgLib.show(centered, "translated 0 background");
	} catch (ImgLibException e) {
		e.printStackTrace();
	}
}
 
开发者ID:imglib,项目名称:imglib2-script,代码行数:40,代码来源:TestExtend.java


示例9: getImagePlusInstance

import net.imglib2.exception.ImgLibException; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public static < T extends RealType< T > & NativeType< T > > ImagePlus getImagePlusInstance(
		final RandomAccessibleInterval< T > img,
		final boolean virtualDisplay,
		final String title,
		final double min,
		final double max )
{
	ImagePlus imp = null;

	if ( img instanceof ImagePlusImg )
		try { imp = ((ImagePlusImg<T, ?>)img).getImagePlus(); } catch (ImgLibException e) {}

	if ( imp == null )
	{
		if ( virtualDisplay )
			imp = ImageJFunctions.wrap( img, title );
		else
			imp = ImageJFunctions.wrap( img, title ).duplicate();
	}

	imp.setTitle( title );
	imp.setDimensions( 1, (int)img.dimension( 2 ), 1 );
	imp.setDisplayRange( min, max );

	return imp;
}
 
开发者ID:fiji,项目名称:SPIM_Registration,代码行数:28,代码来源:DisplayImage.java


示例10: createReRegisteredSeries

import net.imglib2.exception.ImgLibException; //导入依赖的package包/类
public static < T extends RealType< T > & NativeType< T > > ImagePlus createReRegisteredSeries( final T targetType, final ImagePlus imp, final ArrayList<InvertibleBoundable> models, final int dimensionality )
{
	final int numImages = imp.getNFrames();

	// the size of the new image
	final int[] size = new int[ dimensionality ];
	// the offset relative to the output image which starts with its local coordinates (0,0,0)
	final double[] offset = new double[ dimensionality ];

	final int[][] imgSizes = new int[ numImages ][ dimensionality ];
	
	for ( int i = 0; i < numImages; ++i )
	{
		imgSizes[ i ][ 0 ] = imp.getWidth();
		imgSizes[ i ][ 1 ] = imp.getHeight();
		if ( dimensionality == 3 )
			imgSizes[ i ][ 2 ] = imp.getNSlices();
	}
	
	// estimate the boundaries of the output image and the offset for fusion (negative coordinates after transform have to be shifted to 0,0,0)
	Fusion.estimateBounds( offset, size, imgSizes, models, dimensionality );
			
	// for output
	final ImgFactory< T > f = new ImagePlusImgFactory< T >();
	// the composite
	final ImageStack stack = new ImageStack( size[ 0 ], size[ 1 ] );

	for ( int t = 1; t <= numImages; ++t )
	{
		for ( int c = 1; c <= imp.getNChannels(); ++c )
		{
			final Img<T> out = f.create( size, targetType );
			final Img< FloatType > in = ImageJFunctions.convertFloat( Hyperstack_rearranger.getImageChunk( imp, c, t ) );

			fuseChannel( out, Views.interpolate( Views.extendZero( in ), new NLinearInterpolatorFactory< FloatType >() ), offset, models.get( t - 1 ) );

			try
			{
				final ImagePlus outImp = ((ImagePlusImg<?,?>)out).getImagePlus();
				for ( int z = 1; z <= out.dimension( 2 ); ++z )
					stack.addSlice( imp.getTitle(), outImp.getStack().getProcessor( z ) );
			} 
			catch (ImgLibException e) 
			{
				Log.error( "Output image has no ImageJ type: " + e );
			}				
		}
	}
	
	//convertXYZCT ...
	ImagePlus result = new ImagePlus( "registered " + imp.getTitle(), stack );
	
	// numchannels, z-slices, timepoints (but right now the order is still XYZCT)
	if ( dimensionality == 3 )
	{
		result.setDimensions( size[ 2 ], imp.getNChannels(), imp.getNFrames() );
		result = OverlayFusion.switchZCinXYCZT( result );
		return CompositeImageFixer.makeComposite( result, CompositeImage.COMPOSITE );
	}
	//Log.info( "ch: " + imp.getNChannels() );
	//Log.info( "slices: " + imp.getNSlices() );
	//Log.info( "frames: " + imp.getNFrames() );
	result.setDimensions( imp.getNChannels(), 1, imp.getNFrames() );
	
	if ( imp.getNChannels() > 1 )
		return CompositeImageFixer.makeComposite( result, CompositeImage.COMPOSITE );
	return result;
}
 
开发者ID:fiji,项目名称:Stitching,代码行数:69,代码来源:OverlayFusion.java


示例11: show

import net.imglib2.exception.ImgLibException; //导入依赖的package包/类
/** Wrap an Imglib's {@link Img} as an ImageJ's {@link ImagePlus} of the appropriate type.
 * The data is not copied, but accessed with a special-purpose VirtualStack subclass. 
 * @throws ImgLibException */
static public final <T extends RealType<T>> ImagePlus show(final Img<T> img) throws ImgLibException {
	return show(img, "");
}
 
开发者ID:imglib,项目名称:imglib2-script,代码行数:7,代码来源:ImgLib.java


示例12: ExampleIntegralImageFeatures

import net.imglib2.exception.ImgLibException; //导入依赖的package包/类
public ExampleIntegralImageFeatures() throws ImgIOException {
	// Open an image
	String src = "/home/albert/lab/TEM/abd/microvolumes/Seg/180-220-int/180-220-int-00.tif"; // 2d
	final Img<UnsignedByteType> img = (Img<UnsignedByteType>) new ImgOpener().openImgs(src).get(0);
	
	// Integral image
	final Img<LongType> integralImg = new FastIntegralImg<UnsignedByteType, LongType>(img, new LongType(), new IdentityConverter<UnsignedByteType, LongType>());
	// Integral image of squares
	final Img<LongType> integralImgSq = new FastIntegralImg<UnsignedByteType, LongType>(img, new LongType(), new SquaringConverter<UnsignedByteType, LongType>());
	
	// Size of the window
	final long[] radius = new long[integralImg.numDimensions()];
	for (int d=0; d<radius.length; ++d) radius[d] = 5;
	
	// Cursors
	final IntegralCursor<LongType> c1 = new IntegralCursor<LongType>(integralImg, radius);
	final IntegralCursor<LongType> c2 = new IntegralCursor<LongType>(integralImgSq, radius);
	
	// View features
	final long NUM_FEATURES = 4;
	final long[] dims = new long[integralImg.numDimensions() + 1];
	for (int d = 0; d<dims.length -1; ++d) dims[d] = integralImg.dimension(d);
	dims[dims.length -1] = NUM_FEATURES;
	final Img<FloatType> featureStack = new FloatType().createSuitableNativeImg(
			new ArrayImgFactory<FloatType>(), dims);
	final RandomAccess<FloatType> cf = featureStack.randomAccess();
	
	while (c1.hasNext()) {
		final Pair<LongType, long[]> sum = c1.next();
		final Pair<LongType, long[]> sumSq = c2.next();
		cf.setPosition(c1);
		// 1. The sum
		cf.setPosition(0, dims.length -1);
		cf.get().set(sum.getA().getRealFloat());
		// 2. The sum of squares
		cf.fwd(dims.length -1);
		cf.get().set(sumSq.getA().getRealFloat());
		// 3. The mean
		cf.fwd(dims.length -1);
		cf.get().set(sum.getA().getRealFloat() / sum.getB()[0]);
		// 4. The stdDev
		cf.fwd(dims.length -1);
		cf.get().set((float)((sumSq.getA().getRealFloat() - (Math.pow(sum.getA().getRealFloat(), 2) / sum.getB()[0])) / sum.getB()[0]));
	}
	
	try {
		new ImageJ();
		ImgLib.wrap(featureStack).show();
	} catch (ImgLibException e) {
		e.printStackTrace();
	}
}
 
开发者ID:imglib,项目名称:imglib2-script,代码行数:53,代码来源:ExampleIntegralImageFeatures.java


示例13: testIntegralHistogram1d

import net.imglib2.exception.ImgLibException; //导入依赖的package包/类
@Test
public <R extends IntegerType<R> & NativeType<R>> void testIntegralHistogram1d() {
	// Create a 1d image with values 0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7
	Img<UnsignedByteType> img =
			new UnsignedByteType().createSuitableNativeImg(
					new ArrayImgFactory<UnsignedByteType>(), new long[]{16});
	Cursor<UnsignedByteType> c = img.cursor();
	int i = 0;
	int next = 0;
	while (c.hasNext()) {
		c.fwd();
		c.get().set(next);
		++i;
		if (0 == i % 2) ++next;
	}
	//
	LinearHistogram<UnsignedByteType> lh = new LinearHistogram<UnsignedByteType>(16, 1, new UnsignedByteType(0), new UnsignedByteType(7));
	Img<R> ih = IntegralHistogram.create(img, lh);
	
	new ImageJ();
	try {
		ImgLib.wrap((Img)ih, "histogram").show();
	} catch (ImgLibException e) {
		e.printStackTrace();
	}
	
	RandomAccess<R> ra = ih.randomAccess();
	long[] position = new long[2];
	StringBuilder sb = new StringBuilder();
	for (int k=0; k<ih.dimension(0); ++k) {
		position[0] = k;
		sb.append(k + " :: {");
		for (int h=0; h<ih.dimension(1); ++h) {
			position[1] = h;
			ra.setPosition(position);
			System.out.println(ra.get().getRealDouble());
			sb.append(h).append(':').append((long)ra.get().getRealDouble()).append("; ");
		}
		sb.append("}\n");
	}
	System.out.println(sb.toString());
}
 
开发者ID:imglib,项目名称:imglib2-script,代码行数:43,代码来源:IntegralHistogramExpectationChecking.java


示例14: main

import net.imglib2.exception.ImgLibException; //导入依赖的package包/类
final static public void main( final String[] args )
	{
		long t;

//		final int[] samples = new int[ m ];
//		final double[][] coordinates = new double[ m ][ 2 ];
		
//		createPhyllotaxis1( samples, coordinates, size[ 0 ] / 2.0, size[ 1 ] / 2.0, 0.1 );
//		createPattern2( samples, coordinates, size[ 0 ] / 2.0, size[ 1 ] / 2.0, 20 );
		
//		final RealPointSampleList< UnsignedShortType > list = new RealPointSampleList< UnsignedShortType >( 2 );
//		for ( int i = 0; i < samples.length; ++i )
//			list.add( new RealPoint( coordinates[ i ] ), new UnsignedShortType( samples[ i ] ) );

		final RealPointSampleList< UnsignedShortType > list = new RealPointSampleList< UnsignedShortType >( 3 );

		createPhyllotaxis2( list, m, size[ 0 ] / 2.0, size[ 1 ] / 2.0, 20 );

		final ImagePlusImgFactory< UnsignedShortType > factory = new ImagePlusImgFactory< UnsignedShortType >();

		final KDTree< UnsignedShortType > kdtree = new KDTree< UnsignedShortType >( list );

		new ImageJ();

		
		IJ.log( "KDTree Search" );
		IJ.log( "=============" );
		
		/* nearest neighbor */
		IJ.log( "Nearest neighbor ..." );
		final ImagePlusImg< UnsignedShortType, ? > img4 = factory.create( new long[]{ size[ 0 ], size[ 1 ], 2 }, new UnsignedShortType() );
		t = drawNearestNeighbor(
				img4,
				new NearestNeighborSearchOnKDTree< UnsignedShortType >( kdtree ) );
		
		IJ.log( t + "ms " );
		
		try
		{
			final ImagePlus imp4 = img4.getImagePlus();
			imp4.setOpenAsHyperStack( true );
			final CompositeImage impComposite = new CompositeImage( imp4, CompositeImage.COMPOSITE );
			impComposite.show();
			impComposite.setSlice( 1 );
			IJ.run( impComposite, "Grays", "" );
			impComposite.setDisplayRange( 0, m - 1 );
			impComposite.setSlice( 2 );
			impComposite.setDisplayRange( 0, 2 );
			impComposite.updateAndDraw();
			IJ.log( "Done." );
		}
		catch ( final ImgLibException e )
		{
			IJ.log( "Didn't work out." );
			e.printStackTrace();
		}
	}
 
开发者ID:imglib,项目名称:imglib2-tests,代码行数:58,代码来源:KNearestNeighborSearchPhyllotaxisBehavior.java


示例15: exportImage

import net.imglib2.exception.ImgLibException; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public <T extends RealType<T> & NativeType<T>> boolean exportImage( final RandomAccessibleInterval<T> img, final BoundingBoxGUI bb, final TimePoint tp, final ViewSetup vs, final double min, final double max )
{
	// do nothing in case the image is null
	if ( img == null )
		return false;
	
	// determine min and max
	final float[] minmax;
	
	if ( Double.isNaN( min ) || Double.isNaN( max ) )
		minmax = FusionHelper.minMax( img );
	else
		minmax = new float[]{ (float)min, (float)max };

	ImagePlus imp = null;
	
	if ( img instanceof ImagePlusImg )
		try { imp = ((ImagePlusImg<T, ?>)img).getImagePlus(); } catch (ImgLibException e) {}

	if ( imp == null )
		imp = ImageJFunctions.wrap( img, getImgTitler().getImageTitle( tp, vs ) ).duplicate();

	imp.setTitle( getImgTitler().getImageTitle( tp, vs ) );

	if ( bb != null )
	{
		imp.getCalibration().xOrigin = -(bb.min( 0 ) / bb.getDownSampling());
		imp.getCalibration().yOrigin = -(bb.min( 1 ) / bb.getDownSampling());
		imp.getCalibration().zOrigin = -(bb.min( 2 ) / bb.getDownSampling());
		imp.getCalibration().pixelWidth = imp.getCalibration().pixelHeight = imp.getCalibration().pixelDepth = bb.getDownSampling();
	}
	
	imp.setDimensions( 1, (int)img.dimension( 2 ), 1 );
	
	imp.setDisplayRange( minmax[ 0 ], minmax[ 1 ] );
	
	imp.updateAndDraw();

	final String fileName;
	
	if ( !getImgTitler().getImageTitle( tp, vs ).endsWith( ".tif" ) )
		fileName = new File( path, getImgTitler().getImageTitle( tp, vs ) + ".tif" ).getAbsolutePath();
	else
		fileName = new File( path, getImgTitler().getImageTitle( tp, vs ) ).getAbsolutePath();
	
	if ( compress )
	{
		IOFunctions.println( new Date( System.currentTimeMillis() ) + ": Saving file " + fileName + ".zip" );
		return new FileSaver( imp ).saveAsZip( fileName );
	}
	else
	{
		IOFunctions.println( new Date( System.currentTimeMillis() ) + ": Saving file " + fileName );
		return new FileSaver( imp ).saveAsTiffStack( fileName );
	}
}
 
开发者ID:fiji,项目名称:SPIM_Registration,代码行数:58,代码来源:Save3dTIFF.java


示例16: main

import net.imglib2.exception.ImgLibException; //导入依赖的package包/类
public static void main(String[] args) throws ImgLibException {
		System.out.println("starting");

		
//		visualizeEdgelBoxes();
//		checkEdgelPosition();
		
//		checkEdgelType();
//		checkImport();
		
		ball();
		
		System.out.println("finished");
//		System.exit(0);
	}
 
开发者ID:bogovicj,项目名称:hhmi-exp,代码行数:16,代码来源:EdgelOrientationVisValid.java


示例17: ball

import net.imglib2.exception.ImgLibException; //导入依赖的package包/类
public static void ball() throws ImgLibException{
		String edgelMaskPrefix = "/groups/jain/home/bogovicj/projects/crackSegmentation/edgelValidate/edgelball_1";
		String edgelPrefix = "/groups/jain/home/bogovicj/projects/crackSegmentation/edgelValidate/ball_1";
		
		ImagePlusImg<FloatType,?> img = ImagePlusImgs.floats(new long[]{200, 200, 200});
		Cursor<FloatType> c = Views.iterable(Views.offset(img, new long[]{100, 100, 100})).localizingCursor();
		double[] x = new double[]{0, 0, 0};
		while (c.hasNext()) {
		  FloatType t = c.next();
		  c.localize(x);
		  if (LinAlgHelpers.squareLength(x) < 2500)
		         t.set(0xff);
		}
//		img.getImagePlus().show();
		
		int[] patchSize = new int[]{7,7,3};
		CrackCorrection<FloatType> cc = new CrackCorrection<FloatType>(
				img, img, patchSize);
		
		cc.computeEdgels();
		
		int N = 40;
		
		ArrayList<Edgel> edgels = cc.getEdgels();
		Collections.shuffle(edgels, new Random(1));
		
		ArrayImgFactory<UnsignedByteType> ubfactory = new ArrayImgFactory<UnsignedByteType>();
		Img<UnsignedByteType> edgelmaskimg = ubfactory.create(img, new UnsignedByteType(0));
		
		int i = 0;
		
		int[] patchMidPt = PatchTools.patchSizeToMidpt(patchSize);
		
		while(i < N){
			
			
			Edgel edgel = edgels.get(i);
			
//			IntType val = new IntType( i + 1 );
			UnsignedByteType val = new UnsignedByteType( 255 - i  );
			
//			AffineTransform3D xfmIn = CrackCorrection.pickTransformation(edgel);
//			CrackCorrection.edgelToView(edgel, edgelmaskimg, patchSize);
			
			
			AffineTransform3D xfmIn = EdgelTools.edgelToXfm(edgel, patchMidPt);
			double[] pos = new double[edgel.numDimensions() ];
			edgel.localize(pos);
			CrackCorrection.setMask( pos, patchSize, xfmIn, 
					Views.extendValue(edgelmaskimg, new UnsignedByteType()), val);

			i++;
		}
		
		
		ImgOps.write(edgelmaskimg, edgelMaskPrefix + ".tif");
		ImgOps.write(img, edgelPrefix + ".tif");
 
		
//		ImgUtil.write(mask, crackMaskRewriteFn);
		
	}
 
开发者ID:bogovicj,项目名称:hhmi-exp,代码行数:63,代码来源:EdgelOrientationVisValid.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java Connect类代码示例发布时间:2022-05-22
下一篇:
Java TextView类代码示例发布时间: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