当前位置: 首页>>代码示例>>Java>>正文


Java InverseRealTransform类代码示例

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


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

示例1: getInterpolatedSource

import net.imglib2.realtransform.InverseRealTransform; //导入依赖的package包/类
@Override
public RealRandomAccessible< T > getInterpolatedSource( final int t, final int level, final Interpolation method )
{
	if( isTransformed )
	{
		final AffineTransform3D transform = new AffineTransform3D();
		source.getSourceTransform( t, level, transform );
		final RealRandomAccessible< T > sourceRealAccessible = RealViews.affineReal( source.getInterpolatedSource( t, level, method ), transform );
		if( xfm == null )
			return sourceRealAccessible;
		else
			return new RealTransformRealRandomAccessible< T, InverseRealTransform >( sourceRealAccessible, xfm );
	}
	else
	{
		return source.getInterpolatedSource( t, level, method );
	}
}
 
开发者ID:saalfeldlab,项目名称:bigwarp,代码行数:19,代码来源:WarpedSource.java

示例2: setTransformationMovingSourceOnly

import net.imglib2.realtransform.InverseRealTransform; //导入依赖的package包/类
private void setTransformationMovingSourceOnly( final ThinPlateR2LogRSplineKernelTransform transform )
{
	for ( int i = 0; i < movingSourceIndexList.length; i++ )
	{
		int idx = movingSourceIndexList [ i ];

		// the xfm must always be 3d for bdv to be happy.
		// when bigwarp has 2d images though, the z- component will be left unchanged
		InverseRealTransform xfm = new InverseRealTransform( new TpsTransformWrapper( 3, transform ));

		// the updateTransform method creates a copy of the transform
		( ( WarpedSource< ? > ) ( sources.get( idx ).getSpimSource() ) ).updateTransform( xfm );
		if ( sources.get( 0 ).asVolatile() != null )
			( ( WarpedSource< ? > ) ( sources.get( idx ).asVolatile().getSpimSource() ) ).updateTransform( xfm );
	}
}
 
开发者ID:saalfeldlab,项目名称:bigwarp,代码行数:17,代码来源:BigWarp.java

示例3: act

import net.imglib2.realtransform.InverseRealTransform; //导入依赖的package包/类
@Override
public < T extends RealType< T > > void act(
		final int iteration,
		final RandomAccessibleInterval< T > matrix,
		final RandomAccessibleInterval< T > scaledMatrix,
		final double[] lut,
		final int[] permutation,
		final int[] inversePermutation,
		final double[] multipliers,
		final RandomAccessibleInterval< double[] > estimatedFit )
{
	final T dummy = scaledMatrix.randomAccess().get().createVariable();
	dummy.setReal( Double.NaN );
	final String path = fileDir( iteration );
	if ( iteration == 0 )
		createParentDirectory( path );
	final LUTRealTransform tf = new LUTRealTransform( lut, 2, 2 );

	final RealTransformRealRandomAccessible< T, InverseRealTransform > transformed = RealViews.transformReal( Views.interpolate( Views.extendValue( scaledMatrix, dummy ), new NLinearInterpolatorFactory<>() ), tf );
	final double s = 1.0 / ( lut[ lut.length - 1 ] - lut[ 0 ] ) * lut.length;
	final double o = -lut[ 0 ];
	final ScaleAndTranslation scaleAndTranslation = new ScaleAndTranslation( new double[] { s, s }, new double[] { o, o } );
	final IntervalView< T > offset = Views.interval( Views.raster( RealViews.transformReal( transformed, scaleAndTranslation ) ), scaledMatrix );
	final RandomAccessibleInterval< T > strip = MatrixStripConversion.matrixToStrip( offset, range, dummy );
	new FileSaver( ImageJFunctions.wrap( strip, "" ) ).saveAsTiff( path );
}
 
开发者ID:saalfeldlab,项目名称:z-spacing,代码行数:27,代码来源:MatrixVisitor.java

示例4: generateStack

import net.imglib2.realtransform.InverseRealTransform; //导入依赖的package包/类
public static < T extends RealType< T > > ImageStack generateStack(
		final RealRandomAccessible< T > input,
		final int width,
		final int height,
		final int size,
		final double zScale )
{
	final Scale3D scaleTransform = new Scale3D( 1.0, 1.0, zScale );
	final RealTransformRealRandomAccessible< T, InverseRealTransform > scaledInput = RealViews.transformReal( input, scaleTransform );
	final int scaledSize = ( int ) ( size * zScale );
	return generateStack( scaledInput, width, height, scaledSize );
}
 
