• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java IntType类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中net.imglib2.type.numeric.integer.IntType的典型用法代码示例。如果您正苦于以下问题:Java IntType类的具体用法?Java IntType怎么用?Java IntType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



IntType类属于net.imglib2.type.numeric.integer包,在下文中一共展示了IntType类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getLabelMap

import net.imglib2.type.numeric.integer.IntType; //导入依赖的package包/类
/**
 * Relabel the label map according to the tree labeling.
 * @param threshold , all pixel below threshold are set to 0 
 * @param percentFlooding , percent of the peak that will be flooded  (percent between label maximum and the threshold) 
 * @return a label image corresponding to the current tree labeling, threshold, percentFlooding parameters
 */
public Img<IntType> getLabelMap( float hMin, float threshold, float percentFlooding, boolean keepOrphanPeak){
	
	intensity = (IterableInterval<T>) intensity0;
	
	int nDims = segmentMap0.numDimensions();
	long[] dims = new long[nDims];
	segmentMap0.dimensions(dims);
	segmentMap = segmentMap0.factory().create(dims, segmentMap0.firstElement().createVariable() );
	Cursor<IntType> cursor = segmentMap.cursor();
	Cursor<IntType> cursor0 = segmentMap0.cursor();
	while(cursor0.hasNext()){
		cursor.next().set( cursor0.next().get() );
	}
	
	
	Img<IntType> labelMap = fillLabelMap2(hMin, threshold, percentFlooding, keepOrphanPeak);
	
	return labelMap;
}
 
开发者ID:mpicbg-scicomp,项目名称:Interactive-H-Watershed,代码行数:26,代码来源:SegmentHierarchyToLabelMap.java


示例2: HWatershedLabeling

import net.imglib2.type.numeric.integer.IntType; //导入依赖的package包/类
public HWatershedLabeling(Img<T> input, float threshold, Connectivity connectivity)
{
	int nDims = input.numDimensions();
	long[] dims = new long[nDims];
	input.dimensions(dims);
	ImgFactory<IntType> imgFactoryIntType=null;
	try {
		imgFactoryIntType = input.factory().imgFactory( new IntType() );
	} catch (IncompatibleTypeException e) {
		e.printStackTrace();
	}
	
	if ( imgFactoryIntType != null )
	{
		this.labelMapMaxTree = imgFactoryIntType.create(dims, new IntType(0));
		Cursor<IntType> c_label = labelMapMaxTree.cursor();
		Cursor<T>       c_input = input.cursor();
		while( c_input.hasNext() )
		{
			c_label.next().setInteger( (int) c_input.next().getRealFloat() );
		}
	}
	
	this.threshold = threshold;
	this.connectivity = connectivity;
}
 
开发者ID:mpicbg-scicomp,项目名称:Interactive-H-Watershed,代码行数:27,代码来源:HWatershedLabeling.java


示例3: testImgToTensorMapping

import net.imglib2.type.numeric.integer.IntType; //导入依赖的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


示例4: applySplit

import net.imglib2.type.numeric.integer.IntType; //导入依赖的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


示例5: setUp

import net.imglib2.type.numeric.integer.IntType; //导入依赖的package包/类
/**
 * @throws java.lang.Exception
 */
@Before
public void setUp() throws Exception {
	final ArrayList<Integer> al = new ArrayList< Integer >();
	for ( int i = 0; i < size; ++i )
		al.add( i );
	
	Collections.shuffle( al );
	
	for ( int i = 0;  i < lut.length; ++i ) {
		lut[ i ]        = al.get( i );
		inv[ lut[ i ] ] = i;
	}
	
	for ( final IntType l : img )
		l.set( rng.nextInt() );
}
 
开发者ID:saalfeldlab,项目名称:z-spacing,代码行数:20,代码来源:SingleDimensionPermutationTransformTest.java


示例6: getIntIntImgLabellingFromLabelMapImagePlus

