Java Code Examples for net.imglib2.Cursor#next()

The following examples show how to use net.imglib2.Cursor#next() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SubsampleViewTest.java    From imagej-ops with BSD 2-Clause "Simplified" License 6 votes vote down vote up
@Test
public void defaultSubsampleStepsTest() {
	Img<DoubleType> img = new ArrayImgFactory<DoubleType>().create(new int[] { 10, 10 }, new DoubleType());
	MersenneTwisterFast r = new MersenneTwisterFast(SEED);
	for (DoubleType d : img) {
		d.set(r.nextDouble());
	}

	SubsampleView<DoubleType> il2 = Views.subsample((RandomAccessible<DoubleType>) img, 2, 1);
	SubsampleView<DoubleType> opr = ops.transform().subsampleView(img, 2, 1);

	Cursor<DoubleType> il2C = Views.interval(il2, new long[] { 0, 0 }, new long[] { 4, 9 }).localizingCursor();
	RandomAccess<DoubleType> oprRA = opr.randomAccess();

	while (il2C.hasNext()) {
		il2C.next();
		oprRA.setPosition(il2C);
		assertEquals(il2C.get().get(), oprRA.get().get(), 1e-10);
	}
}
 
Example 2
Source File: PermuteViewTest.java    From imagej-ops with BSD 2-Clause "Simplified" License 6 votes vote down vote up
@Test
public void defaultPermuteCoordinatesInverseTest() {
	Img<DoubleType> img = new ArrayImgFactory<DoubleType>().create(new int[]{2, 2}, new DoubleType());
	Cursor<DoubleType> c = img.cursor();
	MersenneTwisterFast r = new MersenneTwisterFast(SEED);
	while (c.hasNext()) {
		c.next().set(r.nextDouble());
	}
	Cursor<DoubleType> il2 = Views.permuteCoordinatesInverse(img, new int[]{0, 1}).cursor();
	RandomAccess<DoubleType> opr = ops.transform().permuteCoordinatesInverseView(img, new int[]{0, 1}).randomAccess();
	
	while (il2.hasNext()) {
		il2.next();
		opr.setPosition(il2);
		assertEquals(il2.get().get(), opr.get().get(), 1e-10);
	}
}
 
Example 3
Source File: PermuteViewTest.java    From imagej-ops with BSD 2-Clause "Simplified" License 6 votes vote down vote up
@Test
public void permuteCoordinatesOfDimensionTest() {
	Img<DoubleType> img = new ArrayImgFactory<DoubleType>().create(new int[]{2, 2}, new DoubleType());
	Cursor<DoubleType> c = img.cursor();
	MersenneTwisterFast r = new MersenneTwisterFast(SEED);
	while (c.hasNext()) {
		c.next().set(r.nextDouble());
	}
	Cursor<DoubleType> il2 = Views.permuteCoordinates(img, new int[]{0, 1}, 1).cursor();
	RandomAccess<DoubleType> opr = ops.transform().permuteCoordinatesView(img, new int[]{0, 1}, 1).randomAccess();
	
	while (il2.hasNext()) {
		il2.next();
		opr.setPosition(il2);
		assertEquals(il2.get().get(), opr.get().get(), 1e-10);
	}
	
}
 
Example 4
Source File: PermuteViewTest.java    From imagej-ops with BSD 2-Clause "Simplified" License 6 votes vote down vote up
@Test
public void defaultPermuteCoordinatesTest() {
	Img<DoubleType> img = new ArrayImgFactory<DoubleType>().create(new int[]{2, 2}, new DoubleType());
	Cursor<DoubleType> c = img.cursor();
	MersenneTwisterFast r = new MersenneTwisterFast(SEED);
	while (c.hasNext()) {
		c.next().set(r.nextDouble());
	}
	Cursor<DoubleType> il2 = Views.permuteCoordinates(img, new int[]{0, 1}).cursor();
	RandomAccess<DoubleType> opr = ops.transform().permuteCoordinatesView(img, new int[]{0, 1}).randomAccess();
	
	while (il2.hasNext()) {
		il2.next();
		opr.setPosition(il2);
		assertEquals(il2.get().get(), opr.get().get(), 1e-10);
	}
	
}
 