开发者ID:saalfeldlab,项目名称:z-spacing,代码行数:13,代码来源:ZPositionCorrection.java

示例5: xfmToView

import net.imglib2.realtransform.InverseRealTransform; //导入依赖的package包/类
public static <T extends RealType<T>> RealTransformRandomAccessible<T, InverseRealTransform> xfmToView(
		InvertibleRealTransform xfm, 
		RandomAccessible<T> src, 
		InterpolatorFactory<T, RandomAccessible<T>> interpFactory) 
{
	RealRandomAccessible<T> interpolant = Views.interpolate(
			src, interpFactory);

	RealTransformRandomAccessible<T, InverseRealTransform> rv = 
		RealViews.transform( interpolant, xfm.inverse() );

	return rv;
}
 
开发者ID:bogovicj,项目名称:hhmi-exp,代码行数:14,代码来源:TransformTools.java

示例6: testView

import net.imglib2.realtransform.InverseRealTransform; //导入依赖的package包/类
@Test
	public void testView(){
		
		/**  test view **/
//		int nLevels = 5;
//		Img<FloatType> img = ImgUtil.createCheckerImg( new int[]{15,15,15}, new FloatType(), nLevels);
//		ImgUtil.writeFloat(img, "/groups/jain/home/bogovicj/projects/crackPatching/toyData/checkerImg.tif");
		
		Img<FloatType> img = ImgOps.createGradientImgY( new int[]{15, 15, 15},  new FloatType());

		RandomAccess<FloatType> imgRa = img.randomAccess();
		
		int[] patchSize = new int[]{5,5,3};
		Edgel e = new Edgel(
				new double[]{7f, 9f, 11f},
				new double[]{0f, 1f, 0f },
				1f
			);
		
		RealTransformRandomAccessible<FloatType, InverseRealTransform> view = EdgelTools.edgelToView(e, img, patchSize);
		RealTransformRandomAccessible<FloatType, InverseRealTransform>.RealTransformRandomAccess viewRa = view.randomAccess();

		viewRa.setPosition(new int[]{2,2,0});
		imgRa.setPosition(new int[]{7,8,11});
		assertEquals("value at patch -z", imgRa.get().get(), viewRa.get().get(), tol);
		
		viewRa.setPosition(new int[]{2,2,1});
		imgRa.setPosition(new int[]{7,9,11});
		assertEquals("value at patch center", imgRa.get().get(), viewRa.get().get(), tol);
		
		viewRa.setPosition(new int[]{2,2,2});
		imgRa.setPosition(new int[]{7,10,11});
		assertEquals("value at patch +z", imgRa.get().get(), viewRa.get().get(), tol);
		
		
	}
 
开发者ID:bogovicj,项目名称:hhmi-exp,代码行数:37,代码来源:EdgelToolsTest.java

示例7: testPca

import net.imglib2.realtransform.InverseRealTransform; //导入依赖的package包/类
@Test
	public void testPca(){
	System.out.println("testPcaReg");
		
		int[] sz = new int[]{ 27,27,27 };
		double[] ctr = ArrayUtil.toDouble( PatchTools.patchSizeToMidpt( sz ));
		double[] sigs = new double[]{1, 10, 0.1};
//		double mint = -1;
//		double maxt = 1.5;
		double mint = -1;
		double maxt = 9e20;
		
		ImagePlusImgFactory<FloatType> factory = new ImagePlusImgFactory<FloatType>();
		
		Img<FloatType> img = ImgOps.createGaussianEllipseImg(factory, sz, ctr, sigs, mint, maxt, new FloatType());
		ImgOps.writeFloat(img, "/groups/jain/home/bogovicj/projects/crackPatching/toyData/ellipseImg.tif");

		AffineTransform3D xfm = TransformTools.rotationCentered(2, Math.PI/8, ctr);
		RealTransformRandomAccessible<FloatType, InverseRealTransform> imgXfm = 
				TransformTools.xfmToView(xfm, 
						Views.extendZero(img), new NLinearInterpolatorFactory<FloatType>());

		ImagePlusImg<FloatType, ?> imgXfmOut = factory.create(img, img.firstElement());
		ImgOps.copyInto( imgXfm, imgXfmOut);

		ImgMoment tgtMom = new ImgMoment();
		double[] tgtOr = tgtMom.orientation(imgXfmOut);
		tgtMom.orientationEvalsEvecs(tgtOr);
		
		System.out.println("tgt or: " + ArrayUtil.printArray(tgtOr));
		System.out.println("tgt cent: " + ArrayUtil.printArray(tgtMom.centroid()));
		
		
		DenseMatrix64F srcR = new DenseMatrix64F( 3, 3 );
		srcR.setData( tgtMom.getEvecs() );
		DenseMatrix64F srcMtx = TransformTools.rotationCenteredMtx(srcR, tgtMom.centroid());
	
	}
 
