diff --git a/src/main/java/qupath/ext/instanseg/ui/InstanSegController.java b/src/main/java/qupath/ext/instanseg/ui/InstanSegController.java index 044586e..5e39c9c 100644 --- a/src/main/java/qupath/ext/instanseg/ui/InstanSegController.java +++ b/src/main/java/qupath/ext/instanseg/ui/InstanSegController.java @@ -1,5 +1,6 @@ package qupath.ext.instanseg.ui; +import javafx.application.Platform; import javafx.beans.binding.Bindings; import javafx.beans.binding.BooleanBinding; import javafx.beans.binding.ObjectBinding; @@ -341,6 +342,10 @@ private void updateInputChannels(ImageData imageData) { if (imageData == null) { return; } + if (!Platform.isFxApplicationThread()) { + Platform.runLater(() -> updateInputChannels(imageData)); + return; + } // Store the checks without changing the current value inputChannelCache.snapshotChecks(); // Update the items