本文整理了Java中net.imglib2.view.Views.addDimension()
方法的一些代码示例,展示了Views.addDimension()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Views.addDimension()
方法的具体详情如下:
包路径:net.imglib2.view.Views
类名称:Views
方法名:addDimension
[英]Create view which adds a dimension to the source RandomAccessible. The additional dimension is the last dimension. For example, an XYZ view is created for an XY source. When accessing an XYZ sample in the view, the final coordinate is discarded and the source XY sample is accessed.
[中]创建将标注添加到源视图的视图。附加维度是最后一个维度。例如,将为XY源创建XYZ视图。在视图中访问XYZ采样时,将放弃最终坐标,并访问源XY采样。
代码示例来源:origin: imagej/imagej-ops
@Override
public IntervalView<T> calculate(RandomAccessibleInterval<T> input) {
return Views.addDimension(input, minOfNewDim, maxOfNewDim);
}
代码示例来源:origin: imagej/imagej-ops
@Override
public MixedTransformView<T> calculate(RandomAccessible<T> input) {
return Views.addDimension(input);
}
代码示例来源:origin: net.preibisch/multiview-reconstruction
protected RandomAccessibleInterval< FloatType > getOrCreateDarkImgDownsampled(ViewId vId, int[] downsamplingFactors)
{
ArrayList< Integer > dsFactorList = new ArrayList< Integer >();
for ( int i : downsamplingFactors )
dsFactorList.add( i );
final ValuePair< File, List< Integer > > key = new ValuePair<>( fileMap.get( vId ).getB(), dsFactorList );
if ( !dsRaiMap.containsKey( key ) )
{
final RandomAccessibleInterval< FloatType > darkImg = getDarkImg( vId );
if ( darkImg == null )
return null;
// NB: we add a singleton z-dimension here for downsampleHDF5 to
// work
final RandomAccessibleInterval< FloatType > downsampled = downsampleHDF5(
Views.addDimension( darkImg, 0, 0 ), downsamplingFactors );
dsRaiMap.put( key, downsampled );
}
return dsRaiMap.get( key );
}
代码示例来源:origin: net.preibisch/multiview-reconstruction
protected RandomAccessibleInterval< FloatType > getOrCreateBrightImgDownsampled(ViewId vId,
int[] downsamplingFactors)
{
ArrayList< Integer > dsFactorList = new ArrayList< Integer >();
for ( int i : downsamplingFactors )
dsFactorList.add( i );
final ValuePair< File, List< Integer > > key = new ValuePair<>( fileMap.get( vId ).getA(), dsFactorList );
if ( !dsRaiMap.containsKey( key ) )
{
final RandomAccessibleInterval< FloatType > brightImg = getBrightImg( vId );
if ( brightImg == null )
return null;
// NB: we add a singleton z-dimension here for downsampleHDF5 to
// work
final RandomAccessibleInterval< FloatType > downsampled = downsampleHDF5(
Views.addDimension( brightImg, 0, 0 ), downsamplingFactors );
dsRaiMap.put( key, downsampled );
}
return dsRaiMap.get( key );
}
代码示例来源:origin: sc.fiji/bigdataviewer-vistools
sourceStacks.set( i, Views.addDimension( sourceStacks.get( i ), 0, 0 ) );
代码示例来源:origin: net.imglib2/imglib2
/**
* Create view which adds a dimension to the source
* {@link RandomAccessibleInterval}. The {@link Interval} boundaries in the
* additional dimension are set to the specified values.
*
* The additional dimension is the last dimension. For example, an XYZ view
* is created for an XY source. When accessing an XYZ sample in the view,
* the final coordinate is discarded and the source XY sample is accessed.
*
* @param interval
* the source
* @param minOfNewDim
* Interval min in the additional dimension.
* @param maxOfNewDim
* Interval max in the additional dimension.
*/
public static < T > IntervalView< T > addDimension( final RandomAccessibleInterval< T > interval, final long minOfNewDim, final long maxOfNewDim )
{
final int m = interval.numDimensions();
final long[] min = new long[ m + 1 ];
final long[] max = new long[ m + 1 ];
for ( int d = 0; d < m; ++d )
{
min[ d ] = interval.min( d );
max[ d ] = interval.max( d );
}
min[ m ] = minOfNewDim;
max[ m ] = maxOfNewDim;
return Views.interval( Views.addDimension( interval ), min, max );
}
代码示例来源:origin: imagej/imagej-ops
@Override
public void run() {
// parse the spacing, and scales strings.
spacing = checkDimensions(spacingString, input.numDimensions(), "Spacings");
scales = Arrays.stream(scaleString.split(regex)).mapToInt(Integer::parseInt)
.toArray();
Dimensions resultDims = Views.addDimension(input, 0, scales.length - 1);
// create output image, potentially-filtered input
result = opService.create().img(resultDims, new FloatType());
for (int s = 0; s < scales.length; s++) {
// Determine whether or not the user would like to apply the gaussian
// beforehand and do it.
RandomAccessibleInterval<T> vesselnessInput = doGauss ? opService.filter()
.gauss(input, scales[s]) : input;
IntervalView<FloatType> scaleResult = Views.hyperSlice(result, result
.numDimensions() - 1, s);
opService.filter().frangiVesselness(scaleResult, vesselnessInput, spacing,
scales[s]);
}
}
}
代码示例来源:origin: imglib/imglib2
/**
* Create view which adds a dimension to the source
* {@link RandomAccessibleInterval}. The {@link Interval} boundaries in the
* additional dimension are set to the specified values.
*
* The additional dimension is the last dimension. For example, an XYZ view
* is created for an XY source. When accessing an XYZ sample in the view,
* the final coordinate is discarded and the source XY sample is accessed.
*
* @param interval
* the source
* @param minOfNewDim
* Interval min in the additional dimension.
* @param maxOfNewDim
* Interval max in the additional dimension.
*/
public static < T > IntervalView< T > addDimension( final RandomAccessibleInterval< T > interval, final long minOfNewDim, final long maxOfNewDim )
{
final int m = interval.numDimensions();
final long[] min = new long[ m + 1 ];
final long[] max = new long[ m + 1 ];
for ( int d = 0; d < m; ++d )
{
min[ d ] = interval.min( d );
max[ d ] = interval.max( d );
}
min[ m ] = minOfNewDim;
max[ m ] = maxOfNewDim;
return Views.interval( Views.addDimension( interval ), min, max );
}
代码示例来源:origin: sc.fiji/bigdataviewer-vistools
interval = new FinalInterval( min, max );
for ( int i = 0; i < sourceStacks.size(); ++i )
sourceStacks.set( i, Views.addDimension( sourceStacks.get( i ) ) );
代码示例来源:origin: net.imglib2/imglib2-algorithm
( RandomAccessible< T > ) Views.addDimension( source ),
Views.interval( Views.addDimension( target ), new FinalInterval( target.dimension( 0 ), 1 ) ),
d,
0 );
代码示例来源:origin: net.imglib2/imglib2-algorithm
( RandomAccessible< T > ) Views.addDimension( source ),
Views.interval( Views.addDimension( target ), new FinalInterval( target.dimension( 0 ), 1 ) ),
0,
weights[ 0 ] );
代码示例来源:origin: net.imglib2/imglib2-algorithm
( RandomAccessible< T > ) Views.addDimension( source ),
Views.interval( Views.addDimension( target ), new FinalInterval( target.dimension( 0 ), 1 ) ),
0,
weights[ 0 ],
代码示例来源:origin: net.imglib2/imglib2-algorithm
/**
*
* Switch for calling convenience method with pre-defined distances.
*
*/
public static enum DISTANCE_TYPE
{
/**
* Squared Euclidian distance using {@link EuclidianDistanceIsotropic} or
* {@link EuclidianDistanceAnisotropic}.
*/
EUCLIDIAN,
/**
* L1 distance using special case implementation.
*/
L1
}
代码示例来源:origin: net.imagej/imagej-deprecated
/**
* {@link RandomAccessibleInterval} with same sice as target is returned
*
* @param src
* {@link RandomAccessibleInterval} to be adjusted
* @param target
* {@link Interval} describing the resulting sizes
* @return Adjusted {@link RandomAccessibleInterval}
*/
public static <T> RandomAccessibleInterval<T> synchronizeDimensionality(
final RandomAccessibleInterval<T> src, final Interval target) {
RandomAccessibleInterval<T> res = src;
// Check direction of conversion
if (intervalEquals(src, target))
return res;
// adjust dimensions
if (res.numDimensions() < target.numDimensions()) {
for (int d = res.numDimensions(); d < target.numDimensions(); d++) {
res = Views.addDimension(res, target.min(d), target.max(d));
}
} else {
for (int d = res.numDimensions() - 1; d >= target.numDimensions(); --d)
res = Views.hyperSlice(res, d, 0);
}
long[] resDims = new long[res.numDimensions()];
res.dimensions(resDims);
return Views.interval(Views.extendBorder(res), target);
}
代码示例来源:origin: net.imglib2/imglib2-ops
/**
* {@link RandomAccessibleInterval} with same sice as target is returned
*
* @param src
* {@link RandomAccessibleInterval} to be adjusted
* @param target
* {@link Interval} describing the resulting sizes
* @return Adjusted {@link RandomAccessibleInterval}
*/
public static <T> RandomAccessibleInterval<T> synchronizeDimensionality(
final RandomAccessibleInterval<T> src, final Interval target) {
RandomAccessibleInterval<T> res = src;
// Check direction of conversion
if (intervalEquals(src, target))
return res;
// adjust dimensions
if (res.numDimensions() < target.numDimensions()) {
for (int d = res.numDimensions(); d < target.numDimensions(); d++) {
res = Views.addDimension(res, target.min(d), target.max(d));
}
} else {
for (int d = res.numDimensions() - 1; d >= target.numDimensions(); --d)
res = Views.hyperSlice(res, d, 0);
}
long[] resDims = new long[res.numDimensions()];
res.dimensions(resDims);
return Views.interval(Views.extendBorder(res), target);
}
代码示例来源:origin: imagej/imagej-ops
@Test
public void addDimensionMinMaxTest() {
Img<DoubleType> img = new ArrayImgFactory<DoubleType>().create(new int[] { 10, 10 }, new DoubleType());
int max = 20;
int min = 0;
IntervalView<DoubleType> il2 = Views.addDimension(img, min, max);
IntervalView<DoubleType> opr = ops.transform().addDimensionView(img, min, max);
assertEquals(il2.numDimensions(), opr.numDimensions(), 0.0);
for (int i = 0; i < il2.numDimensions(); i++) {
assertEquals(il2.dimension(i), opr.dimension(i), 0.0);
}
}
}
代码示例来源:origin: imagej/imagej-ops
RandomAccessible<T> expandedKernelA = Views.addDimension(kernelA);
RandomAccessible<T> expandedKernelB = Views.addDimension(kernelB);
for (int i = 0; i < in().numDimensions() - 3; i++) {
expandedKernelA = Views.addDimension(expandedKernelA);
expandedKernelB = Views.addDimension(expandedKernelB);
代码示例来源:origin: imagej/imagej-ops
@Test
public void addDimensionTest() {
Img<DoubleType> img = new ArrayImgFactory<DoubleType>().create(new int[] { 10, 10 }, new DoubleType());
MixedTransformView<DoubleType> il2 = Views.addDimension((RandomAccessible<DoubleType>)img);
MixedTransformView<DoubleType> opr = ops.transform().addDimensionView((RandomAccessible<DoubleType>)img);
assertEquals(il2.numDimensions(), opr.numDimensions());
boolean[] il2Transform = new boolean[3];
boolean[] oprTransform = new boolean[3];
il2.getTransformToSource().getComponentZero(il2Transform);
opr.getTransformToSource().getComponentZero(oprTransform);
for (int i = 0; i < il2Transform.length; i++) {
assertEquals(il2Transform[i], oprTransform[i]);
}
}
代码示例来源:origin: net.imglib2/imglib2-ops
for (final AxisType type : missing) {
final int idx = targetSpace.getAxisIndex(type);
res = Views.addDimension(res, target.min(idx), target.max(idx));
resSpace.setAxis(type, i++);
代码示例来源:origin: net.imagej/imagej-deprecated
for (final AxisType type : missing) {
final int idx = targetSpace.dimensionIndex(type);
res = Views.addDimension(res, target.min(idx), target.max(idx));
resSpace.setAxis(new DefaultLinearAxis(type), i++);
内容来源于网络,如有侵权,请联系作者删除!