net.imglib2.view.Views.collapse()方法的使用及代码示例

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

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

Views.collapse介绍

[英]Collapse the nth dimension of an n -dimensional RandomAccessible<T> into an (n -1)-dimensional RandomAccessible< GenericComposite<T>>
[中]将n维RandomAccessible<T>的nth维折叠为(n-1)维RandomAccessible<GenericComposite<T>>

代码示例

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

@Override
public CompositeView<T, ? extends GenericComposite<T>> calculate(RandomAccessible<T> input) {
  return Views.collapse(input);
}

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

@Override
public CompositeIntervalView<T, ? extends GenericComposite<T>> calculate(RandomAccessibleInterval<T> input) {
  return Views.collapse(input);
}

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

/**
 * Create an <em>n</em>-dimensional color image from an
 * (<em>n</em>+1)-dimensional image of {@link UnsignedByteType}.
 * @param source The last dimension of the image must be the color channel.
 *               {@link Views#stack} could be used to create the source, if
 *               there is a separate image for each color channel.
 * @param channelOrder Order of the color channels.
 * @return Color view to the source image that can be used for reading and writing.
 */
final static public RandomAccessible< ARGBType > mergeARGB( final RandomAccessible< UnsignedByteType > source, ColorChannelOrder channelOrder ) {
  return Converters.convert( Views.collapse( source ), new CompositeARGBSamplerConverter( channelOrder ) );
}

代码示例来源:origin: imglib/imglib2

/**
 * Create an <em>n</em>-dimensional color image from an
 * (<em>n</em>+1)-dimensional image of {@link UnsignedByteType}.
 * @param source The last dimension of the image must be the color channel.
 *               {@link Views#stack} could be used to create the source, if
 *               there is a separate image for each color channel.
 * @param channelOrder Order of the color channels.
 * @return Color view to the source image that can be used for reading and writing.
 */
final static public RandomAccessible< ARGBType > mergeARGB( final RandomAccessible< UnsignedByteType > source, ColorChannelOrder channelOrder ) {
  return Converters.convert( Views.collapse( source ), new CompositeARGBSamplerConverter( channelOrder ) );
}

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

/**
 * Compose a list of same {@link Interval} and same {@link Type} A
 * {@link RandomAccessibleInterval RandomAccessibleIntervals} into a
 * {@link RandomAccessibleInterval} of some target {@link Type} B using a
 * {@link Converter} from {@link Composite} of A to B.
 *
 * @param components
 * @param composer
 * @param targetType
 * @return
 */
final static public < A, B extends Type< B > > RandomAccessibleInterval< B > compose(
    final List< RandomAccessibleInterval< A > > components,
    final Converter< Composite< A >, B > composer,
    final B targetType )
{
  return convert(
      Views.collapse( Views.stack( components ) ),
      composer,
      targetType );
}

代码示例来源:origin: imglib/imglib2

/**
 * Compose a list of same {@link Interval} and same {@link Type} A
 * {@link RandomAccessibleInterval RandomAccessibleIntervals} into a
 * {@link RandomAccessibleInterval} of some target {@link Type} B using a
 * {@link Converter} from {@link Composite} of A to B.
 *
 * @param components
 * @param composer
 * @param targetType
 * @return
 */
final static public < A, B extends Type< B > > RandomAccessibleInterval< B > compose(
    final List< RandomAccessibleInterval< A > > components,
    final Converter< Composite< A >, B > composer,
    final B targetType )
{
  return convert(
      Views.collapse( Views.stack( components ) ),
      composer,
      targetType );
}

代码示例来源:origin: imglib/imglib2

/**
 * Create an <em>n</em>-dimensional color image from an
 * (<em>n</em>+1)-dimensional image of {@link UnsignedByteType}.
 * @param source The last dimension of the image must be the color channel.
 *               {@link Views#stack} could be used to create the source, if
 *               there is a separate image for each color channel.
 * @param channelOrder Order of the color channels.
 * @return Color view to the source image that can be used for reading and writing.
 */
final static public RandomAccessibleInterval< ARGBType > mergeARGB( final RandomAccessibleInterval< UnsignedByteType > source, ColorChannelOrder channelOrder ) {
  final int channelAxis = source.numDimensions() - 1;
  if ( source.min( channelAxis ) > 0 || source.max( channelAxis ) < channelOrder.channelCount() - 1 )
    throw new IllegalArgumentException();
  return Converters.convert( Views.collapse( source ), new CompositeARGBSamplerConverter( channelOrder ) );
}

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