Example 5
Source File: SubsampleViewTest.java    From imagej-ops with BSD 2-Clause "Simplified" License 6 votes vote down vote up
@Test
public void testIntervalSubsampleSteps() {
	Img<DoubleType> img = ArrayImgs.doubles(10,10);
	MersenneTwisterFast r = new MersenneTwisterFast(SEED);
	for (DoubleType d : img) {
		d.set(r.nextDouble());
	}

	SubsampleIntervalView<DoubleType> expected = Views.subsample((RandomAccessibleInterval<DoubleType>) img, 2, 1);
	SubsampleIntervalView<DoubleType> actual = (SubsampleIntervalView<DoubleType>) ops.transform().subsampleView((RandomAccessibleInterval<DoubleType>)img, 2, 1);

	Cursor<DoubleType> il2C = Views.interval(expected, new long[] { 0, 0 }, new long[] { 4, 9 }).localizingCursor();
	RandomAccess<DoubleType> oprRA = actual.randomAccess();

	while (il2C.hasNext()) {
		il2C.next();
		oprRA.setPosition(il2C);
		assertEquals(il2C.get().get(), oprRA.get().get(), 1e-10);
	}
	
	assertTrue(Intervals.equals(expected, actual));
}
 
Example 6
Source File: SubsampleViewTest.java    From imagej-ops with BSD 2-Clause "Simplified" License 6 votes vote down vote up
@Test
public void testIntervalSubsample() {
	Img<DoubleType> img = ArrayImgs.doubles(10, 10);
	MersenneTwisterFast r = new MersenneTwisterFast(SEED);
	for (DoubleType d : img) {
		d.set(r.nextDouble());
	}

	SubsampleIntervalView<DoubleType> expected = Views.subsample((RandomAccessibleInterval<DoubleType>) img, 2);
	SubsampleIntervalView<DoubleType> actual = (SubsampleIntervalView<DoubleType>) ops.transform().subsampleView((RandomAccessibleInterval<DoubleType>)img, 2);

	Cursor<DoubleType> il2C = Views.interval(expected, new long[] { 0, 0 }, new long[] { 4, 4 }).localizingCursor();
	RandomAccess<DoubleType> oprRA = actual.randomAccess();

	while (il2C.hasNext()) {
		il2C.next();
		oprRA.setPosition(il2C);
		assertEquals(il2C.get().get(), oprRA.get().get(), 1e-10);
	}
	
	assertTrue(Intervals.equals(expected, actual));
}
 
Example 7
Source File: RasterViewTest.java    From imagej-ops with BSD 2-Clause "Simplified" License 6 votes vote down vote up
@Test
public void defaultRasterTest() {
	Img<DoubleType> img = new ArrayImgFactory<DoubleType>().create(new int[]{10,  10}, new DoubleType());
	MersenneTwisterFast r = new MersenneTwisterFast(SEED);
	for (DoubleType d : img) {
		d.set(r.nextDouble());
	}
	RealRandomAccessible<DoubleType> realImg = Views.interpolate(img, new FloorInterpolatorFactory<DoubleType>());
	
	RandomAccessibleOnRealRandomAccessible<DoubleType> il2 = Views.raster(realImg);
	RandomAccessibleOnRealRandomAccessible<DoubleType> opr = ops.transform().rasterView(realImg);
	
	Cursor<DoubleType> il2C = Views.interval(il2, img).localizingCursor();
	RandomAccess<DoubleType> oprRA = Views.interval(opr, img).randomAccess();
	
	while (il2C.hasNext()) {
		il2C.next();
		oprRA.setPosition(il2C);
		assertEquals(il2C.get().get(), oprRA.get().get(), 1e-10);
	}
}
 
Example 8
Source File: LinearIntensityMap.java    From TrakEM2 with GNU General Public License v3.0 6 votes vote down vote up
final static protected < S extends RealType< S >, T extends RealType< T > > void mapComposite(
		final IterableInterval< RealComposite< S > > image,
		final IterableInterval< RealComposite< T > > coefficients )
{
	final Cursor< RealComposite< S > > cs = image.cursor();
	final Cursor< RealComposite< T > > ct = coefficients.cursor();

	while ( cs.hasNext() )
	{
		final RealComposite< S > c = cs.next();
		final RealComposite< T > t = ct.next();

		for ( final S s : c )
			s.setReal( s.getRealDouble() * t.get( 0 ).getRealDouble() + t.get( 1 ).getRealDouble() );
	}
}
 
