Skip to content

Instantly share code, notes, and snippets.

@NicoKiaru
Last active March 31, 2022 10:32
Show Gist options
  • Save NicoKiaru/0ce65758c06542177ca9705b855e9fc3 to your computer and use it in GitHub Desktop.
Save NicoKiaru/0ce65758c06542177ca9705b855e9fc3 to your computer and use it in GitHub Desktop.
Script checking the update sites and some repository #BIOP #Fiji
/**
* 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")
}
if (!updateService.getUpdateSite("PTBIOP").isActive()) {
println("PTBIOP is NOT enabled")
} else {
println("PTBIOP 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");
message.append("BigWarp "+VersionUtils.getVersion(BigWarp.class)+"\n");
message.append("Bdv "+VersionUtils.getVersion(BigDataViewer.class)+"\n");
message.append("Bdv Vistools "+VersionUtils.getVersion(BdvHandle.class)+"\n");
message.append("Bdv Biop Tools "+VersionUtils.getVersion(Elastix2DSplineRegister.class)+"\n");
message.append("Bdv Playground "+VersionUtils.getVersion(SourceAndConverterServices.class)+"\n");
message.append("Bdv BioFormats "+VersionUtils.getVersion(BioFormatsMetaDataHelper.class)+"\n");
message.append("Biop Wrappers "+VersionUtils.getVersion(ElastixTask.class)+"\n");
message.append("Registration Server "+VersionUtils.getVersion(RemoteElastixTask.class)+"\n");
message.append("Bdv Playground Display "+VersionUtils.getVersion(BiopBdvSupplier.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 ch.epfl.biop.bdv.bioformats.BioFormatsMetaDataHelper;
import ch.epfl.biop.sourceandconverter.register.Elastix2DSplineRegister;
import ch.epfl.biop.wrappers.elastix.ElastixTask;
import ch.epfl.biop.wrappers.elastix.RemoteElastixTask;
import ij.IJ;
import net.imagej.ImageJ;
import net.imagej.updater.UpdateService;
import net.imagej.updater.UpdateSite;
import net.imagej.updater.util.AvailableSites;
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;
import sc.fiji.bdvpg.services.SourceAndConverterServices;
import sc.fiji.bdvpg.bdv.supplier.biop.BiopBdvSupplier;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment