From 0cc3f2340dde97cf6568c2e2509fa3d02e238f20 Mon Sep 17 00:00:00 2001 From: ctrebeau <ctrebeau@pasteur.fr> Date: Mon, 2 Nov 2020 12:11:43 +0100 Subject: [PATCH] Addition of Input dimensions as instance variables (instead of static variable in SurfacesExtraction class) --- .../ida/zellige/surfaceConstruction/element/Surface.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/java/fr/pasteur/ida/zellige/surfaceConstruction/element/Surface.java b/src/main/java/fr/pasteur/ida/zellige/surfaceConstruction/element/Surface.java index 2d109305..ec5214dc 100644 --- a/src/main/java/fr/pasteur/ida/zellige/surfaceConstruction/element/Surface.java +++ b/src/main/java/fr/pasteur/ida/zellige/surfaceConstruction/element/Surface.java @@ -163,13 +163,16 @@ public class Surface { Surface surface = new Surface( Math.abs( this.dimension - 1 ), width, height ); Class< ? > theClass; + int length; if ( this.dimension == 0 ) { theClass = SurfaceLineY.class; + length = height; } else { theClass = SurfaceLineX.class; + length = width; } for ( int i = 0; i <= this.getLength() - 1; i++ ) @@ -187,7 +190,7 @@ public class Surface { try { - newSurfaceLine = ( SurfaceLine ) theClass.getDeclaredConstructors()[ 1 ].newInstance( j ); + newSurfaceLine = ( SurfaceLine ) theClass.getDeclaredConstructors()[ 1 ].newInstance( length, j ); } catch ( InstantiationException | IllegalAccessException | InvocationTargetException e ) { @@ -240,6 +243,7 @@ public class Surface public Img< UnsignedShortType > getZMap() { + int count = 0; Dimensions dim = FinalDimensions.wrap( new long[]{width,height }); ImgFactory< UnsignedShortType > factory = Util.getArrayOrCellImgFactory(dim, new UnsignedShortType()); Img< UnsignedShortType > zMap = factory.create(dim); @@ -256,6 +260,7 @@ public class Surface { if ( pixel.size() > 1 ) { + count++; int z = averageIntZ( pixel ) ; if ( z != -1 ) { @@ -273,6 +278,7 @@ public class Surface } } } + System.out.println(" Thre count = " + count); return zMap; } -- GitLab