Skip to content

Commit

Permalink
fix bug: Circular call in Util.asDoubleArray()
Browse files Browse the repository at this point in the history
This was caused by Views.flatIterable() returning RandomAccessibleInterval now
  • Loading branch information
tpietzsch committed May 7, 2024
1 parent d626260 commit dc99660
Showing 1 changed file with 1 addition and 10 deletions.
11 changes: 1 addition & 10 deletions src/main/java/net/imglib2/util/Util.java
Original file line number Diff line number Diff line change
Expand Up @@ -1055,16 +1055,7 @@ public static double[] asDoubleArray( final Iterable< ? extends RealType< ? > >
*/
public static double[] asDoubleArray( final RandomAccessibleInterval< ? extends RealType< ? > > rai )
{
return asDoubleArray( Views.flatIterable( rai ) );
}

/**
* Returns the pixels of an image of RealType as array of doubles.
* The pixels are sorted in flat iteration order.
*/
public static double[] asDoubleArray( final Img< ? extends RealType< ? > > image )
{
return asDoubleArray( ( RandomAccessibleInterval< ? extends RealType< ? > > ) image );
return Views.flatIterable( rai ).stream().mapToDouble( RealType::getRealDouble ).toArray();
}

/**
Expand Down

0 comments on commit dc99660

Please sign in to comment.