Skip to content

Commit

Permalink
Improved painting of detections (& subcellular detections)
Browse files Browse the repository at this point in the history
  • Loading branch information
petebankhead committed Dec 30, 2016
1 parent 0b7bc4d commit 197965c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
Expand Up @@ -39,7 +39,6 @@
import java.awt.geom.AffineTransform;
import java.awt.geom.Ellipse2D;
import java.awt.geom.Line2D;
import java.awt.geom.Line2D.Double;
import java.awt.geom.Path2D;
import java.awt.geom.Point2D;
import java.awt.geom.Rectangle2D;
Expand Down Expand Up @@ -356,8 +355,9 @@ else if (pathObject instanceof PathCellObject && overlayOptions.getShowCellBound
// colorFill = ColorToolsAwt.getTranslucentColor(colorFill);
// else
colorFill = ColorToolsAwt.getMoreTranslucentColor(colorFill);
}
else if (pathObject instanceof PathTileObject && pathClass == null && color !=null && color.getRGB() == PathPrefs.getTileColor()) {
} else if (pathObject.getParent() instanceof PathDetectionObject) {
colorFill = ColorToolsAwt.getTranslucentColor(colorFill);
} else if (pathObject instanceof PathTileObject && pathClass == null && color !=null && color.getRGB() == PathPrefs.getTileColor()) {
// Don't fill in empty, unclassified tiles
colorFill = null; //DisplayHelpers.getMoreTranslucentColor(colorFill);
}
Expand Down
Expand Up @@ -214,7 +214,7 @@ public boolean supportsImageDataChange() {
* Comparator that makes use of levels, not only location.
*
*/
static class DetectionComparator implements Comparator<PathObject> {
public static class DetectionComparator implements Comparator<PathObject> {

private Comparator<PathObject> baseComparator = DefaultPathObjectComparator.getInstance();

Expand Down
Expand Up @@ -29,6 +29,7 @@
import java.awt.Transparency;
import java.awt.image.BufferedImage;
import java.io.File;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
Expand All @@ -39,6 +40,7 @@
import qupath.lib.common.ColorTools;
import qupath.lib.gui.viewer.OverlayOptions;
import qupath.lib.gui.viewer.PathHierarchyPaintingHelper;
import qupath.lib.gui.viewer.overlays.HierarchyOverlay;
import qupath.lib.images.ImageData;
import qupath.lib.images.PathImage;
import qupath.lib.objects.DefaultPathObjectConnectionGroup;
Expand Down Expand Up @@ -228,14 +230,16 @@ public BufferedImage readBufferedImage(RegionRequest request) {
Object o = options.getShowConnections() ? imageData.getProperty(DefaultPathObjectConnectionGroup.KEY_OBJECT_CONNECTIONS) : null;
PathObjectConnections connections = (o instanceof PathObjectConnections) ? (PathObjectConnections)o : null;

Collection<PathObject> pathObjects = getObjectsToPaint(request);
List<PathObject> pathObjects = new ArrayList<>(getObjectsToPaint(request));
if (pathObjects == null || pathObjects.isEmpty()) {
// We can only return null if no connections - otherwise we might still need to draw something
if (connections == null) {
return null;
}
}

Collections.sort(pathObjects, new HierarchyOverlay.DetectionComparator());

GraphicsConfiguration gc = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration();
double downsampleFactor = request.getDownsample();
int width = (int)(request.getWidth() / downsampleFactor);
Expand Down

0 comments on commit 197965c

Please sign in to comment.