@Test public void testResultsTable() throws Exception { final ImagePlus pixels = NewImage.createByteImage("Test", 4, 4, 1, FILL_BLACK); pixels.getStack().getProcessor(1).set(1, 1, (byte) 0xFF); pixels.getStack().getProcessor(1).set(3, 3, (byte) 0xFF); final String[] expectedHeaders = { "# Skeleton", "# Branches", "# Junctions", "# End-point voxels", "# Junction voxels", "# Slab voxels", "Average Branch Length", "# Triple points", "# Quadruple points", "Maximum Branch Length", "Longest Shortest Path", "spx", "spy", "spz" }; final double[][] expectedValues = { { 1, 2 }, { 0, 0 }, { 0, 0 }, { 1, 1 }, { 0, 0 }, { 0, 0 }, { 0.0, 0.0 }, { 0, 0 }, { 0, 0 }, { 0.0, 0.0 }, { 0.0, 0.0 }, { 1.0, 3.0 }, { 1.0, 3.0 }, { 0.0, 0.0 } }; final CommandModule module = command().run( AnalyseSkeletonWrapper.class, true, "inputImage", pixels, "pruneCycleMethod", "None", "calculateShortestPaths", true).get(); @SuppressWarnings("unchecked") final List<DefaultColumn<Double>> table = (List<DefaultColumn<Double>>) module.getOutput("resultsTable"); assertNotNull(table); assertEquals("Results table has wrong number of columns", expectedHeaders.length, table.size()); for (int i = 0; i < table.size(); i++) { final DefaultColumn<Double> column = table.get(i); assertEquals("Column has incorrect header", expectedHeaders[i], column .getHeader()); assertEquals("Column has wrong number of rows", 2, column.size()); for (int j = 0; j < 2; j++) { assertEquals("Column has an incorrect value", expectedValues[i][j], column.get(j), 1e-12); } } }
@Override public void run() { if (isIntensityNeeded()) { openIntensityImage(); if (intensityImage == null) { return; } } statusService.showStatus("Analyse skeleton: skeletonising"); final ImagePlus skeleton = skeletonise(inputImage); final int pruneIndex = mapPruneCycleMethod(pruneCycleMethod); final AnalyzeSkeleton_ analyzeSkeleton_ = new AnalyzeSkeleton_(); final Roi roi = excludeRoi ? inputImage.getRoi() : null; analyzeSkeleton_.setup("", skeleton); statusService.showStatus("Analyse skeleton: analysing skeletons"); final SkeletonResult results = analyzeSkeleton_.run(pruneIndex, pruneEnds, calculateShortestPaths, intensityImage, true, verbose, roi); if (hasNoSkeletons(analyzeSkeleton_)) { cancelMacroSafe(this, NO_SKELETONS); return; } showResults(results); showAdditionalResults(results); if (displaySkeletons) { final ImageStack labelledStack = analyzeSkeleton_.getResultImage(false); labelledSkeleton = new ImagePlus(inputImage.getTitle() + "-labelled-skeletons", labelledStack); labelledSkeleton.setCalibration(inputImage.getCalibration()); if (calculateShortestPaths) { final ImageStack stack = analyzeSkeleton_.getResultImage(true); final String title = inputImage.getShortTitle() + "-shortest-paths"; shortestPaths = new ImagePlus(title, stack); shortestPaths.setCalibration(inputImage.getCalibration()); } } reportUsage(); }
AnalyseSkeletonWrapper extends BoneJCommand { @Override public void run() { if (isIntensityNeeded()) { openIntensityImage(); if (intensityImage == null) { return; } } statusService.showStatus("Analyse skeleton: skeletonising"); final ImagePlus skeleton = skeletonise(inputImage); final int pruneIndex = mapPruneCycleMethod(pruneCycleMethod); final AnalyzeSkeleton_ analyzeSkeleton_ = new AnalyzeSkeleton_(); final Roi roi = excludeRoi ? inputImage.getRoi() : null; analyzeSkeleton_.setup("", skeleton); statusService.showStatus("Analyse skeleton: analysing skeletons"); final SkeletonResult results = analyzeSkeleton_.run(pruneIndex, pruneEnds, calculateShortestPaths, intensityImage, true, verbose, roi); if (hasNoSkeletons(analyzeSkeleton_)) { cancelMacroSafe(this, NO_SKELETONS); return; } showResults(results); showAdditionalResults(results); if (displaySkeletons) { final ImageStack labelledStack = analyzeSkeleton_.getResultImage(false); labelledSkeleton = new ImagePlus(inputImage.getTitle() + "-labelled-skeletons", labelledStack); labelledSkeleton.setCalibration(inputImage.getCalibration()); if (calculateShortestPaths) { final ImageStack stack = analyzeSkeleton_.getResultImage(true); final String title = inputImage.getShortTitle() + "-shortest-paths"; shortestPaths = new ImagePlus(title, stack); shortestPaths.setCalibration(inputImage.getCalibration()); } } reportUsage(); } }
AnalyseSkeletonWrapper extends BoneJCommand { @Override public void run() { if (isIntensityNeeded()) { openIntensityImage(); if (intensityImage == null) { return; } } statusService.showStatus("Analyse skeleton: skeletonising"); final ImagePlus skeleton = skeletonise(inputImage); final int pruneIndex = mapPruneCycleMethod(pruneCycleMethod); final AnalyzeSkeleton_ analyzeSkeleton_ = new AnalyzeSkeleton_(); final Roi roi = excludeRoi ? inputImage.getRoi() : null; analyzeSkeleton_.setup("", skeleton); statusService.showStatus("Analyse skeleton: analysing skeletons"); final SkeletonResult results = analyzeSkeleton_.run(pruneIndex, pruneEnds, calculateShortestPaths, intensityImage, true, verbose, roi); if (hasNoSkeletons(analyzeSkeleton_)) { cancelMacroSafe(this, NO_SKELETONS); return; } showResults(results); showAdditionalResults(results); if (displaySkeletons) { final ImageStack labelledStack = analyzeSkeleton_.getResultImage(false); labelledSkeleton = new ImagePlus(inputImage.getTitle() + "-labelled-skeletons", labelledStack); labelledSkeleton.setCalibration(inputImage.getCalibration()); if (calculateShortestPaths) { final ImageStack stack = analyzeSkeleton_.getResultImage(true); final String title = inputImage.getShortTitle() + "-shortest-paths"; shortestPaths = new ImagePlus(title, stack); shortestPaths.setCalibration(inputImage.getCalibration()); } } reportUsage(); }  }
AnalyseSkeletonWrapper extends BoneJCommand { @Override public void run() { if (isIntensityNeeded()) { openIntensityImage(); if (intensityImage == null) { return; } } statusService.showStatus("Analyse skeleton: skeletonising"); final ImagePlus skeleton = skeletonise(inputImage); final int pruneIndex = mapPruneCycleMethod(pruneCycleMethod); final AnalyzeSkeleton_ analyzeSkeleton_ = new AnalyzeSkeleton_(); final Roi roi = excludeRoi ? inputImage.getRoi() : null; analyzeSkeleton_.setup("", skeleton); statusService.showStatus("Analyse skeleton: analysing skeletons"); final SkeletonResult results = analyzeSkeleton_.run(pruneIndex, pruneEnds, calculateShortestPaths, intensityImage, true, verbose, roi); if (hasNoSkeletons(analyzeSkeleton_)) { cancelMacroSafe(this, NO_SKELETONS); return; } showResults(results); showAdditionalResults(results); if (displaySkeletons) { final ImageStack labelledStack = analyzeSkeleton_.getResultImage(false); labelledSkeleton = new ImagePlus(inputImage.getTitle() + "-labelled-skeletons", labelledStack); labelledSkeleton.setCalibration(inputImage.getCalibration()); if (calculateShortestPaths) { final ImageStack stack = analyzeSkeleton_.getResultImage(true); final String title = inputImage.getShortTitle() + "-shortest-paths"; shortestPaths = new ImagePlus(title, stack); shortestPaths.setCalibration(inputImage.getCalibration()); } } reportUsage(); }  @Override void run(); }
AnalyseSkeletonWrapper extends BoneJCommand { @Override public void run() { if (isIntensityNeeded()) { openIntensityImage(); if (intensityImage == null) { return; } } statusService.showStatus("Analyse skeleton: skeletonising"); final ImagePlus skeleton = skeletonise(inputImage); final int pruneIndex = mapPruneCycleMethod(pruneCycleMethod); final AnalyzeSkeleton_ analyzeSkeleton_ = new AnalyzeSkeleton_(); final Roi roi = excludeRoi ? inputImage.getRoi() : null; analyzeSkeleton_.setup("", skeleton); statusService.showStatus("Analyse skeleton: analysing skeletons"); final SkeletonResult results = analyzeSkeleton_.run(pruneIndex, pruneEnds, calculateShortestPaths, intensityImage, true, verbose, roi); if (hasNoSkeletons(analyzeSkeleton_)) { cancelMacroSafe(this, NO_SKELETONS); return; } showResults(results); showAdditionalResults(results); if (displaySkeletons) { final ImageStack labelledStack = analyzeSkeleton_.getResultImage(false); labelledSkeleton = new ImagePlus(inputImage.getTitle() + "-labelled-skeletons", labelledStack); labelledSkeleton.setCalibration(inputImage.getCalibration()); if (calculateShortestPaths) { final ImageStack stack = analyzeSkeleton_.getResultImage(true); final String title = inputImage.getShortTitle() + "-shortest-paths"; shortestPaths = new ImagePlus(title, stack); shortestPaths.setCalibration(inputImage.getCalibration()); } } reportUsage(); }  @Override void run();  }