Skip to content

Commit

Permalink
Check valid annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelSNelson committed Jan 25, 2024
1 parent 8182a44 commit b7577c8
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/main/groovy/qupath/ext/qp_scope/functions/QP_scope_GUI.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -634,6 +640,18 @@ class QP_scope_GUI {
}


static boolean checkValidAnnotationsGUI() {
Dialog<ButtonType> 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<ButtonType> result = dlg.showAndWait()
return result.isPresent() && result.get() == ButtonType.OK

}

static stageToQuPathAlignmentGUI2() {
List<String> choices = Arrays.asList("Yes", "Use adjusted position")
ChoiceDialog<String> dialog = new ChoiceDialog<>("Yes", choices)
Expand Down
Original file line number Diff line number Diff line change
@@ -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() {
Expand Down

0 comments on commit b7577c8

Please sign in to comment.