@Test public void testMapImagesTrabecularThickness() throws ExecutionException, InterruptedException { final ImagePlus imagePlus = NewImage.createByteImage("image", 2, 2, 2, 1); final CommandModule module = command().run(ThicknessWrapper.class, true, "inputImage", imagePlus, "mapChoice", "Trabecular thickness", "showMaps", true).get(); final ImagePlus trabecularMap = (ImagePlus) module.getOutput( "trabecularMap"); assertNotNull(trabecularMap); assertNull(module.getOutput("spacingMap")); assertNotSame("Original image should not have been overwritten", imagePlus, trabecularMap); }
@Override public void run() { final List<Boolean> mapOptions = getMapOptions(); createLocalThickness(); final Map<Boolean, ImagePlus> thicknessMaps = new HashMap<>(); mapOptions.forEach(foreground -> { prepareRun(foreground); statusService.showStatus("Thickness: creating thickness map"); final ImagePlus map = createMap(); statusService.showStatus("Thickness: calculating results"); addMapResults(map); thicknessMaps.put(foreground, map); }); resultsTable = SharedTable.getTable(); if (showMaps) { final LUT fire = Common.makeFire(); trabecularMap = thicknessMaps.get(true); if (trabecularMap != null) { final StackStatistics trabecularStats = new StackStatistics(trabecularMap); trabecularMap.setDisplayRange(0.0, trabecularStats.max); trabecularMap.setLut(fire); } spacingMap = thicknessMaps.get(false); if (spacingMap != null) { final StackStatistics spacingStats = new StackStatistics(spacingMap); spacingMap.setDisplayRange(0.0, spacingStats.max); spacingMap.setLut(fire); } } reportUsage(); }
ThicknessWrapper extends BoneJCommand { @Override public void run() { final List<Boolean> mapOptions = getMapOptions(); createLocalThickness(); final Map<Boolean, ImagePlus> thicknessMaps = new HashMap<>(); mapOptions.forEach(foreground -> { prepareRun(foreground); statusService.showStatus("Thickness: creating thickness map"); final ImagePlus map = createMap(); statusService.showStatus("Thickness: calculating results"); addMapResults(map); thicknessMaps.put(foreground, map); }); resultsTable = SharedTable.getTable(); if (showMaps) { final LUT fire = Common.makeFire(); trabecularMap = thicknessMaps.get(true); if (trabecularMap != null) { final StackStatistics trabecularStats = new StackStatistics(trabecularMap); trabecularMap.setDisplayRange(0.0, trabecularStats.max); trabecularMap.setLut(fire); } spacingMap = thicknessMaps.get(false); if (spacingMap != null) { final StackStatistics spacingStats = new StackStatistics(spacingMap); spacingMap.setDisplayRange(0.0, spacingStats.max); spacingMap.setLut(fire); } } reportUsage(); } }
ThicknessWrapper extends BoneJCommand { @Override public void run() { final List<Boolean> mapOptions = getMapOptions(); createLocalThickness(); final Map<Boolean, ImagePlus> thicknessMaps = new HashMap<>(); mapOptions.forEach(foreground -> { prepareRun(foreground); statusService.showStatus("Thickness: creating thickness map"); final ImagePlus map = createMap(); statusService.showStatus("Thickness: calculating results"); addMapResults(map); thicknessMaps.put(foreground, map); }); resultsTable = SharedTable.getTable(); if (showMaps) { final LUT fire = Common.makeFire(); trabecularMap = thicknessMaps.get(true); if (trabecularMap != null) { final StackStatistics trabecularStats = new StackStatistics(trabecularMap); trabecularMap.setDisplayRange(0.0, trabecularStats.max); trabecularMap.setLut(fire); } spacingMap = thicknessMaps.get(false); if (spacingMap != null) { final StackStatistics spacingStats = new StackStatistics(spacingMap); spacingMap.setDisplayRange(0.0, spacingStats.max); spacingMap.setLut(fire); } } reportUsage(); }  }
ThicknessWrapper extends BoneJCommand { @Override public void run() { final List<Boolean> mapOptions = getMapOptions(); createLocalThickness(); final Map<Boolean, ImagePlus> thicknessMaps = new HashMap<>(); mapOptions.forEach(foreground -> { prepareRun(foreground); statusService.showStatus("Thickness: creating thickness map"); final ImagePlus map = createMap(); statusService.showStatus("Thickness: calculating results"); addMapResults(map); thicknessMaps.put(foreground, map); }); resultsTable = SharedTable.getTable(); if (showMaps) { final LUT fire = Common.makeFire(); trabecularMap = thicknessMaps.get(true); if (trabecularMap != null) { final StackStatistics trabecularStats = new StackStatistics(trabecularMap); trabecularMap.setDisplayRange(0.0, trabecularStats.max); trabecularMap.setLut(fire); } spacingMap = thicknessMaps.get(false); if (spacingMap != null) { final StackStatistics spacingStats = new StackStatistics(spacingMap); spacingMap.setDisplayRange(0.0, spacingStats.max); spacingMap.setLut(fire); } } reportUsage(); }  @Override void run(); }
ThicknessWrapper extends BoneJCommand { @Override public void run() { final List<Boolean> mapOptions = getMapOptions(); createLocalThickness(); final Map<Boolean, ImagePlus> thicknessMaps = new HashMap<>(); mapOptions.forEach(foreground -> { prepareRun(foreground); statusService.showStatus("Thickness: creating thickness map"); final ImagePlus map = createMap(); statusService.showStatus("Thickness: calculating results"); addMapResults(map); thicknessMaps.put(foreground, map); }); resultsTable = SharedTable.getTable(); if (showMaps) { final LUT fire = Common.makeFire(); trabecularMap = thicknessMaps.get(true); if (trabecularMap != null) { final StackStatistics trabecularStats = new StackStatistics(trabecularMap); trabecularMap.setDisplayRange(0.0, trabecularStats.max); trabecularMap.setLut(fire); } spacingMap = thicknessMaps.get(false); if (spacingMap != null) { final StackStatistics spacingStats = new StackStatistics(spacingMap); spacingMap.setDisplayRange(0.0, spacingStats.max); spacingMap.setLut(fire); } } reportUsage(); }  @Override void run();  }