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 @@ ...@@ -8,13 +8,13 @@
<parent> <parent>
<groupId>org.scijava</groupId> <groupId>org.scijava</groupId>
<artifactId>pom-scijava</artifactId> <artifactId>pom-scijava</artifactId>
<version>16.2.0</version> <version>17.1.1</version>
<relativePath/> <relativePath/>
</parent> </parent>
<groupId>de.mpicbg.scf</groupId> <groupId>de.mpicbg.scf</groupId>
<artifactId>MinCostZSurface_</artifactId> <artifactId>MinCostZSurface_</artifactId>
<version>1.1.2</version> <version>1.1.3</version>
<name>MinCostZSurface_</name> <name>MinCostZSurface_</name>
<description> <description>
...@@ -101,7 +101,6 @@ ...@@ -101,7 +101,6 @@
<dependency> <dependency>
<groupId>sc.fiji</groupId> <groupId>sc.fiji</groupId>
<artifactId>Graph_Cut</artifactId> <artifactId>Graph_Cut</artifactId>
<version>1.0.1</version>
</dependency> </dependency>
</dependencies> </dependencies>
......
...@@ -45,6 +45,8 @@ public class MinCost2ZSurface_Ops < T extends RealType<T> & NativeType< T > > ex ...@@ -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 @Parameter ( label = "Max_delta_z between adjacent voxel" ) // constraint on the surface altitude change from one pixel to another
private int max_dz; 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 // parameter for the use case with 2 surfaces detection
...@@ -114,7 +116,7 @@ public class MinCost2ZSurface_Ops < T extends RealType<T> & NativeType< T > > ex ...@@ -114,7 +116,7 @@ public class MinCost2ZSurface_Ops < T extends RealType<T> & NativeType< T > > ex
start = System.currentTimeMillis(); 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); ZSurface_detector.Create_Surface_Graph(image_cost_ds, max_dz, relativeIntensity);
ZSurface_detector.Add_NoCrossing_Constraint_Between_Surfaces(1, 2, min_dist, max_dist); ZSurface_detector.Add_NoCrossing_Constraint_Between_Surfaces(1, 2, min_dist, max_dist);
end = System.currentTimeMillis(); end = System.currentTimeMillis();
......
...@@ -77,6 +77,7 @@ public class MinCostZSurface < T extends RealType<T> & NumericType< T > & Native ...@@ -77,6 +77,7 @@ public class MinCostZSurface < T extends RealType<T> & NumericType< T > & Native
private float maxFlow; private float maxFlow;
public MinCostZSurface() public MinCostZSurface()
{ {
n_surface = 0; n_surface = 0;
...@@ -85,6 +86,8 @@ public class MinCostZSurface < T extends RealType<T> & NumericType< T > & Native ...@@ -85,6 +86,8 @@ public class MinCostZSurface < T extends RealType<T> & NumericType< T > & Native
graphs_terminal_weights = new ArrayList<float[][]>(); graphs_terminal_weights = new ArrayList<float[][]>();
isProcessed = false; isProcessed = false;
maxFlow = 0 ; maxFlow = 0 ;
} }
...@@ -150,7 +153,11 @@ public class MinCostZSurface < T extends RealType<T> & NumericType< T > & Native ...@@ -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 ...@@ -158,8 +165,9 @@ public class MinCostZSurface < T extends RealType<T> & NumericType< T > & Native
* *
* @param image_cost cost function * @param image_cost cost function
* @param max_dz maximum altitude variation between 2 pixels * @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 ///////////////////// // Check input validity /////////////////////
...@@ -245,7 +253,7 @@ public class MinCostZSurface < T extends RealType<T> & NumericType< T > & Native ...@@ -245,7 +253,7 @@ public class MinCostZSurface < T extends RealType<T> & NumericType< T > & Native
while ( image_cursor.hasNext() ) while ( image_cursor.hasNext() )
{ {
image_cursor.fwd(); image_cursor.fwd();
w = image_cursor.get().getRealFloat(); w = factor * image_cursor.get().getRealFloat();
image_cursor.localize(position); image_cursor.localize(position);
long posIdx = position[0]+ position[1]*Width + position[2]*Slice; long posIdx = position[0]+ position[1]*Width + position[2]*Slice;
current_offset = (n_surface)*nNodes_perSurf + posIdx; current_offset = (n_surface)*nNodes_perSurf + posIdx;
...@@ -265,7 +273,7 @@ public class MinCostZSurface < T extends RealType<T> & NumericType< T > & Native ...@@ -265,7 +273,7 @@ public class MinCostZSurface < T extends RealType<T> & NumericType< T > & Native
Edges_weights[1][EdgeCount] = zeroWeight; Edges_weights[1][EdgeCount] = zeroWeight;
EdgeCount++; EdgeCount++;
} }
w -= imagex.get().getRealFloat(); w -= factor * imagex.get().getRealFloat();
} }
else if (position[2]>0) else if (position[2]>0)
{ {
...@@ -277,7 +285,7 @@ public class MinCostZSurface < T extends RealType<T> & NumericType< T > & Native ...@@ -277,7 +285,7 @@ public class MinCostZSurface < T extends RealType<T> & NumericType< T > & Native
EdgeCount++; EdgeCount++;
imagex.move(new int[] {0,0,-1}); // no need to test for out of bound here 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 else
w = -infiniteWeight; w = -infiniteWeight;
...@@ -305,6 +313,7 @@ public class MinCostZSurface < T extends RealType<T> & NumericType< T > & Native ...@@ -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 // increment the number of surface set and return success of the operation
n_surface++; n_surface++;
return true; return true;
} }
...@@ -467,6 +476,8 @@ public class MinCostZSurface < T extends RealType<T> & NumericType< T > & Native ...@@ -467,6 +476,8 @@ public class MinCostZSurface < T extends RealType<T> & NumericType< T > & Native
} }
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
// create outputs //////////////////////////////////////////////////////////////////////// // 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