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

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

本文整理了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

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

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

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

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

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

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

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

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

  1. /**
  2. * Compose a list of same {@link Interval} and same {@link Type} A
  3. * {@link RandomAccessibleInterval RandomAccessibleIntervals} into a
  4. * {@link RandomAccessibleInterval} of some target {@link Type} B using a
  5. * {@link Converter} from {@link Composite} of A to B.
  6. *
  7. * @param components
  8. * @param composer
  9. * @param targetType
  10. * @return
  11. */
  12. final static public < A, B extends Type< B > > RandomAccessibleInterval< B > compose(
  13. final List< RandomAccessibleInterval< A > > components,
  14. final Converter< Composite< A >, B > composer,
  15. final B targetType )
  16. {
  17. return convert(
  18. Views.collapse( Views.stack( components ) ),
  19. composer,
  20. targetType );
  21. }

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

  1. /**
  2. * Compose a list of same {@link Interval} and same {@link Type} A
  3. * {@link RandomAccessibleInterval RandomAccessibleIntervals} into a
  4. * {@link RandomAccessibleInterval} of some target {@link Type} B using a
  5. * {@link Converter} from {@link Composite} of A to B.
  6. *
  7. * @param components
  8. * @param composer
  9. * @param targetType
  10. * @return
  11. */
  12. final static public < A, B extends Type< B > > RandomAccessibleInterval< B > compose(
  13. final List< RandomAccessibleInterval< A > > components,
  14. final Converter< Composite< A >, B > composer,
  15. final B targetType )
  16. {
  17. return convert(
  18. Views.collapse( Views.stack( components ) ),
  19. composer,
  20. targetType );
  21. }

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

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

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

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

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

  1. @SuppressWarnings({ "unchecked", "rawtypes" })
  2. @Override
  3. public void compute(final RandomAccessibleInterval<I> input,
  4. final IterableInterval<BitType> output)
  5. {
  6. final List<RandomAccessibleInterval<RealType>> listOfIntegralImages =
  7. new ArrayList<>();
  8. for (final int order : requiredIntegralImages()) {
  9. final RandomAccessibleInterval<RealType> requiredIntegralImg =
  10. getIntegralImage(input, order);
  11. listOfIntegralImages.add(requiredIntegralImg);
  12. }
  13. // Composite image of integral images of order 1 and 2
  14. final RandomAccessibleInterval<RealType> stacked = Views.stack(
  15. listOfIntegralImages);
  16. final RandomAccessibleInterval<? extends Composite<RealType>> compositeRAI =
  17. Views.collapse(stacked);
  18. final RandomAccessibleInterval<? extends Composite<RealType>> extendedCompositeRAI =
  19. removeLeadingZeros(compositeRAI);
  20. final NeighborhoodsIterableInterval<? extends Composite<RealType>> neighborhoods =
  21. shape.neighborhoodsSafe(extendedCompositeRAI);
  22. if (map == null) {
  23. map = (BinaryComputerOp) ops().op(Map.class, out(), in(), neighborhoods,
  24. filterOp);
  25. }
  26. map.compute(input, neighborhoods, output);
  27. }

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

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

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

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

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

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

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

  1. @Test
  2. public void collapseRAITest() {
  3. Img<DoubleType> img = new ArrayImgFactory<DoubleType>().create(new int[] { 10, 10, 10 }, new DoubleType());
  4. CompositeIntervalView<DoubleType, ? extends GenericComposite<DoubleType>> il2 = Views
  5. .collapse((RandomAccessibleInterval<DoubleType>) img);
  6. CompositeIntervalView<DoubleType, ? extends GenericComposite<DoubleType>> opr = ops.transform()
  7. .collapseView((RandomAccessibleInterval<DoubleType>) img);
  8. assertEquals(il2.numDimensions(), opr.numDimensions());
  9. }
  10. }

相关文章