Commit d9aaa4e8 authored by Guillaume Blin's avatar Guillaume Blin

RidgeSection renamed to Ridglet to be consistent with documentation

parent 72e94ee9
......@@ -47,6 +47,13 @@ import com.alee.utils.ThreadUtils;
import net.imglib2.RandomAccess;
import net.imglib2.type.numeric.RealType;
/**
*
* A {@link Ridge} is unique path inside a {@link Ridglet} tree
*
* @param <T> Same as {@link RidgePoint}
* @param <V> Same as {@link RidgePoint}
*/
public class Ridge<T extends RealType<T>, V extends RealType<V>> implements Iterable<long[]>{
private static Logger log = LoggerFactory.getLogger(Ridge.class);
......@@ -158,6 +165,9 @@ public class Ridge<T extends RealType<T>, V extends RealType<V>> implements Iter
/**
* @return The proportion of ridge pixels where the local curvature is zero
*/
private double getZeroProportion() {
return (double)getCurvature().zeroCount()/(double)curvFeatures.getN() ;
}
......@@ -221,6 +231,9 @@ public class Ridge<T extends RealType<T>, V extends RealType<V>> implements Iter
/**
* @return The {@link CurvatureFeature}s of this {@link Ridge}
*/
private CurvatureFeatures getCurvature() {
if(curvFeatures==null){
List<Integer> cc = toChainCode();
......@@ -247,7 +260,7 @@ public class Ridge<T extends RealType<T>, V extends RealType<V>> implements Iter
public boolean selfIntersecting(){
return false; //TODO
return false; // This is a placeholder for now
//return ImgGeometry.selfIntersecting(toPolyline());
}
......@@ -353,7 +366,7 @@ public class Ridge<T extends RealType<T>, V extends RealType<V>> implements Iter
}
}
// Now check cliped area for each found neighbour
// Now check clipped area for each found neighbour
for(T n : ids){
//log.debug("Id -> "+n);
......@@ -475,11 +488,11 @@ public class Ridge<T extends RealType<T>, V extends RealType<V>> implements Iter
if(length == -1){
for(RidgePoint<?,?> rp : left){
RidgeSection<?,?> rs = rp.getRidgeSection();
Ridglet<?,?> rs = rp.getRidgeSection();
length += rs.pathLength();
}
for(RidgePoint<?,?> rp : right){
RidgeSection<?,?> rs = rp.getRidgeSection();
Ridglet<?,?> rs = rp.getRidgeSection();
length += rs.pathLength();
}
......@@ -948,8 +961,8 @@ public class Ridge<T extends RealType<T>, V extends RealType<V>> implements Iter
"Compactness",
"Curvature Zeros",
"Curvature non Zero",
"Average Concave",
"Average Convex",
"Sum Concave",
"Sum Convex",
};
}
......
......@@ -52,6 +52,7 @@ import net.imglib2.outofbounds.OutOfBoundsFactory;
import net.imglib2.type.numeric.RealType;
import net.imglib2.view.Views;
public class RidgePoint<T extends RealType<T>, V extends RealType<V>> implements TreeNode<RidgePoint<T,V>> {
private final static Logger log = LoggerFactory.getLogger(RidgePoint.class);
......@@ -108,10 +109,10 @@ public class RidgePoint<T extends RealType<T>, V extends RealType<V>> implements
private final V highestIntensity;
/**
* The Ridge Section linking the center of the parent RidgePoint to this RidgePoint,
* The Ridglet linking the centre of the parent RidgePoint to this RidgePoint,
* If this RidgePoint is the root the path will have only one point
*/
private final RidgeSection<T,V> path;
private final Ridglet<T,V> path;
......@@ -203,7 +204,7 @@ public class RidgePoint<T extends RealType<T>, V extends RealType<V>> implements
else{
this.path = new RidgeSection<>(p);
this.path = new Ridglet<>(p);
......@@ -256,7 +257,7 @@ public class RidgePoint<T extends RealType<T>, V extends RealType<V>> implements
// Tracing.toChainCode(tracks.get(c)); //DEBUG remove
//Create a new RidgeSection and a new Child
RidgeSection<T,V> tr = new RidgeSection<>(tracks.get(c), cp);
Ridglet<T,V> tr = new Ridglet<>(tracks.get(c), cp);
children[c] = new RidgePoint<>(this, depth+1, pair.getFirst(), tr);
}
}
......@@ -305,7 +306,7 @@ public class RidgePoint<T extends RealType<T>, V extends RealType<V>> implements
@SuppressWarnings("unchecked")
public RidgePoint(RidgePoint<T,V> parent, int depth, LeafCase isLeaf, RidgeSection<T,V> track) {
public RidgePoint(RidgePoint<T,V> parent, int depth, LeafCase isLeaf, Ridglet<T,V> track) {
this.identifier = gen++;
......@@ -459,7 +460,7 @@ public class RidgePoint<T extends RealType<T>, V extends RealType<V>> implements
//Create children
List<Pair<LeafCase,RidgeSection<T,V>>> LR = childCase(path.childCenter(), tracks);
List<Pair<LeafCase,Ridglet<T,V>>> LR = childCase(path.childCenter(), tracks);
children = new RidgePoint[LR.size()];
for(int c = 0; c<LR.size(); c++){
......@@ -1144,7 +1145,7 @@ public class RidgePoint<T extends RealType<T>, V extends RealType<V>> implements
/**
* @see RidgeSection#rebase(int)
* @see Ridglet#rebase(int)
*/
private ArrayList<long[]> rebase(int furthest, boolean createChild) {
......@@ -1487,9 +1488,9 @@ public class RidgePoint<T extends RealType<T>, V extends RealType<V>> implements
* starting from one maximum in maxToParent and the left entry return true if the ridge reaches the max distance
* and false if the a lowest intensity threshold was reached first
*/
private List<Pair<LeafCase, RidgeSection<T,V>>> childCase(long[] center, List<List<long[]>> maxToParent) {
private List<Pair<LeafCase, Ridglet<T,V>>> childCase(long[] center, List<List<long[]>> maxToParent) {
List<Pair<LeafCase, RidgeSection<T,V>>> cases = new ArrayList<>(maxToParent.size());
List<Pair<LeafCase, Ridglet<T,V>>> cases = new ArrayList<>(maxToParent.size());
//Store maxima in same order as the provided list
......@@ -1513,7 +1514,7 @@ public class RidgePoint<T extends RealType<T>, V extends RealType<V>> implements
maxToParent.get(i).addAll(pair.getSecond());
cases.add(new Pair<>(pair.getFirst(), new RidgeSection<>(maxToParent.get(i), cp)));
cases.add(new Pair<>(pair.getFirst(), new Ridglet<>(maxToParent.get(i), cp)));
}
return cases;
......@@ -1536,9 +1537,9 @@ public class RidgePoint<T extends RealType<T>, V extends RealType<V>> implements
/**
* @return The {@link RidgeSection} allowing to move from the {@link RidgePoint} to its parent
* @return The {@link Ridglet} allowing to move from the {@link RidgePoint} to its parent
*/
public RidgeSection<T,V> getRidgeSection(){
public Ridglet<T,V> getRidgeSection(){
return path;
}
......@@ -1688,7 +1689,7 @@ public class RidgePoint<T extends RealType<T>, V extends RealType<V>> implements
list.add(this.path.nextAfterChild());
// DEBUG System.out.println("Leaf : "+gen);
// DEBUG list.forEach(l->System.out.println(Arrays.toString(l)));
RidgeSection<T,V> mock = new RidgeSection<>(list, 0);
Ridglet<T,V> mock = new Ridglet<>(list, 0);
this.addChild(new RidgePoint<>(this, depth+1, LeafCase.Self_Intersect, mock));
}
}
......@@ -1704,7 +1705,7 @@ public class RidgePoint<T extends RealType<T>, V extends RealType<V>> implements
sAccess.get().set(id);
});
RidgeSection<T,V> mock = new RidgeSection<>(l, 0);
Ridglet<T,V> mock = new Ridglet<>(l, 0);
this.addChild(new RidgePoint<>(this, depth+1, LeafCase.Self_Intersect, mock));
}
......
......@@ -35,14 +35,14 @@ import net.imglib2.type.numeric.RealType;
/**
*
* A RidgeSection stores locations of a ridge from a parent {@link RidgePoint} to a child {@link RidgePoint}.
* A {@link Ridglet} stores locations of a ridge from a parent {@link RidgePoint} to a child {@link RidgePoint}.
* It also stores the location of the end of the parent zone of influence (crossing point)
*
* @author Guillaume Blin
*
* @param <T>
*/
public class RidgeSection<T extends RealType<T>, V extends RealType<V>> {
public class Ridglet<T extends RealType<T>, V extends RealType<V>> {
......@@ -59,11 +59,10 @@ public class RidgeSection<T extends RealType<T>, V extends RealType<V>> {
/**
* @param access Access on the original image (non filtered)
* @param track The polyline defining this section, from the parent to the child end point
* @param cp
*/
public RidgeSection(List<long[]> track, int cp) {
public Ridglet(List<long[]> track, int cp) {
this.track = track;
......@@ -76,7 +75,7 @@ public class RidgeSection<T extends RealType<T>, V extends RealType<V>> {
}
public RidgeSection(Point p) {
public Ridglet(Point p) {
long[] loc = new long[2];
p.localize(loc);
......
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