net.imglib2.util.Util.getSuitableImgFactory()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(7.4k)|赞(0)|评价(0)|浏览(135)

本文整理了Java中net.imglib2.util.Util.getSuitableImgFactory()方法的一些代码示例,展示了Util.getSuitableImgFactory()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Util.getSuitableImgFactory()方法的具体详情如下:
包路径:net.imglib2.util.Util
类名称:Util
方法名:getSuitableImgFactory

Util.getSuitableImgFactory介绍

[英]Create an appropriate ImgFactory for the requested targetSize and type. If the type is a NativeType, then #getArrayOrCellImgFactory(Dimensions,NativeType) is used; if not, a ListImgFactory is returned.
[中]为请求的targetSize和type创建适当的ImgFactory。如果类型是NativeType,则使用#getArrayOrCellImgFactory(维度,NativeType);如果不是,则返回ListImgFactory。

代码示例

代码示例来源:origin: net.imagej/imagej-common

private <T> ImgFactory<T> imgFactory(
    final RandomAccessibleInterval<T> rai)
  {
    final T type = Util.getTypeFromInterval(rai);
    return Util.getSuitableImgFactory(rai, type);
  }
}

代码示例来源:origin: net.imglib2/imglib2-algorithm-gpl

/**
 * Contructor of ExplicitDiffusionScheme, calls contructor
 * {@code ExplicitDiffusionScheme(RandomAccessibleInterval<T>,
 * RandomAccessibleInterval<FloatType>, ImgFactory<FloatType>)} and uses a default
 * {@code ArrayImgFactory<FloatType>} or {@code CellImgFactory<FloatType>} as third parameter
 * (depends on size of input).
 * @param input the input Img
 * @param D the diffusion tensor
 */
public ExplicitDiffusionScheme( final RandomAccessibleInterval< T > input, final RandomAccessibleInterval< FloatType > D ) 
{
  this( input, D, Util.getSuitableImgFactory( input, new FloatType() ) );
}

代码示例来源:origin: net.imglib2/imglib2-algorithm-gpl

/**
 * 
 * @param input
 * @param doDimension
 * @deprecated Use
 *             {@link #Gradient(RandomAccessibleInterval, ImgFactory, boolean[])}
 *             instead and define a imgFactory for the output.
 */
@Deprecated
public Gradient( final Img< T > input, final boolean[] doDimension )
{
  this( input, Util.getSuitableImgFactory( input, new FloatType() ), doDimension );
}

代码示例来源:origin: net.imglib2/imglib2-algorithm-gpl

public IsotropicDiffusionTensor(final long[] dimensions, float val) {
  this.dimensions = dimensions;
  this.val = val;
  // Instantiate tensor holder, and initialize cursors
  long[] tensorDims = new long[dimensions.length + 1];
  for (int i = 0; i < dimensions.length; i++) {
    tensorDims[i] = dimensions[i];
  }
  tensorDims[dimensions.length] = dimensions.length * (dimensions.length - 1);
  ImgFactory< FloatType > factory = Util.getSuitableImgFactory( new FinalDimensions( dimensions ), new FloatType() );
  this.D = factory.create( tensorDims );
}

代码示例来源:origin: net.imglib2/imglib2-algorithm-gpl

private static ImgFactory< FloatType > chooseFactory( Img< ? > input )
{
  try
  {
    return input.factory().imgFactory( new FloatType() );
  }
  catch ( IncompatibleTypeException e )
  {
    return Util.getSuitableImgFactory( input, new FloatType() );
  }
}

代码示例来源:origin: net.imglib2/imglib2-algorithm-gpl

/**
 * This method creates an {@link ImgFactory} of {@link FloatType} for a given {@link Img}. If the {@link ImgFactory} of the
 * given {@link Img} is not compatible with {@link FloatType} it returns an {@link ArrayImgFactory} or a {@link CellImgFactory}
 * depending on the size of the {@link Img}
 * 
 * @param img - the input {@link Img}
 * @return a factory for {@link FloatType}
 */
private static final < T extends Type< T > > ImgFactory< FloatType > getFloatImgFactory( final Img< T > img )
{
  ImgFactory< FloatType > factory;
  
  try 
  {
    factory = img.factory().imgFactory( new FloatType() );
  } 
  catch (IncompatibleTypeException e) 
  {
    factory = Util.getSuitableImgFactory( img, new FloatType() );
  }
  
  return factory;
}

代码示例来源:origin: imagej/imagej-ops

