Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/main/java/net/imglib2/util/Intervals.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
import net.imglib2.FinalRealInterval;
import net.imglib2.Interval;
import net.imglib2.Localizable;
import net.imglib2.RandomAccessibleInterval;
import net.imglib2.RealInterval;
import net.imglib2.RealLocalizable;
import net.imglib2.transform.integer.Mixed;
Expand Down Expand Up @@ -1030,6 +1031,17 @@ public static double[] minAsDoubleArray( final RealInterval interval )
return min;
}

/**
* Returns an image, where each pixel value is the position of the pixel
* represented as {@link Localizable}.
*
* @param interval
* Interval of the returned image.
*/
public static RandomAccessibleInterval< Localizable > positions( final Interval interval ) {
return Localizables.randomAccessibleInterval( interval);
}

/**
* Returns a string that contains min, max and the dimensions of the
* {@link Interval}.
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/net/imglib2/util/Localizables.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public static RandomAccessible< Localizable > randomAccessible( final int n ) {
return new LocationRandomAccessible( n );
}

public RandomAccessibleInterval< Localizable > randomAccessibleInterval( final Interval interval ) {
public static RandomAccessibleInterval< Localizable > randomAccessibleInterval( final Interval interval ) {
return Views.interval( randomAccessible( interval.numDimensions() ), interval );
}

Expand Down