本文整理汇总了Java中net.imglib2.type.numeric.integer.LongType类的典型用法代码示例。如果您正苦于以下问题:Java LongType类的具体用法?Java LongType怎么用?Java LongType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LongType类属于net.imglib2.type.numeric.integer包,在下文中一共展示了LongType类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: testImgToTensorMapping
import net.imglib2.type.numeric.integer.LongType; //导入依赖的package包/类
/** Tests the tensor(RAI, int[]) function */
@Test
public void testImgToTensorMapping() {
assertEquals(1, 1);
final long[] dims = new long[] { 5, 4, 3, 2 };
final int[] mapping = new int[] { 1, 3, 0, 2 }; // A strange mapping
final long[] shape = new long[] { 3, 5, 2, 4 };
final int n = dims.length;
// ByteType
testImg2TensorMappingForType(new ArrayImgFactory<ByteType>().create(dims, new ByteType()), mapping, n, shape,
DataType.UINT8);
// DoubleType
testImg2TensorMappingForType(new ArrayImgFactory<DoubleType>().create(dims, new DoubleType()), mapping, n,
shape, DataType.DOUBLE);
// FloatType
testImg2TensorMappingForType(new ArrayImgFactory<FloatType>().create(dims, new FloatType()), mapping, n, shape,
DataType.FLOAT);
// IntType
testImg2TensorMappingForType(new ArrayImgFactory<IntType>().create(dims, new IntType()), mapping, n, shape,
DataType.INT32);
// LongType
testImg2TensorMappingForType(new ArrayImgFactory<LongType>().create(dims, new LongType()), mapping, n, shape,
DataType.INT64);
}
开发者ID:imagej,项目名称:imagej-tensorflow,代码行数:31,代码来源:TensorsTest.java
示例2: applySplit
import net.imglib2.type.numeric.integer.LongType; //导入依赖的package包/类
/**
* Splits a subspace along the given coordinates
* <p>
* For example, if you have a 5D {X, Y, Z, C, T} hyperstack, and give the
* coordinates {{3, 0}, {4, 1}} you'll get a 3D {X, Y, Z} subspace of the
* first channel, and second time frame
* </p>
*
* @param hyperstack an n-dimensional image
* @param splitCoordinates (dimension, position) pairs describing the
* hyperstack split
* @return The subspace interval
*/
private static <T extends RealType<T> & NativeType<T>>
RandomAccessibleInterval<T> applySplit(final ImgPlus<T> hyperstack,
final List<ValuePair<IntType, LongType>> splitCoordinates)
{
final List<ValuePair<IntType, LongType>> workingSplit = createWorkingCopy(
splitCoordinates);
RandomAccessibleInterval<T> slice = hyperstack;
for (int i = 0; i < workingSplit.size(); i++) {
final int dimension = workingSplit.get(i).a.get();
final long position = workingSplit.get(i).b.get();
slice = Views.hyperSlice(slice, dimension, position);
decrementIndices(workingSplit, dimension);
}
return slice;
}
开发者ID:bonej-org,项目名称:BoneJ2,代码行数:29,代码来源:HyperstackUtils.java
示例3: accept
import net.imglib2.type.numeric.integer.LongType; //导入依赖的package包/类
@Override
public boolean accept( final Pair< LabelMultisetType, LongType > current, final Pair< LabelMultisetType, LongType > reference )
{
final LabelMultisetType currentLabelSet = current.getA();
final long currentPaint = current.getB().getIntegerLong();
if ( currentPaint != Label.TRANSPARENT )
return currentPaint == comparison && currentPaint != reference.getB().getIntegerLong();
else
{
for ( final long fragment : this.fragmentsContainedInSeedSegment )
{
if ( currentLabelSet.contains( fragment ) )
return true;
}
}
return false;
}
开发者ID:saalfeldlab,项目名称:bigcat,代码行数:22,代码来源:LabelFillController.java
示例4: paint
import net.imglib2.type.numeric.integer.LongType; //导入依赖的package包/类
protected void paint( final RealLocalizable coords)
{
final AccessBoxRandomAccessible< LongType > accessBoxExtendedLabels = new AccessBoxRandomAccessible<>( extendedLabels );
final RandomAccessible< LongType > labelSource = Views.hyperSlice( accessBoxExtendedLabels, brushNormalAxis, Math.round( coords.getDoublePosition( 2 ) ) );
final Neighborhood< LongType > sphere =
HyperSphereNeighborhood.< LongType >factory().create(
new long[]{
Math.round( coords.getDoublePosition( brushNormalAxis == 0 ? 1 : 0 ) ),
Math.round( coords.getDoublePosition( brushNormalAxis == 2 ? 1 : 2 ) ) },
Math.round( brushRadius / Affine3DHelpers.extractScale( labelTransform, brushNormalAxis == 0 ? 1 : 0 ) ),
labelSource.randomAccess() );
for ( final LongType t : sphere )
t.set( getValue() );
dirtyLabelsInterval.touch( accessBoxExtendedLabels.createAccessInterval() );
}
开发者ID:saalfeldlab,项目名称:bigcat,代码行数:19,代码来源:LabelBrushController.java
示例5: LabelRestrictToSegmentController
import net.imglib2.type.numeric.integer.LongType; //导入依赖的package包/类
public LabelRestrictToSegmentController(
final ViewerPanel viewer,
final RandomAccessibleInterval< LabelMultisetType > labels,
final RandomAccessibleInterval< LongType > paintedLabels,
final AffineTransform3D labelTransform,
final FragmentSegmentAssignment assignment,
final SelectionController selectionController,
final Shape shape,
final InputTriggerConfig config )
{
this.viewer = viewer;
this.labels = labels;
this.paintedLabels = paintedLabels;
this.labelTransform = labelTransform;
this.assignment = assignment;
this.selectionController = selectionController;
this.shape = shape;
inputAdder = config.inputTriggerAdder( inputTriggerMap, "restrict" );
labelLocation = new RealPoint( 3 );
new Intersect( "restrict", "shift R button1" ).register();
}
开发者ID:saalfeldlab,项目名称:bigcat,代码行数:24,代码来源:LabelRestrictToSegmentController.java
示例6: initCanvas
import net.imglib2.type.numeric.integer.LongType; //导入依赖的package包/类
/**
* Load or initialize canvas
*
* @param params
* @throws IOException
*/
protected void initCanvas( final P params ) throws IOException
{
System.out.println( "Opening canvas from " + params.inFile );
final IHDF5Reader reader = HDF5Factory.openForReading( params.inFile );
/* canvas (to which the brush paints) */
if ( reader.exists( params.canvas ) )
canvas = H5Utils.loadUnsignedLong( reader, params.canvas, cellDimensions );
else
{
canvas = new CellImgFactory< LongType >( cellDimensions ).create( maxRawDimensions, new LongType() );
for ( final LongType t : canvas )
t.set( Label.TRANSPARENT );
}
reader.close();
}
开发者ID:saalfeldlab,项目名称:bigcat,代码行数:24,代码来源:BigCat.java
示例7: visualizeVisibleIds
import net.imglib2.type.numeric.integer.LongType; //导入依赖的package包/类
/**
* Visualization to test how it works.
*
* @param screenLabels
*/
@SuppressWarnings( "unused" )
public static void visualizeVisibleIds(
final RandomAccessibleInterval< Pair< LabelMultisetType, LongType > > screenLabels )
{
final GoldenAngleSaturatedARGBStream argbStream =
new GoldenAngleSaturatedARGBStream(
new FragmentSegmentAssignment(
new LocalIdService() ) );
final RandomAccessibleInterval< ARGBType > convertedScreenLabels =
Converters.convert(
screenLabels,
new PairLabelMultisetLongARGBConverter( argbStream ),
new ARGBType() );
ImageJFunctions.show( convertedScreenLabels );
}
开发者ID:saalfeldlab,项目名称:bigcat,代码行数:23,代码来源:PairLabelMultiSetLongIdPicker.java
示例8: convert
import net.imglib2.type.numeric.integer.LongType; //导入依赖的package包/类
@Override
public void convert(
final Pair< VolatileLabelMultisetType, LongType > input,
final VolatileARGBType output )
{
final long inputB = input.getB().get();
if ( inputB == Label.TRANSPARENT )
{
final VolatileLabelMultisetType inputA = input.getA();
if ( inputA.isValid() )
{
convertValid( inputA, output );
}
else
{
output.setValid( false );
}
}
else
{
output.set( argbStream.argb( inputB ) );
output.setValid( true );
}
}
开发者ID:saalfeldlab,项目名称:bigcat,代码行数:25,代码来源:PairVolatileLabelMultisetLongARGBConverter.java
示例9: chooseBestType
import net.imglib2.type.numeric.integer.LongType; //导入依赖的package包/类
static private final <R extends IntegerType<R> & NativeType<R>> R chooseBestType(final int nBits) {
if (nBits < 9) return (R)(Object) new UnsignedByteType();
else if (nBits< 13) return (R)(Object) new Unsigned12BitType();
else if (nBits < 17) return (R)(Object) new UnsignedShortType();
else if (nBits < 33) return (R)(Object) new UnsignedIntType();
else if (nBits < 65) return (R)(Object) new LongType();
else throw new IllegalArgumentException("Cannot do an histogram of " + nBits + " bits.");
/*
switch (nBits) {
case 8:
return (R) new UnsignedByteType();
case 12:
return (R) new Unsigned12BitType();
case 16:
return (R) new UnsignedShortType();
case 32:
return (R) new UnsignedIntType();
case 64:
return (R) new LongType();
default:
return (R) new UnsignedAnyBitType(nBits);
}
*/
}
开发者ID:imglib,项目名称:imglib2-script,代码行数:26,代码来源:IntegralHistogram.java
示例10: countTranslatedGrids
import net.imglib2.type.numeric.integer.LongType; //导入依赖的package包/类
/**
* Count foreground sections in all grids created from the translations
*
* @param input N-dimensional binary interval
* @param translations Stream of translation coordinates in n-dimensions
* @param sizes Sizes of the interval's dimensions in pixels
* @param sectionSize Size of a section in the grids
* @return Foreground sections counted in each grid
*/
private static <B extends BooleanType<B>> LongStream countTranslatedGrids(
final RandomAccessibleInterval<B> input, final Stream<long[]> translations,
final long[] sizes, final long sectionSize)
{
final int lastDimension = sizes.length - 1;
final LongType foreground = new LongType();
final long[] sectionPosition = new long[sizes.length];
return translations.mapToLong(gridOffset -> {
foreground.setZero();
Arrays.fill(sectionPosition, 0);
countGrid(input, lastDimension, sizes, gridOffset, sectionPosition,
sectionSize, foreground);
return foreground.get();
});
}
开发者ID:imagej,项目名称:imagej-ops,代码行数:25,代码来源:BoxCount.java
示例11: countGrid
import net.imglib2.type.numeric.integer.LongType; //导入依赖的package包/类
/**
* Recursively counts the number of foreground sections in the grid over the
* given interval
*
* @param interval An n-dimensional interval with binary elements
* @param dimension Current dimension processed, start from the last
* @param sizes Sizes of the interval's dimensions in pixels
* @param translation Translation of grid start in each dimension
* @param sectionPosition The accumulated position of the current grid section
* (start from [0, 0, ... 0])
* @param sectionSize Size of a grid section (n * n * ... n)
* @param foreground Number of foreground sections found so far (start from 0)
*/
private static <B extends BooleanType<B>> void countGrid(
final RandomAccessibleInterval<B> interval, final int dimension,
final long[] sizes, final long[] translation, final long[] sectionPosition,
final long sectionSize, final LongType foreground)
{
for (int p = 0; p < sizes[dimension]; p += sectionSize) {
sectionPosition[dimension] = translation[dimension] + p;
if (dimension == 0) {
final IntervalView<B> box = sectionView(interval, sizes,
sectionPosition, sectionSize);
if (box != null && hasForeground(box)) {
foreground.inc();
}
}
else {
countGrid(interval, dimension - 1, sizes, translation, sectionPosition,
sectionSize, foreground);
}
}
}
开发者ID:imagej,项目名称:imagej-ops,代码行数:34,代码来源:BoxCount.java
示例12: initialize
import net.imglib2.type.numeric.integer.LongType; //导入依赖的package包/类
@Override
public void initialize() {
if (in() != null) {
slicewiseOps = new UnaryComputerOp[in().numDimensions()];
for (int i = 0; i < in().numDimensions(); ++i) {
slicewiseOps[i] = Computers.unary(ops(), Slice.class,
RandomAccessibleInterval.class, RandomAccessibleInterval.class,
getComputer(i), i);
}
}
createLongRAI = Functions.unary(ops(), Ops.Create.Img.class,
RandomAccessibleInterval.class, Dimensions.class, new LongType());
createDoubleRAI = Functions.unary(ops(), Ops.Create.Img.class,
RandomAccessibleInterval.class, Dimensions.class, new DoubleType());
}
开发者ID:imagej,项目名称:imagej-ops,代码行数:18,代码来源:AbstractIntegralImg.java
示例13: testIntegralImageSimilarity
import net.imglib2.type.numeric.integer.LongType; //导入依赖的package包/类
/**
* @see DefaultIntegralImg
* @see SquareIntegralImg
*/
@SuppressWarnings({ "unchecked" })
@Test
public void testIntegralImageSimilarity() {
RandomAccessibleInterval<LongType> out1 =
(RandomAccessibleInterval<LongType>) ops.run(DefaultIntegralImg.class,
in);
RandomAccessibleInterval<DoubleType> out2 =
(RandomAccessibleInterval<DoubleType>) ops.run(WrappedIntegralImg.class,
in);
// Remove 0s from integralImg by shifting its interval by +1
final long[] min = new long[out2.numDimensions()];
final long[] max = new long[out2.numDimensions()];
for (int d = 0; d < out2.numDimensions(); ++d) {
min[d] = out2.min(d) + 1;
max[d] = out2.max(d);
}
// Define the Interval on the infinite random accessibles
final FinalInterval interval = new FinalInterval(min, max);
LocalThresholdTest.testIterableIntervalSimilarity(Views.iterable(out1),
Views.iterable(Views.offsetInterval(out2, interval)));
}
开发者ID:imagej,项目名称:imagej-ops,代码行数:30,代码来源:IntegralImgTest.java
示例14: createLongArray
import net.imglib2.type.numeric.integer.LongType; //导入依赖的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
示例15: extractLongArray
import net.imglib2.type.numeric.integer.LongType; //导入依赖的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
示例16: testImgToTensorReverse
import net.imglib2.type.numeric.integer.LongType; //导入依赖的package包/类
/** Tests the tensor(RAI) function */
@Test
public void testImgToTensorReverse() {
assertEquals(1, 1);
final long[] dims = new long[] { 20, 10, 3 };
final long[] shape = new long[] { 3, 10, 20 };
final int n = dims.length;
// ByteType
testImg2TensorReverseForType(new ArrayImgFactory<ByteType>().create(dims, new ByteType()), n, shape,
DataType.UINT8);
// DoubleType
testImg2TensorReverseForType(new ArrayImgFactory<DoubleType>().create(dims, new DoubleType()), n, shape,
DataType.DOUBLE);
// FloatType
testImg2TensorReverseForType(new ArrayImgFactory<FloatType>().create(dims, new FloatType()), n, shape,
DataType.FLOAT);
// IntType
testImg2TensorReverseForType(new ArrayImgFactory<IntType>().create(dims, new IntType()), n, shape,
DataType.INT32);
// LongType
testImg2TensorReverseForType(new ArrayImgFactory<LongType>().create(dims, new LongType()), n, shape,
DataType.INT64);
}
开发者ID:imagej,项目名称:imagej-tensorflow,代码行数:30,代码来源:TensorsTest.java
示例17: testImgToTensorDirect
import net.imglib2.type.numeric.integer.LongType; //导入依赖的package包/类
/** Tests the tensorDirect(RAI) function */
@Test
public void testImgToTensorDirect() {
assertEquals(1, 1);
final long[] dims = new long[] { 20, 10, 3 };
final int n = dims.length;
// ByteType
testImg2TensorDirectForType(new ArrayImgFactory<ByteType>().create(dims, new ByteType()), n, dims,
DataType.UINT8);
// DoubleType
testImg2TensorDirectForType(new ArrayImgFactory<DoubleType>().create(dims, new DoubleType()), n, dims,
DataType.DOUBLE);
// FloatType
testImg2TensorDirectForType(new ArrayImgFactory<FloatType>().create(dims, new FloatType()), n, dims,
DataType.FLOAT);
// IntType
testImg2TensorDirectForType(new ArrayImgFactory<IntType>().create(dims, new IntType()), n, dims,
DataType.INT32);
// LongType
testImg2TensorDirectForType(new ArrayImgFactory<LongType>().create(dims, new LongType()), n, dims,
DataType.INT64);
}
开发者ID:imagej,项目名称:imagej-tensorflow,代码行数:29,代码来源:TensorsTest.java
示例18: splitDims
import net.imglib2.type.numeric.integer.LongType; //导入依赖的package包/类
/**
* Recursively calls {@link #applySplit(ImgPlus, List)} to split the
* hyperstack into subspaces.
*
* @param hyperstack an n-dimensional image
* @param splitIndices the indices of the axes in the hyperstack used for
* splitting
* @param splitIndex the i in splitIndices[i] currently used. Start from the
* last index
* @param meta the metadata describing the position of the next subspace
* @param splitCoordinates the (dimension, position) pairs describing the
* current split
* @param subscripts the subscripts of the axes see
* @param subspaces A builder for the stream of all the subspaces formed
*/
private static <T extends RealType<T> & NativeType<T>> void splitDims(
final ImgPlus<T> hyperstack, final int[] splitIndices, final int splitIndex,
final HyperAxisMeta[] meta,
final List<ValuePair<IntType, LongType>> splitCoordinates,
final long[] subscripts, final Builder<Subspace<T>> subspaces)
{
if (splitIndex < 0) {
final RandomAccessibleInterval<T> subspace = applySplit(hyperstack,
splitCoordinates);
if (!isEmptySubspace(subspace)) {
subspaces.add(new Subspace<>(subspace, meta));
}
}
else {
final int splitDimension = splitIndices[splitIndex];
final AxisType type = hyperstack.axis(splitDimension).type();
final long subscript = subscripts[splitIndex];
final long size = hyperstack.dimension(splitDimension);
final ValuePair<IntType, LongType> pair = new ValuePair<>(new IntType(
splitDimension), new LongType());
for (long position = 0; position < size; position++) {
pair.b.set(position);
splitCoordinates.add(pair);
meta[splitIndex] = new HyperAxisMeta(type, position, subscript);
splitDims(hyperstack, splitIndices, splitIndex - 1, meta,
splitCoordinates, subscripts, subspaces);
splitCoordinates.remove(pair);
}
}
}
开发者ID:bonej-org,项目名称:BoneJ2,代码行数:46,代码来源:HyperstackUtils.java
示例19: createWorkingCopy
import net.imglib2.type.numeric.integer.LongType; //导入依赖的package包/类
/**
* Clones and sorts the given {@link List}.
* <p>
* It ensures that original ones don't get altered while applying a split (see
* {@link #applySplit(ImgPlus, List)}). Pairs are sorted in the order of
* dimension ({@link ValuePair#a}).
* </p>
*/
private static List<ValuePair<IntType, LongType>> createWorkingCopy(
final List<ValuePair<IntType, LongType>> splitCoordinates)
{
final List<ValuePair<IntType, LongType>> workingSplit = new ArrayList<>();
for (ValuePair<IntType, LongType> pair : splitCoordinates) {
ValuePair<IntType, LongType> copy = new ValuePair<>(pair.a.copy(),
pair.b);
workingSplit.add(copy);
}
workingSplit.sort(Comparator.comparingInt(pair -> pair.a.get()));
return workingSplit;
}
开发者ID:bonej-org,项目名称:BoneJ2,代码行数:21,代码来源:HyperstackUtils.java
示例20: testSplitSubspacesIntervalData
import net.imglib2.type.numeric.integer.LongType; //导入依赖的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
注:本文中的net.imglib2.type.numeric.integer.LongType类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论