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


Java Views.collapseReal方法代码示例

本文整理汇总了Java中net.imglib2.view.Views.collapseReal方法的典型用法代码示例。如果您正苦于以下问题:Java Views.collapseReal方法的具体用法?Java Views.collapseReal怎么用?Java Views.collapseReal使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.imglib2.view.Views的用法示例。


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

示例1: getAccessor

import net.imglib2.view.Views; //导入方法依赖的package包/类
/**
 * Logic stolen from
 * <a href='https://github.com/trakem2/TrakEM2/blob/master/TrakEM2_/src/main/java/org/janelia/intensity/LinearIntensityMap.java'>
 *   TrakEM2 LinearIntensityMap
 * </a>.
 *
 * @return an accessor for deriving warped pixel intensities.
 */
public RealRandomAccess<RealComposite<DoubleType>> getAccessor() {

    final ArrayImg<DoubleType, DoubleArray> warpField =
            ArrayImgs.doubles(values, columnCount, rowCount, VALUES_PER_AFFINE);

    final CompositeIntervalView<DoubleType, RealComposite<DoubleType>>
            collapsedSource = Views.collapseReal(warpField);

    final RandomAccessible<RealComposite<DoubleType>> extendedCollapsedSource = Views.extendBorder(collapsedSource);
    final RealRandomAccessible<RealComposite<DoubleType>> coefficients =
            Views.interpolate(extendedCollapsedSource, interpolatorFactory);

    final double xScale = getXScale();
    final double yScale = getYScale();
    final double[] scale = { xScale, yScale };
    final double[] shift = { 0.5 * xScale , 0.5 * yScale };

    final ScaleAndTranslation scaleAndTranslation = new ScaleAndTranslation(scale, shift);

    final RealRandomAccessible<RealComposite<DoubleType>> stretchedCoefficients =
            RealViews.transform(coefficients, scaleAndTranslation);

    return stretchedCoefficients.realRandomAccess();
}
 
开发者ID:saalfeldlab,项目名称:render,代码行数:33,代码来源:AffineWarpField.java

示例2: defaultCollapseRealTest

import net.imglib2.view.Views; //导入方法依赖的package包/类
@Test
public void defaultCollapseRealTest() {

	Img<DoubleType> img = new ArrayImgFactory<DoubleType>().create(new int[] { 10, 10 },
			new DoubleType());

	CompositeIntervalView<DoubleType, RealComposite<DoubleType>> il2 = Views
			.collapseReal((RandomAccessibleInterval<DoubleType>) img);
	CompositeIntervalView<DoubleType, RealComposite<DoubleType>> opr = ops.transform()
			.collapseRealView((RandomAccessibleInterval<DoubleType>) img);

	assertEquals(il2.numDimensions(), opr.numDimensions());

	CompositeView<DoubleType, RealComposite<DoubleType>> il2_2 = Views
			.collapseReal((RandomAccessible<DoubleType>) img, 1);
	CompositeView<DoubleType, RealComposite<DoubleType>> opr_2 = ops.transform()
			.collapseRealView((RandomAccessible<DoubleType>) img, 1);

	assertEquals(il2_2.numDimensions(), opr_2.numDimensions());
}
 
开发者ID:imagej,项目名称:imagej-ops,代码行数:21,代码来源:CollapseRealViewTest.java

示例3: AbstractLUTGrid

