@Test public void testAdditionalResultsTable() throws Exception { final ImagePlus line = NewImage.createByteImage("Test", 3, 3, 1, FILL_BLACK); line.getStack().getProcessor(1).set(1, 1, (byte) 0xFF); line.getStack().getProcessor(1).set(2, 2, (byte) 0xFF); final String length = String.valueOf(Math.sqrt(2.0) / 2); Calibration cal = line.getCalibration(); cal.pixelWidth = 0.5; cal.pixelHeight = 0.5; cal.pixelDepth = 0.5; line.setCalibration(cal); final String[] expectedHeaders = { "# Skeleton", "# Branch", "Branch length", "V1 x", "V1 y", "V1 z", "V2 x", "V2 y", "V2 z", "Euclidean distance", "running average length", "average intensity (inner 3rd)", "average intensity" }; final String[] expectedValues = { "1", "1", length, "0.5", "0.5", "0.0", "1.0", "1.0", "0.0", length, length, "255.0", "255.0" }; final CommandModule module = command().run( AnalyseSkeletonWrapper.class, true, "inputImage", line, "pruneCycleMethod", "None", "verbose", true, "pruneEnds", false).get(); final DefaultGenericTable table = (DefaultGenericTable) module.getOutput( "verboseTable"); assertNotNull(table); assertEquals("Results table has wrong number of columns", expectedHeaders.length, table.size()); for (int i = 0; i < table.size(); i++) { final PrimitiveColumn<?, ?> column = (PrimitiveColumn<?, ?>) table.get(i); assertEquals("Column has incorrect header", expectedHeaders[i], column .getHeader()); assertEquals("Column has wrong number of rows", 1, column.size()); assertEquals("Column "+i+" has an incorrect value", expectedValues[i], String .valueOf(column.get(0))); } }
@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();  }