本文整理汇总了Java中net.imglib2.view.Views.extendBorder方法的典型用法代码示例。如果您正苦于以下问题:Java Views.extendBorder方法的具体用法?Java Views.extendBorder怎么用?Java Views.extendBorder使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.imglib2.view.Views
的用法示例。
在下文中一共展示了Views.extendBorder方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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();
}
示例2: 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();
}
示例3: doOnUnToggle
import net.imglib2.view.Views; //导入方法依赖的package包/类
@Override
public void doOnUnToggle( final int x, final int y )
{
synchronized ( viewer )
{
viewer.setCursor( Cursor.getPredefinedCursor( Cursor.WAIT_CURSOR ) );
setCoordinates( x, y );
final Point p = new Point( Math.round( labelLocation.getDoublePosition( 0 ) ), Math.round( labelLocation.getDoublePosition( 1 ) ), Math.round( labelLocation.getDoublePosition( 2 ) ) );
final ArrayImg< ByteType, ByteArray > img = wrapBufferedImage( filledPixelsOverlay.img );
final ArrayRandomAccess< ByteType > imgAccess = img.randomAccess();
imgAccess.setPosition( new int[] { x, y } );
final byte overlayValueAtPoint = imgAccess.get().get();
final ExtendedRandomAccessibleInterval< ByteType, IntervalView< ByteType > > borderExtended = Views.extendBorder( Views.interval( Views.addDimension( img ), new FinalInterval( img.dimension( 0 ), img.dimension( 1 ), overlayValueAtPoint ) ) );
final RandomAccessibleOnRealRandomAccessible< ByteType > interpolatedAndTransformed =
Views.raster( RealViews.transform( Views.interpolate( borderExtended, new NearestNeighborInterpolatorFactory<>() ), labelTransform.inverse().copy().concatenate( viewerToGlobalCoordinatesTransform.inverse() )// toLabelSpace
) );
final long seedFragmentLabel = LabelFillController.getBiggestLabel( labels, p );
System.out.println( seedFragmentLabel + " " + overlayValueAtPoint + " " + getColor().getRGB() );
final RandomAccess< LongType > paintedLabelAccess = paintedLabels.randomAccess();
paintedLabelAccess.setPosition( p );
final long paintedLabel = paintedLabelAccess.get().get();
final long segmentLabel = assignment.getSegment( seedFragmentLabel );
final long comparison = paintedLabel == TRANSPARENT ? segmentLabel : paintedLabel;
final long[] fragmentsContainedInSegment = assignment.getFragments( segmentLabel );
final Filter< Pair< Pair< LabelMultisetType, ByteType >, LongType >, Pair< Pair< LabelMultisetType, ByteType >, LongType > > filter = ( p1, p2 ) -> {
final Pair< LabelMultisetType, ByteType > multiSetOverlayPairComp = p1.getA();
final long currentPaint = p1.getB().get();
if ( multiSetOverlayPairComp.getB().get() == overlayValueAtPoint && currentPaint != p2.getB().get() )
{
if ( currentPaint != TRANSPARENT )
return currentPaint == comparison;
else
{
final LabelMultisetType currentMultiSet = multiSetOverlayPairComp.getA();
for ( final long fragment : fragmentsContainedInSegment )
if ( currentMultiSet.contains( fragment ) )
return true;
return false;
}
}
return false;
};
final long t0 = System.currentTimeMillis();
final AccessBoxRandomAccessible< LongType > accessTrackingExtendedPaintedLabels =
new AccessBoxRandomAccessible<>(
Views.extendValue(
paintedLabels,
new LongType( Label.TRANSPARENT ) ) );
FloodFill.fill( new RandomAccessiblePair<>(
Views.extendValue( labels, new LabelMultisetType() ),
interpolatedAndTransformed ),
accessTrackingExtendedPaintedLabels,
p,
new ValuePair<>( new LabelMultisetType(), new ByteType( overlayValueAtPoint ) ),
new LongType( selectionController.getActiveFragmentId() ),
new DiamondShape( 1 ),
filter );
dirtyLabelsInterval.touch( accessTrackingExtendedPaintedLabels.createAccessInterval() );
final long t1 = System.currentTimeMillis();
System.out.println( "Filling took " + ( t1 - t0 ) + " ms" );
System.out.println( " modified box: " + Util.printInterval( dirtyLabelsInterval.getDirtyInterval() ) );
viewer.setCursor( Cursor.getPredefinedCursor( Cursor.DEFAULT_CURSOR ) );
viewer.requestRepaint();
}
action.run();
}
示例4: calculate
import net.imglib2.view.Views; //导入方法依赖的package包/类
@Override
public ExtendedRandomAccessibleInterval<T, F> calculate(F input) {
return Views.extendBorder(input);
}
示例5: deinterval
import net.imglib2.view.Views; //导入方法依赖的package包/类
public static <T> RandomAccessible<T> deinterval(RandomAccessibleInterval<T> input){
return Views.extendBorder(input);
}