Skip to content

Commit

Permalink
Util.getTypeFromInterval returns getType().createVariable() is possible
Browse files Browse the repository at this point in the history
  • Loading branch information
tpietzsch committed May 7, 2024
1 parent 57160bc commit add5f6d
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/main/java/net/imglib2/util/Util.java
Original file line number Diff line number Diff line change
Expand Up @@ -796,7 +796,8 @@ final static public long[] int2long( final int[] i )
@Deprecated
public static < T, F extends Interval & RandomAccessible< T > > T getTypeFromInterval( final F rai )
{
return rai.getType();
final T type = rai.getType();
return type instanceof Type ? ( T ) ( ( Type ) type ).createVariable() : type;
}

/**
Expand All @@ -810,9 +811,10 @@ public static < T, F extends Interval & RandomAccessible< T > > T getTypeFromInt
* @return - an instance of T
*/
@Deprecated
public static < T, F extends RealInterval & RealRandomAccessible< T >> T getTypeFromRealInterval( final F rai )
public static < T, F extends RealInterval & RealRandomAccessible< T > > T getTypeFromRealInterval( final F rai )
{
return rai.getType();
final T type = rai.getType();
return type instanceof Type ? ( T ) ( ( Type ) type ).createVariable() : type;
}

/**
Expand Down

0 comments on commit add5f6d

Please sign in to comment.