/**
 * Create an <em>n</em>-dimensional color image from an
 * (<em>n</em>+1)-dimensional image of {@link UnsignedByteType}.
 * @param source The last dimension of the image must be the color channel.
 *               {@link Views#stack} could be used to create the source, if
 *               there is a separate image for each color channel.
 * @param channelOrder Order of the color channels.
 * @return Color view to the source image that can be used for reading and writing.
 */
final static public RandomAccessibleInterval< ARGBType > mergeARGB( final RandomAccessibleInterval< UnsignedByteType > source, ColorChannelOrder channelOrder ) {
  final int channelAxis = source.numDimensions() - 1;
  if ( source.min( channelAxis ) > 0 || source.max( channelAxis ) < channelOrder.channelCount() - 1 )
    throw new IllegalArgumentException();
  return Converters.convert( Views.collapse( source ), new CompositeARGBSamplerConverter( channelOrder ) );
}

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

@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public void compute(final RandomAccessibleInterval<I> input,
  final IterableInterval<BitType> output)
{
  final List<RandomAccessibleInterval<RealType>> listOfIntegralImages =
    new ArrayList<>();
  for (final int order : requiredIntegralImages()) {
    final RandomAccessibleInterval<RealType> requiredIntegralImg =
      getIntegralImage(input, order);
    listOfIntegralImages.add(requiredIntegralImg);
  }
  // Composite image of integral images of order 1 and 2
  final RandomAccessibleInterval<RealType> stacked = Views.stack(
    listOfIntegralImages);
  final RandomAccessibleInterval<? extends Composite<RealType>> compositeRAI =
    Views.collapse(stacked);
  final RandomAccessibleInterval<? extends Composite<RealType>> extendedCompositeRAI =
    removeLeadingZeros(compositeRAI);
  final NeighborhoodsIterableInterval<? extends Composite<RealType>> neighborhoods =
    shape.neighborhoodsSafe(extendedCompositeRAI);
  if (map == null) {
    map = (BinaryComputerOp) ops().op(Map.class, out(), in(), neighborhoods,
      filterOp);
  }
  map.compute(input, neighborhoods, output);
}

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

listDerivs1.add(deriv1);
derivative0 = Converters.convert(Views.collapse(Views.stack(listDerivs0)), converterGetMax,
    new FloatType());
derivative1 = Converters.convert(Views.collapse(Views.stack(listDerivs1)), converterGetMax,
    new FloatType());

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

@Test
public void collapseRATest() {
  Img<DoubleType> img = new ArrayImgFactory<DoubleType>().create(new int[] { 10, 10, 10 }, new DoubleType());
  CompositeView<DoubleType, ? extends GenericComposite<DoubleType>> il2 = Views
      .collapse((RandomAccessible<DoubleType>) img);
  CompositeView<DoubleType, ? extends GenericComposite<DoubleType>> opr = ops.transform()
      .collapseView((RandomAccessible<DoubleType>) img);
  assertEquals(il2.numDimensions(), opr.numDimensions());
}

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

@Test
public void defaultCollapseTest() {
  Img<DoubleType> img = new ArrayImgFactory<DoubleType>().create(new int[] { 10, 10 },
      new DoubleType());
  CompositeIntervalView<DoubleType, ? extends GenericComposite<DoubleType>> il2 = Views
      .collapse(img);
  CompositeIntervalView<DoubleType, ? extends GenericComposite<DoubleType>> opr = ops.transform()
      .collapseView(img);
  assertEquals(il2.numDimensions(), opr.numDimensions());
}

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

@Test
  public void collapseRAITest() {

    Img<DoubleType> img = new ArrayImgFactory<DoubleType>().create(new int[] { 10, 10, 10 }, new DoubleType());

    CompositeIntervalView<DoubleType, ? extends GenericComposite<DoubleType>> il2 = Views
        .collapse((RandomAccessibleInterval<DoubleType>) img);

    CompositeIntervalView<DoubleType, ? extends GenericComposite<DoubleType>> opr = ops.transform()
        .collapseView((RandomAccessibleInterval<DoubleType>) img);

    assertEquals(il2.numDimensions(), opr.numDimensions());
  }
}

相关文章