/** * Tests that the correct values are given by the various {@link FormatTools#defaultMinMax} * signatures. */ @Test public void testDefaultMinMax() throws FormatException, IOException { final String sampleImage = "8bit-unsigned&pixelType=int8&indexed=true&planarDims=3&lengths=50,50,1&axes=X,Y,Channel.fake"; final Reader reader = scifio.initializer().initializeReader(sampleImage); final ImageMetadata iMeta = reader.getMetadata().get(0); iMeta.setBitsPerPixel(7); // Test min/max computation using ImageMetadat directly assertEquals((long) -Math.pow(2, 6), FormatTools.defaultMinMax(iMeta)[0]); assertEquals((long) Math.pow(2, 6) - 1, FormatTools.defaultMinMax(iMeta)[1]); // Test min/max computation using bits per pixel assertEquals( (long) -Math.pow(2, 6), FormatTools.defaultMinMax(iMeta.getPixelType(), iMeta.getBitsPerPixel())[0]); assertEquals( (long) Math.pow(2, 6) - 1, FormatTools.defaultMinMax(iMeta.getPixelType(), iMeta.getBitsPerPixel())[1]); // Test min/max computation using bits per pixel assertEquals((long) -Math.pow(2, 7), FormatTools.defaultMinMax(iMeta.getPixelType(), -1)[0]); assertEquals((long) Math.pow(2, 7) - 1, FormatTools.defaultMinMax(iMeta.getPixelType(), -1)[1]); // Test min/max computation using pixel type assertEquals((long) -Math.pow(2, 7), FormatTools.defaultMinMax(iMeta.getPixelType())[0]); assertEquals((long) Math.pow(2, 7) - 1, FormatTools.defaultMinMax(iMeta.getPixelType())[1]); }
public AxisValue(final AxisType type, final long length) { this.type = FormatTools.createAxis(type); this.length = length; }