开发者ID:bogovicj,项目名称:hhmi-exp,代码行数:39,代码来源:TestPcaRotReg.java

示例8: apply

import net.imglib2.realtransform.InverseRealTransform; //导入依赖的package包/类
public static ImagePlus apply(
		final ImagePlus movingIp,
		final ImagePlus targetIp,
		final LandmarkTableModel landmarks,
		final Interpolation interp,
		final int nThreads )
{
	int numChannels = movingIp.getNChannels();
	BigWarpData bwData = BigWarpInit.createBigWarpDataFromImages( movingIp, targetIp );

	BigWarpExporter< ? > exporter = null;
	ArrayList< SourceAndConverter< ? > > sources = bwData.sources;
	int[] movingSourceIndexList = bwData.movingSourceIndices;
	int[] targetSourceIndexList = bwData.targetSourceIndices;
	VoxelDimensions voxdim = sources.get( targetSourceIndexList[ 0 ] ).getSpimSource().getVoxelDimensions();

	ArrayList< SourceAndConverter< ? >> sourcesxfm = BigWarp.wrapSourcesAsTransformed(
			sources, 
			landmarks.getNumdims(),
			movingSourceIndexList );

	ThinPlateR2LogRSplineKernelTransform xfm = landmarks.getTransform();

	for ( int i = 0; i < numChannels; i++ )
	{
		InverseRealTransform irXfm = new InverseRealTransform( new TpsTransformWrapper( 3, xfm ) );
		((WarpedSource< ? >) (sourcesxfm.get( i ).getSpimSource())).updateTransform( irXfm );
		((WarpedSource< ? >) (sourcesxfm.get( i ).getSpimSource())).setIsTransformed( true );
	}

	if ( BigWarpRealExporter.isTypeListFullyConsistent( sources, movingSourceIndexList ) )
	{
		Object baseType = sourcesxfm.get( movingSourceIndexList[ 0 ] ).getSpimSource().getType();
		if ( ByteType.class.isInstance( baseType ) )
			exporter = new BigWarpRealExporter< ByteType >( sourcesxfm, movingSourceIndexList, targetSourceIndexList, interp, ( ByteType ) baseType );
		else if ( UnsignedByteType.class.isInstance( baseType ) )
			exporter = new BigWarpRealExporter< UnsignedByteType >( sourcesxfm, movingSourceIndexList, targetSourceIndexList, interp, ( UnsignedByteType ) baseType );
		else if ( IntType.class.isInstance( baseType ) )
			exporter = new BigWarpRealExporter< IntType >( sourcesxfm, movingSourceIndexList, targetSourceIndexList, interp, ( IntType ) baseType );
		else if ( UnsignedShortType.class.isInstance( baseType ) )
			exporter = new BigWarpRealExporter< UnsignedShortType >( sourcesxfm, movingSourceIndexList, targetSourceIndexList, interp, ( UnsignedShortType ) baseType );
		else if ( FloatType.class.isInstance( baseType ) )
			exporter = new BigWarpRealExporter< FloatType >( sourcesxfm, movingSourceIndexList, targetSourceIndexList, interp, ( FloatType ) baseType );
		else if ( DoubleType.class.isInstance( baseType ) )
			exporter = new BigWarpRealExporter< DoubleType >( sourcesxfm, movingSourceIndexList, targetSourceIndexList, interp, ( DoubleType ) baseType );
		else if ( ARGBType.class.isInstance( baseType ) )
			exporter = new BigWarpARGBExporter( sourcesxfm, movingSourceIndexList, targetSourceIndexList );
		else
		{
			System.err.println( "Can't export type " + baseType.getClass() );
			exporter = null;
			return null;
		}
	}

	ImagePlus warpedIp = exporter.exportMovingImagePlus( false, nThreads );

	// Note: need to get number of channels and frames from moving image
	// but get the number of slices form the target
	warpedIp.setDimensions( movingIp.getNChannels(), targetIp.getNSlices(),
			movingIp.getNFrames() );

	warpedIp.getCalibration().pixelWidth = 1.0 / voxdim.dimension( 0 );
	warpedIp.getCalibration().pixelHeight = 1.0 / voxdim.dimension( 1 );
	warpedIp.getCalibration().pixelDepth = voxdim.dimension( 2 );
	warpedIp.getCalibration().setUnit( voxdim.unit() );
	warpedIp.setTitle( movingIp.getTitle() + "_bigwarped" );

	return warpedIp;
}
 