Example 9
Source File: IntervalViewTest.java    From imagej-ops with BSD 2-Clause "Simplified" License 6 votes vote down vote up
@Test
public void defaultIntervalTest() {
	
	Img<DoubleType> img = new ArrayImgFactory<DoubleType>().create(new int[]{10, 10}, new DoubleType());
	
	MersenneTwisterFast r = new MersenneTwisterFast(SEED);
	for (DoubleType d : img) {
		d.set(r.nextDouble());
	}
	
	Cursor<DoubleType> il2 = Views.interval(img, img).localizingCursor();
	RandomAccess<DoubleType> opr = ops.transform().intervalView(img, img).randomAccess();

	
	while (il2.hasNext()) {
		DoubleType e = il2.next();
		opr.setPosition(il2);
		
		assertEquals(e.get(), opr.get().get(), 1e-10);
	}
}
 
Example 10
Source File: LocalThresholdTest.java    From imagej-ops with BSD 2-Clause "Simplified" License 5 votes vote down vote up
/**
 * Checks if two {@link IterableInterval} have the same content.
 *
 * @param ii1
 * @param ii2
 */
public static <T extends RealType<T>, S extends RealType<S>> void
	testIterableIntervalSimilarity(IterableInterval<T> ii1,
		IterableInterval<S> ii2)
{
	// Test for pixel-wise equality of the results
	Cursor<T> cursor1 = ii1.localizingCursor();
	Cursor<S> cursor2 = ii2.cursor();
	while (cursor1.hasNext() && cursor2.hasNext()) {
		T value1 = cursor1.next();
		S value2 = cursor2.next();

		assertEquals(value1.getRealDouble(), value2.getRealDouble(), 0.00001d);
	}
}
 
Example 11
Source File: LinearIntensityMap.java    From TrakEM2 with GNU General Public License v3.0 5 votes vote down vote up
final static protected < T extends RealType< T > > void mapARGB(
		final IterableInterval< ARGBType > image,
		final IterableInterval< RealComposite< T > > coefficients )
{
	final Cursor< ARGBType > cs = image.cursor();
	final Cursor< RealComposite< T > > ct = coefficients.cursor();

	while ( cs.hasNext() )
	{
		final RealComposite< T > t = ct.next();
		final double alpha = t.get( 0 ).getRealDouble();
		final double beta = t.get( 1 ).getRealDouble();

		final ARGBType s = cs.next();
		final int argb = s.get();
		final int a = ( ( argb >> 24 ) & 0xff );
		final double r = ( ( argb >> 16 ) & 0xff ) * alpha + beta;
		final double g = ( ( argb >> 8 ) & 0xff ) * alpha + beta;
		final double b = ( argb & 0xff ) * alpha + beta;

		s.set(
				( a << 24 ) |
				( ( r < 0 ? 0 : r > 255 ? 255 : ( int )( r + 0.5 ) ) << 16 ) |
				( ( g < 0 ? 0 : g > 255 ? 255 : ( int )( g + 0.5 ) ) << 8 ) |
				( b < 0 ? 0 : b > 255 ? 255 : ( int )( b + 0.5 ) ) );
	}
}
 
Example 12
Source File: LinearIntensityMap.java    From TrakEM2 with GNU General Public License v3.0 5 votes vote down vote up
final static protected < S extends RealType< S >, T extends RealType< T > > void map(
		final IterableInterval< S > image,
		final IterableInterval< RealComposite< T > > coefficients )
{
	final Cursor< S > cs = image.cursor();
	final Cursor< RealComposite< T > > ct = coefficients.cursor();

	while ( cs.hasNext() )
	{
		final S s = cs.next();
		final RealComposite< T > t = ct.next();
		s.setReal( s.getRealDouble() * t.get( 0 ).getRealDouble() + t.get( 1 ).getRealDouble() );
	}
}
 
Example 13
Source File: FlatIterableViewTest.java    From imagej-ops with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Test
public void defaultFlatIterableTest() {
	Img<DoubleType> img = new ArrayImgFactory<DoubleType>().create(new int[] { 10, 10 }, new DoubleType());

	Cursor<DoubleType> il2 = Views.flatIterable(img).cursor();

	Cursor<DoubleType> opr = ops.transform().flatIterableView(img).cursor();

	while (il2.hasNext()) {
		il2.next();
		opr.next();
		assertEquals(il2.getDoublePosition(0), opr.getDoublePosition(0), 1e-10);
		assertEquals(il2.getDoublePosition(1), opr.getDoublePosition(1), 1e-10);
	}
}
 