import net.imglib2.view.Views; //导入方法依赖的package包/类
public AbstractLUTGrid( final int numSourceDimensions, final int numTargetDimensions,
		final RandomAccessibleInterval< DoubleType > lutArray, final double[] scale, final double[] shift )
{
	super();
	this.numSourceDimensions = numSourceDimensions;
	this.numTargetDimensions = numTargetDimensions;
	this.lutArray = lutArray;

	// generate n-1 dimensional array that has local LUTs as columns
	final CompositeIntervalView< DoubleType, RealComposite< DoubleType > > collapsedSource = Views.collapseReal( lutArray );
	this.dimensions = new FinalInterval( collapsedSource );
	this.nNonTransformedCoordinates = this.dimensions.numDimensions();
	this.lutMaxIndex = ( int ) ( this.lutArray.dimension( this.nNonTransformedCoordinates ) ) - 1;

	// generate scale transform to allow for generating interpolated
	// high-res LUT from low-res LUT
	this.scale = new double[ this.nNonTransformedCoordinates ];
	this.shift = new double[ this.nNonTransformedCoordinates ];
	copyAndFillIfNecessary( scale, this.scale );
	copyAndFillIfNecessary( shift, this.shift );

	final ScaleAndTranslation scaleAndShift = new ScaleAndTranslation( this.scale, this.shift );
	final ExtendedRandomAccessibleInterval< RealComposite< DoubleType >, CompositeIntervalView< DoubleType, RealComposite< DoubleType > > > extendedCollapsedSource =
			Views.extendBorder( collapsedSource );
	this.coefficients = RealViews.transform( Views.interpolate( extendedCollapsedSource, this.interpolatorFactory ), scaleAndShift );
	this.access = this.coefficients.realRandomAccess();
	this.currentLut = this.access.get();

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

示例4: calculate

import net.imglib2.view.Views; //导入方法依赖的package包/类
@Override
public CompositeIntervalView<T, RealComposite<T>> calculate(RandomAccessibleInterval<T> input) {
	List<RandomAccessibleInterval<T>> derivatives = new ArrayList<>();
	for (int i = 0; i < derivativeComputers.length; i++) {
		RandomAccessibleInterval<T> derivative = createRAI.calculate(input);
		derivativeComputers[i].compute(input, derivative);
		for (int j = 0; j < derivativeComputers.length; j++) {
			RandomAccessibleInterval<T> out = createRAI.calculate(input);
			derivativeComputers[j].compute(derivative, out);
			derivatives.add(out);
		}
	}
	RandomAccessibleInterval<T> stackedDerivatives = Views.stack(derivatives);
	return Views.collapseReal(stackedDerivatives);
}
 
开发者ID:imagej,项目名称:imagej-ops,代码行数:16,代码来源:HessianRAI.java

示例5: calculate

import net.imglib2.view.Views; //导入方法依赖的package包/类
@Override
public CompositeIntervalView<T, RealComposite<T>> calculate(RandomAccessibleInterval<T> input) {
	List<RandomAccessibleInterval<T>> derivatives = new ArrayList<>();
	for (int i = 0; i < derivativeFunctions.length; i++) {
		RandomAccessibleInterval<T> derivative = derivativeFunctions[i].calculate(input);
		derivatives.add(derivative);
	}

	RandomAccessibleInterval<T> stacked = Views.stack(derivatives);
	return Views.collapseReal(stacked);
}
 
开发者ID:imagej,项目名称:imagej-ops,代码行数:12,代码来源:PartialDerivativesRAI.java

示例6: estimate

import net.imglib2.view.Views; //导入方法依赖的package包/类
@Override
protected RandomAccessibleInterval< double[] > estimate( final int size )
{

	{
		final ArrayRandomAccess< DoubleType > ra = summedMeasurements.randomAccess();
		for ( int n = 0; n < nSamples.length; ++n )
		{
			ra.setPosition( n, 0 );
			final double[] ns = nSamples[ n ];
			for ( int r = 0; r < ns.length; ++r )
			{
				ra.setPosition( r, 1 );
				ra.get().mul( 1.0 / ns[ r ] );
			}
		}
	}


	final CompositeIntervalView< DoubleType, RealComposite< DoubleType > > collapsed =
			Views.collapseReal( summedMeasurements );

	final RealRandomAccessible< RealComposite< DoubleType > > interpolated =
			Views.interpolate( Views.extendBorder( collapsed ), new NLinearInterpolatorFactory<>() );

	final FinalInterval fi = new FinalInterval( size );
	final IntervalView< RealComposite< DoubleType > > transformed =
			Views.interval( Views.raster( RealViews.transformReal( interpolated, scaleAndTranslation ) ), fi );

	final Cursor< RealComposite< DoubleType > > t = transformed.cursor();
	final ArrayList< double[] > list = new ArrayList<>();
	for ( int n = 0; n < size; ++n )
	{
		final RealComposite< DoubleType > c = t.next();
		final double[] target = new double[ nSamples[ 0 ].length ];
		target[ 0 ] = -1;
		for ( int i = 1; i < target.length; ++i )
			target[ i ] = -c.get( i ).get();
		list.add( target );
	}

	return new ListImg<>( list, list.size() );
}
 
开发者ID:saalfeldlab,项目名称:z-spacing,代码行数:44,代码来源:LocalCorrelationFitAverage.java

示例7: calculate

import net.imglib2.view.Views; //导入方法依赖的package包/类
@Override
public CompositeIntervalView<T, RealComposite<T>> calculate(RandomAccessibleInterval<T> input) {
	return Views.collapseReal(input);
}
 
开发者ID:imagej,项目名称:imagej-ops,代码行数:5,代码来源:DefaultCollapseReal2CompositeIntervalView.java

示例8: calculate

import net.imglib2.view.Views; //导入方法依赖的package包/类
@Override
public CompositeView<T, RealComposite<T>> calculate(RandomAccessible<T> input) {
	return Views.collapseReal(input, numChannels);
}
 
开发者ID:imagej,项目名称:imagej-ops,代码行数:5,代码来源:DefaultCollapseReal2CompositeView.java


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