src/main/java/sc/fiji/pQCT/selectroi/liveWireEngine/LiveWireCosts.java
private void initLaplacian() {

		// Using finite differences convolute
		// @formatter:off
        final double[][] laplacianKernel = {
		        { 0, 1, 0 },
                { 1, -4, 1 },
                { 0, 1, 0 }
		};
        // @formatter:on
		for (int i = 1; i < rows - 1; i++) {
			for (int j = 1; j < columns - 1; j++) {
				laplacian[i][j] = 0;
				for (int j2 = -1; j2 <= 1; ++j2) {
					for (int i2 = -1; i2 <= 1; ++i2) {
						laplacian[i][j] += imagePixels[i + i2][j + j2] *
							laplacianKernel[i2 + 1][j2 + 1];
					}
				}
			}
		}

		/*Search for zero crossing to binarize the result*/
		double[][] tempLap = new double[rows][columns];
		for (final double[] row : tempLap) {
			Arrays.fill(row, 1.0);
		}
		/*Check pixel neighbourhoods for zero-crossings*/
		final int[][] neighbourhood = new int[8][2]; // 8 connected neighbourhood
		for (int i = 1; i < rows - 1; i++) {
			for (int j = 1; j < columns - 1; j++) {
				tempLap[i][j] = 1;
				if (laplacian[i][j] == 0) {
					// No need to check neighbours
					tempLap[i][j] = 0;
				}
				else {
					// Check 8-connected neighbour
					for (int th = 0; th < 8; ++th) {
						neighbourhood[th][0] = i + LAPLACIAN_NEIGHBOUR_INDICES[th][0];
						neighbourhood[th][1] = j + LAPLACIAN_NEIGHBOUR_INDICES[th][1];
					}
					tempLap = checkNeighbours(tempLap, neighbourhood, new int[] { i, j });
				}
			}
		}
		/*OverWrite Laplacian*/
		for (int i = 0; i < rows; i++) {
			System.arraycopy(tempLap[i], 0, laplacian[i], 0, columns);
		}
	}
/*initializes laplacian image zero-crossings. Marks zero-crossings with 0, otherwise the value is 1*/
initializes laplacian image zero-crossings. Marks zero-crossings with 0, otherwise the value is 1
initializes laplacian image zero - crossings . Marks zero - crossings with 0 otherwise the value is 1
private void initLaplacian() {
        final double[][] laplacianKernel = {
		        { 0, 1, 0 },
                { 1, -4, 1 },
                { 0, 1, 0 }
		};
		for (int i = 1; i < rows - 1; i++) {
			for (int j = 1; j < columns - 1; j++) {
				laplacian[i][j] = 0;
				for (int j2 = -1; j2 <= 1; ++j2) {
					for (int i2 = -1; i2 <= 1; ++i2) {
						laplacian[i][j] += imagePixels[i + i2][j + j2] *
							laplacianKernel[i2 + 1][j2 + 1];
					}
				}
			}
		}
		/*Search for zero crossing to binarize the result*/
		double[][] tempLap = new double[rows][columns];
		for (final double[] row : tempLap) {
			Arrays.fill(row, 1.0);
		}
		/*Check pixel neighbourhoods for zero-crossings*/
		final int[][] neighbourhood = new int[8][2]; 
		for (int i = 1; i < rows - 1; i++) {
			for (int j = 1; j < columns - 1; j++) {
				tempLap[i][j] = 1;
				if (laplacian[i][j] == 0) {
					tempLap[i][j] = 0;
				}
				else {
					for (int th = 0; th < 8; ++th) {
						neighbourhood[th][0] = i + LAPLACIAN_NEIGHBOUR_INDICES[th][0];
						neighbourhood[th][1] = j + LAPLACIAN_NEIGHBOUR_INDICES[th][1];
					}
					tempLap = checkNeighbours(tempLap, neighbourhood, new int[] { i, j });
				}
			}
		}
		/*OverWrite Laplacian*/
		for (int i = 0; i < rows; i++) {
			System.arraycopy(tempLap[i], 0, laplacian[i], 0, columns);
		}
	}
private void initLaplacian ( ) { final double [ ] [ ] laplacianKernel = { { 0 , 1 , 0 } , { 1 , - 4 , 1 } , { 0 , 1 , 0 } } ; for ( int i = 1 ; i < rows - 1 ; i ++ ) { for ( int j = 1 ; j < columns - 1 ; j ++ ) { laplacian [ i ] [ j ] = 0 ; for ( int j2 = - 1 ; j2 <= 1 ; ++ j2 ) { for ( int i2 = - 1 ; i2 <= 1 ; ++ i2 ) { laplacian [ i ] [ j ] += imagePixels [ i + i2 ] [ j + j2 ] * laplacianKernel [ i2 + 1 ] [ j2 + 1 ] ; } } } } /*Search for zero crossing to binarize the result*/ double [ ] [ ] tempLap = new double [ rows ] [ columns ] ; for ( final double [ ] row : tempLap ) { Arrays . fill ( row , 1.0 ) ; } /*Check pixel neighbourhoods for zero-crossings*/ final int [ ] [ ] neighbourhood = new int [ 8 ] [ 2 ] ; for ( int i = 1 ; i < rows - 1 ; i ++ ) { for ( int j = 1 ; j < columns - 1 ; j ++ ) { tempLap [ i ] [ j ] = 1 ; if ( laplacian [ i ] [ j ] == 0 ) { tempLap [ i ] [ j ] = 0 ; } else { for ( int th = 0 ; th < 8 ; ++ th ) { neighbourhood [ th ] [ 0 ] = i + LAPLACIAN_NEIGHBOUR_INDICES [ th ] [ 0 ] ; neighbourhood [ th ] [ 1 ] = j + LAPLACIAN_NEIGHBOUR_INDICES [ th ] [ 1 ] ; } tempLap = checkNeighbours ( tempLap , neighbourhood , new int [ ] { i , j } ) ; } } } /*OverWrite Laplacian*/ for ( int i = 0 ; i < rows ; i ++ ) { System . arraycopy ( tempLap [ i ] , 0 , laplacian [ i ] , 0 , columns ) ; } }
initializes laplacian image zero-crossings.
initializes laplacian image zero - crossings .
// Using finite differences convolute // @formatter:off // @formatter:on // 8 connected neighbourhood // No need to check neighbours // Check 8-connected neighbour