Example 14
Source File: DefaultLBP2D.java    From imagej-ops with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@SuppressWarnings("unchecked")
@Override
public void compute(RandomAccessibleInterval<I> input,
	ArrayList<LongType> output)
{
	ArrayList<LongType> numberList = new ArrayList<>();
	RandomAccess<I> raInput = Views.extendZero(input).randomAccess();
	final Cursor<I> cInput = Views.flatIterable(input).cursor();
	final ClockwiseDistanceNeighborhoodIterator<I> cNeigh =
		new ClockwiseDistanceNeighborhoodIterator<>(raInput, distance);

	while (cInput.hasNext()) {
		cInput.next();
		double centerValue = cInput.get().getRealDouble();

		int resultBinaryValue = 0;

		cNeigh.reset();
		while (cNeigh.hasNext()) {
			double nValue = cNeigh.next().getRealDouble();
			int pos = cNeigh.getIndex();
			if (nValue >= centerValue) {
				resultBinaryValue |= (1 << pos);
			}
		}
		numberList.add(new LongType(resultBinaryValue));
	}

	Histogram1d<Integer> hist = histOp.calculate(numberList);
	Iterator<LongType> c = hist.iterator();
	while (c.hasNext()) {
		output.add(new LongType(c.next().get()));
	}

}
 
Example 15
Source File: AddLabelImage.java    From sciview with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Override
public void run() {

    // interpret the current image as a label image and convert it to ImgLabeling

    @SuppressWarnings("unchecked")
    Img<T> labelMap = ( Img<T> ) currentImage.getImgPlus();

    final Dimensions dims = labelMap;
    final IntType t = new IntType();
    final RandomAccessibleInterval<IntType> img = Util.getArrayOrCellImgFactory( dims, t ).create( dims, t );
    ImgLabeling<Integer, IntType> labeling = new ImgLabeling<>( img );

    final Cursor<LabelingType<Integer>> labelCursor = Views.flatIterable( labeling ).cursor();

    for( final T input : Views.flatIterable( labelMap ) ) {
        final LabelingType<Integer> element = labelCursor.next();
        if( input.getRealFloat() != 0 ) {
            element.add( ( int ) input.getRealFloat() );
        }
    }

    // take the regions, process them to meshes and put it in the viewer
    LabelRegions<Integer> labelRegions = new LabelRegions<>( labeling );

    Object[] regionsArr = labelRegions.getExistingLabels().toArray();
    for( int i = 0; i < labelRegions.getExistingLabels().size(); i++ ) {
        LabelRegion<Integer> lr = labelRegions.getLabelRegion( ( Integer ) regionsArr[i] );

        Mesh mesh = ops.geom().marchingCubes( lr );
        sciView.addMesh( mesh );
    }
}
 
Example 16
Source File: LabelIntersectionCellLoader.java    From paintera with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void load(final SingleCellArrayImg<UnsignedByteType, ?> cell) throws Exception
{
	LOG.debug(
			"Populating cell {} {} {}",
			Intervals.minAsLongArray(cell),
			Intervals.maxAsLongArray(cell),
			cell.size()
	         );
	final IntervalView<U> label2Interval        = Views.interval(data2, cell);
	final Cursor<T> label1Cursor                = Views.flatIterable(Views.interval(data1, cell)).cursor();
	final Cursor<U> label2Cursor                = Views.flatIterable(label2Interval).cursor();
	final Cursor<UnsignedByteType> targetCursor = cell.localizingCursor();

	//		cell.forEach( UnsignedByteType::setZero );
	while (targetCursor.hasNext())
	{
		final UnsignedByteType targetType = targetCursor.next();
		final T                label1Type = label1Cursor.next();
		final U                label2Type = label2Cursor.next();
		if (targetType.get() == 0)
		{
			if (check1.test(label1Type) && check2.test(label2Type))
			{
				FloodFill.fill(
						Views.extend(label2Interval, new OutOfBoundsConstantValueFactory<>(extension)),
						Views.extendValue(cell, new UnsignedByteType(1)),
						targetCursor,
						new UnsignedByteType(1),
						new DiamondShape(1),
						(s, t) -> check2.test(s) && t.get() == 0
				              );
			}
		}
	}
}
 
