public void parseFile(Plate plate, String attributeName, File envisionFile) { Sheet sheet = StringTable.openWorkSheet(envisionFile).getSheetAt(0); Point tableTopLeftPos = StringTable.findNextPlatePosition(sheet, new Point(1, 1)); int numSkipTables = propTableIndex.getIntValue() - 1; while (tableTopLeftPos != null && numSkipTables > 0) { tableTopLeftPos = StringTable.findNextPlatePosition( sheet, new Point((int) tableTopLeftPos.getX(), (int) (tableTopLeftPos.getY() + 1))); numSkipTables--; } if (tableTopLeftPos == null) { throw new RuntimeException("Could not find readout-table in file " + envisionFile); } Rectangle tableBounds = StringTable.guessPlateBounds(sheet, tableTopLeftPos); StringTable envisionTable = StringTable.readStringGridFromExcel(tableBounds, sheet); // either set the plate dimensions or validate them if (plate.getNumRows() < 0) { plate.setNumColumns(envisionTable.getWidth() - 1); plate.setNumRows(envisionTable.getHeight() - 1); } else { assert envisionTable.getWidth() - 1 == plate.getNumColumns(); assert envisionTable.getHeight() - 1 == plate.getNumRows(); } for (int colIndex = 0; colIndex < plate.getNumColumns(); colIndex++) { for (int rowIndex = 0; rowIndex < plate.getNumRows(); rowIndex++) { int plateRow = rowIndex + 1; // this inversion looks weired but it is correct int plateColumn = colIndex + 1; Well well = plate.getWell(plateColumn, plateRow); if (well == null) { well = new Well(); well.setPlateRow(plateRow); well.setPlateColumn(plateColumn); well.setPlate(plate); plate.addWell(well); } Double readout = ScreenImportUtils.parseDouble(envisionTable.get(plateRow, plateColumn)); if (readout != null) { well.getWellStatistics().put(attributeName, readout); } } } }
private void populateWell(Integer plateColumn, Integer plateRow, Well zStackWell) { List<String> readouts = TdsUtils.flattenReadoutNames(curPlateSelection); for (String readoutName : readouts) { DescriptiveStatistics descStats = new DescriptiveStatistics(); for (Plate plate : curPlateSelection) { Well curWell = plate.getWell(plateColumn, plateRow); if (curWell == null) continue; Double readoutValue = curWell.getReadout(readoutName); if (readoutValue != null) { descStats.addValue(readoutValue); } } zStackWell.getWellStatistics().put(readoutName, descStats.getMean()); } }