@Test public void testTimeDimensionCancelsPlugin() throws Exception { final String expectedMessage = CommonMessages.HAS_TIME_DIMENSIONS + ". Please split the hyperstack."; final ImagePlus imagePlus = IJ.createHyperStack("test", 3, 3, 1, 3, 3, 8); final CommandModule module = command().run( AnalyseSkeletonWrapper.class, true, "inputImage", imagePlus).get(); assertTrue("An image with time dimension should have cancelled the plugin", module.isCanceled()); assertEquals("Cancel reason is incorrect", expectedMessage, module .getCancelReason()); verify(MOCK_UI, timeout(1000)).dialogPrompt(anyString(), anyString(), any(), any()); }
@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();  }