Example 17
Source File: AbstractFeatureTest.java    From imagej-ops with BSD 2-Clause "Simplified" License 5 votes vote down vote up
/**
 * @param dim dimensions of the image
 * @param radii of the ellipse
 * @param offset of the ellipse
 * @return an {@link Img} of {@link BitType} filled with a ellipse
 */
@SuppressWarnings({ "deprecation" })
public Img<UnsignedByteType> getEllipsedBitImage(final long[] dim,
	final double[] radii, final double[] offset)
{

	// create empty bittype image with desired dimensions
	final ArrayImg<UnsignedByteType, ByteArray> img = ArrayImgs.unsignedBytes(
		dim);

	// create ellipse
	final EllipseRegionOfInterest ellipse = new EllipseRegionOfInterest();
	ellipse.setRadii(radii);

	// set origin in the center of image
	final double[] origin = new double[dim.length];
	for (int i = 0; i < dim.length; i++)
		origin[i] = dim[i] / 2;
	ellipse.setOrigin(origin);

	// get iterable intervall and cursor of ellipse
	final IterableInterval<UnsignedByteType> ii = ellipse
		.getIterableIntervalOverROI(img);
	final Cursor<UnsignedByteType> cursor = ii.cursor();

	// fill image with ellipse
	while (cursor.hasNext()) {
		cursor.next();
		cursor.get().set(255);
	}

	return img;
}
 
Example 18
Source File: ProcessIndependentPortion.java    From SPIM_Registration with GNU General Public License v2.0 4 votes vote down vote up
@Override
public String call() throws Exception 
{
	// make the interpolators and get the transformations
	final RealRandomAccess< T > r = Views.interpolate( Views.extendMirrorSingle( img ), interpolatorFactory ).realRandomAccess();
	final int[] imgSize = new int[]{ (int)img.dimension( 0 ), (int)img.dimension( 1 ), (int)img.dimension( 2 ) };

	final Cursor< T > cursor = fusedImg.localizingCursor();
	final float[] s = new float[ 3 ];
	final float[] t = new float[ 3 ];
	
	cursor.jumpFwd( portion.getStartPosition() );
	
	for ( int j = 0; j < portion.getLoopSize(); ++j )
	{
		// move img cursor forward any get the value (saves one access)
		final T v = cursor.next();
		cursor.localize( s );
		
		if ( doDownSampling )
		{
			s[ 0 ] *= downSampling;
			s[ 1 ] *= downSampling;
			s[ 2 ] *= downSampling;
		}
		
		s[ 0 ] += bb.min( 0 );
		s[ 1 ] += bb.min( 1 );
		s[ 2 ] += bb.min( 2 );
		
		transform.applyInverse( t, s );
		
		if ( FusionHelper.intersects( t[ 0 ], t[ 1 ], t[ 2 ], imgSize[ 0 ], imgSize[ 1 ], imgSize[ 2 ] ) )
		{
			r.setPosition( t );
			v.setReal( r.get().getRealFloat() );
		}
	}
	
	return portion + " finished successfully (individual fusion, no weights).";
}
 
