本文整理汇总了Java中net.imglib2.img.basictypeaccess.array.LongArray类的典型用法代码示例。如果您正苦于以下问题:Java LongArray类的具体用法?Java LongArray怎么用?Java LongArray使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LongArray类属于net.imglib2.img.basictypeaccess.array包,在下文中一共展示了LongArray类的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: createLongArray
import net.imglib2.img.basictypeaccess.array.LongArray; //导入依赖的package包/类
private static long[] createLongArray(
final RandomAccessibleInterval<LongType> image)
{
final long[] dims = Intervals.dimensionsAsLongArray(image);
final ArrayImg<LongType, LongArray> dest = ArrayImgs.longs(dims);
copy(image, dest);
return dest.update(null).getCurrentStorageArray();
}
开发者ID:imagej,项目名称:imagej-tensorflow,代码行数:9,代码来源:Tensors.java
示例2: extractLongArray
import net.imglib2.img.basictypeaccess.array.LongArray; //导入依赖的package包/类
private static long[] extractLongArray(
final RandomAccessibleInterval<LongType> image)
{
if (!(image instanceof ArrayImg)) return null;
@SuppressWarnings("unchecked")
final ArrayImg<LongType, ?> arrayImg = (ArrayImg<LongType, ?>) image;
final Object dataAccess = arrayImg.update(null);
return dataAccess instanceof LongArray ? //
((LongArray) dataAccess).getCurrentStorageArray() : null;
}
开发者ID:imagej,项目名称:imagej-tensorflow,代码行数:11,代码来源:Tensors.java
示例3: testSplitSubspacesIntervalData
import net.imglib2.img.basictypeaccess.array.LongArray; //导入依赖的package包/类
/**
* Fill the 3D subspaces of a 5D hyperstack with random data, and check that
* it's split correctly. That is, each element in each 3D space split should
* correspond to the original image
*/
@Test
public void testSplitSubspacesIntervalData() throws Exception {
// SETUP
final long depth = 3;
final long height = 3;
final long width = 3;
final long channels = 2;
final long frames = 2;
final Random random = new Random(0xC0FFEE);
final ArrayImg<LongType, LongArray> img = ArrayImgs.longs(width, height,
depth, channels, frames);
final ImgPlus<LongType> imgPlus = new ImgPlus<>(img, "", X_AXIS, Y_AXIS,
Z_AXIS, C_AXIS, T_AXIS);
final List<long[]> positions = Arrays.asList(new long[] { 0, 0, 0, 0, 0 },
new long[] { 0, 0, 0, 1, 0 }, new long[] { 0, 0, 0, 0, 1 }, new long[] {
0, 0, 0, 1, 1 });
final long[] sizes = new long[] { width, height, depth, 1, 1 };
final List<IntervalView<LongType>> expectedSubspaces = new ArrayList<>();
positions.forEach(position -> {
final IntervalView<LongType> subspace = Views.offsetInterval(imgPlus,
position, sizes);
subspace.forEach(e -> e.set(random.nextLong()));
expectedSubspaces.add(subspace);
});
// EXECUTE
final Stream<Subspace<LongType>> subspaces = HyperstackUtils
.split3DSubspaces(imgPlus);
// VERIFY
subspaces.forEach(subspace -> {
final Iterator<LongType> expected = Views.flatIterable(expectedSubspaces
.remove(0)).iterator();
final IterableInterval<LongType> resultIterable = Views.flatIterable(
subspace.interval);
resultIterable.forEach(result -> assertEquals(expected.next().get(),
result.get()));
});
}
开发者ID:bonej-org,项目名称:BoneJ2,代码行数:45,代码来源:HyperstackUtilsTest.java
示例4: multiply
import net.imglib2.img.basictypeaccess.array.LongArray; //导入依赖的package包/类
@OpMethod(ops = {
net.imagej.ops.math.ConstantToArrayImageP.MultiplyLong.class,
net.imagej.ops.math.ConstantToArrayImage.MultiplyLong.class,
net.imagej.ops.math.ConstantToArrayImageP.MultiplyUnsignedLong.class,
net.imagej.ops.math.ConstantToArrayImage.MultiplyUnsignedLong.class })
public <N extends NativeType<N>> ArrayImg<N, LongArray> multiply(
final ArrayImg<N, LongArray> image, final long value)
{
@SuppressWarnings("unchecked")
final ArrayImg<N, LongArray> result = (ArrayImg<N, LongArray>) ops().run(
Ops.Math.Multiply.NAME, image, value);
return result;
}
开发者ID:imagej,项目名称:imagej-ops,代码行数:14,代码来源:MathNamespace.java
示例5: add
import net.imglib2.img.basictypeaccess.array.LongArray; //导入依赖的package包/类
@OpMethod(ops = { net.imagej.ops.math.ConstantToPlanarImage.AddLong.class,
net.imagej.ops.math.ConstantToPlanarImage.AddUnsignedLong.class })
public <N extends NativeType<N>> PlanarImg<N, LongArray> add(
final PlanarImg<N, LongArray> image, final long value)
{
@SuppressWarnings("unchecked")
final PlanarImg<N, LongArray> result = (PlanarImg<N, LongArray>) ops().run(
Ops.Math.Add.NAME, image, value);
return result;
}
开发者ID:imagej,项目名称:imagej-ops,代码行数:11,代码来源:MathNamespace.java
示例6: divide
import net.imglib2.img.basictypeaccess.array.LongArray; //导入依赖的package包/类
@OpMethod(ops = { net.imagej.ops.math.ConstantToArrayImageP.DivideLong.class,
net.imagej.ops.math.ConstantToArrayImage.DivideLong.class,
net.imagej.ops.math.ConstantToArrayImageP.DivideUnsignedLong.class,
net.imagej.ops.math.ConstantToArrayImage.DivideUnsignedLong.class })
public <N extends NativeType<N>> ArrayImg<N, LongArray> divide(
final ArrayImg<N, LongArray> image, final long value)
{
@SuppressWarnings("unchecked")
final ArrayImg<N, LongArray> result = (ArrayImg<N, LongArray>) ops().run(
Ops.Math.Divide.NAME, image, value);
return result;
}
开发者ID:imagej,项目名称:imagej-ops,代码行数:13,代码来源:MathNamespace.java
示例7: subtract
import net.imglib2.img.basictypeaccess.array.LongArray; //导入依赖的package包/类
@OpMethod(ops = {
net.imagej.ops.math.ConstantToArrayImageP.SubtractLong.class,
net.imagej.ops.math.ConstantToArrayImage.SubtractLong.class,
net.imagej.ops.math.ConstantToArrayImageP.SubtractUnsignedLong.class,
net.imagej.ops.math.ConstantToArrayImage.SubtractUnsignedLong.class })
public <N extends NativeType<N>> ArrayImg<N, LongArray> subtract(
final ArrayImg<N, LongArray> image, final long value)
{
@SuppressWarnings("unchecked")
final ArrayImg<N, LongArray> result = (ArrayImg<N, LongArray>) ops().run(
Ops.Math.Subtract.NAME, image, value);
return result;
}
开发者ID:imagej,项目名称:imagej-ops,代码行数:14,代码来源:MathNamespace.java
示例8: createLongInstance
import net.imglib2.img.basictypeaccess.array.LongArray; //导入依赖的package包/类
@Override
public SCIFIOCellImg<T, LongArray> createLongInstance(
final long[] dimensions, final Fraction entitiesPerPixel)
{
return createInstance(new LongArrayLoader(reader(), subregion), dimensions,
entitiesPerPixel);
}
开发者ID:scifio,项目名称:scifio,代码行数:8,代码来源:SCIFIOCellImgFactory.java
示例9: LongImage
import net.imglib2.img.basictypeaccess.array.LongArray; //导入依赖的package包/类
public LongImage(final long[] dim, final long[] pixels) {
super(new LongArray(pixels), dim, new Fraction());
setLinkedType(new LongType(this));
}
开发者ID:imglib,项目名称:imglib2-script,代码行数:5,代码来源:LongImage.java
示例10: benchmark
import net.imglib2.img.basictypeaccess.array.LongArray; //导入依赖的package包/类
public static final void benchmark( final String[] args )
{
final int ntrials = 10;
final Shape strel = new DiamondShape( 3 );
final ArrayImg< FloatType, FloatArray > img = ArrayImgs.floats( new long[] { 200, 200 } );
for ( final FloatType pixel : img )
{
pixel.set( 1f );
}
final ArrayRandomAccess< FloatType > ra = img.randomAccess();
final ArrayImg< BitType, LongArray > bitsImg = ArrayImgs.bits( new long[] { img.dimension( 0 ), img.dimension( 1 ) } );
for ( final BitType pixelB : bitsImg )
{
pixelB.set( true );
}
final ArrayRandomAccess< BitType > raBits = bitsImg.randomAccess(); // LOL
final Random ran = new Random( 1l );
for ( int i = 0; i < 1000; i++ )
{
final int x = ran.nextInt( ( int ) img.dimension( 0 ) );
final int y = ran.nextInt( ( int ) img.dimension( 1 ) );
ra.setPosition( new int[] { x, y } );
ra.get().set( 0f );
raBits.setPosition( ra );
raBits.get().set( false );
}
// Dilate to new image
Img< BitType > imgBits3 = Opening.open( bitsImg, strel, 1 );
long start = System.currentTimeMillis();
for ( int i = 0; i < ntrials; i++ )
{
imgBits3 = Opening.open( bitsImg, strel, 1 );
}
long end = System.currentTimeMillis();
System.out.println( "BitType time: " + ( ( end - start ) / ntrials ) + " ms." );
Img< FloatType > img3 = Opening.open( img, strel, 1 );
start = System.currentTimeMillis();
for ( int i = 0; i < ntrials; i++ )
{
img3 = Opening.open( img, strel, 1 );
}
end = System.currentTimeMillis();
System.out.println( "FloatType time: " + ( ( end - start ) / ntrials ) + " ms." );
ImageJ.main( args );
ImageJFunctions.show( img3, "Float" );
ImageJFunctions.show( imgBits3, "Bit" );
}
开发者ID:imglib,项目名称:imglib2-tests,代码行数:57,代码来源:OpeningTests.java
示例11: benchmark
import net.imglib2.img.basictypeaccess.array.LongArray; //导入依赖的package包/类
public static final void benchmark( final String[] args )
{
final int ntrials = 10;
final Shape strel = new DiamondShape( 3 );
final ArrayImg< FloatType, FloatArray > img = ArrayImgs.floats( new long[] { 200, 200 } );
for ( final FloatType pixel : img )
{
pixel.set( 1f );
}
final ArrayRandomAccess< FloatType > ra = img.randomAccess();
final ArrayImg< BitType, LongArray > bitsImg = ArrayImgs.bits( new long[] { img.dimension( 0 ), img.dimension( 1 ) } );
for ( final BitType pixelB : bitsImg )
{
pixelB.set( true );
}
final ArrayRandomAccess< BitType > raBits = bitsImg.randomAccess(); // LOL
final Random ran = new Random( 1l );
for ( int i = 0; i < 1000; i++ )
{
final int x = ran.nextInt( ( int ) img.dimension( 0 ) );
final int y = ran.nextInt( ( int ) img.dimension( 1 ) );
ra.setPosition( new int[] { x, y } );
ra.get().set( 0f );
raBits.setPosition( ra );
raBits.get().set( false );
}
// Dilate to new image
Img< BitType > imgBits3 = Erosion.erode( bitsImg, strel, 1 );
long start = System.currentTimeMillis();
for ( int i = 0; i < ntrials; i++ )
{
imgBits3 = Erosion.erode( bitsImg, strel, 1 );
}
long end = System.currentTimeMillis();
System.out.println( "BitType time: " + ( ( end - start ) / ntrials ) + " ms." );
Img< FloatType > img3 = Erosion.erode( img, strel, 1 );
start = System.currentTimeMillis();
for ( int i = 0; i < ntrials; i++ )
{
img3 = Erosion.erode( img, strel, 1 );
}
end = System.currentTimeMillis();
System.out.println( "FloatType time: " + ( ( end - start ) / ntrials ) + " ms." );
ImageJ.main( args );
ImageJFunctions.show( img3, "Float" );
ImageJFunctions.show( imgBits3, "Bit" );
}
开发者ID:imglib,项目名称:imglib2-tests,代码行数:57,代码来源:ErosionTests.java
示例12: chain
import net.imglib2.img.basictypeaccess.array.LongArray; //导入依赖的package包/类
public static void chain( final String[] args )
{
ImageJ.main( args );
final List< Shape > strel = StructuringElements.disk( 6, 2, 4 );
for ( final Shape shape : strel )
{
System.out.println( shape );
System.out.println( MorphologyUtils.printNeighborhood( shape, 2 ) );
}
final FloatType minVal = new FloatType( 0f );
final ArrayImg< FloatType, FloatArray > img = ArrayImgs.floats( new long[] { 200, 200 } );
final ArrayImg< BitType, LongArray > bitsImg = ArrayImgs.bits( new long[] { img.dimension( 0 ), img.dimension( 1 ) } );
final ArrayRandomAccess< FloatType > ra = img.randomAccess();
final ArrayRandomAccess< BitType > raBits = bitsImg.randomAccess(); // LOL
final Random ran = new Random( 1l );
for ( int i = 0; i < 100; i++ )
{
final int x = ran.nextInt( ( int ) img.dimension( 0 ) );
final int y = ran.nextInt( ( int ) img.dimension( 1 ) );
ra.setPosition( new int[] { x, y } );
ra.get().set( 255f );
raBits.setPosition( new int[] { x, y } );
raBits.get().set( true );
}
ImageJFunctions.show( img, "Source" );
// // Dilate to provided target
// final Interval interval2 = FinalInterval.createMinSize( new long[] { 50, 50, 85, 50 } );
// final Img< FloatType > img2 = img.factory().create( interval2, new FloatType() );
// final long[] translation = new long[ interval2.numDimensions() ];
// interval2.min( translation );
// final IntervalView< FloatType > translate = Views.translate( img2, translation );
// Dilation.dilate( img, translate, strel, minVal, 1 );
// ImageJFunctions.show( img2, "DilatedToTarget" );
// // Dilate to new image
// final Img< FloatType > img3 = Dilation.dilate( img, strel, minVal, 1 );
// ImageJFunctions.show( img3, "DilatedToNewImg" );
// Dilate to new image FULL version.
final Img< FloatType > img4 = Dilation.dilateFull( img, strel, minVal, 1 );
ImageJFunctions.show( img4, "DilatedToNewImgFULL" );
// // Dilate in place
// final Interval interval = FinalInterval.createMinSize( new long[] { 100, -10, 80, 100 } );
// Dilation.dilateInPlace( img, interval, strel, minVal, 1 );
// ImageJFunctions.show( img, "DilatedInPlace" );
//
// ImageJFunctions.show( img, "SourceAgain" );
//
// /*
// * Binary type
// */
//
// ImageJFunctions.show( bitsImg, "BitsSource" );
//
// // Dilate to new image
// final Img< BitType > imgBits3 = Dilation.dilate( bitsImg, strel, 1 );
// ImageJFunctions.show( imgBits3, "BitsDilatedToNewImg" );
}
开发者ID:imglib,项目名称:imglib2-tests,代码行数:64,代码来源:DilationTests.java
示例13: show
import net.imglib2.img.basictypeaccess.array.LongArray; //导入依赖的package包/类
public static void show( final String[] args ) throws ImgIOException
{
ImageJ.main( args );
final Shape strel = new DiamondShape( 3 );
final String fn = "DrosophilaWing.tif";
final List< SCIFIOImgPlus< FloatType >> imgs = new
ImgOpener().openImgs( fn, new ArrayImgFactory< FloatType >(), new
FloatType() );
final Img< FloatType > img = imgs.get( 0 ).getImg();
// final ArrayImg< FloatType, FloatArray > img = ArrayImgs.floats( new long[] { 800, 600 } );
// final ArrayRandomAccess< FloatType > ra = img.randomAccess();
// final Random ran = new Random( 1l );
// for ( int i = 0; i < 100; i++ )
// {
// final int x = ran.nextInt( ( int ) img.dimension( 0 ) );
// final int y = ran.nextInt( ( int ) img.dimension( 1 ) );
// ra.setPosition( new int[] { x, y } );
// ra.get().set( 255f );
// }
ImageJFunctions.show( img, "Source" );
// Dilate to provided target
final Interval interval2 = FinalInterval.createMinSize( new long[] { 280, 200, 185, 100 } );
final Img< FloatType > img2 = img.factory().create( interval2, new FloatType() );
final long[] translation = new long[ interval2.numDimensions() ];
interval2.min( translation );
final IntervalView< FloatType > translate = Views.translate( img2, translation );
Dilation.dilate( img, translate, strel, 1 );
ImageJFunctions.show( img2, "DilatedToTarget" );
// Dilate to new image
final Img< FloatType > img3 = Dilation.dilate( img, strel, 1 );
ImageJFunctions.show( img3, "DilatedToNewImg" );
// Dilate to new image FULL version.
final Img< FloatType > img4 = Dilation.dilateFull( img, strel, 1 );
ImageJFunctions.show( img4, "DilatedToNewImgFULL" );
// Dilate in place
final Interval interval = FinalInterval.createMinSize( new long[] { 100, -10, 200, 200 } );
Dilation.dilateInPlace( img, interval, strel, 1 );
ImageJFunctions.show( img, "DilatedInPlace" );
/*
* Binary type
*/
final ArrayImg< BitType, LongArray > bitsImg = ArrayImgs.bits( new long[] { 800, 600 } );
final ArrayRandomAccess< BitType > raBits = bitsImg.randomAccess(); // LOL
final Random ran2 = new Random( 1l );
for ( int i = 0; i < 100; i++ )
{
final int x = ran2.nextInt( ( int ) bitsImg.dimension( 0 ) );
final int y = ran2.nextInt( ( int ) bitsImg.dimension( 1 ) );
raBits.setPosition( new int[] { x, y } );
raBits.get().set( true );
}
ImageJFunctions.show( bitsImg, "BitsSource" );
// Dilate to new image
final Img< BitType > imgBits3 = Dilation.dilate( bitsImg, strel, 1 );
ImageJFunctions.show( imgBits3, "BitsDilatedToNewImg" );
}
开发者ID:imglib,项目名称:imglib2-tests,代码行数:69,代码来源:DilationTests.java
示例14: benchmark
import net.imglib2.img.basictypeaccess.array.LongArray; //导入依赖的package包/类
public static final void benchmark( final String[] args )
{
final int ntrials = 10;
final Shape strel = new DiamondShape( 3 );
final ArrayImg< FloatType, FloatArray > img = ArrayImgs.floats( new long[] { 200, 200 } );
final ArrayRandomAccess< FloatType > ra = img.randomAccess();
final ArrayImg< BitType, LongArray > bitsImg = ArrayImgs.bits( new long[] { img.dimension( 0 ), img.dimension( 1 ) } );
final ArrayRandomAccess< BitType > raBits = bitsImg.randomAccess(); // LOL
final Random ran = new Random( 1l );
for ( int i = 0; i < 1000; i++ )
{
final int x = ran.nextInt( ( int ) img.dimension( 0 ) );
final int y = ran.nextInt( ( int ) img.dimension( 1 ) );
ra.setPosition( new int[] { x, y } );
ra.get().set( 1f );
raBits.setPosition( ra );
raBits.get().set( true );
}
// Dilate to new image
Img< BitType > imgBits3 = Dilation.dilate( bitsImg, strel, 1 );
long start = System.currentTimeMillis();
for ( int i = 0; i < ntrials; i++ )
{
imgBits3 = Dilation.dilate( bitsImg, strel, 1 );
}
long end = System.currentTimeMillis();
System.out.println( "BitType time: " + ( ( end - start ) / ntrials ) + " ms." );
Img< FloatType > img3 = Dilation.dilate( img, strel, 1 );
start = System.currentTimeMillis();
for ( int i = 0; i < ntrials; i++ )
{
img3 = Dilation.dilate( img, strel, 1 );
}
end = System.currentTimeMillis();
System.out.println( "FloatType time: " + ( ( end - start ) / ntrials ) + " ms." );
ImageJ.main( args );
ImageJFunctions.show( img3, "Float" );
ImageJFunctions.show( imgBits3, "Bit" );
}
开发者ID:imglib,项目名称:imglib2-tests,代码行数:49,代码来源:DilationTests.java
示例15: benchmark
import net.imglib2.img.basictypeaccess.array.LongArray; //导入依赖的package包/类
public static final void benchmark( final String[] args )
{
final int ntrials = 10;
final Shape strel = new DiamondShape( 3 );
final ArrayImg< UnsignedByteType, ByteArray > img = ArrayImgs.unsignedBytes( new long[] { 200, 200 } );
for ( final UnsignedByteType pixel : img )
{
pixel.set( 1 );
}
final ArrayRandomAccess< UnsignedByteType > ra = img.randomAccess();
final ArrayImg< BitType, LongArray > bitsImg = ArrayImgs.bits( new long[] { img.dimension( 0 ), img.dimension( 1 ) } );
for ( final BitType pixelB : bitsImg )
{
pixelB.set( true );
}
final ArrayRandomAccess< BitType > raBits = bitsImg.randomAccess(); // LOL
final Random ran = new Random( 1l );
for ( int i = 0; i < 1000; i++ )
{
final int x = ran.nextInt( ( int ) img.dimension( 0 ) );
final int y = ran.nextInt( ( int ) img.dimension( 1 ) );
ra.setPosition( new int[] { x, y } );
ra.get().set( 0 );
raBits.setPosition( ra );
raBits.get().set( false );
}
// Dilate to new image
Img< BitType > imgBits3 = Closing.close( bitsImg, strel, 1 );
long start = System.currentTimeMillis();
for ( int i = 0; i < ntrials; i++ )
{
imgBits3 = Closing.close( bitsImg, strel, 1 );
}
long end = System.currentTimeMillis();
System.out.println( "BitType time: " + ( ( end - start ) / ntrials ) + " ms." );
Img< net.imglib2.type.numeric.integer.UnsignedByteType > img3 = Closing.close( img, strel, 1 );
start = System.currentTimeMillis();
for ( int i = 0; i < ntrials; i++ )
{
img3 = Closing.close( img, strel, 1 );
}
end = System.currentTimeMillis();
System.out.println( "UnsignedByteType time: " + ( ( end - start ) / ntrials ) + " ms." );
ImageJ.main( args );
ImageJFunctions.show( img3, "Float" );
ImageJFunctions.show( imgBits3, "Bit" );
}
开发者ID:imglib,项目名称:imglib2-tests,代码行数:57,代码来源:ClosingTests.java
示例16: emptyArray
import net.imglib2.img.basictypeaccess.array.LongArray; //导入依赖的package包/类
@Override
public LongArray emptyArray(final int entities) {
return new LongArray(entities);
}
开发者ID:scifio,项目名称:scifio,代码行数:5,代码来源:LongArrayLoader.java
注:本文中的net.imglib2.img.basictypeaccess.array.LongArray类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论