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

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

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

public static < T > RandomAccessibleInterval< T > translateIfNecessary( final Interval original, final RandomAccessibleInterval< T > copy )
{
  if ( Views.isZeroMin( original ) )
  {
    return copy;
  }
  else
  {
    final long[] min = new long[ original.numDimensions() ];
    original.min( min );
    return Views.translate( copy, min );
  }
}

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

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

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

public static < T extends Type< T > > Img< T > copyImgNoTranslation(
    final RandomAccessibleInterval< T > input,
    final ImgFactory< T > factory,
    final T type,
    final ExecutorService service,
    final boolean showProgress  )
{
  final RandomAccessibleInterval< T > in;
  if ( Views.isZeroMin( input ) )
    in = input;
  else
    in = Views.zeroMin( input );
  final long[] dim = new long[ in.numDimensions() ];
  in.dimensions( dim );
  final Img< T > tImg = factory.create( dim, type );
  // copy the virtual construct into an actual image
  copyImg( in, tImg, service, showProgress );
  return tImg;
}

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

this.psf = new DeconViewPSF( kernel, psfType );
if ( Views.isZeroMin( image ) )
  this.image = image;
else
  this.image = Views.zeroMin( image );
if ( Views.isZeroMin( weight ) )
  this.weight = weight;
else

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

public void setMinMax ( final RandomAccessibleInterval< S > source, final Converter< S, FloatType > converter )
  {
    final RandomAccessibleIntervalCursor< S > cursor = new RandomAccessibleIntervalCursor< S >( Views.isZeroMin( source ) ? source : Views.zeroMin( source ) );
    final FloatType t = new FloatType();

    if ( cursor.hasNext() )
    {
      converter.convert( cursor.next(), t );

      float min = t.get();
      float max = min;

      while ( cursor.hasNext() )
      {
        converter.convert( cursor.next(), t );
        final float value = t.get();

        if ( value < min )
          min = value;

        if ( value > max )
          max = value;
      }

      System.out.println("fmax = " + max );
      System.out.println("fmin = " + min );
      imageProcessor.setMinAndMax( min, max );
    }
  }
}

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

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

    IntervalView<DoubleType> imgTranslated = Views.interval(
        Views.translate((RandomAccessible<DoubleType>) img, 2, 5), new long[] { 2, 5 }, new long[] { 12, 15 });

    IntervalView<DoubleType> il2 = Views.zeroMin(imgTranslated);
    IntervalView<DoubleType> opr = ops.transform().zeroMinView(imgTranslated);

    assertTrue(Views.isZeroMin(il2) == Views.isZeroMin(opr));
  }
}

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

if ( Views.isZeroMin( input ) )
  in = input;
else

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

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

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

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

相关文章