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

Bug fix : NPE when the first SurfaceLine of a Surface is null in...

Bug fix : NPE when the first SurfaceLine of a Surface is null in rebuildPixelsArray() method in ReferenceSurfaceExtraction.
Addition of GetWidth and getHeight methods
parent 2303cf8e
No related branches found
No related tags found
2 merge requests!10Surface reconstruction Refactoring,!5Bug fix : NPE when the first SurfaceLine of a Surface is null in...
Pipeline #41321 passed
......@@ -57,9 +57,9 @@ public class Main
// Input of the image.
final String imagePath =
"doc/STK.tif";
// "doc/STK.tif";
// "C:\\Users\\ctrebeau\\Desktop\\MoucheAile\\STK\\STK_Mouche_c01_f0001_p005.tif";
// "C:\\Users\\ctrebeau\\Downloads\\phantom3b_combined.tif";
"C:\\Users\\ctrebeau\\Downloads\\phantom3b_combined.tif";
// "C:\\Users\\ctrebeau\\Desktop\\HighRes\\STK_170706_Vangl2-Lp-wt_E14.5_Phall_cochlea_01bHighRes_c01_f0001_p005.tif";
System.out.println(imagePath);
// Creation of the image : version with unsigned type. */
......
......@@ -103,8 +103,8 @@ public class ReferenceSurfaceExtraction< T extends RealType< T > & NativeType< T
*/
private Pixels[][] rebuildPixelsArray( Surface surface )
{
int width = surface.get().length;
int height = surface.get()[0].getLength();
int width = surface.getHeight();
int height = surface.getWidth();
Pixels[][] tempCoordinates = new Pixels[ height ][ width ]; // Transposed array
for ( int i = 0; i <= width - 1; i++ )
{
......
......@@ -306,7 +306,18 @@ public class Surface
}
public int getWidth()
{
for ( SurfaceLine surfaceLine: surfaceLines
)
{
if (surfaceLine != null)
{
return surfaceLine.getLength();
}
}
return 0;
}
public int getHeight()
{
return this.surfaceLines.length;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment