public static void main(final String... args) { // Launch ImageJ as usual. final ImageJ ij = net.imagej.Main.launch(args); // Launch our "Hello World" command right away. ij.op().run(OmeroImageReader2.class); // ij.op().run(OmeroImageReader.class, true); }
@Test public void testEmptyDatasetFails() throws AssertionError { final long[] dims = {0, 0}; final AxisType[] axisTypes = {Axes.X, Axes.Y}; dataset = ij.dataset().create(new BitType(), dims, "Test set", axisTypes); final boolean result = (boolean) ij.op().run(DatasetIsBinary.class, dataset); assertFalse("Empty dataset is not binary", result); }
@Test public void testDatasetWithTwoValuesPasses() throws AssertionError { final int minValue = 0; final int maxValue = 1; dataset = datasetCreator.createDataset(DatasetType.BIT); DatasetCreator.fillWithRandomWholeNumbers(dataset, minValue, maxValue); final boolean result = (boolean) ij.op().run(DatasetIsBinary.class, dataset); assertTrue("A Dataset with two distinct values is binary", result); }
@Test public void testInvalidDatasetTypesFail() throws AssertionError { final Stream<DatasetType> allTypes = Arrays.stream(DatasetType.values()); allTypes .filter(t -> t != DatasetType.BIT) .forEach( type -> { dataset = datasetCreator.createDataset(type); final boolean result = (boolean) ij.op().run(DatasetIsBinary.class, dataset); final String typeClassName = dataset.getType().getClass().getName(); assertFalse("A Dataset of type " + typeClassName + " should not be binary", result); }); }