final ShuffledView<T> shuffled = new ShuffledView<>(trimmedImage1,
Img<T> buffer = Util.getSuitableImgFactory(shuffled, type1).create(
  shuffled);
for (int i = 0; i < count; i++) {

代码示例来源:origin: net.imglib2/imglib2-algorithm

public static < T extends BooleanType< T > > void spur( final RandomAccessible< T > source, final IterableInterval< T > target )
{
  final T extendedVal = target.firstElement().createVariable();
  extendedVal.set( false );
  final ImgFactory< T > factory = Util.getSuitableImgFactory( target, extendedVal );
  final Img< T > temp = factory.create( target );
  new Spur1().calculate( source, temp );
  new Spur2().calculate( temp, target );
}

代码示例来源:origin: net.imglib2/imglib2-algorithm

public static < T extends BooleanType< T > > void thin( final RandomAccessible< T > source, final IterableInterval< T > target )
{
  final T extendedVal = target.firstElement().createVariable();
  extendedVal.set( false );
  final ImgFactory< T > factory = Util.getSuitableImgFactory( target, extendedVal );
  final Img< T > temp = factory.create( target );
  new Thin1().calculate( source, temp );
  new Thin2().calculate( temp, target );
}

代码示例来源:origin: net.imglib2/imglib2-script

/**
 * 
 * @param nBins The desired number of bins.
 * @param numDimensions The dimensions of the image region from which the histogram is computed.
 * @param min The minimum value, from which the first bin starts; all values under min will be added to the first bin.
 * @param max The maximum value, at which the last bin ends; all values over max will be added to the last bin.
 * @param op The type in which operations will be computed.
 */
public Histogram(
    final int nBins,
    final int numDimensions,
    final T min,
    final T max)
{
  this.bins = new long[nBins];
  this.maxPositions = new long[numDimensions];
  this.minPositions = new long[numDimensions];
  this.min = min;
  this.max = max;
  //
  this.range = min.createVariable();
  this.range.set(max);
  this.range.sub(min);
  //
  final Dimensions dims = new FinalDimensions( nBins );
  this.binValues = Util.getSuitableImgFactory( dims, min ).create( dims );
  this.accessBinValues = this.binValues.randomAccess();
}

代码示例来源:origin: net.imglib2/imglib2-algorithm

final ImgFactory< T > factory = Util.getSuitableImgFactory( interval, minVal );
final Img< T > img = factory.create( interval );
final long[] min = new long[ interval.numDimensions() ];

代码示例来源:origin: net.imglib2/imglib2-algorithm

final ImgFactory< T > factory = Util.getSuitableImgFactory( interval, minVal );
final Img< T > img = factory.create( interval );
final long[] min = new long[ interval.numDimensions() ];

代码示例来源:origin: net.imglib2/imglib2-algorithm

final ImgFactory< T > factory = Util.getSuitableImgFactory( interval, maxVal );
final Img< T > img = factory.create( interval );
final long[] min = new long[ interval.numDimensions() ];

代码示例来源:origin: net.imglib2/imglib2-algorithm

final ImgFactory< T > factory = Util.getSuitableImgFactory( interval, minVal );
final Img< T > img = factory.create( interval );
final long[] min = new long[ interval.numDimensions() ];

代码示例来源:origin: net.imglib2/imglib2-algorithm

final ImgFactory< T > factory = Util.getSuitableImgFactory( interval, minVal );
final Img< T > img = factory.create( interval );
final long[] min = new long[ interval.numDimensions() ];

代码示例来源:origin: net.imglib2/imglib2-algorithm

final ImgFactory< T > factory = Util.getSuitableImgFactory( interval, minVal );
final Img< T > img = factory.create( interval );
final long[] min = new long[ interval.numDimensions() ];

代码示例来源:origin: net.imglib2/imglib2-algorithm

final ImgFactory< T > factory = Util.getSuitableImgFactory( interval, minVal );
final Img< T > img = factory.create( interval );
final long[] min = new long[ interval.numDimensions() ];

代码示例来源:origin: net.imglib2/imglib2-algorithm

final ImgFactory< T > factory = Util.getSuitableImgFactory( interval, maxVal );
final Img< T > img = factory.create( interval );
final long[] min = new long[ interval.numDimensions() ];

代码示例来源:origin: net.imglib2/imglib2-algorithm

final ImgFactory< T > factory = Util.getSuitableImgFactory( target, maxVal );
final Img< T > img = factory.create( target );
final long[] min = new long[ target.numDimensions() ];

代码示例来源:origin: net.imglib2/imglib2-algorithm

final ExtendedRandomAccessibleInterval< T, RandomAccessibleInterval< T >> extended = Views.extendValue( source, minVal );
final ImgFactory< T > factory = Util.getSuitableImgFactory( interval, minVal );
final Img< T > img = factory.create( interval );
final long[] min = new long[ interval.numDimensions() ];

相关文章