Search in sources :

Example 31 with PixelCalibration

use of qupath.lib.images.servers.PixelCalibration in project qupath by qupath.

the class LocalBinaryPatternsPlugin method getPreferredTileSizePixels.

static ImmutableDimension getPreferredTileSizePixels(final ImageServer<BufferedImage> server, final ParameterList params) {
    // Determine tile size
    int tileWidth, tileHeight;
    PixelCalibration cal = server.getPixelCalibration();
    if (cal.hasPixelSizeMicrons()) {
        double tileSize = params.getDoubleParameterValue("tileSizeMicrons");
        tileWidth = (int) (tileSize / cal.getPixelWidthMicrons() + .5);
        tileHeight = (int) (tileSize / cal.getPixelHeightMicrons() + .5);
    } else {
        tileWidth = (int) (params.getDoubleParameterValue("tileSizePx") + .5);
        tileHeight = tileWidth;
    }
    return ImmutableDimension.getInstance(tileWidth, tileHeight);
}
Also used : PixelCalibration(qupath.lib.images.servers.PixelCalibration)

Aggregations

PixelCalibration (qupath.lib.images.servers.PixelCalibration)31 BufferedImage (java.awt.image.BufferedImage)9 ArrayList (java.util.ArrayList)8 ROI (qupath.lib.roi.interfaces.ROI)8 RegionRequest (qupath.lib.regions.RegionRequest)7 MeasurementList (qupath.lib.measurements.MeasurementList)6 PathObject (qupath.lib.objects.PathObject)6 Calibration (ij.measure.Calibration)5 PathCellObject (qupath.lib.objects.PathCellObject)5 ParameterList (qupath.lib.plugins.parameters.ParameterList)5 List (java.util.List)4 Collection (java.util.Collection)3 HashMap (java.util.HashMap)3 Map (java.util.Map)3 ImagePlus (ij.ImagePlus)2 ByteProcessor (ij.process.ByteProcessor)2 FloatProcessor (ij.process.FloatProcessor)2 ImageProcessor (ij.process.ImageProcessor)2 Graphics2D (java.awt.Graphics2D)2 LinkedHashMap (java.util.LinkedHashMap)2