Skip to content
Snippets Groups Projects
Commit 0cc3f234 authored by Céline  TREBEAU's avatar Céline TREBEAU
Browse files

Addition of Input dimensions as instance variables (instead of static variable...

Addition of Input dimensions as instance variables (instead of static variable in SurfacesExtraction class)
parent 6237687f
Branches
Tags
1 merge request!10Surface reconstruction Refactoring
...@@ -163,13 +163,16 @@ public class Surface ...@@ -163,13 +163,16 @@ public class Surface
{ {
Surface surface = new Surface( Math.abs( this.dimension - 1 ), width, height ); Surface surface = new Surface( Math.abs( this.dimension - 1 ), width, height );
Class< ? > theClass; Class< ? > theClass;
int length;
if ( this.dimension == 0 ) if ( this.dimension == 0 )
{ {
theClass = SurfaceLineY.class; theClass = SurfaceLineY.class;
length = height;
} }
else else
{ {
theClass = SurfaceLineX.class; theClass = SurfaceLineX.class;
length = width;
} }
for ( int i = 0; i <= this.getLength() - 1; i++ ) for ( int i = 0; i <= this.getLength() - 1; i++ )
...@@ -187,7 +190,7 @@ public class Surface ...@@ -187,7 +190,7 @@ public class Surface
{ {
try try
{ {
newSurfaceLine = ( SurfaceLine ) theClass.getDeclaredConstructors()[ 1 ].newInstance( j ); newSurfaceLine = ( SurfaceLine ) theClass.getDeclaredConstructors()[ 1 ].newInstance( length, j );
} }
catch ( InstantiationException | IllegalAccessException | InvocationTargetException e ) catch ( InstantiationException | IllegalAccessException | InvocationTargetException e )
{ {
...@@ -240,6 +243,7 @@ public class Surface ...@@ -240,6 +243,7 @@ public class Surface
public Img< UnsignedShortType > getZMap() public Img< UnsignedShortType > getZMap()
{ {
int count = 0;
Dimensions dim = FinalDimensions.wrap( new long[]{width,height }); Dimensions dim = FinalDimensions.wrap( new long[]{width,height });
ImgFactory< UnsignedShortType > factory = Util.getArrayOrCellImgFactory(dim, new UnsignedShortType()); ImgFactory< UnsignedShortType > factory = Util.getArrayOrCellImgFactory(dim, new UnsignedShortType());
Img< UnsignedShortType > zMap = factory.create(dim); Img< UnsignedShortType > zMap = factory.create(dim);
...@@ -256,6 +260,7 @@ public class Surface ...@@ -256,6 +260,7 @@ public class Surface
{ {
if ( pixel.size() > 1 ) if ( pixel.size() > 1 )
{ {
count++;
int z = averageIntZ( pixel ) ; int z = averageIntZ( pixel ) ;
if ( z != -1 ) if ( z != -1 )
{ {
...@@ -273,6 +278,7 @@ public class Surface ...@@ -273,6 +278,7 @@ public class Surface
} }
} }
} }
System.out.println(" Thre count = " + count);
return zMap; return zMap;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment