/** * Given an IntegerType, returns a new Type containing its minimum possible * value. * @param <R> the IntegerType in question. * @param r a representative Type object. * @return a new Type containing its minimum possible * value. */ private static <R extends IntegerType<R>> R minType(R r) { R type = r.createVariable(); type.setReal(r.getMinValue()); return type; }
/** * Given an IntegerType, returns a new Type containing its maximum possible * value. * @param <R> the IntegerType in question. * @param r a representative Type object. * @return a new Type containing its maximum possible * value. */ private static <R extends IntegerType<R>> R maxType(R r) { R type = r.createVariable(); type.setReal(r.getMaxValue()); return type; }
/** * Given an IntegerType, returns a new Type containing its minimum possible * value. * * @param <R> * the IntegerType in question. * @param r * a representative Type object. * @return a new Type containing its minimum possible value. */ private static < R extends IntegerType< R >> R minType( final R r ) { final R type = r.createVariable(); type.setReal( r.getMinValue() ); return type; }
/** * Given an IntegerType, returns a new Type containing its maximum possible * value. * * @param <R> * the IntegerType in question. * @param r * a representative Type object. * @return a new Type containing its maximum possible value. */ private static < R extends IntegerType< R >> R maxType( final R r ) { final R type = r.createVariable(); type.setReal( r.getMaxValue() ); return type; }
private Img< T > createImage( final T type, final int max ) { final ImgFactory< T > imFactory = new ArrayImgFactory<>( type ); final Img< T > img = imFactory.create( DIMS ); // populate image with random samples for ( final T t : img ) t.setReal( max * Math.random() ); return img; }
for ( int i = 0; i < max; i++ ) val.setReal( i ); final long binPos = hist.map( val ); final long actual = hist.frequency( binPos );