import net.imglib2.type.numeric.integer.IntType; //导入依赖的package包/类
public static ImgLabeling< Integer, IntType > getIntIntImgLabellingFromLabelMapImagePlus( final ImagePlus labelMap )
{
	final Img< FloatType > img2 = ImageJFunctions.convertFloat( labelMap );

	final Dimensions dims = img2;
	final IntType t = new IntType();
	final RandomAccessibleInterval< IntType > img = Util.getArrayOrCellImgFactory( dims, t ).create( dims, t );
	final ImgLabeling< Integer, IntType > labeling = new ImgLabeling<>( img );

	final Cursor< LabelingType< Integer > > labelCursor = Views.flatIterable( labeling ).cursor();
	for ( final UnsignedByteType input : Views.flatIterable( ImageJFunctions.wrapByte( labelMap ) ) )
	{
		final LabelingType< Integer > element = labelCursor.next();
		if ( input.get() != 0 )
			element.add( input.get() );
	}

	return labeling;
}
 
开发者ID:imglib,项目名称:imglib2-tests,代码行数:20,代码来源:LabelingExample.java


示例7: print

import net.imglib2.type.numeric.integer.IntType; //导入依赖的package包/类
public static void print( PixelListComponentTree< IntType > tree )
{
	for ( PixelListComponent< IntType > component : tree )
	{
		System.out.println( component );

		for ( int r = 0; r < dimensions[1]; ++r )
		{
			System.out.print("| ");
			for ( int c = 0; c < dimensions[0]; ++c )
			{
				boolean set = false;
				for ( Localizable l : component )
					if( l.getIntPosition( 0 ) == c && l.getIntPosition( 1 ) == r )
						set = true;
				System.out.print( set ? "x " : ". " );
			}
			System.out.println("|");
		}

		System.out.println();
	}
}
 
开发者ID:imglib,项目名称:imglib2-tests,代码行数:24,代码来源:PixelListComponentTreeExample.java


示例8: main

import net.imglib2.type.numeric.integer.IntType; //导入依赖的package包/类
public static void main( String[] args )
{
	ImgFactory< IntType > imgFactory = new ArrayImgFactory< IntType >();
	Img< IntType > input = imgFactory.create( dimensions, new IntType() );

	// fill input image with test data
	int[] pos = new int[ 2 ];
	Cursor< IntType > c = input.localizingCursor();
	while ( c.hasNext() )
	{
		c.fwd();
		c.localize( pos );
		c.get().set( testData[ pos[ 1 ] ][ pos[ 0 ] ] );
	}

	System.out.println("== dark to bright ==");
	PixelListComponentTree< IntType > tree = PixelListComponentTree.buildComponentTree( input, new IntType(), true );
	print( tree );

	System.out.println("== bright to dark ==");
	tree = PixelListComponentTree.buildComponentTree( input, new IntType(), false );
	print( tree );
}
 
开发者ID:imglib,项目名称:imglib2-tests,代码行数:24,代码来源:PixelListComponentTreeExample.java


示例9: testImageFactory

import net.imglib2.type.numeric.integer.IntType; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Test
public void testImageFactory() {

	final Dimensions dim = new FinalDimensions( 10, 10, 10 );

	assertEquals("Labeling Factory: ", ArrayImgFactory.class,
		((Img<?>) ((ImgLabeling<String, ?>) ops.run(
			DefaultCreateImgLabeling.class, dim, null,
			new ArrayImgFactory<IntType>())).getIndexImg()).factory().getClass());

	assertEquals("Labeling Factory: ", CellImgFactory.class,
		((Img<?>) ((ImgLabeling<String, ?>) ops.run(
			DefaultCreateImgLabeling.class, dim, null,
			new CellImgFactory<IntType>())).getIndexImg()).factory().getClass());

}
 
开发者ID:imagej,项目名称:imagej-ops,代码行数:18,代码来源:CreateLabelingTest.java