开发者ID:saalfeldlab,项目名称:bigwarp,代码行数:71,代码来源:ApplyBigwarpPlugin.java

示例9: updateTransform

import net.imglib2.realtransform.InverseRealTransform; //导入依赖的package包/类
public void updateTransform( InverseRealTransform xfm )
{
	this.xfm = xfm;
}
 
开发者ID:saalfeldlab,项目名称:bigwarp,代码行数:5,代码来源:WarpedSource.java

示例10: inverse

import net.imglib2.realtransform.InverseRealTransform; //导入依赖的package包/类
@Override
public InvertibleRealTransform inverse()
{
	return new InverseRealTransform( this );
}
 
开发者ID:saalfeldlab,项目名称:bigwarp,代码行数:6,代码来源:TpsTransformWrapper.java

示例11: applyBigWarpHelper

import net.imglib2.realtransform.InverseRealTransform; //导入依赖的package包/类
public static BigWarpExporter< ? > applyBigWarpHelper( AbstractSpimData< ? >[] spimDataP, AbstractSpimData< ? >[] spimDataQ,
		ImagePlus impP, LandmarkTableModel ltm, Interpolation interpolation )
{
	String[] names = generateNames( impP );
	BigWarpData data = BigWarpInit.createBigWarpData( spimDataP, spimDataQ, names );

	int numChannels = impP.getNChannels();
	System.out.println( numChannels + " channels" );
	int[] movingSourceIndexList = new int[ numChannels ];
	for ( int i = 0; i < numChannels; i++ )
	{
		movingSourceIndexList[ i ] = i;
	}
	
	int[] targetSourceIndexList = data.targetSourceIndices;
	
	ArrayList< SourceAndConverter< ? >> sourcesxfm = BigWarp.wrapSourcesAsTransformed(
			data.sources, 
			ltm.getNumdims(),
			movingSourceIndexList );

	ThinPlateR2LogRSplineKernelTransform xfm = ltm.getTransform();

	for ( int i = 0; i < numChannels; i++ )
	{
		InverseRealTransform irXfm = new InverseRealTransform( new TpsTransformWrapper( 3, xfm ) );
		((WarpedSource< ? >) (sourcesxfm.get( i ).getSpimSource())).updateTransform( irXfm );
		((WarpedSource< ? >) (sourcesxfm.get( i ).getSpimSource())).setIsTransformed( true );
	}
	
	BigWarpExporter< ? > exporter;
	Object baseType = sourcesxfm.get( movingSourceIndexList[ 0 ] ).getSpimSource().getType();
	if ( ByteType.class.isInstance( baseType ) )
		exporter = new BigWarpRealExporter< ByteType >( sourcesxfm,
				movingSourceIndexList, targetSourceIndexList, interpolation,
				(ByteType) baseType );
	else if ( UnsignedByteType.class.isInstance( baseType ) )
		exporter = new BigWarpRealExporter< UnsignedByteType >( sourcesxfm,
				movingSourceIndexList, targetSourceIndexList, interpolation,
				(UnsignedByteType) baseType );
	else if ( IntType.class.isInstance( baseType ) )
		exporter = new BigWarpRealExporter< IntType >( sourcesxfm, movingSourceIndexList,
				targetSourceIndexList, interpolation, (IntType) baseType );
	else if ( UnsignedShortType.class.isInstance( baseType ) )
		exporter = new BigWarpRealExporter< UnsignedShortType >( sourcesxfm,
				movingSourceIndexList, targetSourceIndexList, interpolation,
				(UnsignedShortType) baseType );
	else if ( FloatType.class.isInstance( baseType ) )
		exporter = new BigWarpRealExporter< FloatType >( sourcesxfm,
				movingSourceIndexList, targetSourceIndexList, interpolation,
				(FloatType) baseType );
	else if ( DoubleType.class.isInstance( baseType ) )
		exporter = new BigWarpRealExporter< DoubleType >( sourcesxfm,
				movingSourceIndexList, targetSourceIndexList, interpolation,
				(DoubleType) baseType );
	else if ( ARGBType.class.isInstance( baseType ) )
		exporter = new BigWarpARGBExporter( sourcesxfm,
				movingSourceIndexList, targetSourceIndexList );
	else
	{
		System.err.println( "Can't export type " + baseType.getClass() );
		exporter = null;
	}

	return exporter;
}
 