Example 19
Source File: ProcessSequentialPortionWeight.java    From SPIM_Registration with GNU General Public License v2.0 4 votes vote down vote up
@Override
public String call() throws Exception 
{
	final int numViews = imgs.size();
	
	// make the interpolators, weights and get the transformations
	final ArrayList< RealRandomAccess< T > > interpolators = new ArrayList< RealRandomAccess< T > >( numViews );
	final ArrayList< RealRandomAccess< FloatType > > weightAccess = new ArrayList< RealRandomAccess< FloatType > >();
	final int[][] imgSizes = new int[ numViews ][ 3 ];
	
	for ( int i = 0; i < numViews; ++i )
	{
		final RandomAccessibleInterval< T > img = imgs.get( i );
		imgSizes[ i ] = new int[]{ (int)img.dimension( 0 ), (int)img.dimension( 1 ), (int)img.dimension( 2 ) };
		
		interpolators.add( Views.interpolate( Views.extendMirrorSingle( img ), interpolatorFactory ).realRandomAccess() );
					
		weightAccess.add( weights.get( i ).realRandomAccess() );
	}

	final Cursor< T > cursor = fusedImg.localizingCursor();
	final Cursor< FloatType > cursorW = weightImg.cursor();

	final float[] s = new float[ 3 ];
	final float[] t = new float[ 3 ];
	
	cursor.jumpFwd( portion.getStartPosition() );
	cursorW.jumpFwd( portion.getStartPosition() );
	
	for ( int j = 0; j < portion.getLoopSize(); ++j )
	{
		// move img cursor forward any get the value (saves one access)
		final T v = cursor.next();
		cursor.localize( s );

		// move weight cursor forward and get the value 
		final FloatType w = cursorW.next();

		if ( doDownSampling )
		{
			s[ 0 ] *= downSampling;
			s[ 1 ] *= downSampling;
			s[ 2 ] *= downSampling;
		}
		
		s[ 0 ] += bb.min( 0 );
		s[ 1 ] += bb.min( 1 );
		s[ 2 ] += bb.min( 2 );
		
		double sum = 0;
		double sumW = 0;
		
		for ( int i = 0; i < numViews; ++i )
		{				
			transforms[ i ].applyInverse( t, s );
			
			if ( FusionHelper.intersects( t[ 0 ], t[ 1 ], t[ 2 ], imgSizes[ i ][ 0 ], imgSizes[ i ][ 1 ], imgSizes[ i ][ 2 ] ) )
			{
				final RealRandomAccess< T > r = interpolators.get( i );
				r.setPosition( t );
				
				final RealRandomAccess< FloatType > weight = weightAccess.get( i );
				weight.setPosition( t );
				
				final double w1 = weight.get().get();
				
				sum += r.get().getRealDouble() * w1;
				sumW += w1;
			}
		}
		
		if ( sumW > 0 )
		{
			v.setReal( v.getRealFloat() + sum );
			w.set( w.get() + (float)sumW );
		}
	}
	
	return portion + " finished successfully (one weight).";
}
 
Example 20
Source File: ProcessSequentialPortion.java    From SPIM_Registration with GNU General Public License v2.0 4 votes vote down vote up
@Override
public String call() throws Exception 
{
	final int numViews = imgs.size();
	
	// make the interpolators and get the transformations
	final ArrayList< RealRandomAccess< T > > interpolators = new ArrayList< RealRandomAccess< T > >( numViews );
	final int[][] imgSizes = new int[ numViews ][ 3 ];
	
	for ( int i = 0; i < numViews; ++i )
	{
		final RandomAccessibleInterval< T > img = imgs.get( i );
		imgSizes[ i ] = new int[]{ (int)img.dimension( 0 ), (int)img.dimension( 1 ), (int)img.dimension( 2 ) };
		
		interpolators.add( Views.interpolate( Views.extendMirrorSingle( img ), interpolatorFactory ).realRandomAccess() );
	}

	final Cursor< T > cursor = fusedImg.localizingCursor();
	final Cursor< FloatType > cursorW = weightImg.cursor();
	
	final float[] s = new float[ 3 ];
	final float[] t = new float[ 3 ];
	
	cursor.jumpFwd( portion.getStartPosition() );
	cursorW.jumpFwd( portion.getStartPosition() );
	
	for ( int j = 0; j < portion.getLoopSize(); ++j )
	{
		// move img cursor forward any get the value (saves one access)
		final T v = cursor.next();
		cursor.localize( s );
		
		// move weight cursor forward and get the value 
		final FloatType w = cursorW.next();
		
		if ( doDownSampling )
		{
			s[ 0 ] *= downSampling;
			s[ 1 ] *= downSampling;
			s[ 2 ] *= downSampling;
		}
		
		s[ 0 ] += bb.min( 0 );
		s[ 1 ] += bb.min( 1 );
		s[ 2 ] += bb.min( 2 );
		
		double sum = 0;
		int sumW = 0;
		
		for ( int i = 0; i < numViews; ++i )
		{				
			transforms[ i ].applyInverse( t, s );
			
			if ( FusionHelper.intersects( t[ 0 ], t[ 1 ], t[ 2 ], imgSizes[ i ][ 0 ], imgSizes[ i ][ 1 ], imgSizes[ i ][ 2 ] ) )
			{
				final RealRandomAccess< T > r = interpolators.get( i );
				r.setPosition( t );
				sum += r.get().getRealDouble();
				++sumW;
			}
		}
		
		if ( sumW > 0 )
		{
			v.setReal( v.getRealFloat() + sum );
			w.set( w.get() + sumW );
		}
	}
	
	return portion + " finished successfully (no weights).";
}