Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added structures for holding grayscale maps.
Introduced seed maps and probability maps and rewritten core processors to support them. Task: #284 (http://github.com/CellDynamics/QuimP/issues/284) Comments Changed storage for seed maps to modified HashMap. Accept multiple maps for one type of seeds. Added maps Solver process only fg maps Support for multicell in most of RW internal methods Set bck iter number dependent on fg Propagate seeds supports muticolor images Fixed decodeSeeds Tests for multi color seeds and some todos Verified multi seed segmentation Added simple UI for selecting seeds by ROIs. New TODOs Refactored and cleaned seeds
- Loading branch information
1 parent
7c96396
commit c4aa3b7
Showing
32 changed files
with
1,792 additions
and
583 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
src/main/java/com/github/celldynamics/quimp/plugin/randomwalk/ListMap.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
/** | ||
* | ||
*/ | ||
package com.github.celldynamics.quimp.plugin.randomwalk; | ||
|
||
import java.util.ArrayList; | ||
import java.util.HashMap; | ||
import java.util.List; | ||
|
||
import com.github.celldynamics.quimp.plugin.randomwalk.RandomWalkSegmentation.SeedTypes; | ||
|
||
/** | ||
* Store objects (maps) under specified key. There are many maps allowed under one key. | ||
* | ||
* <p>For particular key, maps are stored in ArrayList structure. | ||
* | ||
* @author p.baniukiewicz | ||
* @param <T> type of map stored | ||
* | ||
*/ | ||
@SuppressWarnings("serial") | ||
public class ListMap<T> extends HashMap<SeedTypes, List<T>> { | ||
|
||
/** | ||
* | ||
*/ | ||
public ListMap() { | ||
super(); | ||
} | ||
|
||
/** | ||
* @param initialCapacity | ||
*/ | ||
public ListMap(int initialCapacity) { | ||
super(initialCapacity); | ||
} | ||
|
||
/** | ||
* Store specified map in this structure. | ||
* | ||
* <p>This method does not verify if this particular map is already present. | ||
* | ||
* @param key key to store map under, will be created if necessary | ||
* @param val map to store under specified key | ||
* @return List of maps where specified seed map has been stored | ||
*/ | ||
public List<T> put(SeedTypes key, T val) { | ||
List<T> loc = get(key); | ||
if (loc != null) { | ||
loc.add(val); | ||
} else { | ||
put(key, new ArrayList<>()); | ||
loc = get(key); | ||
loc.add(val); | ||
} | ||
return loc; | ||
} | ||
} |
62 changes: 62 additions & 0 deletions
62
src/main/java/com/github/celldynamics/quimp/plugin/randomwalk/ProbabilityMaps.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
package com.github.celldynamics.quimp.plugin.randomwalk; | ||
|
||
import java.util.List; | ||
import java.util.ListIterator; | ||
|
||
import org.apache.commons.math3.linear.RealMatrix; | ||
|
||
import com.github.celldynamics.quimp.plugin.randomwalk.RandomWalkSegmentation.SeedTypes; | ||
|
||
/** | ||
* Store probability maps computed for foreground and background objects. | ||
* | ||
* <p>Allow to keep many maps for FG and BG, e.g. when there are more than one object that should be | ||
* handled separately. For given {@link SeedTypes} key maps are stored in ArrayList. | ||
* | ||
* @author p.baniukiewicz | ||
* @see Seeds | ||
*/ | ||
@SuppressWarnings("serial") | ||
public class ProbabilityMaps extends ListMap<RealMatrix> { | ||
|
||
/** | ||
* | ||
*/ | ||
public ProbabilityMaps() { | ||
super(); | ||
} | ||
|
||
/** | ||
* Convert list of maps under specified key to 3d array of doubles. | ||
* | ||
* <p>Data in output array are references. Require the same size of all maps within specified key. | ||
* | ||
* @param key which map to convert | ||
* @return 3d array [map][width][height] or null if there is no maps under specified key | ||
* @throws IllegalArgumentException if size is not equal | ||
*/ | ||
public double[][][] convertTo3dMatrix(Object key) { | ||
List<RealMatrix> maps = get(key); | ||
// Can be null if points not found | ||
if (maps == null || maps.isEmpty()) { | ||
return null; | ||
} | ||
// assume all maps have the same resolution | ||
int width = maps.get(0).getColumnDimension(); | ||
int height = maps.get(0).getRowDimension(); | ||
int depth = maps.size(); | ||
for (int i = 1; i < maps.size(); i++) { | ||
RealMatrix tmp = maps.get(i); | ||
if (tmp.getRowDimension() != height || tmp.getColumnDimension() != width) { | ||
throw new IllegalArgumentException("All maps must have the same resoultion"); | ||
} | ||
} | ||
double[][][] ret = new double[depth][][]; | ||
ListIterator<RealMatrix> it = maps.listIterator(); | ||
while (it.hasNext()) { | ||
ret[it.nextIndex()] = it.next().getData(); | ||
} | ||
|
||
return ret; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.