本文整理汇总了Java中net.imglib2.Point类的典型用法代码示例。如果您正苦于以下问题:Java Point类的具体用法?Java Point怎么用?Java Point使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Point类属于net.imglib2包,在下文中一共展示了Point类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: calcIndex
import net.imglib2.Point; //导入依赖的package包/类
/**
* Calculates the index of a point in a buffer of a Tensor of the given
* shape
*/
private int calcIndex(final long[] shape, final int[] mapping, final Point p) {
assert p.numDimensions() == shape.length;
int n = shape.length;
// switch index and value of the mapping
int[] switchedMapping = new int[mapping.length];
IntStream.range(0, mapping.length).forEach(i -> switchedMapping[mapping[i]] = i);
int index = 0;
for (int dimPreSize = 1, d = n - 1; d >= 0; d--) {
index += dimPreSize * p.getIntPosition(switchedMapping[d]);
dimPreSize *= shape[d];
}
return index;
}
开发者ID:imagej,项目名称:imagej-tensorflow,代码行数:20,代码来源:TensorsTest.java
示例2: main
import net.imglib2.Point; //导入依赖的package包/类
public static void main(String[] args) {
double o1 = 6;
double o2 = Double.NEGATIVE_INFINITY;
int np1 = 30;
int np2 = 20;
System.out.println( Double.isInfinite( o2 ));
int ccCompare = Double.compare(o1, o2);
if (ccCompare != 0)
System.out.println( ccCompare );
else
System.out.println( (int)(np1 - np2) );
System.exit( 0 );
PhaseCorrelationPeak2 peaks = new PhaseCorrelationPeak2(new Point(new int[] {10, 10}), 1.0);
Dimensions pcmDims = new FinalDimensions(new int[] {50, 50});
Dimensions imgDims = new FinalDimensions(new int[] {30, 30});
PhaseCorrelation2Util.expandPeakToPossibleShifts(peaks, pcmDims, imgDims, imgDims);
}
开发者ID:PreibischLab,项目名称:BigStitcher,代码行数:23,代码来源:PhaseCorrelationPeak2.java
示例3: click
import net.imglib2.Point; //导入依赖的package包/类
@Override
public void click( final int x, final int y )
{
if ( filledPixelsOverlay.visible() )
{
synchronized ( viewer )
{
viewer.setCursor( Cursor.getPredefinedCursor( Cursor.WAIT_CURSOR ) );
final Point p = new Point( x, y );
final ArrayImg< ByteType, ByteArray > img = wrapBufferedImage( filledPixelsOverlay.img );
final ByteType extension = new ByteType( ( byte ) 1 );
final long t0 = System.currentTimeMillis();
final ArrayRandomAccess< ByteType > ra = img.randomAccess();
ra.setPosition( p );
FloodFill.fill( Views.extendValue( img, extension ), Views.extendValue( img, extension ), p, extension.copy(), extension.copy(), new DiamondShape( 1 ), filter );
final long t1 = System.currentTimeMillis();
System.out.println( "Filling took " + ( t1 - t0 ) + " ms" );
viewer.setCursor( Cursor.getPredefinedCursor( Cursor.DEFAULT_CURSOR ) );
viewer.getDisplay().repaint();
}
}
}
开发者ID:saalfeldlab,项目名称:bigcat,代码行数:27,代码来源:DrawProjectAndIntersectController.java
示例4: testCorners
import net.imglib2.Point; //导入依赖的package包/类
public void testCorners() {
long[] window = new long[]{10, 10, 10};
int numDimensions = window.length;
Point[] offsets = new Point[(int)Math.pow(2, numDimensions)];
for (int i=0; i<offsets.length; ++i) offsets[i] = new Point(numDimensions);
int d = 0;
while (d < numDimensions) {
final int flip = (int)Math.pow(2, d);
int sign = -1;
for (int i=0; i<offsets.length;) {
offsets[i].setPosition(sign * window[d] / 2, d);
++i;
if (0 == i % flip) sign *= -1;
}
++d;
}
for (int i=0; i<offsets.length; ++i) {
System.out.println(offsets[i].toString());
}
}
开发者ID:imglib,项目名称:imglib2-script,代码行数:21,代码来源:TestHistograms.java
示例5: getInsidePoints
import net.imglib2.Point; //导入依赖的package包/类
@SuppressWarnings( "unchecked" )
static ArrayList< Point >[] getInsidePoints( final ArrayList< Point > points, final double[][] planes )
{
final int nPlanes = planes.length;
final int n = points.get( 0 ).numDimensions();
final ArrayList< Point > inside = new ArrayList< Point >();
final ArrayList< Point > outside = new ArrayList< Point >();
A: for ( final Point p : points )
{
for ( int i = 0; i < nPlanes; ++i )
{
final double[] plane = planes[ i ];
double dot = 0;
for ( int d = 0; d < n; ++d )
dot += p.getDoublePosition( d ) * plane[ d ];
if ( dot < plane[ n ] )
{
outside.add( p );
continue A;
}
}
inside.add( p );
}
return new ArrayList[] { inside, outside };
}
开发者ID:imglib,项目名称:imglib2-tests,代码行数:26,代码来源:ClipConvexPolytopeKDTreeBenchmark.java
示例6: gaussianSmooth
import net.imglib2.Point; //导入依赖的package包/类
/**
* Gaussian Smooth of the input image using intermediate float format.
* @param <T>
* @param img
* @param sigma
* @return
*/
public static <T extends RealType<T> & NativeType<T>> RandomAccessibleInterval<T> gaussianSmooth(
RandomAccessibleInterval<T> img, double[] sigma) {
Interval interval = Views.iterable(img);
ImgFactory<T> outputFactory = new ArrayImgFactory<T>();
final long[] dim = new long[ img.numDimensions() ];
img.dimensions(dim);
RandomAccessibleInterval<T> output = outputFactory.create( dim,
img.randomAccess().get().createVariable() );
final long[] pos = new long[ img.numDimensions() ];
Arrays.fill(pos, 0);
Localizable origin = new Point(pos);
ImgFactory<FloatType> tempFactory = new ArrayImgFactory<FloatType>();
RandomAccessible<T> input = Views.extendMirrorSingle(img);
Gauss.inFloat(sigma, input, interval, output, origin, tempFactory);
return output;
}
开发者ID:fiji,项目名称:Colocalisation_Analysis,代码行数:28,代码来源:TestImageAccessor.java
示例7: checkImage
import net.imglib2.Point; //导入依赖的package包/类
/** Checks one image for the dimensions and marked points */
private <T extends RealType<T>> void checkImage(final Img<T> img, final int n, final long[] dims,
final List<Point> points) {
assertArrayEquals(dims, Intervals.dimensionsAsLongArray(img));
assertEquals(n, img.numDimensions());
checkPoints(img, points);
}
开发者ID:imagej,项目名称:imagej-tensorflow,代码行数:8,代码来源:TensorsTest.java
示例8: testImg2TensorReverseForType
import net.imglib2.Point; //导入依赖的package包/类
/** Tests the tensor(RAI) function for one image */
private <T extends RealType<T>> void testImg2TensorReverseForType(final Img<T> img, final int n, final long[] shape,
final DataType t) {
// Put some values to check into the image
List<Point> points = createTestPoints(n);
markPoints(img, points);
Tensor tensor = Tensors.tensor(img);
assertArrayEquals(shape, tensor.shape());
assertEquals(n, tensor.numDimensions());
assertEquals(t, tensor.dataType());
checkPointsTensor(tensor, IntStream.range(0, n).map(i -> n - 1 - i).toArray(), points);
}
开发者ID:imagej,项目名称:imagej-tensorflow,代码行数:15,代码来源:TensorsTest.java
示例9: testImg2TensorDirectForType
import net.imglib2.Point; //导入依赖的package包/类
/** Tests the tensorDirect(RAI) function for one image */
private <T extends RealType<T>> void testImg2TensorDirectForType(final Img<T> img, final int n, final long[] shape,
final DataType t) {
// Put some values to check into the image
List<Point> points = createTestPoints(n);
markPoints(img, points);
Tensor tensor = Tensors.tensorDirect(img);
assertArrayEquals(shape, tensor.shape());
assertEquals(n, tensor.numDimensions());
assertEquals(t, tensor.dataType());
checkPointsTensor(tensor, IntStream.range(0, n).toArray(), points);
}
开发者ID:imagej,项目名称:imagej-tensorflow,代码行数:15,代码来源:TensorsTest.java
示例10: testImg2TensorMappingForType
import net.imglib2.Point; //导入依赖的package包/类
/** Tests the tensor(RAI, int[]) function for one image */
private <T extends RealType<T>> void testImg2TensorMappingForType(final Img<T> img, final int[] mapping,
final int n, final long[] shape, final DataType t) {
// Put some values to check into the image
List<Point> points = createTestPoints(n);
markPoints(img, points);
Tensor tensor = Tensors.tensor(img, mapping);
assertArrayEquals(shape, tensor.shape());
assertEquals(n, tensor.numDimensions());
assertEquals(t, tensor.dataType());
checkPointsTensor(tensor, mapping, points);
}
开发者ID:imagej,项目名称:imagej-tensorflow,代码行数:14,代码来源:TensorsTest.java
示例11: createTestPoints
import net.imglib2.Point; //导入依赖的package包/类
/** Creates some interesting points to mark */
private List<Point> createTestPoints(int n) {
List<Point> points = new ArrayList<>();
points.add(new Point(n));
for (int d = 0; d < n; d++) {
Point p = new Point(n);
p.fwd(d);
points.add(p);
}
return points;
}
开发者ID:imagej,项目名称:imagej-tensorflow,代码行数:12,代码来源:TensorsTest.java
示例12: markPoints
import net.imglib2.Point; //导入依赖的package包/类
/** Marks a list of points in an image */
private <T extends RealType<T>> void markPoints(final Img<T> img, final List<Point> points) {
for (int i = 0; i < points.size(); i++) {
RandomAccess<T> randomAccess = img.randomAccess();
randomAccess.setPosition(points.get(i));
randomAccess.get().setReal(i + 1);
}
}
开发者ID:imagej,项目名称:imagej-tensorflow,代码行数:9,代码来源:TensorsTest.java
示例13: checkPoints
import net.imglib2.Point; //导入依赖的package包/类
/** Checks if points in an image are set to the right value */
private <T extends RealType<T>> void checkPoints(final Img<T> img, List<Point> points) {
for (int i = 0; i < points.size(); i++) {
RandomAccess<T> randomAccess = img.randomAccess();
randomAccess.setPosition(points.get(i));
assertEquals(i + 1, randomAccess.get().getRealFloat(), 0.001);
}
}
开发者ID:imagej,项目名称:imagej-tensorflow,代码行数:9,代码来源:TensorsTest.java
示例14: execForPointsWithBufferIndex
import net.imglib2.Point; //导入依赖的package包/类
/**
* Calculates the index of a point in a Tensor buffer and executes the
* BiConsumer with the index and the value of the point (which is the index
* in the list + 1).
*/
private void execForPointsWithBufferIndex(final long[] shape, final int[] mapping, final List<Point> points,
final BiConsumer<Integer, Integer> exec) {
for (int i = 0; i < points.size(); i++) {
exec.accept(calcIndex(shape, mapping, points.get(i)), i + 1);
}
}
开发者ID:imagej,项目名称:imagej-tensorflow,代码行数:12,代码来源:TensorsTest.java
示例15: main
import net.imglib2.Point; //导入依赖的package包/类
public static void main(String[] args)
{
RigidWarp3D warp = new RigidWarp3D();
AffineGet affine = warp
.getAffine( new double[] { Math.cos( Math.PI / 4 ) - 1, 0, 0, Math.sin( Math.PI / 4 ), 2, 2, 2 } );
System.out.println( Util.printCoordinates( affine.getRowPackedCopy() ) );
for ( int d = 0; d < 3; d++ )
for ( int p = 0; p < warp.numParameters(); p++ )
System.out.println( warp.partial( new Point( 1, 2, 3 ), d, p ) );
}
开发者ID:PreibischLab,项目名称:BigStitcher,代码行数:12,代码来源:RigidWarp3D.java
示例16: main
import net.imglib2.Point; //导入依赖的package包/类
public static void main(String[] args)
{
RigidWarp aw = new RigidWarp( 2 );
System.out.println( Util.printCoordinates( aw.getAffine( new double[] {Math.PI / 2, 0, 0} ).getRowPackedCopy() ) );
for (int d = 0; d<2; d++)
for (int p = 0; p<3; p++)
System.out.println( aw.partial( new Point( 2,3 ), d, p ) );
}
开发者ID:PreibischLab,项目名称:BigStitcher,代码行数:10,代码来源:RigidWarp2D.java
示例17: main
import net.imglib2.Point; //导入依赖的package包/类
public static void main( String[] args )
{
final Point p = new Point( 90, 90 ); // identical to (-10,-10), so subpixel localization can move on periodic condition outofbounds
PhaseCorrelationPeak2 pcp = new PhaseCorrelationPeak2( p, 5 );
Dimensions pcmDims = new FinalDimensions( 100, 100 );
Dimensions p1 = new FinalDimensions( 80, 81 );
Dimensions p2 = new FinalDimensions( 91, 90 );
final List<PhaseCorrelationPeak2> peaks = expandPeakToPossibleShifts( pcp, pcmDims, p1, p2 );
for ( final PhaseCorrelationPeak2 pc : peaks )
System.out.println( Util.printCoordinates( pc.getShift() ) );
Img< FloatType > a = ImgLib2Util.openAs32Bit( new File( "73.tif.zip" ) );
Img< FloatType > b = ImgLib2Util.openAs32Bit( new File( "74.tif.zip" ) );
// BenchmarkHelper.benchmarkAndPrint( 10, true, new Runnable()
// {
// @Override
// public void run()
// {
// System.out.println( getCorrelation ( a, b ) );
// }
// } );
BenchmarkHelper.benchmarkAndPrint( 10, true, new Runnable()
{
@Override
public void run()
{
PairwiseStitching.getShift( a, b, new Translation3D(), new Translation3D(),
new PairwiseStitchingParameters(), Executors.newFixedThreadPool( Runtime.getRuntime().availableProcessors() ) );
}
} );
// System.out.println( getCorrelation ( a, b ) );
// System.out.println( getCorrelation ( a, c ) );
// System.out.println( getCorrelation ( b, c ) );
}
开发者ID:PreibischLab,项目名称:BigStitcher,代码行数:41,代码来源:PhaseCorrelation2Util.java
示例18: PhaseCorrelationPeak2
import net.imglib2.Point; //导入依赖的package包/类
public PhaseCorrelationPeak2(Localizable pcmPosition, double phaseCorr)
{
this.pcmLocation = new Point( pcmPosition );
this.shift = null;
this.subpixelPcmLocation = null;
this.subpixelShift = null;
this.phaseCorr = phaseCorr;
this.crossCorr = 0.0;
this.nPixel = 0;
}
开发者ID:PreibischLab,项目名称:BigStitcher,代码行数:11,代码来源:PhaseCorrelationPeak2.java
示例19: fillMask
import net.imglib2.Point; //导入依赖的package包/类
private < T extends BooleanType< T > > GrowingStoreRandomAccessibleSingletonAccess< T > fillMask( final AffineTransform3D tf, final long[] initialMin, final long[] initialMax, final Point p, final GrowingStoreRandomAccessibleSingletonAccess.Factory< T > factory, final T notVisited, final T fillLabel )
{
final GrowingStoreRandomAccessibleSingletonAccess< T > tmpFill = new GrowingStoreRandomAccessibleSingletonAccess<>( initialMin, initialMax, factory, notVisited.createVariable() );
final AccessBoxRandomAccessible< LongType > accessTrackingExtendedPaintedLabels = new AccessBoxRandomAccessible<>(
Views.extendValue(
paintedLabels,
new LongType( Label.TRANSPARENT ) ) );
final AffineRandomAccessible< LongType, AffineGet > transformedPaintedLabels =
RealViews.affine(
Views.interpolate(
accessTrackingExtendedPaintedLabels,
new NearestNeighborInterpolatorFactory<>() ),
tf );
final MixedTransformView< LongType > hyperSlice = Views.hyperSlice( Views.raster( transformedPaintedLabels ), 2, 0 );
final AffineRandomAccessible< LabelMultisetType, AffineGet > transformedLabels = RealViews.affine( Views.interpolate( Views.extendValue( labels, new LabelMultisetType() ), new NearestNeighborInterpolatorFactory<>() ), tf );
final MixedTransformView< LabelMultisetType > hyperSliceLabels = Views.hyperSlice( Views.raster( transformedLabels ), 2, 0 );
final RandomAccessiblePair< LabelMultisetType, LongType > labelsPaintedLabelsPair = new RandomAccessiblePair<>( hyperSliceLabels, hyperSlice );
final RandomAccessiblePair< LabelMultisetType, LongType >.RandomAccess pairAccess = labelsPaintedLabelsPair.randomAccess();
pairAccess.setPosition( p );
final long seedPaint = pairAccess.get().getB().getIntegerLong();
final long seedFragmentLabel = getBiggestLabel( pairAccess.getA() );
FloodFill.fill( labelsPaintedLabelsPair, tmpFill, p, new ValuePair< LabelMultisetType, LongType >( new LabelMultisetType(), new LongType( selectionController.getActiveFragmentId() ) ), fillLabel, new DiamondShape( 1 ), new SegmentAndPaintFilter2D< T >( seedPaint, seedFragmentLabel, assignment ), new TypeWriter<>() );
dirtyLabelsInterval.touch( accessTrackingExtendedPaintedLabels.createAccessInterval() );
return tmpFill;
}
开发者ID:saalfeldlab,项目名称:bigcat,代码行数:34,代码来源:LabelFillController.java
示例20: main
import net.imglib2.Point; //导入依赖的package包/类
public static void main( final String[] args )
{
final int w = 800;
final int h = 800;
final int nPoints = 10000;
// make random 2D Points
final Random rand = new Random( 123124 );
final ArrayList< Point > points = new ArrayList< Point >();
for ( int i = 0; i < nPoints; ++i )
{
final long x = rand.nextInt( w );
final long y = rand.nextInt( h );
points.add( new Point( x, y ) );
}
// split on hyperplane
final HyperPlane plane = new HyperPlane( 1, 0.5, 600 );
final KDTree< Point > kdtree = new KDTree< Point >( points, points );
final SplitHyperPlaneKDTree< Point > split = new SplitHyperPlaneKDTree< Point >( kdtree );
split.split( plane );
// show all points
final Img< ARGBType > pointsImg = ArrayImgs.argbs( w, h );
paint( points, pointsImg, new ARGBType( 0x00ff00 ) );
ImageJFunctions.show( pointsImg );
// show inside/outside points
final Img< ARGBType > clipImg = ArrayImgs.argbs( w, h );
paint( split.getAboveNodes(), clipImg, new ARGBType( 0xffff00 ) );
paint( split.getBelowNodes(), clipImg, new ARGBType( 0x0000ff ) );
ImageJFunctions.show( clipImg );
}
开发者ID:imglib,项目名称:imglib2-tests,代码行数:34,代码来源:SplitHyperPlaneKDTreeExample.java
注:本文中的net.imglib2.Point类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论