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

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

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

Views.isZeroMin介绍

[英]test whether the source interval starts at (0,0,...,0)
[中]测试震源间隔是否从(0,0,…,0)开始

代码示例

代码示例来源:origin: net.preibisch/multiview-reconstruction

  1. public static < T > RandomAccessibleInterval< T > translateIfNecessary( final Interval original, final RandomAccessibleInterval< T > copy )
  2. {
  3. if ( Views.isZeroMin( original ) )
  4. {
  5. return copy;
  6. }
  7. else
  8. {
  9. final long[] min = new long[ original.numDimensions() ];
  10. original.min( min );
  11. return Views.translate( copy, min );
  12. }
  13. }

代码示例来源:origin: net.preibisch/multiview-reconstruction

  1. /**
  2. * get the highest index in dimension dim where a hyperslice of img in that dimension contains nonzero values.
  3. * NB: the result is in local image coordinates (i.e. we zero-min the input)
  4. * @param img the input image
  5. * @param dim the dimension along which to check
  6. * @param <T> pixel type
  7. * @return the highest index with nonzero pixels
  8. */
  9. public static <T extends RealType< T >> long getMaxNonzero(RandomAccessibleInterval< T > img, int dim)
  10. {
  11. final RandomAccessibleInterval< T > imgLocal = Views.isZeroMin( img ) ? img :Views.zeroMin( img );
  12. long i = imgLocal.dimension( dim ) - 1;
  13. for (; i >= 0; i--)
  14. {
  15. if (isNonezero( Views.hyperSlice( imgLocal, dim, i ) ))
  16. return i;
  17. }
  18. return 0l;
  19. }

代码示例来源:origin: net.preibisch/multiview-reconstruction

  1. public static < T extends Type< T > > Img< T > copyImgNoTranslation(
  2. final RandomAccessibleInterval< T > input,
  3. final ImgFactory< T > factory,
  4. final T type,
  5. final ExecutorService service,
  6. final boolean showProgress )
  7. {
  8. final RandomAccessibleInterval< T > in;
  9. if ( Views.isZeroMin( input ) )
  10. in = input;
  11. else
  12. in = Views.zeroMin( input );
  13. final long[] dim = new long[ in.numDimensions() ];
  14. in.dimensions( dim );
  15. final Img< T > tImg = factory.create( dim, type );
  16. // copy the virtual construct into an actual image
  17. copyImg( in, tImg, service, showProgress );
  18. return tImg;
  19. }

代码示例来源:origin: net.preibisch/multiview-reconstruction

  1. this.psf = new DeconViewPSF( kernel, psfType );
  2. if ( Views.isZeroMin( image ) )
  3. this.image = image;
  4. else
  5. this.image = Views.zeroMin( image );
  6. if ( Views.isZeroMin( weight ) )
  7. this.weight = weight;
  8. else

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

  1. public void setMinMax ( final RandomAccessibleInterval< S > source, final Converter< S, FloatType > converter )
  2. {
  3. final RandomAccessibleIntervalCursor< S > cursor = new RandomAccessibleIntervalCursor< S >( Views.isZeroMin( source ) ? source : Views.zeroMin( source ) );
  4. final FloatType t = new FloatType();
  5. if ( cursor.hasNext() )
  6. {
  7. converter.convert( cursor.next(), t );
  8. float min = t.get();
  9. float max = min;
  10. while ( cursor.hasNext() )
  11. {
  12. converter.convert( cursor.next(), t );
  13. final float value = t.get();
  14. if ( value < min )
  15. min = value;
  16. if ( value > max )
  17. max = value;
  18. }
  19. System.out.println("fmax = " + max );
  20. System.out.println("fmin = " + min );
  21. imageProcessor.setMinAndMax( min, max );
  22. }
  23. }
  24. }

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

  1. @Test
  2. public void defaultZeroMinTest() {
  3. Img<DoubleType> img = new ArrayImgFactory<DoubleType>().create(new int[] { 10, 10 }, new DoubleType());
  4. IntervalView<DoubleType> imgTranslated = Views.interval(
  5. Views.translate((RandomAccessible<DoubleType>) img, 2, 5), new long[] { 2, 5 }, new long[] { 12, 15 });
  6. IntervalView<DoubleType> il2 = Views.zeroMin(imgTranslated);
  7. IntervalView<DoubleType> opr = ops.transform().zeroMinView(imgTranslated);
  8. assertTrue(Views.isZeroMin(il2) == Views.isZeroMin(opr));
  9. }
  10. }

代码示例来源:origin: net.preibisch/multiview-reconstruction

  1. if ( Views.isZeroMin( input ) )
  2. in = input;
  3. else

代码示例来源:origin: net.preibisch/multiview-reconstruction

  1. if ( Views.isZeroMin( psfIn ) )
  2. psf = Views.iterable( psfIn );
  3. else

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

  1. this.projector = new XYProjector< S, T >( Views.isZeroMin( source ) ? source : Views.zeroMin( source ), img, converter );

相关文章