开发者ID:saalfeldlab,项目名称:bigwarp,代码行数:67,代码来源:BigWarpBatchTransformFOV.java

示例12: estimateFromMatrix

import net.imglib2.realtransform.InverseRealTransform; //导入依赖的package包/类
public < T extends RealType< T >, W extends RealType< W > > RandomAccessibleInterval< double[] > estimateFromMatrix(
		final RandomAccessibleInterval< T > correlations,
		final double[] coordinates,
		final AbstractLUTRealTransform transform,
		final RandomAccessibleInterval< W > estimateWeightMatrix,
		final Options options )
{
	final int range = options.comparisonRange;
	final boolean forceMonotonicity = options.forceMonotonicity;

	final T correlationsNaNExtension = correlations.randomAccess().get().copy();
	correlationsNaNExtension.setReal( Double.NaN );
	final RealRandomAccessible< T > extendedInterpolatedCorrelations = Views.interpolate( Views.extendValue( correlations, correlationsNaNExtension ), new NLinearInterpolatorFactory<>() );

	final RealTransformRealRandomAccessible< T, InverseRealTransform > transformedCorrelations = RealViews.transformReal( extendedInterpolatedCorrelations, transform );

	// TODO extend border or value (nan)?
	final RealRandomAccessible< W > extendedInterpolatedWeights = Views.interpolate( Views.extendBorder( estimateWeightMatrix ), new NLinearInterpolatorFactory<>() );

	final RealTransformRealRandomAccessible< W, InverseRealTransform > transformedWeights = RealViews.transformReal( extendedInterpolatedWeights, transform );

	final RealRandomAccess< T > access1 = transformedCorrelations.realRandomAccess();
	final RealRandomAccess< T > access2 = transformedCorrelations.realRandomAccess();

	final RealRandomAccess< W > wAccess1 = transformedWeights.realRandomAccess();
	final RealRandomAccess< W > wAccess2 = transformedWeights.realRandomAccess();

	init( range );

	for ( int z = 0; z < coordinates.length; ++z )
	{
		access1.setPosition( z, 1 );
		access1.setPosition( z, 0 );
		transform.apply( access1, access1 );
		access2.setPosition( access1 );

		wAccess1.setPosition( access1 );
		wAccess2.setPosition( access1 );

		double currentMin1 = Double.MAX_VALUE;
		double currentMin2 = Double.MAX_VALUE;
		// should w go in pairwise?
		for ( int k = 0; k <= range; ++k, access1.fwd( 0 ), access2.bck( 0 ), wAccess1.fwd( 0 ), wAccess2.bck( 0 ) )
		{
			final double a1 = access1.get().getRealDouble();
			final double a2 = access2.get().getRealDouble();
			if ( !Double.isNaN( a1 ) && a1 > 0.0 && ( !forceMonotonicity || a1 < currentMin1 ) )
			{
				currentMin1 = a1;
				add( z, k, a1, wAccess1.get().getRealDouble() );
			}
			if ( !Double.isNaN( a2 ) && a2 > 0.0 && ( !forceMonotonicity || a2 < currentMin2 ) )
			{
				currentMin2 = a2;
				add( z, k, a2, wAccess2.get().getRealDouble() );
			}
		}
	}

	return estimate( coordinates.length );
}
 
