Permalink
Browse files

Add interval method to Regions

This method is used to create RealRandomAccessibleRealIntervals from
transformed regions. Since transformed regions are RealRandomAccessibles
they need to be changed into Intervals before they can be passed to
other Regions methods.
  • Loading branch information...
awalter17 committed Jan 6, 2017
1 parent 5e18da6 commit 7eb6080a2d6a9dbe191e85ae3b7ad3980d2d8fc4
Showing with 10 additions and 2 deletions.
  1. +10 −2 src/main/java/net/imglib2/roi/Regions.java
@@ -34,18 +34,19 @@
package net.imglib2.roi;
import net.imglib2.IterableInterval;
import net.imglib2.RandomAccess;
import net.imglib2.RandomAccessible;
import net.imglib2.RandomAccessibleInterval;
import net.imglib2.RealInterval;
import net.imglib2.RealRandomAccessible;
import net.imglib2.RealRandomAccessibleRealInterval;
import net.imglib2.roi.geometric.RasterizedRegion;
import net.imglib2.roi.operators.RealBinaryExclusiveOr;
import net.imglib2.roi.operators.RealBinaryIntersection;
import net.imglib2.roi.operators.RealUnaryNot;
import net.imglib2.roi.operators.RealBinarySubtraction;
import net.imglib2.roi.operators.RealBinaryUnion;
import net.imglib2.roi.util.Contains;
import net.imglib2.roi.util.IterableRandomAccessibleRegion;
import net.imglib2.roi.util.RealIntervalView;
import net.imglib2.roi.util.SamplingIterableInterval;
import net.imglib2.type.BooleanType;
import net.imglib2.type.logic.BoolType;
@@ -111,4 +112,11 @@
{
return new RealBinaryExclusiveOr( leftOperand, rightOperand );
}
public static RealRandomAccessibleRealInterval< BoolType > interval( final RealRandomAccessible< BoolType > source, final RealInterval interval )
{
if ( RealRandomAccessibleRealInterval.class.isInstance( source ) )
return ( RealRandomAccessibleRealInterval< BoolType > ) source;
return new RealIntervalView< BoolType >( interval, source );
}
}

0 comments on commit 7eb6080

Please sign in to comment.