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 2f34b1f4ae1ee2fe39762a5db35571e20b2f483b..534aab1e7f2f68e00dcaf28b0b70680e0ef4afd7 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 @@ -147,7 +147,7 @@ public class Surface * * @return the identical transposed {@link Surface} */ - public Surface transpose(int length) + public Surface transpose( int length ) { Surface surface = new Surface( Math.abs( this.dimension - 1 ), length ); Class< ? > theClass; @@ -231,15 +231,15 @@ public class Surface { ReferenceSurfaceExtraction.displaySurface( this ); int count = 0; - Dimensions dim = FinalDimensions.wrap( new long[]{surfaceLines.length,surfaceLines[0].getLength() }); - ImgFactory< UnsignedShortType > factory = Util.getArrayOrCellImgFactory(dim, new UnsignedShortType()); - Img< UnsignedShortType > zMap = factory.create(dim); + Dimensions dim = FinalDimensions.wrap( new long[]{ getHeight(), getWidth() } ); + ImgFactory< UnsignedShortType > factory = Util.getArrayOrCellImgFactory( dim, new UnsignedShortType() ); + Img< UnsignedShortType > zMap = factory.create( dim ); RandomAccess< UnsignedShortType > randomAccess = zMap.randomAccess(); for ( SurfaceLine surfaceLine : this.get() ) { if ( surfaceLine != null ) { - randomAccess.setPosition(surfaceLine.getLine(), 0); + randomAccess.setPosition( surfaceLine.getLine(), 0 ); for ( int i = 0; i <= surfaceLine.getDimension().length - 1; i++ ) { Pixels pixel = surfaceLine.get( i ); @@ -248,25 +248,25 @@ public class Surface if ( pixel.size() > 1 ) { count++; - int z = averageIntZ( pixel ) ; - if ( z != -1 ) + int z = averageIntZ( pixel ); + if ( z != - 1 ) { - randomAccess.setPosition(i, 1); - randomAccess.get().set(new UnsignedShortType(z + 1)); + randomAccess.setPosition( i, 1 ); + randomAccess.get().set( new UnsignedShortType( z + 1 ) ); } } else { int z = pixel.get( 0 ).getZ(); - randomAccess.setPosition(i, 1); - randomAccess.get().set(new UnsignedShortType(z + 1)); + randomAccess.setPosition( i, 1 ); + randomAccess.get().set( new UnsignedShortType( z + 1 ) ); } } } } } ImageJFunctions.show( zMap, "after getzmap" ); - System.out.println(" Thre count = " + count); + System.out.println( " Thre count = " + count ); return zMap; } @@ -284,7 +284,7 @@ public class Surface { return ( z1 + z2 ) / 2; } - return -1; + return - 1; } /** @@ -308,16 +308,17 @@ public class Surface public int getWidth() { - for ( SurfaceLine surfaceLine: surfaceLines - ) + for ( SurfaceLine surfaceLine : surfaceLines + ) { - if (surfaceLine != null) + if ( surfaceLine != null ) { return surfaceLine.getLength(); } } return 0; } + public int getHeight() { return this.surfaceLines.length;