diff --git a/src/main/groovy/qupath/ext/qp_scope/functions/QP_scope_GUI.groovy b/src/main/groovy/qupath/ext/qp_scope/functions/QP_scope_GUI.groovy index 43212bf..04b52bf 100644 --- a/src/main/groovy/qupath/ext/qp_scope/functions/QP_scope_GUI.groovy +++ b/src/main/groovy/qupath/ext/qp_scope/functions/QP_scope_GUI.groovy @@ -191,6 +191,12 @@ class QP_scope_GUI { // Run the modified script QuPathGUI.getInstance().runScript(null, tissueDetectScript) //At this point the tissue should be outlined in an annotation + + boolean annotationStatusCheck = checkValidAnnotationsGUI() + if (!annotationStatusCheck){ + return + } + def annotations = getAnnotationObjects().findAll{it.getPathClass().toString().equals("Tissue")} Double frameWidthMicrons = (preferences.frameWidth as Double) / (preferences.pixelSizeSource as Double) * (preferences.pixelSizeFirstScanType as Double) Double frameHeightMicrons = (preferences.frameHeight as Double) / (preferences.pixelSizeSource as Double) * (preferences.pixelSizeFirstScanType as Double) @@ -634,6 +640,18 @@ class QP_scope_GUI { } + static boolean checkValidAnnotationsGUI() { + Dialog dlg = new Dialog<>() + dlg.initModality(Modality.NONE) + dlg.setTitle("Validate annotation boundaries") + dlg.setHeaderText("Check the existing annotations to make sure what you want to image exists within an annotation. \n Delete, edit, or manually create any changes you would want at this stage, then click OK.") + // Add buttons to the dialog + dlg.getDialogPane().getButtonTypes().addAll(ButtonType.OK, ButtonType.CANCEL) + Optional result = dlg.showAndWait() + return result.isPresent() && result.get() == ButtonType.OK + + } + static stageToQuPathAlignmentGUI2() { List choices = Arrays.asList("Yes", "Use adjusted position") ChoiceDialog dialog = new ChoiceDialog<>("Yes", choices) diff --git a/src/main/groovy/qupath/ext/qp_scope/utilities/PythonTestScripts.groovy b/src/main/groovy/qupath/ext/qp_scope/utilities/PythonTestScripts.groovy index 59cc603..a59e827 100644 --- a/src/main/groovy/qupath/ext/qp_scope/utilities/PythonTestScripts.groovy +++ b/src/main/groovy/qupath/ext/qp_scope/utilities/PythonTestScripts.groovy @@ -1,5 +1,10 @@ package qupath.ext.qp_scope.utilities +/* + * String versions of the test scripts that can be bundled with the plugin, and be targeted/run when the file paths + * provided by the user do not point to valid locations. + */ + class PythonTestScripts { static String pyTestGetStageCoordinates() {