diff --git a/CHANGELOG.md b/CHANGELOG.md index 1a4115ecc..59b2cd292 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ This is a work-in-progress for the next QuPath release. * `isOverlayNG` should be turned on by default (https://github.com/qupath/qupath/issues/1244) * Labeled image instance export doesn't work as expected for z-stacks (https://github.com/qupath/qupath/issues/1267) * Fix PathClass singleton creation when a derived PathClass is requested (https://github.com/qupath/qupath/pull/1286) +* 'Run for project' does not recognize when previous images have been deleted (https://github.com/qupath/qupath/issues/1291) ### Dependency updates * Bio-Formats 7.0.0 diff --git a/qupath-gui-fx/src/main/java/qupath/lib/gui/scripting/DefaultScriptEditor.java b/qupath-gui-fx/src/main/java/qupath/lib/gui/scripting/DefaultScriptEditor.java index f74238afd..3ea81b1be 100644 --- a/qupath-gui-fx/src/main/java/qupath/lib/gui/scripting/DefaultScriptEditor.java +++ b/qupath-gui-fx/src/main/java/qupath/lib/gui/scripting/DefaultScriptEditor.java @@ -446,7 +446,8 @@ private void initializeActions() { beautifySourceAction.setAccelerator(new KeyCodeCombination(KeyCode.L, KeyCombination.SHORTCUT_DOWN, KeyCombination.ALT_DOWN)); beautifySourceAction.disabledProperty().bind(canBeautifyBinding); compressSourceAction.disabledProperty().bind(canCompressBinding); - + + // Reset previous images when the project changes qupath.projectProperty().addListener((v, o, n) -> { previousImages.clear(); }); @@ -1535,7 +1536,11 @@ void handleRunProject(final boolean doSave) { // FilteredList> sourceList = new FilteredList<>(FXCollections.observableArrayList(project.getImageList())); String sameImageWarning = "A selected image is open in the viewer!\nAny unsaved changes will be ignored."; - var listSelectionView = ProjectDialogs.createImageChoicePane(qupath, project.getImageList(), previousImages, sameImageWarning); + var imageList = project.getImageList(); + // Remove any images that have been removed from the project + // See https://github.com/qupath/qupath/issues/1291 + previousImages.retainAll(new HashSet<>(imageList)); + var listSelectionView = ProjectDialogs.createImageChoicePane(qupath, imageList, previousImages, sameImageWarning); Dialog dialog = new Dialog<>(); dialog.initOwner(qupath.getStage());