示例10: exhaustiveKendallTauBRankTesting

import net.imglib2.type.numeric.integer.IntType; //导入依赖的package包/类
@Test
public void exhaustiveKendallTauBRankTesting() {
	assumeTrue(exhaustive);
	final int n = 5, m = 10;
	final int[] values1 = new int[n], values2 = new int[n];
	for (int i = 0; i < 100; i++) {
		for (int j = 0; j < n; j++) {
			values1[j] = Math.abs(pseudoRandom()) % m;
			values2[j] = Math.abs(pseudoRandom()) % m;
		}
		
		//final PairIterator<DoubleType> iter = pairIterator(values1, values2);
		final Iterable<Pair<IntType, IntType>> iter = new IterablePair<>(ArrayImgs.ints(values1, n), ArrayImgs.ints(values2, n));
		double kendallValue1 = calculateNaive(iter.iterator());
		double kendallValue2 = (Double) ops.run(KendallTauBRank.class, values1, values2);
		if (Double.isNaN(kendallValue1)) {
			assertTrue("i: " + i + ", value2: " + kendallValue2, Double.isInfinite(kendallValue2) || Double.isNaN(kendallValue2));
		} else {
			assertEquals("i: " + i, kendallValue1, kendallValue2, 1e-10);
		}
	}
}
 
开发者ID:imagej,项目名称:imagej-ops,代码行数:23,代码来源:KendallTauBRankTest.java


示例11: createData

import net.imglib2.type.numeric.integer.IntType; //导入依赖的package包/类
@Before
public void createData() {
	@SuppressWarnings("unchecked")
	final ImgLabeling<String, IntType> imgL = (ImgLabeling<String, IntType>) ops
		.run(DefaultCreateImgLabeling.class, new long[] { 10, 10 },
			new IntType());

	final Cursor<LabelingType<String>> inc = imgL.cursor();

	while (inc.hasNext()) {
		inc.next().add(Math.random() > 0.5 ? "A" : "B");
	}

	// and another loop to construct some ABs
	while (inc.hasNext()) {
		inc.next().add(Math.random() > 0.5 ? "A" : "B");
	}

	input = imgL.getMapping();
}
 
开发者ID:imagej,项目名称:imagej-ops,代码行数:21,代码来源:CopyLabelingMappingTest.java


示例12: createData

import net.imglib2.type.numeric.integer.IntType; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Before
public void createData() {
	input = (ImgLabeling<String, IntType>) ops.run(
		DefaultCreateImgLabeling.class, new long[] { 10, 10 }, new IntType());

	final Cursor<LabelingType<String>> inc = input.cursor();

	while (inc.hasNext()) {
		inc.next().add(Math.random() > 0.5 ? "A" : "B");
	}

	// and another loop to construct some ABs
	while (inc.hasNext()) {
		inc.next().add(Math.random() > 0.5 ? "A" : "B");
	}

}
 
开发者ID:imagej,项目名称:imagej-ops,代码行数:19,代码来源:CopyImgLabelingTest.java


示例13: initFromCurrentCell

import net.imglib2.type.numeric.integer.IntType; //导入依赖的package包/类
private void initFromCurrentCell() {
	//create an array img based copy of the labeling
	Labeling<String> inputLabeling = m_currentCell.getLabeling();

	long[] dims = new long[inputLabeling.numDimensions()];
	inputLabeling.dimensions(dims);
		
	NativeImgFactory<?> imgFac = (NativeImgFactory<?>) ImgFactoryTypes.getImgFactory(ImgFactoryTypes.ARRAY_IMG_FACTORY);
	NativeImgLabeling<String, IntType> copiedLabeling;
	try {
		copiedLabeling = new NativeImgLabeling<String, IntType>(imgFac.imgFactory(new IntType())
		        .create(dims, new IntType()));
				
		ImgCopyOperation<LabelingType<String>> copy = new ImgCopyOperation<LabelingType<String>>();
		copy.compute(inputLabeling, copiedLabeling);

		//and set the current labeling
		m_currentLabeling = copiedLabeling;
	} catch (IncompatibleTypeException e) {
		e.printStackTrace();
	}
}
 
