Commit b0322ef7 authored by lombardo's avatar lombardo

add relative weight parameter to minCostZsurface, update version and pom-scijava version

parent dd6c302d
......@@ -8,13 +8,13 @@
<parent>
<groupId>org.scijava</groupId>
<artifactId>pom-scijava</artifactId>
<version>16.2.0</version>
<version>17.1.1</version>
<relativePath/>
</parent>
<groupId>de.mpicbg.scf</groupId>
<artifactId>MinCostZSurface_</artifactId>
<version>1.1.2</version>
<version>1.1.3</version>
<name>MinCostZSurface_</name>
<description>
......@@ -101,7 +101,6 @@
<dependency>
<groupId>sc.fiji</groupId>
<artifactId>Graph_Cut</artifactId>
<version>1.0.1</version>
</dependency>
</dependencies>
......
......@@ -45,6 +45,8 @@ public class MinCost2ZSurface_Ops < T extends RealType<T> & NativeType< T > > ex
@Parameter ( label = "Max_delta_z between adjacent voxel" ) // constraint on the surface altitude change from one pixel to another
private int max_dz;
@Parameter ( label = "relative weight", required=false, persist=false ) // multiplicative factor that balance the intensity in both surfaces allowing better detection
private float relativeIntensity = 1f ;
// parameter for the use case with 2 surfaces detection
......@@ -114,7 +116,7 @@ public class MinCost2ZSurface_Ops < T extends RealType<T> & NativeType< T > > ex
start = System.currentTimeMillis();
ZSurface_detector.Create_Surface_Graph(image_cost_ds, max_dz);
ZSurface_detector.Create_Surface_Graph(image_cost_ds, max_dz);
ZSurface_detector.Create_Surface_Graph(image_cost_ds, max_dz, relativeIntensity);
ZSurface_detector.Add_NoCrossing_Constraint_Between_Surfaces(1, 2, min_dist, max_dist);
end = System.currentTimeMillis();
......
......@@ -77,6 +77,7 @@ public class MinCostZSurface < T extends RealType<T> & NumericType< T > & Native
private float maxFlow;
public MinCostZSurface()
{
n_surface = 0;
......@@ -85,6 +86,8 @@ public class MinCostZSurface < T extends RealType<T> & NumericType< T > & Native
graphs_terminal_weights = new ArrayList<float[][]>();
isProcessed = false;
maxFlow = 0 ;
}
......@@ -150,7 +153,11 @@ public class MinCostZSurface < T extends RealType<T> & NumericType< T > & Native
public boolean Create_Surface_Graph(Img<T> image_cost, int max_dz)
{
float factor = 1f;
return Create_Surface_Graph( image_cost, max_dz, factor);
}
/**
......@@ -158,8 +165,9 @@ public class MinCostZSurface < T extends RealType<T> & NumericType< T > & Native
*
* @param image_cost cost function
* @param max_dz maximum altitude variation between 2 pixels
* @param factor positive multiplicative value to make intensity in both surfaces look similar
*/
public boolean Create_Surface_Graph(Img<T> image_cost, int max_dz)
public boolean Create_Surface_Graph(Img<T> image_cost, int max_dz, float factor)
{
/////////////////////////////////////////////
// Check input validity /////////////////////
......@@ -245,7 +253,7 @@ public class MinCostZSurface < T extends RealType<T> & NumericType< T > & Native
while ( image_cursor.hasNext() )
{
image_cursor.fwd();
w = image_cursor.get().getRealFloat();
w = factor * image_cursor.get().getRealFloat();
image_cursor.localize(position);
long posIdx = position[0]+ position[1]*Width + position[2]*Slice;
current_offset = (n_surface)*nNodes_perSurf + posIdx;
......@@ -265,7 +273,7 @@ public class MinCostZSurface < T extends RealType<T> & NumericType< T > & Native
Edges_weights[1][EdgeCount] = zeroWeight;
EdgeCount++;
}
w -= imagex.get().getRealFloat();
w -= factor * imagex.get().getRealFloat();
}
else if (position[2]>0)
{
......@@ -277,7 +285,7 @@ public class MinCostZSurface < T extends RealType<T> & NumericType< T > & Native
EdgeCount++;
imagex.move(new int[] {0,0,-1}); // no need to test for out of bound here
w -= imagex.get().getRealFloat();
w -= factor * imagex.get().getRealFloat();
}
else
w = -infiniteWeight;
......@@ -305,6 +313,7 @@ public class MinCostZSurface < T extends RealType<T> & NumericType< T > & Native
// increment the number of surface set and return success of the operation
n_surface++;
return true;
}
......@@ -467,6 +476,8 @@ public class MinCostZSurface < T extends RealType<T> & NumericType< T > & Native
}
///////////////////////////////////////////////////////////////////////////////////////////
// create outputs ////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment