本文整理汇总了Java中net.imglib2.util.ValuePair类的典型用法代码示例。如果您正苦于以下问题:Java ValuePair类的具体用法?Java ValuePair怎么用?Java ValuePair使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ValuePair类属于net.imglib2.util包,在下文中一共展示了ValuePair类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: applySplit
import net.imglib2.util.ValuePair; //导入依赖的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
示例2: addSubspaceTable
import net.imglib2.util.ValuePair; //导入依赖的package包/类
private void addSubspaceTable(final Subspace<BitType> subspace,
final List<ValuePair<DoubleType, DoubleType>> pairs)
{
final String label = inputImage.getName() + " " + subspace.toString();
final GenericColumn labelColumn = ResultUtils.createLabelColumn(label, pairs
.size());
final DoubleColumn xColumn = new DoubleColumn("-log(size)");
final DoubleColumn yColumn = new DoubleColumn("log(count)");
pairs.stream().map(p -> p.a.get()).forEach(xColumn::add);
pairs.stream().map(p -> p.b.get()).forEach(yColumn::add);
final GenericTable resultsTable = new DefaultGenericTable();
resultsTable.add(labelColumn);
resultsTable.add(xColumn);
resultsTable.add(yColumn);
subspaceTables.add(resultsTable);
}
开发者ID:bonej-org,项目名称:BoneJ2,代码行数:17,代码来源:FractalDimensionWrapper.java
示例3: lines
import net.imglib2.util.ValuePair; //导入依赖的package包/类
private Stream<ValuePair<Point3d, Vector3d>> lines(final long bins,
final double sign)
{
final Vector3d direction = getNormal(sign);
final Vector3d t = new Vector3d(translation);
t.scale(sign);
final double range = 1.0 / bins;
final Builder<ValuePair<Point3d, Vector3d>> builder = Stream.builder();
for (int i = 0; i < bins; i++) {
final double minC = i * range;
for (int j = 0; j < bins; j++) {
final double minD = j * range;
final double c = (rng.nextDouble() * range + minC) * size - 0.5 *
size;
final double d = (rng.nextDouble() * range + minD) * size - 0.5 *
size;
final Point3d origin = createOrigin(c, d, t);
builder.add(new ValuePair<>(origin, direction));
}
}
return builder.build();
}
开发者ID:bonej-org,项目名称:BoneJ2,代码行数:23,代码来源:LineGrid.java
示例4: testValenceSorterOnFishGraph
import net.imglib2.util.ValuePair; //导入依赖的package包/类
@Test
public void testValenceSorterOnFishGraph() {
final Graph fishGraph = TestGraphs.createDownWardFacingFishGraph();
final Pair<Integer, Integer> range = new ValuePair<>(0, Integer.MAX_VALUE);
final Map<Integer, List<Vertex>> map = valenceSorterOp.calculate(fishGraph, range);
final Set<Integer> keySet = map.keySet();
final int[] expectedCounts = { 2, 2, 1 };
final int[] expectedValences = { 1, 2, 4 };
assertEquals("Wrong number of valences", 3, keySet.size());
for (int i = 0; i < expectedCounts.length; i++) {
assertTrue("Expected valence missing", map.containsKey(expectedValences[i]));
final List<Vertex> vertices = map.get(expectedValences[i]);
final int valence = expectedValences[i];
assertEquals("Wrong number of vertices with valence " + valence, expectedCounts[i], vertices.size());
assertTrue("A vertex has wrong number of branches (valence)",
vertices.stream().allMatch(v -> valence == v.getBranches().size()));
}
}
开发者ID:bonej-org,项目名称:BoneJ2,代码行数:23,代码来源:VertexValenceSorterTest.java
示例5: testRangeOnFishGraph
import net.imglib2.util.ValuePair; //导入依赖的package包/类
@Test
public void testRangeOnFishGraph() {
final Graph fishGraph = TestGraphs.createDownWardFacingFishGraph();
final Pair<Integer, Integer> range = new ValuePair<>(2, 3);
final Map<Integer, List<Vertex>> map = valenceSorterOp.calculate(fishGraph, range);
final Set<Integer> keySet = map.keySet();
final int expectedCount = 2;
final int expectedValence = 2;
assertEquals("Wrong number of valences", 1, keySet.size());
assertTrue("Expected valence missing", map.containsKey(expectedValence));
final List<Vertex> vertices = map.get(expectedValence);
assertEquals("Wrong number of vertices with valence " + expectedValence, expectedCount, vertices.size());
assertTrue("A vertex has wrong number of branches (valence)",
vertices.stream().allMatch(v -> expectedValence == v.getBranches().size()));
}
开发者ID:bonej-org,项目名称:BoneJ2,代码行数:20,代码来源:VertexValenceSorterTest.java
示例6: getComparisons
import net.imglib2.util.ValuePair; //导入依赖的package包/类
public List<Pair<? extends Group< ? extends BasicViewDescription< ? extends BasicViewSetup > >, ? extends Group< ? extends BasicViewDescription< ? extends BasicViewSetup >>>> getComparisons()
{
final List<Pair<? extends Group< ? extends BasicViewDescription< ? extends BasicViewSetup > >, ? extends Group< ? extends BasicViewDescription< ? extends BasicViewSetup >>>> res = new ArrayList<>();
// filter first
final List<BasicViewDescription< ? > > ungroupedElements =
SpimDataTools.getFilteredViewDescriptions( data.getSequenceDescription(), filters);
// then group
final List< Group< BasicViewDescription< ? > >> groupedElements =
Group.combineBy(ungroupedElements, groupingFactors);
// go through possible group pairs
for (int i = 0; i < groupedElements.size(); ++i)
for(int j = i+1; j < groupedElements.size(); ++j)
{
// we will want to process the pair if:
// the groups do not differ along an axis along which we want to treat elements individually (e.g. Angle)
// but they differ along an axis that we want to register (e.g Tile)
if (!groupsDifferByAny( groupedElements.get( i ), groupedElements.get( j ), axesOfApplication )
&& groupsDifferByAny( groupedElements.get( i ), groupedElements.get( j ), axesOfComparison ))
res.add(new ValuePair<>(groupedElements.get( i ), groupedElements.get( j )));
}
return res;
}
开发者ID:PreibischLab,项目名称:BigStitcher,代码行数:25,代码来源:SpimDataFilteringAndGrouping.java
示例7: getInitialTransforms
import net.imglib2.util.ValuePair; //导入依赖的package包/类
/**
*
* @param vr the ViewRegistration to decompose
* @param is2d true or false
* @param dsCorrectionT downsampling correction
* @return (1) the ViewRegistration without Translation part and the translation, with the inverse of (1) and dsCorrection applied
*/
public static Pair<AffineGet, TranslationGet> getInitialTransforms( final ViewRegistration vr, final boolean is2d, final AffineTransform3D dsCorrectionT )
{
AffineTransform3D model = vr.getModel().copy();
// get model without translation (last column set to 0)
AffineTransform3D modelWithoutTranslation = model.copy();
modelWithoutTranslation.set( 0, 0, 3 );
modelWithoutTranslation.set( 0, 1, 3 );
modelWithoutTranslation.set( 0, 2, 3 );
// the translation with inverse of other part of model applied
final double[] target = model.getTranslation();
modelWithoutTranslation.applyInverse( target, target );
// we go from big to downsampled, thats why the inverse
dsCorrectionT.applyInverse( target, target );
if ( is2d )
return new ValuePair<>(modelWithoutTranslation, new Translation2D( target[ 0 ], target[ 1 ] ));
else
return new ValuePair<>(modelWithoutTranslation, new Translation3D( target[ 0 ], target[ 1 ], target[ 2 ] ));
}
开发者ID:PreibischLab,项目名称:BigStitcher,代码行数:31,代码来源:TransformTools.java
示例8: selectedViewDescriptions
import net.imglib2.util.ValuePair; //导入依赖的package包/类
@Override
public void selectedViewDescriptions(
List< List< BasicViewDescription< ? extends BasicViewSetup > > > viewDescriptions)
{
List<Pair<Group<ViewId>, Group<ViewId>>> res = new ArrayList<>();
for (int i = 0; i<viewDescriptions.size(); i++)
for (int j = i+1; j<viewDescriptions.size(); j++)
{
Group<ViewId> groupA = new Group<>();
groupA.getViews().addAll( viewDescriptions.get( i ) );
Group<ViewId> groupB = new Group<>();
groupB.getViews().addAll( viewDescriptions.get( j ) );
res.add( new ValuePair< Group<ViewId>, Group<ViewId> >( groupA, groupB ) );
}
setActiveLinks( res );
}
开发者ID:PreibischLab,项目名称:BigStitcher,代码行数:18,代码来源:DemoLinkOverlay.java
示例9: calculate
import net.imglib2.util.ValuePair; //导入依赖的package包/类
@Override
public Pair<I, I> calculate(final Iterable<I> input) {
double tmpMin = Double.POSITIVE_INFINITY;
double tmpMax = Double.NEGATIVE_INFINITY;
for (final I in : input) {
final double n = in.getRealDouble();
if (tmpMin > n) {
tmpMin = n;
}
if (tmpMax < n) {
tmpMax = n;
}
}
final I min = input.iterator().next().createVariable();
min.setReal(tmpMin);
final I max = input.iterator().next().createVariable();
max.setReal(tmpMax);
return new ValuePair<>(min, max);
}
开发者ID:imagej,项目名称:imagej-ops,代码行数:26,代码来源:DefaultMinMax.java
示例10: calculate
import net.imglib2.util.ValuePair; //导入依赖的package包/类
@Override
public Pair<RealLocalizable, RealLocalizable> calculate(Polygon input) {
final List<? extends RealLocalizable> points = function.calculate(input).getVertices();
double distance = Double.NEGATIVE_INFINITY;
RealLocalizable p0 = points.get(0);
RealLocalizable p1 = points.get(0);
for (int i = 0; i < points.size(); i++) {
for (int j = i + 2; j < points.size(); j++) {
final RealLocalizable tmpP0 = points.get(i);
final RealLocalizable tmpP1 = points.get(j);
final double tmp = Math.sqrt(Math.pow(tmpP0.getDoublePosition(0) - tmpP1.getDoublePosition(0), 2)
+ Math.pow(tmpP0.getDoublePosition(1) - tmpP1.getDoublePosition(1), 2));
if (tmp > distance) {
distance = tmp;
p0 = tmpP0;
p1 = tmpP1;
}
}
}
return new ValuePair<>(p0, p1);
}
开发者ID:imagej,项目名称:imagej-ops,代码行数:26,代码来源:DefaultMaximumFeret.java
示例11: testAllBackground
import net.imglib2.util.ValuePair; //导入依赖的package包/类
@Test
public void testAllBackground() throws Exception {
// SETUP
final double expectedCount = Math.log(0.0);
final Img<BitType> img = ArrayImgs.bits(TEST_DIMS);
// EXECUTE
final List<ValuePair<DoubleType, DoubleType>> points = ops.topology()
.boxCount(img, MAX_SIZE, MIN_SIZE, SCALING);
// VERIFY
assertNotNull(points);
assertEquals(ITERATIONS, points.size());
for (int i = 0; i < ITERATIONS; i++) {
assertEquals(EXPECTED_SIZES[i], points.get(i).a.get(), 1e-12);
assertEquals(expectedCount, points.get(i).b.get(), 1e-12);
}
}
开发者ID:imagej,项目名称:imagej-ops,代码行数:19,代码来源:BoxCountTest.java
示例12: testAllForeground
import net.imglib2.util.ValuePair; //导入依赖的package包/类
@Test
public void testAllForeground() {
// SETUP
final double scalingPow = DoubleStream.generate(() -> SCALING).limit(
DIMENSIONS).reduce((i, j) -> i * j).orElse(0);
final double[] expectedCounts = DoubleStream.iterate(1.0, i -> i *
scalingPow).map(Math::log).limit(ITERATIONS).toArray();
final Img<BitType> img = ArrayImgs.bits(TEST_DIMS);
img.forEach(BitType::setOne);
// EXECUTE
final List<ValuePair<DoubleType, DoubleType>> points = ops.topology()
.boxCount(img, MAX_SIZE, MIN_SIZE, SCALING);
// VERIFY
for (int i = 0; i < ITERATIONS; i++) {
assertEquals(EXPECTED_SIZES[i], points.get(i).a.get(), 1e-12);
assertEquals(expectedCounts[i], points.get(i).b.get(), 1e-12);
}
}
开发者ID:imagej,项目名称:imagej-ops,代码行数:21,代码来源:BoxCountTest.java
示例13: testHyperCube
import net.imglib2.util.ValuePair; //导入依赖的package包/类
@Test
public void testHyperCube() {
// SETUP
final double[] expectedSizes = DoubleStream.of(4, 2, 1).map(i -> -Math.log(
i)).toArray();
final double[] expectedCounts = DoubleStream.of(1, 16, 16).map(Math::log)
.toArray();
final Img<BitType> img = ArrayImgs.bits(4, 4, 4, 4);
final IntervalView<BitType> hyperView = Views.offsetInterval(img,
new long[] { 1, 1, 1, 1 }, new long[] { 2, 2, 2, 2 });
hyperView.forEach(BitType::setOne);
// EXECUTE
final List<ValuePair<DoubleType, DoubleType>> points = ops.topology()
.boxCount(img, 4L, 1L, 2.0);
// VERIFY
for (int i = 0; i < expectedSizes.length; i++) {
assertEquals(expectedSizes[i], points.get(i).a.get(), 1e-12);
assertEquals(expectedCounts[i], points.get(i).b.get(), 1e-12);
}
}
开发者ID:imagej,项目名称:imagej-ops,代码行数:23,代码来源:BoxCountTest.java
示例14: testHyperCubeTranslations
import net.imglib2.util.ValuePair; //导入依赖的package包/类
/**
* Test box counting with a hyper cube and one grid translation (should find a
* better fit than in @see {@link #testHyperCube()})
*/
@Test
public void testHyperCubeTranslations() {
final double[] expectedSizes = DoubleStream.of(4, 2, 1).map(i -> -Math.log(
i)).toArray();
final double[] expectedCounts = DoubleStream.of(1, 1, 16).map(Math::log)
.toArray();
final Img<BitType> img = ArrayImgs.bits(4, 4, 4, 4);
final IntervalView<BitType> hyperView = Views.offsetInterval(img,
new long[] { 1, 1, 1, 1 }, new long[] { 2, 2, 2, 2 });
hyperView.forEach(BitType::setOne);
// EXECUTE
final List<ValuePair<DoubleType, DoubleType>> points = ops.topology()
.boxCount(img, 4L, 1L, 2.0, 1L);
// VERIFY
for (int i = 0; i < expectedSizes.length; i++) {
assertEquals(expectedSizes[i], points.get(i).a.get(), 1e-12);
assertEquals(expectedCounts[i], points.get(i).b.get(), 1e-12);
}
}
开发者ID:imagej,项目名称:imagej-ops,代码行数:26,代码来源:BoxCountTest.java
示例15: testOneVoxel
import net.imglib2.util.ValuePair; //导入依赖的package包/类
@Test
public void testOneVoxel() {
// SETUP
final PrimitiveIterator.OfDouble sizes = DoubleStream.of(9, 3, 1).map(
i -> -Math.log(i)).iterator();
final PrimitiveIterator.OfDouble counts = DoubleStream.of(1, 1, 1).map(
Math::log).iterator();
final Img<BitType> img = ArrayImgs.bits(9, 9, 9);
final RandomAccess<BitType> access = img.randomAccess();
access.setPosition(new long[] { 4, 4, 4 });
access.get().setOne();
// EXECUTE
final List<ValuePair<DoubleType, DoubleType>> points = ops.topology()
.boxCount(img, 9L, 3L, 3.0);
// VERIFY
points.forEach(p -> {
assertEquals(p.a.get(), sizes.next(), 1e-12);
assertEquals(p.b.get(), counts.next(), 1e-12);
});
}
开发者ID:imagej,项目名称:imagej-ops,代码行数:23,代码来源:BoxCountTest.java
示例16: binData
import net.imglib2.util.ValuePair; //导入依赖的package包/类
public static List< ValuePair< Double, Integer > > binData( final List< Double > data, final double min, final double max, final int numBins )
{
// avoid the one value that is exactly 100%
final double size = max - min + 0.000001;
// bin and count the entries
final int[] bins = new int[ numBins ];
for ( final double v : data )
++bins[ (int)Math.floor( ( ( v - min ) / size ) * numBins ) ];
// make the list of bins
final ArrayList< ValuePair< Double, Integer > > hist = new ArrayList< >();
final double binSize = size / numBins;
for ( int bin = 0; bin < numBins; ++bin )
hist.add( new ValuePair< >( min + binSize/2 + binSize * bin, bins[ bin ] ) );
return hist;
}
开发者ID:fiji,项目名称:SPIM_Registration,代码行数:21,代码来源:Histogram.java
示例17: createDataset
import net.imglib2.util.ValuePair; //导入依赖的package包/类
protected IntervalXYDataset createDataset( final List< Double > values, final int numBins, final String title )
{
final XYSeries series = new XYSeries( title );
final ValuePair< Double, Double > minmax = getMinMax( values );
this.min = minmax.getA();
this.max = minmax.getB();
final List< ValuePair< Double, Integer > > hist = binData( values, min, max, numBins );
for ( final ValuePair< Double, Integer > pair : hist )
series.add( pair.getA(), pair.getB() );
final XYSeriesCollection dataset = new XYSeriesCollection( series );
dataset.setAutoWidth( true );
return dataset;
}
开发者ID:fiji,项目名称:SPIM_Registration,代码行数:19,代码来源:Histogram.java
示例18: determineSizeSimple
import net.imglib2.util.ValuePair; //导入依赖的package包/类
protected Pair< double[], double[] > determineSizeSimple( final ArrayList< ChannelProcess > channelsToUse, final int detections )
{
final List< double[] > points = getAllDetectionsInGlobalCoordinates( channelsToUse, detections );
if ( points.size() < 1 )
{
IOFunctions.println( "At least one point is required. Stopping" );
return null;
}
final double[] min = points.get( 0 ).clone();
final double[] max = min.clone();
for ( final double[] p : points )
for ( int d = 0; d < p.length; ++d )
{
min[ d ] = Math.min( min[ d ], p[ d ] );
max[ d ] = Math.max( max[ d ], p[ d ] );
}
IOFunctions.println( "Min (direct): " + Util.printCoordinates( min ) );
IOFunctions.println( "Max (direct): " + Util.printCoordinates( max ) );
return new ValuePair< double[], double[] >( min, max );
}
开发者ID:fiji,项目名称:SPIM_Registration,代码行数:26,代码来源:AutomaticReorientation.java
示例19: numReorientated
import net.imglib2.util.ValuePair; //导入依赖的package包/类
protected Pair< Integer, Integer > numReorientated()
{
final ViewRegistrations vrs = spimData.getViewRegistrations();
int isReorientated = 0;
int sumViews = 0;
for ( final ViewId viewId : viewIdsToProcess )
{
final ViewDescription vd = spimData.getSequenceDescription().getViewDescription( viewId );
if ( !vd.isPresent() )
continue;
final ViewRegistration vr = vrs.getViewRegistration( viewId );
final ViewTransform vt = vr.getTransformList().get( 0 );
++sumViews;
if ( vt.hasName() && vt.getName().startsWith( reorientationDescription ) )
++isReorientated;
}
return new ValuePair< Integer, Integer >( isReorientated, sumViews );
}
开发者ID:fiji,项目名称:SPIM_Registration,代码行数:26,代码来源:AutomaticReorientation.java
示例20: matchOps
import net.imglib2.util.ValuePair; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private void matchOps() {
centroidOp = Functions.unary(opService, CentroidLinAlg3d.class, Vector3d.class, List.class);
cleanShortEdgesOp = Functions.binary(opService, CleanShortEdges.class, Graph.class, Graph.class, Double.class,
coefficients, iteratePruning, useClusters);
range = new ValuePair<>(minimumValence, maximumValence);
valenceSorterOp = (BinaryFunctionOp) Functions.binary(opService, VertexValenceSorter.class, Map.class,
Graph.class, range);
nPointAnglesOp = (BinaryFunctionOp) Functions.binary(opService, NPointAngles.class, List.class, List.class,
Integer.class);
}
开发者ID:bonej-org,项目名称:BoneJ2,代码行数:12,代码来源:IntertrabecularAngleWrapper.java
注:本文中的net.imglib2.util.ValuePair类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论