@Override public int getPixelType() { return reader.getPixelType(); }
@Override public int getPixelType() { return reader.getPixelType(); }
/** * cgb - created from the methods below? * * Retrieves how many bytes per pixel the current plane or section has. * @return the number of bytes per pixel. */ public String getPixelsType() { return FormatTools.getPixelTypeString(reader.getPixelType()); }
@Override public int getPixelType() { return getReader().getPixelType(); }
@Override public int getPixelType() { return getReader().getPixelType(); }
public int getByteWidth() { return FormatTools.getBytesPerPixel(reader.getPixelType()); }
public boolean isFloat() { return FormatTools.isFloatingPoint(reader.getPixelType()); }
public boolean isSigned() { return FormatTools.isSigned(reader.getPixelType()); }
public void checkWarnings() { if (!normalize && (reader.getPixelType() == FormatTools.FLOAT || reader.getPixelType() == FormatTools.DOUBLE)) { LOGGER.warn(""); LOGGER.warn("Java does not support " + "display of unnormalized floating point data."); LOGGER.warn("Please use the '-normalize' option " + "to avoid receiving a cryptic exception."); } if (reader.isRGB() && reader.getRGBChannelCount() > 4) { LOGGER.warn(""); LOGGER.warn("Java does not support merging more than 4 channels."); LOGGER.warn("Please use the '-separate' option " + "to avoid losing channels beyond the 4th."); } }
/** Returns the size in bytes of a w * h tile. */ public static int getPlaneSize(IFormatReader r, int w, int h) { return w * h * r.getRGBChannelCount() * getBytesPerPixel(r.getPixelType()); }
/** Returns the size in bytes of a w * h tile. */ public static int getPlaneSize(IFormatReader r, int w, int h) { return w * h * r.getRGBChannelCount() * getBytesPerPixel(r.getPixelType()); }
@Override public int getPixelType() { FormatTools.assertId(getCurrentFile(), true, 2); return noStitch ? reader.getPixelType() : core.get(getCoreIndex()).pixelType; }
@Override public int getPixelType() { FormatTools.assertId(getCurrentFile(), true, 2); return noStitch ? reader.getPixelType() : core.get(getCoreIndex()).pixelType; }
/** * Determines whether the given reader represents any floating point data. * @param reader the reader to check * @return true if any of the reader's series have a floating point pixel type * @see #isFloatingPoint(int) */ public static boolean isFloatingPoint(IFormatReader reader) { int originalSeries = reader.getSeries(); for (int s=0; s<reader.getSeriesCount(); s++) { reader.setSeries(s); if (isFloatingPoint(reader.getPixelType())) { reader.setSeries(originalSeries); return true; } } reader.setSeries(originalSeries); return false; }
/** * Determines whether the given reader represents any floating point data. * @param reader the reader to check * @return true if any of the reader's series have a floating point pixel type * @see #isFloatingPoint(int) */ public static boolean isFloatingPoint(IFormatReader reader) { int originalSeries = reader.getSeries(); for (int s=0; s<reader.getSeriesCount(); s++) { reader.setSeries(s); if (isFloatingPoint(reader.getPixelType())) { reader.setSeries(originalSeries); return true; } } reader.setSeries(originalSeries); return false; }
private byte[] getTile(IFormatReader reader, int resolution, int no, int x, int y, int w, int h) throws FormatException, IOException { if (resolution < reader.getResolutionCount()) { reader.setResolution(resolution); return reader.openBytes(no, x, y, w, h); } reader.setResolution(0); IImageScaler scaler = new SimpleImageScaler(); int scale = (int) Math.pow(pyramidScale, resolution); byte[] tile = reader.openBytes(no, x * scale, y * scale, w * scale, h * scale); int type = reader.getPixelType(); return scaler.downsample(tile, w * scale, h * scale, scale, FormatTools.getBytesPerPixel(type), reader.isLittleEndian(), FormatTools.isFloatingPoint(type), reader.getRGBChannelCount(), reader.isInterleaved()); }
private void assertSeries(int series) { reader.setSeries(series); sizeX = reader.getSizeX(); sizeY = reader.getSizeY(); sizeZ = reader.getSizeZ(); sizeC = reader.getSizeC(); sizeT = reader.getSizeT(); imageCount = reader.getImageCount(); bpp = FormatTools.getBytesPerPixel(reader.getPixelType()); planeSize = sizeX * sizeY * bpp; topHalfSize = (sizeY / 2) * sizeX * bpp; bottomHalfSize = (sizeY - (sizeY / 2)) * sizeX * bpp; topLeftQuarterSize = (sizeY / 2) * (sizeX / 2) * bpp; topRightQuarterSize = (sizeY / 2) * (sizeX - (sizeX / 2)) * bpp; bottomLeftQuarterSize = (sizeY - (sizeY / 2)) * (sizeX / 2) * bpp; bottomRightQuarterSize = (sizeY - (sizeY / 2)) * (sizeX - (sizeX / 2)) * bpp; if (!bigImage) { bigImage = sizeX * sizeY > 9000000; } }
@Test public void setId() throws Exception { srcReader = new ImageReader(); checkReader = new ImageReader(); srcReader.setId(src); checkReader.setId(check); assertEquals(srcReader.getSeriesCount(), checkReader.getSeriesCount()); for (int s=0; s<srcReader.getSeriesCount(); s++) { srcReader.setSeries(s); checkReader.setSeries(s); assertEquals(srcReader.getSizeX(), checkReader.getSizeX()); assertEquals(srcReader.getSizeY(), checkReader.getSizeY()); assertEquals(srcReader.getSizeC(), checkReader.getSizeC()); assertEquals(srcReader.getSizeZ(), checkReader.getSizeZ()); assertEquals(srcReader.getSizeT(), checkReader.getSizeT()); assertEquals(srcReader.getPixelType(), checkReader.getPixelType()); assertEquals(srcReader.isRGB(), checkReader.isRGB()); assertEquals(srcReader.getDimensionOrder(), checkReader.getDimensionOrder()); // it's OK if the endian setting is different, so don't check that } }
public static void populatePixelsOnly(MetadataStore store, IFormatReader r) { int oldSeries = r.getSeries(); for (int i=0; i<r.getSeriesCount(); i++) { r.setSeries(i); String pixelType = FormatTools.getPixelTypeString(r.getPixelType()); populatePixelsOnly(store, i, r.isLittleEndian(), r.getDimensionOrder(), pixelType, r.getSizeX(), r.getSizeY(), r.getSizeZ(), r.getSizeC(), r.getSizeT(), r.getRGBChannelCount()); if (store instanceof IPyramidStore) { for (int res=1; res<r.getResolutionCount(); res++) { r.setResolution(res); ((IPyramidStore) store).setResolutionSizeX( new PositiveInteger(r.getSizeX()), i, res); ((IPyramidStore) store).setResolutionSizeY( new PositiveInteger(r.getSizeY()), i, res); } r.setResolution(0); } } r.setSeries(oldSeries); }
public static void populatePixelsOnly(MetadataStore store, IFormatReader r) { int oldSeries = r.getSeries(); for (int i=0; i<r.getSeriesCount(); i++) { r.setSeries(i); String pixelType = FormatTools.getPixelTypeString(r.getPixelType()); populatePixelsOnly(store, i, r.isLittleEndian(), r.getDimensionOrder(), pixelType, r.getSizeX(), r.getSizeY(), r.getSizeZ(), r.getSizeC(), r.getSizeT(), r.getRGBChannelCount()); if (store instanceof IPyramidStore) { for (int res=1; res<r.getResolutionCount(); res++) { r.setResolution(res); ((IPyramidStore) store).setResolutionSizeX( new PositiveInteger(r.getSizeX()), i, res); ((IPyramidStore) store).setResolutionSizeY( new PositiveInteger(r.getSizeY()), i, res); } r.setResolution(0); } } r.setSeries(oldSeries); }