Skip to content

Add install headless extension and call it#2027

Merged
petebankhead merged 1 commit intoqupath:mainfrom
Rylern:headless-extensions
Nov 5, 2025
Merged

Add install headless extension and call it#2027
petebankhead merged 1 commit intoqupath:mainfrom
Rylern:headless-extensions

Conversation

@Rylern
Copy link
Contributor

@Rylern Rylern commented Oct 29, 2025

A proposal to fix #2007. This is done by:

  • Adding a installHeadless() function to QuPathExtension with a default (do-nothing) implementation.
  • Calling installHeadless() of all current extensions when the script command is used when running QuPath from the command line.

@petebankhead petebankhead merged commit d5309b1 into qupath:main Nov 5, 2025
3 checks passed
@petebankhead petebankhead added this to the v0.7.0 milestone Nov 5, 2025
@Rylern Rylern deleted the headless-extensions branch November 11, 2025 09:46
@NicoKiaru
Copy link

Hello @Rylern,

Is installHeadless called even when QuPath is launched with a GUI ?
It looks like no. Is it the intended behaviour ? Because then the code is a bit weird since I have to put in two places the method to add the custom image servers ser/deserializers.

    @Override
    public void installExtension(QuPathGUI qupath) {
    	if (alreadyInstalled || !checkCompatibility())
			return;
		
		try {
            addWarpyImageServer();
			// Add ImageCombinerWarpy action
			var imageCombinerWarpy = ActionTools.createAction(new InteractiveImageCombinerWarpyCommand(qupath), "Interactive image combiner Warpy");
			MenuTools.addMenuItems(qupath.getMenu("Analyze", false), imageCombinerWarpy);
	    	alreadyInstalled = true;
		} catch (Throwable t) {
			logger.debug("Unable to add ImageCombinerWarpy to menu", t);
		}		
    }

    @Override
    public void installHeadless() {
        addWarpyImageServer();
    }

@Rylern
Copy link
Contributor Author

Rylern commented Mar 12, 2026

Is installHeadless called even when QuPath is launched with a GUI ?

No, this is mentioned in the function documentation:

* Install the extension in headless mode. This function is only called if QuPath is run without the user
* interface.
* <p>
* See {@link #installExtension(QuPathGUI)} for installing the extension when the graphical user interface
* is used.

This allows for more flexibility, as it means you can have some code that runs when the GUI is not present, but not when the GUI is present.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make it possible to initialize extensions even when running headless

3 participants