开发者ID:MichaelZinsmaier,项目名称:knip-contribution,代码行数:23,代码来源:LabelAnnotatorView.java


示例14: fillLabelMap2

import net.imglib2.type.numeric.integer.IntType; //导入依赖的package包/类
protected Img<IntType> fillLabelMap2( float hMin, float threshold, float percentFlooding, boolean keepOrphanPeak ){
	
	
	int nNodes = segmentTree0.getNumNodes();
	int[] nodeIdToLabel = new int[nNodes];
	int[] nodeIdToLabelRoot = new int[nNodes];
	double[] peakThresholds = new double[nNodes];
	
	this.nLabels = treeLabeler.getLabeling(hMin, threshold, percentFlooding, keepOrphanPeak, nodeIdToLabel, nodeIdToLabelRoot, peakThresholds);
	
	Cursor<IntType> cursor = segmentMap.cursor();
	Cursor<T> cursorImg = intensity.cursor();
	while( cursor.hasNext() )
	{
		T imgPixel = cursorImg.next();
		float val =imgPixel.getRealFloat();
		
		IntType pixel = cursor.next();
		if(  val >= threshold )
		{
			final int nodeId = (int)pixel.getRealFloat();
			final int labelRoot = nodeIdToLabelRoot[nodeId];
			if(  val >= peakThresholds[labelRoot]  )
			{	
				final int label = nodeIdToLabel[nodeId];
				pixel.setReal( (float)label );
			}
			else
				pixel.setReal( 0.0 );
		}
		else
			pixel.setReal( 0.0 );
	}
	return segmentMap;
	
}
 
开发者ID:mpicbg-scicomp,项目名称:Interactive-H-Watershed,代码行数:37,代码来源:SegmentHierarchyToLabelMap.java


示例15: createIntArray

import net.imglib2.type.numeric.integer.IntType; //导入依赖的package包/类
private static int[] createIntArray(
	final RandomAccessibleInterval<IntType> image)
{
	final long[] dims = Intervals.dimensionsAsLongArray(image);
	final ArrayImg<IntType, IntArray> dest = ArrayImgs.ints(dims);
	copy(image, dest);
	return dest.update(null).getCurrentStorageArray();
}
 
开发者ID:imagej,项目名称:imagej-tensorflow,代码行数:9,代码来源:Tensors.java


示例16: extractIntArray

import net.imglib2.type.numeric.integer.IntType; //导入依赖的package包/类
private static int[] extractIntArray(
	final RandomAccessibleInterval<IntType> image)
{
	if (!(image instanceof ArrayImg)) return null;
	@SuppressWarnings("unchecked")
	final ArrayImg<IntType, ?> arrayImg = (ArrayImg<IntType, ?>) image;
	final Object dataAccess = arrayImg.update(null);
	return dataAccess instanceof IntArray ? //
		((IntArray) dataAccess).getCurrentStorageArray() : null;
}
 
开发者ID:imagej,项目名称:imagej-tensorflow,代码行数:11,代码来源:Tensors.java


示例17: testImgToTensorReverse

import net.imglib2.type.numeric.integer.IntType; //导入依赖的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


示例18: testImgToTensorDirect

import net.imglib2.type.numeric.integer.IntType; //导入依赖的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


示例19: splitDims

import net.imglib2.type.numeric.integer.IntType; //导入依赖的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


示例20: createWorkingCopy

import net.imglib2.type.numeric.integer.IntType; //导入依赖的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



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java IErrorHandlingPolicy类代码示例发布时间:2022-05-21
下一篇:
Java BreakpointRequest类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap