Skip to content

Commit b187865

Browse files
committed
chore: DistanceTransform use new methods
* getType * addDimension with bounds
1 parent d864930 commit b187865

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

src/main/java/net/imglib2/algorithm/morphology/distance/DistanceTransform.java

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -528,7 +528,7 @@ public static < T extends RealType< T >, U extends RealType< U >, V extends Real
528528
{
529529
transformAlongDimension(
530530
( RandomAccessible< T > ) Views.addDimension( source ),
531-
Views.interval( Views.addDimension( target ), new FinalInterval( target.dimension( 0 ), 1 ) ),
531+
Views.addDimension( target, 0, 0 ),
532532
d,
533533
0 );
534534
}
@@ -601,7 +601,7 @@ public static < T extends RealType< T >, U extends RealType< U >, V extends Real
601601
{
602602
transformAlongDimensionParallel(
603603
( RandomAccessible< T > ) Views.addDimension( source ),
604-
Views.interval( Views.addDimension( target ), new FinalInterval( target.dimension( 0 ), 1 ) ),
604+
Views.addDimension( target, 0, 0 ),
605605
d,
606606
0,
607607
es,
@@ -734,8 +734,7 @@ public static < B extends BooleanType< B >, U extends RealType< U >, V extends R
734734
final DISTANCE_TYPE distanceType,
735735
final double... weights )
736736
{
737-
738-
final U maxVal = Util.getTypeFromInterval( tmp ).createVariable();
737+
final U maxVal = tmp.getType().copy();
739738
maxVal.setReal( maxVal.getMaxValue() );
740739
final Converter< B, U > converter = new BinaryMaskToCost<>( maxVal );
741740
final RandomAccessible< U > converted = Converters.convert( source, converter, maxVal.createVariable() );
@@ -789,7 +788,7 @@ public static < B extends BooleanType< B >, U extends RealType< U >, V extends R
789788
final int nTasks,
790789
final double... weights ) throws InterruptedException, ExecutionException
791790
{
792-
final U maxVal = Util.getTypeFromInterval( tmp ).createVariable();
791+
final U maxVal = tmp.getType().copy();
793792
maxVal.setReal( maxVal.getMaxValue() );
794793
final Converter< B, U > converter = new BinaryMaskToCost<>( maxVal );
795794
final RandomAccessible< U > converted = Converters.convert( source, converter, maxVal.createVariable() );
@@ -916,7 +915,7 @@ public static < B extends BooleanType< B >, U extends RealType< U >, V extends R
916915
final RandomAccessibleInterval< V > target,
917916
final Distance d )
918917
{
919-
final U maxVal = Util.getTypeFromInterval( tmp ).createVariable();
918+
final U maxVal = tmp.getType().copy();
920919
maxVal.setReal( maxVal.getMaxValue() );
921920
final Converter< B, U > converter = new BinaryMaskToCost<>( maxVal );
922921
final RandomAccessible< U > converted = Converters.convert( source, converter, maxVal.createVariable() );
@@ -963,7 +962,7 @@ public static < B extends BooleanType< B >, U extends RealType< U >, V extends R
963962
final ExecutorService es,
964963
final int nTasks ) throws InterruptedException, ExecutionException
965964
{
966-
final U maxVal = Util.getTypeFromInterval( tmp ).createVariable();
965+
final U maxVal = tmp.getType().copy();
967966
maxVal.setReal( maxVal.getMaxValue() );
968967
final Converter< B, U > converter = new BinaryMaskToCost<>( maxVal );
969968
final RandomAccessible< U > converted = Converters.convert( source, converter, maxVal.createVariable() );
@@ -1005,7 +1004,7 @@ private static < T extends RealType< T >, U extends RealType< U >, V extends Rea
10051004
{
10061005
transformL1AlongDimension(
10071006
( RandomAccessible< T > ) Views.addDimension( source ),
1008-
Views.interval( Views.addDimension( target ), new FinalInterval( target.dimension( 0 ), 1 ) ),
1007+
Views.addDimension( target, 0, 0 ),
10091008
0,
10101009
weights[ 0 ] );
10111010
}
@@ -1073,7 +1072,7 @@ private static < T extends RealType< T >, U extends RealType< U >, V extends Rea
10731072
{
10741073
transformL1AlongDimensionParallel(
10751074
( RandomAccessible< T > ) Views.addDimension( source ),
1076-
Views.interval( Views.addDimension( target ), new FinalInterval( target.dimension( 0 ), 1 ) ),
1075+
Views.addDimension( target, 0, 0 ),
10771076
0,
10781077
weights[ 0 ],
10791078
es,

0 commit comments

Comments
 (0)