-
Notifications
You must be signed in to change notification settings - Fork 1
Code_Snippets
CellDynamics edited this page Dec 19, 2017
·
8 revisions
- Scan binary image and produce outlines
ImagePlus ip = IJ.openImage("/home/Tests/239/shape1.tif");
TrackOutlineLocal track = new TrackOutlineLocal(ip.getProcessor(), 0).get(0); // get first outline
Outline outlineOrg = track.getOutlines(STEPS, false);
- Save outlines as images (in one image)
RoiSaver.saveRois(tmpdir + "reo.tif", 512, 512,
outlineOrg.asList(), Color.GREEN,
outlineSh.asList(), Color.RED,
null, null);
- Save Outline to csv file
CsvWritter csv = new CsvWritter(Paths.get(tmpdir, "outlineOrg.csv"), FormatConverter.headerEcmmOutline);
FormatConverter.saveOutline(outlineOrg, csv);
csv.close();
Use QuimP.SUPER_DEBUG
to enable additional (usually time consuming) debug:
if (QuimP.SUPER_DEBUG) { // save intermediate results
LOGGER.debug("Saving intermediate results");
String tmpdir = System.getProperty("java.io.tmpdir") + File.separator;
IJ.saveAsTiff(new ImagePlus("", fg1), tmpdir + "fg1_QuimP.tif");
IJ.saveAsTiff(new ImagePlus("", bg1), tmpdir + "bg1_QuimP.tif");
}
Then, in e.g. runner code set:
static {
System.setProperty("logback.configurationFile", "quimp-logback.xml");
System.setProperty("quimpconfig.superDebug", "true");
}
or in runner configuration in Eclipse:
-ea
-Dlogback.configurationFile=quimp-logback.xml
-Dquimpconfig.superDebug=true
try (DirectoryStream<Path> dirStream = Files.newDirectoryStream(input, "*.maQP")) {
dirStream.forEach(path -> LOGGER.debug(path.toString()));
}
@Rule
public MyTemporaryFolder folder = new MyTemporaryFolder();
@Test
public void testQconf2paQp2Qconf() throws Exception {
Path target = folder.getRoot().toPath();
}
// to prevent deleting tmp folder override after()
class MyTemporaryFolder extends TemporaryFolder {
@Override
protected void after() {
// comment to block deleting - for testing
// super.after();
}
}
QuimP selects first node randomly, this often happens when new Shape is created because of used algorithm that starts from fake head and then remove it. To block this for tests use:
Field f = Shape.class.getDeclaredField("threshold");
f.setAccessible(true);
f.setDouble(Shape.class, 1.0);
This software has been partially supported by BBSRC and The Software Sustainability Institute