Skip to content

Commit add5f6d

Browse files
committed
Util.getTypeFromInterval returns getType().createVariable() is possible
See #312 (comment)
1 parent 57160bc commit add5f6d

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/main/java/net/imglib2/util/Util.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -796,7 +796,8 @@ final static public long[] int2long( final int[] i )
796796
@Deprecated
797797
public static < T, F extends Interval & RandomAccessible< T > > T getTypeFromInterval( final F rai )
798798
{
799-
return rai.getType();
799+
final T type = rai.getType();
800+
return type instanceof Type ? ( T ) ( ( Type ) type ).createVariable() : type;
800801
}
801802

802803
/**
@@ -810,9 +811,10 @@ public static < T, F extends Interval & RandomAccessible< T > > T getTypeFromInt
810811
* @return - an instance of T
811812
*/
812813
@Deprecated
813-
public static < T, F extends RealInterval & RealRandomAccessible< T >> T getTypeFromRealInterval( final F rai )
814+
public static < T, F extends RealInterval & RealRandomAccessible< T > > T getTypeFromRealInterval( final F rai )
814815
{
815-
return rai.getType();
816+
final T type = rai.getType();
817+
return type instanceof Type ? ( T ) ( ( Type ) type ).createVariable() : type;
816818
}
817819

818820
/**

0 commit comments

Comments
 (0)