Skip to content

Commit

Permalink
correct copying of rais
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosuc3m committed Jan 2, 2025
1 parent 2e3f763 commit 0b82fc2
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/main/java/io/bioimage/modelrunner/tensor/Tensor.java
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,11 @@ public static < T extends RealType< T > & NativeType< T >, R extends RealType< R
{
final ImgFactory< R > factory = Util.getArrayOrCellImgFactory( input, type );
final Img< R > output = factory.create( input );
RealTypeConverters.copyFromTo( input, output );
RealType< ? > s = Util.getTypeFromInterval( input );
RealType< ? > d = Util.getTypeFromInterval( output );
Converter< RealType< ? >, RealType< ? > > copy = RealTypeConverters.getConverter( s, d );
boolean useMultiThreading = Intervals.numElements(output) >= 20_000;
LoopBuilder.setImages( input, output ).multiThreaded( useMultiThreading ).forEachPixel( copy::convert );
return output;
}

Expand Down

0 comments on commit 0b82fc2

Please sign in to comment.