开发者ID:saalfeldlab,项目名称:z-spacing,代码行数:62,代码来源:AbstractCorrelationFit.java

示例13: inverse

import net.imglib2.realtransform.InverseRealTransform; //导入依赖的package包/类
/**
 * TODO create actual inverse
 */
@Override
public InvertibleRealTransform inverse()
{
	return new InverseRealTransform( this );
}
 
开发者ID:saalfeldlab,项目名称:z-spacing,代码行数:9,代码来源:SingleDimensionLUTRealTransform.java

示例14: main

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

	new ImageJ();
	final ImagePlus imp = new ImagePlus( "http://media.npr.org/images/picture-show-flickr-promo.jpg" );
	for ( int y = imp.getHeight() / 2; y < imp.getHeight(); ++y )
	{
		for ( int x = imp.getWidth() / 2; x < imp.getWidth(); ++x )
		{
			imp.getProcessor().setf( x, y, Float.NaN );
		}
	}
	imp.show();
	System.out.println( imp.getHeight() + " " + imp.getWidth() + " " + imp.getStack().getSize() );

	final int xyIndices = 5;
	final ArrayImg< FloatType, FloatArray > img4D = ArrayImgs.floats( xyIndices, xyIndices, imp.getWidth(), imp.getHeight() );

	final ArrayImg< DoubleType, DoubleArray > lut = ArrayImgs.doubles( xyIndices, xyIndices, Math.max( imp.getWidth(), imp.getHeight() ) );
	final ArrayRandomAccess< DoubleType > lutRA = lut.randomAccess();
	final ArrayRandomAccess< FloatType > ra = img4D.randomAccess();
	ra.setPosition( new int[] { 0, 0, 0, 0 } );
	for ( int yPrime = 0; yPrime < xyIndices; ++yPrime )
	{
		ra.setPosition( yPrime, 1 );
		for ( int xPrime = 0; xPrime < xyIndices; ++xPrime )
		{
			ra.setPosition( xPrime, 0 );
			for ( int y = 0; y < imp.getHeight(); ++y )
			{
				ra.setPosition( y, 3 );
				for ( int x = 0; x < imp.getWidth(); ++x )
				{
					ra.setPosition( x, 2 );
					ra.get().set( imp.getProcessor().getf( x, y ) );
					if ( Math.abs( x - y ) > 5 )
					{
						ra.get().set( Float.NaN );
					}
				}
			}
		}
	}

	for ( int xPrime = 0; xPrime < xyIndices; ++xPrime )
	{
		for ( int yPrime = 0; yPrime < xyIndices; ++yPrime )
		{
			for ( int z = 0; z < lut.dimension( 2 ); ++z )
			{
				lutRA.setPosition( new int[] { xPrime, yPrime, z } );
				lutRA.get().set( z );
			}
		}

	}

	final LUTGrid lutGrid = new LUTGrid( 4, 4, lut );

	final RealRandomAccessible< FloatType > source = Views.interpolate( Views.extendValue( img4D, new FloatType( Float.NaN ) ), new NLinearInterpolatorFactory< FloatType >() );
	final RealTransformRealRandomAccessible< FloatType, InverseRealTransform > source2 = RealViews.transformReal( source, lutGrid );
	final RealRandomAccessible< FloatType > source3 = Views.interpolate( Views.extendBorder( img4D ), new NLinearInterpolatorFactory< FloatType >() );
	final RealTransformRealRandomAccessible< FloatType, InverseRealTransform > source4 = RealViews.transformReal( source3, lutGrid );
	final IntervalView< FloatType > v1 = Views.hyperSlice( Views.hyperSlice( img4D, 1, xyIndices / 2 ), 0, xyIndices / 2 );
	final IntervalView< FloatType > v2 = Views.interval( Views.hyperSlice( Views.hyperSlice( Views.raster( source2 ), 1, 0 ), 0, xyIndices - 5 ), new FinalInterval( v1 ) );
	final IntervalView< FloatType > v3 = Views.interval( Views.hyperSlice( Views.hyperSlice( Views.raster( source4 ), 1, 0 ), 0, xyIndices - 5 ), new FinalInterval( v1 ) );

	ImageJFunctions.show( v1, "hyperSlice" );
	ImageJFunctions.show( v2, "extendNaN" );
	ImageJFunctions.show( v3, "extendBorder" );

}
 
