SkeletoniseWrapper extends BoneJCommand { @Override public void run() { skeleton = cleanDuplicate(inputImage); skeleton.setTitle("Skeleton of " + inputImage.getTitle()); final PlugInFilter skeletoniser = new Skeletonize3D_(); statusService.showStatus("Skeletonise: skeletonising"); skeletoniser.setup("", skeleton); skeletoniser.run(null); reportUsage(); }  @Override void run();  }
@Test public void testCompositeImageCancelsPlugin() throws Exception { final String expectedMessage = CommonMessages.HAS_CHANNEL_DIMENSIONS + ". Please split the channels."; final ImagePlus imagePlus = IJ.createHyperStack("test", 3, 3, 3, 3, 1, 8); final CommandModule module = command().run(SkeletoniseWrapper.class, true, "inputImage", imagePlus).get(); assertTrue("A composite image 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()); }
@Test public void testRun() throws Exception { final String expectedTitle = "Skeleton of Test"; final ImagePlus imagePlus = NewImage.createImage("Test", 5, 5, 5, 8, 1); final Calibration calibration = new Calibration(); calibration.setUnit("my unit"); imagePlus.setCalibration(calibration); final CommandModule module = command().run(SkeletoniseWrapper.class, true, "inputImage", imagePlus).get(); final ImagePlus skeleton = (ImagePlus) module.getOutput("skeleton"); assertNotNull("Skeleton image should not be null", skeleton); assertEquals("Skeleton has wrong title", expectedTitle, skeleton .getTitle()); assertEquals("Skeleton should have same calibration", "my unit", skeleton .getCalibration().getUnit()); assertNotSame("Original image should not have been overwritten", imagePlus, skeleton); }
@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(SkeletoniseWrapper.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()); }