New ImageJ script runner#1682
Merged
petebankhead merged 35 commits intoqupath:mainfrom Oct 20, 2024
Merged
Conversation
Almost... but still not.
Only for the main QuPath window currently
Fix regression that broke storing the script in the workflow history
Also add lots of javadocs
Also externalize more strings (this time for dialogs)
These make it possible to determine whether an image has a dark or light background based on QuPath's image type.
This starts to replace RoiLabeling with a more general-purpose class that should be more intuitive.
MenuItems for copy, cut, paste etc. having accelerators caused trouble because the behaviors were already built in to TextArea, so the commands could end up being called twice.
This involves considerable changes around ScriptEditor classes, so it will take a bit of time to iron out any new troubles that have been introduced...
ScriptLanguage no longer uses a service provider, because that was making things very awkward. It required public constructors, and calling things like GroovyLanguage.getInstance() could return null if things were done in the wrong order. It is still possible to add jython (or other jsr223 engines) to the extensions folder, and they should become supported by the script editor.
Member
Author
|
This is the macro shown above, included as an example: /*
* ImageJ macro to apply an automated threshold to detect a single region.
* You will need to return the active Roi to see the results in QuPath.
*/
// Define method (e.g. "Triangle", "Otsu"...)
method = "Otsu";
// Check if the image has a property specifying a dark background
// Override this by setting the value to true or false
if (Property.get("qupath.image.background")=="dark")
darkBackground = true;
else
darkBackground = false;
// Ensure 8-bit grayscale
resetMinAndMax();
run("8-bit");
// Create Roi from threshold
if (darkBackground)
setAutoThreshold(method + " dark");
else
setAutoThreshold(method);
run("Create Selection");This effectively makes it possible to apply any of ImageJ's auto thresholding methods to any region of an image (or the entire image) - adapting for brightfield or fluorescence based on the image type. The resolution and channel can be specified from within QuPath's UI when the region is being sent. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This replaces the ImageJ macro runner.
Both can be seen in this screenshot - the old on the left, the new on the right:
Improvements include:
Ctrl+spaceRoigroups, which map to QuPath classificationsImagePlusobtained from ImageJ via a call toIJ.getImage()IJProcessingandIJFiltersclasses make it easier to process images obtained this wayImagePlusbased on the QuPath image type so it's possible to determine a sensible value ofdarkBackgroundorlightBackgroundin macros or scriptsThis required a lot of changes, so there is a reasonable chance things have broken elsewhere... including with the regular script editor (which needed changed to make it possible to generate a script editor control elsewhere). But I think it remains functional...
Some limitations:
OverlayOptionsobjectIJ.getImage()orimport [something]is included