addGlobalMeta("Magic identifier", in.readString(2)); addGlobalMeta("File size (in bytes)", in.readInt()); in.skipBytes(4); global = in.readInt(); if (getSizeX() < 1) { LOGGER.trace("Invalid width: {}; using the absolute value", getSizeX()); m.sizeX = Math.abs(getSizeX()); if (getSizeY() < 1) { LOGGER.trace("Invalid height: {}; using the absolute value", getSizeY()); m.sizeY = Math.abs(getSizeY()); invertY = true; addGlobalMeta("Color planes", in.readShort()); bpp = in.readShort(); if (bpp > 8) bpp /= getSizeC(); m.rgb = getSizeC() > 1; m.littleEndian = true; m.interleaved = true; m.metadataComplete = true; m.indexed = palette != null; if (isIndexed()) { m.sizeC = 1; m.rgb = false;
@Override public void close(boolean fileOnly) throws IOException { super.close(fileOnly); if (thumbReader != null) thumbReader.close(fileOnly);
int rowsToSkip = invertY ? y : getSizeY() - (h + y); int rowLength = (getSizeX() * (isIndexed() ? 1 : getSizeC()) * bpp) / 8; else pad *= getSizeC(); int planeSize = getSizeX() * getSizeC() * h; if (bpp >= 8) planeSize *= (bpp / 8); else planeSize /= (8 / bpp); if (planeSize + getSizeY() + in.getFilePointer() <= in.length()) { pad = 1; planeSize += h; int effectiveC = palette != null && palette[0].length > 0 ? 1 : getSizeC(); int nBits = (getSizeX() - w - x) * bpp * effectiveC + pad * 8; boolean endOfFile = false; int index = 0; byte[] plane = new byte[getSizeX() * getSizeY() * getRGBChannelCount()]; while(!endOfFile) { byte firstByte = (byte) (in.readBits(bpp) & 0xff); readPlane(s, x, y, w, h, buf); if (getRGBChannelCount() > 1) { ImageTools.bgrToRgb(buf, isInterleaved(), 1, getRGBChannelCount());
tiffs = new ArrayList<String>(getImageCount()); thumbReader = new BMPReader(); if (thumbId != null) { thumbId = replaceExtension(thumbId, "pty", "bmp"); thumb.close(); Location.mapFile("thumbnail.bmp", new ByteArrayHandle(b)); thumbReader.setId("thumbnail.bmp"); for (int i=0; i<getSeriesCount(); i++) { core.get(i).thumbSizeX = thumbReader.getSizeX(); core.get(i).thumbSizeY = thumbReader.getSizeY(); thumbReader.close(); Location.mapFile("thumbnail.bmp", null);
if (reader == null) { file = "tile.bmp"; reader = new BMPReader();
tiffs = new ArrayList<String>(getImageCount()); thumbReader = new BMPReader(); if (thumbId != null) { thumbId = replaceExtension(thumbId, "pty", "bmp"); thumb.close(); Location.mapFile("thumbnail.bmp", new ByteArrayHandle(b)); thumbReader.setId("thumbnail.bmp"); for (int i=0; i<getSeriesCount(); i++) { core.get(i).thumbSizeX = thumbReader.getSizeX(); core.get(i).thumbSizeY = thumbReader.getSizeY(); thumbReader.close(); Location.mapFile("thumbnail.bmp", null);
if (reader == null) { file = "tile.bmp"; reader = new BMPReader();
addGlobalMeta("Magic identifier", in.readString(2)); addGlobalMeta("File size (in bytes)", in.readInt()); in.skipBytes(4); global = in.readInt(); if (getSizeX() < 1) { LOGGER.trace("Invalid width: {}; using the absolute value", getSizeX()); m.sizeX = Math.abs(getSizeX()); if (getSizeY() < 1) { LOGGER.trace("Invalid height: {}; using the absolute value", getSizeY()); m.sizeY = Math.abs(getSizeY()); invertY = true; addGlobalMeta("Color planes", in.readShort()); bpp = in.readShort(); if (bpp > 8) bpp /= getSizeC(); m.rgb = getSizeC() > 1; m.littleEndian = true; m.interleaved = true; m.metadataComplete = true; m.indexed = palette != null; if (isIndexed()) { m.sizeC = 1; m.rgb = false;
int rowsToSkip = invertY ? y : getSizeY() - (h + y); int rowLength = (getSizeX() * (isIndexed() ? 1 : getSizeC()) * bpp) / 8; else pad *= getSizeC(); int planeSize = getSizeX() * getSizeC() * h; if (bpp >= 8) planeSize *= (bpp / 8); else planeSize /= (8 / bpp); if (planeSize + getSizeY() + in.getFilePointer() <= in.length()) { pad = 1; planeSize += h; int effectiveC = palette != null && palette[0].length > 0 ? 1 : getSizeC(); int nBits = (getSizeX() - w - x) * bpp * effectiveC + pad * 8; boolean endOfFile = false; int index = 0; byte[] plane = new byte[getSizeX() * getSizeY() * getRGBChannelCount()]; while(!endOfFile) { byte firstByte = (byte) (in.readBits(bpp) & 0xff); readPlane(s, x, y, w, h, buf); if (getRGBChannelCount() > 1) { ImageTools.bgrToRgb(buf, isInterleaved(), 1, getRGBChannelCount());
@Override public void close(boolean fileOnly) throws IOException { super.close(fileOnly); if (thumbReader != null) thumbReader.close(fileOnly);