/** * Parse masks into a separate overlay-specific MetadataStore. */ public void parseMasks(MetadataStore overlayStore) throws FormatException, IOException { boolean originalMaskParsing = parseMasks; int roi = 0; parseMasks = true; for (AnalysisFile roiFile : roiFiles) { roi += parseMasks(overlayStore, roiFile.well, roi, roiFile.filename); } parseMasks = originalMaskParsing; }
if (checkSuffix(id, "txt")) { for (String file : wellList) { String path = new Location(well, file).getAbsolutePath(); if (isThisType(path) && checkSuffix(path, new String[] {"tif", "tiff"})) initFile(path); return; if (!isGroupFiles()) { tiffs = new String[][] {{id}}; readers = new MinimalTiffReader[1][1]; r.setMetadataStore(getMetadataStore()); r.setId(tiffs[0][0]); core = new ArrayList<CoreMetadata>(r.getCoreMetadataList()); addGlobalMeta(entry.getKey(), entry.getValue()); getMetadataOptions().getMetadataLevel() != MetadataLevel.MINIMUM) String[] n = line.split("\t"); if (n[0].endsWith(":")) n[0] = n[0].substring(0, n[0].length() - 1); if (n.length >= 2) addGlobalMeta(n[0], n[1]); String[] d = row.split("\t"); for (int col=3; col<cols.length; col++) { addGlobalMeta("Plate " + d[0] + ", Well " + d[2] + " " + cols[col],
private byte[] getTile(int well, int no, int row, int col, Region intersection) throws FormatException, IOException { intersection.x %= tileWidth; intersection.y %= tileHeight; int tileIndex = (no * tileRows + row) * tileCols + col; readers[well][tileIndex].setId(tiffs[well][tileIndex]); int bpp = FormatTools.getBytesPerPixel(getPixelType()); int ch = getRGBChannelCount(); int bufferSize = intersection.width * intersection.height * ch * bpp; if (cachedTileBuffer == null || cachedTileBuffer.length != bufferSize) { cachedTileBuffer = new byte[bufferSize]; } byte[] buf = readers[well][tileIndex].openBytes(0, cachedTileBuffer, intersection.x, intersection.y, intersection.width, intersection.height); readers[well][tileIndex].close(); return buf; }
if (c < getEffectiveSizeC()) { store.setChannelName(channelNames.get(c), well, c); for (int i=0; i<getImageCount(); i++) { store.setPlaneExposureTime(new Time(exposure, UNITS.SECOND), well, i);
@Override public boolean isThisType(String filename, boolean open) { if (!open) return super.isThisType(filename, open); // no file system access Location baseFile = new Location(filename).getAbsoluteFile(); Location wellDir = baseFile.getParentFile(); String wellName = wellDir.getName(); if (checkSuffix(filename, "txt")) { String name = baseFile.getName(); return wellName.equals("results") || wellName.equals("Batchresults") || name.equals("Nugenesistemplate.txt") || name.startsWith("mode"); } Location experiment = null; try { experiment = wellDir.getParentFile().getParentFile(); } catch (NullPointerException e) { } if (experiment == null) return false; boolean validName = wellName.startsWith("Well") || wellName.equals("results") || (wellName.length() == 1 && wellName.replaceAll("\\d", "").length() == 0); return validName && super.isThisType(filename, open); }
if (checkSuffix(id, "txt")) { for (String file : wellList) { String path = new Location(well, file).getAbsolutePath(); if (isThisType(path) && checkSuffix(path, new String[] {"tif", "tiff"})) initFile(path); return; if (!isGroupFiles()) { tiffs = new String[][] {{id}}; readers = new MinimalTiffReader[1][1]; r.setMetadataStore(getMetadataStore()); r.setId(tiffs[0][0]); core = new ArrayList<CoreMetadata>(r.getCoreMetadataList()); addGlobalMeta(entry.getKey(), entry.getValue()); getMetadataOptions().getMetadataLevel() != MetadataLevel.MINIMUM) String[] n = line.split("\t"); if (n[0].endsWith(":")) n[0] = n[0].substring(0, n[0].length() - 1); if (n.length >= 2) addGlobalMeta(n[0], n[1]); String[] d = row.split("\t"); for (int col=3; col<cols.length; col++) { addGlobalMeta("Plate " + d[0] + ", Well " + d[2] + " " + cols[col],
private byte[] getTile(int well, int no, int row, int col, Region intersection) throws FormatException, IOException { intersection.x %= tileWidth; intersection.y %= tileHeight; int tileIndex = (no * tileRows + row) * tileCols + col; readers[well][tileIndex].setId(tiffs[well][tileIndex]); int bpp = FormatTools.getBytesPerPixel(getPixelType()); int ch = getRGBChannelCount(); int bufferSize = intersection.width * intersection.height * ch * bpp; if (cachedTileBuffer == null || cachedTileBuffer.length != bufferSize) { cachedTileBuffer = new byte[bufferSize]; } byte[] buf = readers[well][tileIndex].openBytes(0, cachedTileBuffer, intersection.x, intersection.y, intersection.width, intersection.height); readers[well][tileIndex].close(); return buf; }
if (c < getEffectiveSizeC()) { store.setChannelName(channelNames.get(c), well, c); for (int i=0; i<getImageCount(); i++) { store.setPlaneExposureTime(new Time(exposure, UNITS.SECOND), well, i);
@Override public boolean isThisType(String filename, boolean open) { if (!open) return super.isThisType(filename, open); // no file system access Location baseFile = new Location(filename).getAbsoluteFile(); Location wellDir = baseFile.getParentFile(); String wellName = wellDir.getName(); if (checkSuffix(filename, "txt")) { String name = baseFile.getName(); return wellName.equals("results") || wellName.equals("Batchresults") || name.equals("Nugenesistemplate.txt") || name.startsWith("mode"); } Location experiment = null; try { experiment = wellDir.getParentFile().getParentFile(); } catch (NullPointerException e) { } if (experiment == null) return false; boolean validName = wellName.startsWith("Well") || wellName.equals("results") || (wellName.length() == 1 && wellName.replaceAll("\\d", "").length() == 0); return validName && super.isThisType(filename, open); }
/** * Parse masks into a separate overlay-specific MetadataStore. */ public void parseMasks(MetadataStore overlayStore) throws FormatException, IOException { boolean originalMaskParsing = parseMasks; int roi = 0; parseMasks = true; for (AnalysisFile roiFile : roiFiles) { roi += parseMasks(overlayStore, roiFile.well, roi, roiFile.filename); } parseMasks = originalMaskParsing; }
/** * If available, populates overlays for a given set of pixels objects. * @param pixelsList Pixels objects to populate overlays for. * @param plateIds Plate object IDs to populate overlays for. */ private void importOverlays( List<Pixels> pixelsList, List<Long> plateIds) throws FormatException, IOException { IFormatReader baseReader = reader.getImageReader().getReader(); if (baseReader instanceof MIASReader) { try { MIASReader miasReader = (MIASReader) baseReader; ServiceFactoryPrx sf = store.getServiceFactory(); OverlayMetadataStore s = new OverlayMetadataStore(); s.initialize(sf, pixelsList, plateIds); miasReader.parseMasks(s); s.complete(); } catch (ServerError e) { log.warn("Error while populating MIAS overlays.", e); } } }