开发者ID:saalfeldlab,项目名称:z-spacing,代码行数:73,代码来源:LUTGrid.java

示例15: registerEdgelsOrient

import net.imglib2.realtransform.InverseRealTransform; //导入依赖的package包/类
public void registerEdgelsOrient( Edgel e, Edgel f, int i )
	{
		ImagePlusImgFactory<T> ipfactory = new ImagePlusImgFactory<T>(); 
		Img<T> ePatch = ipfactory.create(patchSize, img.firstElement());
		Img<T> fPatch = ipfactory.create(patchSize, img.firstElement());
		
		computeCrackDepthNormalMask( e );	
		sampleImgByDepth( e, ePatch );
		
		computeCrackDepthNormalMask( f );	
		sampleImgByDepth( f, fPatch );
		
		ImgOps.writeFloat( ePatch, 
				String.format("%s/patchDepthSamp_test.tif", debugOutDir));
		ImgOps.writeFloat( fPatch, 
				String.format("%s/patchDepthSamp_test_match.tif", debugOutDir));
		
		Img<T> ePatch2 = ImgOps.collapseSum(ePatch);
		Img<T> fPatch2 = ImgOps.collapseSum(fPatch);
		
		int[] midPt = PatchTools.patchSizeToMidpt(patchSize);
		int[] midPtPatch = ArrayUtil.subArray(
				PatchTools.patchSizeToMidpt(patchSize),
				0, ePatch2.numDimensions());
		
		logger.debug(" end: " + (ePatch2.numDimensions() - 1));
		logger.debug(" midPt: " + ArrayUtil.printArray(midPtPatch));		
		int zdim = midPtPatch.length - 1; 
//		
//		IntervalView<T> ePatch2 = Views.hyperSlice( ePatch, zdim, midPt[zdim] );
//		IntervalView<T> fPatch2 = Views.hyperSlice( fPatch, zdim, midPt[zdim] );
		
		/** DEBUG WRITE TO FILE **/
		long[] min = new long[ePatch2.numDimensions()];
		ePatch2.min(min);
		long[] max = new long[ePatch2.numDimensions()];
		ePatch2.max(max);
		IntervalIterator itvl = new IntervalIterator( min, max );
//		
//		logger.debug(" patchout min: " + ArrayUtil.printArray(min));
//		logger.debug(" patchout max: " + ArrayUtil.printArray(max));
//		
		ImagePlusImg<T, ?> ePatch2out = ipfactory.create(itvl, img.firstElement());
		ImgOps.copyInto(ePatch2, ePatch2out);
		ImgOps.writeFloat( ePatch2out, 
				String.format("%s/patchDepthSamp_test_col.tif", debugOutDir));

		ImagePlusImg<T, ?> fPatch2out = ipfactory.create(itvl, img.firstElement());
		ImgOps.copyInto(fPatch2, fPatch2out);
		ImgOps.writeFloat( fPatch2out, 
				String.format("%s/patchDepthSamp_test_col_match.tif", debugOutDir));
		/** DEBUG WRITE TO FILE **/
		
		
		// register
		
		AffineTransform xfm = TransformTools.rotationPca(ePatch2, fPatch2, ArrayUtil.toDouble(midPtPatch));
		logger.debug("xfm : \n" + TransformTools.printAffineTransform(xfm));
		
		AffineTransform3D xfmPre = EdgelTools.edgelToXfm(f, midPt);
		xfmPre.preConcatenate(xfm);
		
		RealTransformRandomAccessible<T, InverseRealTransform> fPatch2Xfm = RealViews.transform( 
				Views.interpolate(img, new NLinearInterpolatorFactory<T>()), 
				xfmPre.inverse());
		
		ImagePlusImg<T, ?> fPatch2Xfmout = ipfactory.create(itvl, img.firstElement());
		ImgOps.copyInto(fPatch2Xfm, fPatch2Xfmout);
		ImgOps.writeFloat( fPatch2Xfmout, 
				String.format("%s/patchDepthSamp_test_col_match_Xfm.tif", debugOutDir));
	}
 
开发者ID:bogovicj,项目名称:hhmi-exp,代码行数:72,代码来源:CrackCorrection.java


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