Skip to content

Instantly share code, notes, and snippets.

@NicoKiaru
Created December 2, 2022 07:09
Show Gist options
  • Save NicoKiaru/204fd4541a1fb49a0ed047b61aa02a10 to your computer and use it in GitHub Desktop.
Save NicoKiaru/204fd4541a1fb49a0ed047b61aa02a10 to your computer and use it in GitHub Desktop.
Logs all Fiji update sites activated and other information (OS, ij version)
/**
* Simple script demoing how to check if an update site is enabled
* and how to list all enabled update sites
*
* @author Nicolas Chiaruttini
* BIOP, EPFL, 2022
**/
#@UpdateService updateService
// To check if an update site is enabled:
if (!updateService.getUpdateSite("Fiji-Legacy").isActive()) {
println("Fiji-legacy is NOT enabled")
} else {
println("Fiji-Legacy is enabled")
}
// Get the list of all update sites:
def Map<String, UpdateSite> sites = AvailableSites.getAvailableSites();
StringBuilder message = new StringBuilder();
message.append("------------------------\n")
message.append("Update sites enabled:\n")
sites.values().stream()
.filter(site -> updateService.getUpdateSite(site.getName()).isActive())
.forEach(site -> {
message.append("\t"+site.getName()+"\t "+site.getURL()+"\n");
});
message.append("-----\n");
message.append("OS and Dependencies Info\n");
message.append("OS "+ System.getProperty("os.name")+"\n");
message.append("ImageJ "+ VersionUtils.getVersion(ImageJ.class)+"\n");
message.append("IJ "+ VersionUtils.getVersion(IJ.class)+"\n");
// To get another package version:
// message.append("Something "+ VersionUtils.getVersion(AClassInTHeSomethingPackage.class)+"\n");
message.append("------------------------\n")
IJ.log(message.toString())
return ""
import net.imagej.updater.UpdateService
import net.imagej.updater.UpdateSite
import net.imagej.updater.util.AvailableSites
import bdv.BigDataViewer
import bdv.util.BdvHandle
import bigwarp.BigWarp
import ij.IJ
import net.imagej.ImageJ
import org.scijava.command.Command
import org.scijava.platform.PlatformService
import org.scijava.plugin.Parameter
import org.scijava.plugin.Plugin
import org.scijava.util.VersionUtils
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment