/** * Computes a unique N-D position corresponding * to the given rasterized index value. * @param lengths the maximum value at each positional dimension * @param raster rasterized index value * @return position along each dimensional axis */ public static int[] rasterToPosition(int[] lengths, int raster) { return rasterToPosition(lengths, raster, new int[lengths.length]); }
/** * Shortcut for converting rasterized position to N-D position, * using the given array instead of allocating a new one. */ protected int[] pos(int raster, int[] pos) { return FormatTools.rasterToPosition(lengths, raster, pos); }
/** * Computes a unique N-D position corresponding * to the given rasterized index value. * @param lengths the maximum value at each positional dimension * @param raster rasterized index value * @return position along each dimensional axis */ public static int[] rasterToPosition(int[] lengths, int raster) { return rasterToPosition(lengths, raster, new int[lengths.length]); }
/** * Shortcut for converting rasterized position to N-D position, * using the given array instead of allocating a new one. */ protected int[] pos(int raster, int[] pos) { return FormatTools.rasterToPosition(lengths, raster, pos); }
/** Shortcut for converting rasterized position to N-D position. */ protected int[] pos(int raster) { return FormatTools.rasterToPosition(lengths, raster); }
/** Shortcut for converting rasterized position to N-D position. */ protected int[] pos(int raster) { return FormatTools.rasterToPosition(lengths, raster); }
private int[] getPos(int seriesIndex) { int[] lengths = new int[2]; if (montageIndex < fieldIndex) { lengths[0] = montageOffsets == null ? 1 : montageOffsets.length; lengths[1] = fieldOffsets == null ? 1 : fieldOffsets.length; } else { lengths[1] = montageOffsets == null ? 1 : montageOffsets.length; lengths[0] = fieldOffsets == null ? 1 : fieldOffsets.length; } if (lengths[0] == 0) lengths[0] = 1; if (lengths[1] == 0) lengths[1] = 1; return FormatTools.rasterToPosition(lengths, seriesIndex); }
private int[] getPos(int seriesIndex) { int[] lengths = new int[2]; if (montageIndex < fieldIndex) { lengths[0] = montageOffsets == null ? 1 : montageOffsets.length; lengths[1] = fieldOffsets == null ? 1 : fieldOffsets.length; } else { lengths[1] = montageOffsets == null ? 1 : montageOffsets.length; lengths[0] = fieldOffsets == null ? 1 : fieldOffsets.length; } if (lengths[0] == 0) lengths[0] = 1; if (lengths[1] == 0) lengths[1] = 1; return FormatTools.rasterToPosition(lengths, seriesIndex); }
/** * Convert the given series (Image) index to a * WellSample, Well, and Plate index. * This should match the ordering used by XMLMockObjects. * * @param seriesIndex the index of the series/Image * @return an array of length 3 containing the * WellSample, Well, and Plate indices (in order), * or null if SPW metadata was not defined */ private int[] toSPWCoordinates(int seriesIndex) { if (plates < 1) { return null; } int screenCount = (int) Math.max(screens, 1); return FormatTools.rasterToPosition( new int[] {plateAcqs * fields, plateRows * plateCols, screenCount * plates}, seriesIndex); }
private Well getWell(int seriesIndex) { int[] coordinates = FormatTools.rasterToPosition( new int[] {fieldColumnCount, fieldRowCount, wellCount}, seriesIndex); return new Well(coordinates[1], coordinates[0], coordinates[2]); }
private FlexFile lookupFile(int fileSeries) { effectiveFieldCount = fieldCount; if (wellCount * plateCount == flexFiles.size()) { effectiveFieldCount = 1; } int[] lengths = new int[] {fieldCount, wellCount, plateCount}; int[] pos = FormatTools.rasterToPosition(lengths, fileSeries); boolean zeroWell = wellCount == 1 && effectiveFieldCount == 1; int row = zeroWell ? 0 : wellNumber[pos[1]][0]; int col = zeroWell ? 0 : wellNumber[pos[1]][1]; return lookupFile(row, col, effectiveFieldCount == 1 ? 0 : pos[0]); }
private FlexFile lookupFile(int fileSeries) { effectiveFieldCount = fieldCount; if (wellCount * plateCount == flexFiles.size()) { effectiveFieldCount = 1; } int[] lengths = new int[] {fieldCount, wellCount, plateCount}; int[] pos = FormatTools.rasterToPosition(lengths, fileSeries); boolean zeroWell = wellCount == 1 && effectiveFieldCount == 1; int row = zeroWell ? 0 : wellNumber[pos[1]][0]; int col = zeroWell ? 0 : wellNumber[pos[1]][1]; return lookupFile(row, col, effectiveFieldCount == 1 ? 0 : pos[0]); }
private Well getWell(int seriesIndex) { int[] coordinates = FormatTools.rasterToPosition( new int[] {fieldColumnCount, fieldRowCount, wellCount}, seriesIndex); return new Well(coordinates[1], coordinates[0], coordinates[2]); }
int[] pos = FormatTools.rasterToPosition(lengths, file); final StringBuilder pty = new StringBuilder(); for (int block=0; block<prefixes.length; block++) {
int[] pos = FormatTools.rasterToPosition(lengths, file); final StringBuilder pty = new StringBuilder(); for (int block=0; block<prefixes.length; block++) {
/** Updates the slider values to match the ImagePlus's displayed plane. */ private void syncSliders() { cIndex = FormatTools.rasterToPosition(cLengths, imp.getChannel() - 1); for (int i=0; i<cSliders.length; i++) { cSliders[i].setValue(cIndex[i] + 1); } if (zScroll != null) zScroll.setValue(imp.getSlice()); if (tScroll != null) tScroll.setValue(imp.getFrame()); }
/** Updates the slider values to match the ImagePlus's displayed plane. */ private void syncSliders() { cIndex = FormatTools.rasterToPosition(cLengths, imp.getChannel() - 1); for (int i=0; i<cSliders.length; i++) { cSliders[i].setValue(cIndex[i] + 1); } if (zScroll != null) zScroll.setValue(imp.getSlice()); if (tScroll != null) tScroll.setValue(imp.getFrame()); }
case CacheEvent.POSITION_CHANGED: len = cache.getStrategy().getLengths(); pos = FormatTools.rasterToPosition(len, ndx); printArray("pos ->", pos); break; case CacheEvent.OBJECT_LOADED: len = cache.getStrategy().getLengths(); pos = FormatTools.rasterToPosition(len, ndx); printArray("loaded:", pos); break; case CacheEvent.OBJECT_DROPPED: len = cache.getStrategy().getLengths(); pos = FormatTools.rasterToPosition(len, ndx); printArray("dropped:", pos); break;
case CacheEvent.POSITION_CHANGED: len = cache.getStrategy().getLengths(); pos = FormatTools.rasterToPosition(len, ndx); printArray("pos ->", pos); break; case CacheEvent.OBJECT_LOADED: len = cache.getStrategy().getLengths(); pos = FormatTools.rasterToPosition(len, ndx); printArray("loaded:", pos); break; case CacheEvent.OBJECT_DROPPED: len = cache.getStrategy().getLengths(); pos = FormatTools.rasterToPosition(len, ndx); printArray("dropped:", pos); break;
int[] posZ = FormatTools.rasterToPosition(lenZ[sno], zct[0]); int[] posC = FormatTools.rasterToPosition(lenC[sno], zct[1]); int[] posT = FormatTools.rasterToPosition(lenT[sno], zct[2]);