diff --git a/src/main/java/fr/pasteur/ida/zellige/steps/construction/Interpolation.java b/src/main/java/fr/pasteur/ida/zellige/steps/construction/Interpolation.java index 78a35907b9577685251b01a8268f5bf00ef5d916..877defc3250c3bece99bc5eaeb9bd3d92abeb797 100644 --- a/src/main/java/fr/pasteur/ida/zellige/steps/construction/Interpolation.java +++ b/src/main/java/fr/pasteur/ida/zellige/steps/construction/Interpolation.java @@ -170,7 +170,7 @@ public class Interpolation private Img< UnsignedShortType > execute( RandomAccessibleInterval< UnsignedShortType > input, int dimension ) { ImgFactory< UnsignedShortType > factory = new ArrayImgFactory<>( new UnsignedShortType() ); - Img< UnsignedShortType > interpolated = factory.create( input ); + Img< UnsignedShortType > interpolated = factory.create( input.dimensionsAsLongArray() ); ImgUtil.copy( input, interpolated ); RandomAccess< UnsignedShortType > interpolatedAccess = interpolated.randomAccess(); RandomAccess< UnsignedShortType > zMapAccess = input.randomAccess(); diff --git a/src/main/java/fr/pasteur/ida/zellige/steps/projection/ReferenceSurfaceProjection.java b/src/main/java/fr/pasteur/ida/zellige/steps/projection/ReferenceSurfaceProjection.java index a1a88f25182fdca05106127e2e1d321bdecf9842..e30c964c4ef8f4befa64478deffb31d7df346cc1 100644 --- a/src/main/java/fr/pasteur/ida/zellige/steps/projection/ReferenceSurfaceProjection.java +++ b/src/main/java/fr/pasteur/ida/zellige/steps/projection/ReferenceSurfaceProjection.java @@ -194,7 +194,7 @@ public class ReferenceSurfaceProjection< T extends RealType< T > & NativeType< T public static < T extends RealType< T > & NativeType< T > > Img< BitType > getSegmentedSurfaceMask ( IterableInterval< T > segmentedSurface, int delta ) { - Img< BitType > segmentedSurfaceMask = new ArrayImgFactory<>( new BitType() ).create( segmentedSurface ); + Img< BitType > segmentedSurfaceMask = new ArrayImgFactory<>( new BitType() ).create( segmentedSurface.dimensionsAsLongArray() ); Cursor< T > surfaceAccess = segmentedSurface.cursor(); RandomAccess< BitType > mapAccess = segmentedSurfaceMask.randomAccess(); while ( surfaceAccess.hasNext() ) @@ -223,7 +223,7 @@ public class ReferenceSurfaceProjection< T extends RealType< T > & NativeType< T public static < T extends RealType< T > & NativeType< T > > Img< T > getSegmentedSurface ( Img< UnsignedShortType > extractedHeightMap, RandomAccessibleInterval< T > originalInput, ImgFactory< T > factory ) { - Img< T > segmentedSurface = factory.create( originalInput ); + Img< T > segmentedSurface = factory.create( originalInput.dimensionsAsLongArray() ); RandomAccess< T > surfaceAccess = segmentedSurface.randomAccess(); RandomAccess< T > inputAccess = originalInput.randomAccess(); Cursor< UnsignedShortType > heightMapCursor = extractedHeightMap.cursor(); diff --git a/src/main/java/fr/pasteur/ida/zellige/steps/selection/classification/AmplitudeClassification.java b/src/main/java/fr/pasteur/ida/zellige/steps/selection/classification/AmplitudeClassification.java index ac6e9deceaadbc251c5f541dd52af61e442db79f..badccd543d56c61412e4e3d2b4d46dfc3cd2f85d 100644 --- a/src/main/java/fr/pasteur/ida/zellige/steps/selection/classification/AmplitudeClassification.java +++ b/src/main/java/fr/pasteur/ida/zellige/steps/selection/classification/AmplitudeClassification.java @@ -82,7 +82,7 @@ public class AmplitudeClassification< T extends RealType< T > & NativeType< T > final ImgFactory< T > factory, double amplitudeThreshold ) throws DataValidationException { long start = System.currentTimeMillis(); - Img< BitType > amplitude = new ArrayImgFactory<>( new BitType() ).create( input ); + Img< BitType > amplitude = new ArrayImgFactory<>( new BitType() ).create( input.dimensionsAsLongArray() ); AmplitudeClassification< T > classification = new AmplitudeClassification<>( input, factory, amplitude, amplitudeThreshold ); classification.run(); @@ -132,7 +132,7 @@ public class AmplitudeClassification< T extends RealType< T > & NativeType< T > private Img< T > getAmplitude( RandomAccessibleInterval< T > max, ImgFactory< T > factory, RandomAccessibleInterval< T > min ) { - Img< T > amp = factory.create( max ); + Img< T > amp = factory.create( max.dimensionsAsLongArray() ); RandomAccess< T > maxAccess = max.randomAccess(); RandomAccess< T > minAccess = min.randomAccess(); RandomAccess< T > ampAccess = amp.randomAccess(); diff --git a/src/main/java/fr/pasteur/ida/zellige/steps/selection/classification/Classification.java b/src/main/java/fr/pasteur/ida/zellige/steps/selection/classification/Classification.java index 8934c3b7c6878d9a5e55f5db926ffb6d068ec8bb..c16a3a2b675f4738faf7884f41ada22cf00930cb 100644 --- a/src/main/java/fr/pasteur/ida/zellige/steps/selection/classification/Classification.java +++ b/src/main/java/fr/pasteur/ida/zellige/steps/selection/classification/Classification.java @@ -153,7 +153,7 @@ public class Classification< T extends RealType< T > & NativeType< T > > ImgFactory< BitType > factory, RandomAccessibleInterval< BitType > thresholds ) { - Img< BitType > output = factory.create( thresholds ); + Img< BitType > output = factory.create( thresholds.dimensionsAsLongArray() ); Cursor< BitType > amplitudeCursor = amplitude.localizingCursor(); RandomAccess< BitType > thresholdAccess = thresholds.randomAccess(); diff --git a/src/main/java/fr/pasteur/ida/zellige/steps/selection/classification/OtsuClassification.java b/src/main/java/fr/pasteur/ida/zellige/steps/selection/classification/OtsuClassification.java index 15561a8575c85dbce3851a00fffec703e78f61c0..47ac18fe7ef73c74ba3f02118f25e3e1e2caaa28 100644 --- a/src/main/java/fr/pasteur/ida/zellige/steps/selection/classification/OtsuClassification.java +++ b/src/main/java/fr/pasteur/ida/zellige/steps/selection/classification/OtsuClassification.java @@ -64,7 +64,7 @@ public class OtsuClassification< T extends RealType< T > & NativeType< T > > this.input = input; this.output = output; this.userThreshold = userThreshold; - this.grid = factory.create( input ); + this.grid = factory.create( input.dimensionsAsLongArray() ); } /** @@ -74,7 +74,7 @@ public class OtsuClassification< T extends RealType< T > & NativeType< T > > private OtsuClassification( final RandomAccessibleInterval< T > input, final ImgFactory< T > factory ) { this.input = input; - this.grid = factory.create( input ); + this.grid = factory.create( input.dimensionsAsLongArray() ); } /** @@ -91,7 +91,7 @@ public class OtsuClassification< T extends RealType< T > & NativeType< T > > long start = System.currentTimeMillis(); // Prepare output. final ImgFactory< BitType > bitTypeImgFactory = net.imglib2.util.Util.getArrayOrCellImgFactory( input, new BitType() ); - Img< BitType > binary = bitTypeImgFactory.create( input ); + Img< BitType > binary = bitTypeImgFactory.create( input.dimensionsAsLongArray() ); OtsuClassification< T > classification = new OtsuClassification<>( input, factory, binary, userThreshold ); classification.run(); long stop = System.currentTimeMillis(); @@ -131,7 +131,7 @@ public class OtsuClassification< T extends RealType< T > & NativeType< T > > { long start = System.currentTimeMillis(); final ImgFactory< BitType > bitTypeImgFactory = net.imglib2.util.Util.getArrayOrCellImgFactory( input, new BitType() ); - Img< BitType > output = bitTypeImgFactory.create( input ); + Img< BitType > output = bitTypeImgFactory.create( input.dimensionsAsLongArray() ); Cursor< T > sourceCursor = input.localizingCursor(); Cursor< T > gridCursor = grid.cursor(); RandomAccess< BitType > randomAccess = output.randomAccess(); diff --git a/src/main/java/fr/pasteur/ida/zellige/steps/selection/postTreatment/PostTreatment.java b/src/main/java/fr/pasteur/ida/zellige/steps/selection/postTreatment/PostTreatment.java index a9db304a0256fe301565209eb0b4a2460901cd08..e5863da3f050d06abd004e72b421ffa71ae59ee0 100644 --- a/src/main/java/fr/pasteur/ida/zellige/steps/selection/postTreatment/PostTreatment.java +++ b/src/main/java/fr/pasteur/ida/zellige/steps/selection/postTreatment/PostTreatment.java @@ -82,7 +82,7 @@ public class PostTreatment public static Img< FloatType > convertBitTypeIntoFloatType( IterableInterval< BitType > image ) { final ImgFactory< FloatType > imgFactory = new ArrayImgFactory<>( new FloatType() ); - final Img< FloatType > copy = imgFactory.create( image ); + final Img< FloatType > copy = imgFactory.create( image.dimensionsAsLongArray() ); Cursor< BitType > bitTypeCursor = image.cursor(); Cursor< FloatType > floatTypeCursor = copy.cursor(); diff --git a/src/main/java/fr/pasteur/ida/zellige/steps/selection/postTreatment/islandSearch/IslandSearch.java b/src/main/java/fr/pasteur/ida/zellige/steps/selection/postTreatment/islandSearch/IslandSearch.java index 39d9d09ff4eb02b4bac12f766aef4db9428e1f2b..b0c5b033c5426e9b190e1c33c9df4f3497fdb052 100644 --- a/src/main/java/fr/pasteur/ida/zellige/steps/selection/postTreatment/islandSearch/IslandSearch.java +++ b/src/main/java/fr/pasteur/ida/zellige/steps/selection/postTreatment/islandSearch/IslandSearch.java @@ -79,7 +79,7 @@ public class IslandSearch { long start = System.currentTimeMillis(); ImgFactory< BitType > factory = new ArrayImgFactory<>( new BitType() ); - Img< BitType > output = factory.create( classifiedImage ); + Img< BitType > output = factory.create( classifiedImage.dimensionsAsLongArray() ); ImgUtil.copy( classifiedImage, output ); new IslandSearch( classifiedImage, output, islandSize, connectivityType ); long stop = System.currentTimeMillis(); diff --git a/src/main/java/fr/pasteur/ida/zellige/steps/selection/pretreatment/Pretreatment.java b/src/main/java/fr/pasteur/ida/zellige/steps/selection/pretreatment/Pretreatment.java index c257cb24883610ef6633e867cf5dc7f91990bc28..24c51b30d3eccc68b46a53d92d3f69fa9799c125 100644 --- a/src/main/java/fr/pasteur/ida/zellige/steps/selection/pretreatment/Pretreatment.java +++ b/src/main/java/fr/pasteur/ida/zellige/steps/selection/pretreatment/Pretreatment.java @@ -103,7 +103,7 @@ public class Pretreatment< T extends RealType< T > & NativeType< T > > RandomAccessibleInterval< T > image, ImgFactory< T > factory ) { LOGGER.debug( "Staring normalization." ); - Img< T > normalizedImage = factory.create( image ); + Img< T > normalizedImage = factory.create( image.dimensionsAsLongArray() ); ImgUtil.copy( image, normalizedImage ); T min = normalizedImage.firstElement().createVariable(); min.setReal( 0 ); diff --git a/src/main/java/fr/pasteur/ida/zellige/steps/selection/util/ExtremaDetection.java b/src/main/java/fr/pasteur/ida/zellige/steps/selection/util/ExtremaDetection.java index e2a32d5b142759f5158fa367a91865d3d86dcac4..6d1cd56334d73e141fa956ef2381e41907c42ca7 100644 --- a/src/main/java/fr/pasteur/ida/zellige/steps/selection/util/ExtremaDetection.java +++ b/src/main/java/fr/pasteur/ida/zellige/steps/selection/util/ExtremaDetection.java @@ -59,7 +59,7 @@ public class ExtremaDetection< T extends RealType< T > & NativeType< T > > parameterCheck( input, factory, type, method ); this.input = input; this.factory = factory; - this.extrema = factory.create( input ); + this.extrema = factory.create( input.dimensionsAsLongArray() ); this.type = type; LOGGER.debug( "Partial derivative is : {}", method ); } diff --git a/src/main/java/fr/pasteur/ida/zellige/steps/selection/util/ExtremaDetection2D.java b/src/main/java/fr/pasteur/ida/zellige/steps/selection/util/ExtremaDetection2D.java index 1ae97bb04cea61a013ab9017e7a564d8c6416efd..e4507dcfae55a74aac52d10d5f59030ff62e6203 100644 --- a/src/main/java/fr/pasteur/ida/zellige/steps/selection/util/ExtremaDetection2D.java +++ b/src/main/java/fr/pasteur/ida/zellige/steps/selection/util/ExtremaDetection2D.java @@ -79,7 +79,7 @@ public class ExtremaDetection2D< T extends RealType< T > & NativeType< T > > { { // Output for partial derivative. - RandomAccessibleInterval< T > sectionDerivative = factory.create( inputSection ); + RandomAccessibleInterval< T > sectionDerivative = factory.create( inputSection.dimensionsAsLongArray() ); // Partial derivative computation */ Derivative.run( inputSection, sectionDerivative, method ); computeExtrema( inputSection, sectionDerivative );