Java Code Examples for bdv.viewer.Source#getNumMipmapLevels()
The following examples show how to use
bdv.viewer.Source#getNumMipmapLevels() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DataSource.java From paintera with GNU General Public License v2.0 | 6 votes |
/** * Returns transforms for all scale levels in the given {@link Source} into the world coordinates * without the half-pixel offset. This is useful for converting between coordinate spaces * when pixel coordinates represent the top-left corner of the pixel instead of its center. * @param source * @param t * @return */ static AffineTransform3D[] getUnshiftedWorldTransforms(final Source<?> source, final int t) { // get mipmap transforms without the half-pixel shift final AffineTransform3D[] unshiftedWorldTransforms = new AffineTransform3D[source.getNumMipmapLevels()]; final AffineTransform3D fullResToWorldTransform = new AffineTransform3D(); source.getSourceTransform(0, 0, fullResToWorldTransform); for (int i = 0; i < unshiftedWorldTransforms.length; ++i) { final double[] scales = DataSource.getRelativeScales(source, 0, 0, i); final Scale3D toFullResTransform = new Scale3D(scales); unshiftedWorldTransforms[i] = new AffineTransform3D(); unshiftedWorldTransforms[i].preConcatenate(toFullResTransform).preConcatenate(fullResToWorldTransform); } return unshiftedWorldTransforms; }
Example 2
Source File: LabelBlockLookupAllBlocks.java From paintera with GNU General Public License v2.0 | 6 votes |
public static LabelBlockLookupAllBlocks fromSource(final Source<?> source, final int... fallbackBlockSize) { if (fallbackBlockSize.length < 3) return fromSource(source); final long[][] dims = new long[source.getNumMipmapLevels()][3]; final int[][] blockSizes = new int[dims.length][3]; for (int level = 0; level < dims.length; ++level) { final RandomAccessibleInterval<?> rai = source.getSource(0, level); Arrays.setAll(dims[level], rai::dimension); if (rai instanceof AbstractCellImg<?, ?, ?, ?>) ((AbstractCellImg<?, ?, ?, ?>) rai).getCellGrid().cellDimensions(blockSizes[level]); else Arrays.setAll(blockSizes[level], d -> fallbackBlockSize[d]); } return new LabelBlockLookupAllBlocks(dims, blockSizes); }
Example 3
Source File: RendererBlockSizes.java From paintera with GNU General Public License v2.0 | 4 votes |
public static int[][] getRendererBlockSizes(final Source<?> source, final int rendererBlockSize) { final double[][] scales = new double[source.getNumMipmapLevels()][]; Arrays.setAll(scales, i -> DataSource.getScale(source, 0, i)); return getRendererBlockSizes(scales, rendererBlockSize); }