org.scijava.log.LogService Java Examples

The following examples show how to use org.scijava.log.LogService. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ProcessUtil.java    From scijava-jupyter-kernel with Apache License 2.0 6 votes vote down vote up
public static Map<String, String> executePythonCode(File pythonBinaryPath, String sourceCode, LogService log) {

        Map<String, String> results = null;

        try {
            File tempFile = File.createTempFile("scijava-script", ".py");
            Files.write(tempFile.toPath(), sourceCode.getBytes());

            String[] cmd = new String[]{pythonBinaryPath.toString(), tempFile.toString()};

            results = ProcessUtil.executeProcess(cmd, log);
        } catch (IOException ex) {
            log.error(ex);
        }

        return results;
    }
 
Example #2
Source File: SystemUtil.java    From scijava-jupyter-kernel with Apache License 2.0 5 votes vote down vote up
public static void deleteFolderRecursively(Path rootPath, LogService log) {
    if (rootPath.toFile().exists()) {
        try {
            Files.walk(rootPath, FileVisitOption.FOLLOW_LINKS)
                    .sorted(Comparator.reverseOrder())
                    .map(Path::toFile)
                    .forEach(File::delete);
        } catch (IOException ex) {
            log.error(ex);
        }
    }
}
 
Example #3
Source File: DefaultRefManagerService.java    From scifio with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public RefCleaner(final ReferenceQueue queue, final Set<Reference> refs,
	final LogService log, final boolean[] runFlag)
{
	this.queue = queue;
	this.refs = refs;
	logService = log;
	run = runFlag;
}
 
Example #4
Source File: NativeQTFormat.java    From scifio with BSD 2-Clause "Simplified" License 5 votes vote down vote up
/** Debugging method; prints information on an atom. */
private static void print(final int depth, final long size,
	final String type, final LogService log)
{
	final StringBuilder sb = new StringBuilder();
	for (int i = 0; i < depth; i++)
		sb.append(" ");
	sb.append(type + " : [" + size + "]");
	log.debug(sb.toString());
}
 
Example #5
Source File: InstallScijavaKernel.java    From scijava-jupyter-kernel with Apache License 2.0 5 votes vote down vote up
public static void main(String... args) {
    Context context = new Context();

    LogService log = context.service(LogService.class);
    log.setLevel(LogLevel.INFO);

    JupyterService jupyter = context.service(JupyterService.class);
    jupyter.installKernel(args);

    context.dispose();
}
 
Example #6
Source File: MatVectorImagePlusConverter.java    From IJ-OpenCV with GNU General Public License v3.0 4 votes vote down vote up
@Override
public LogService log() {
    return super.log();
}
 
Example #7
Source File: IFD.java    From scifio with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public IFD(final IFD ifd, final LogService log) {
	super(ifd);
	this.log = log;
}
 
Example #8
Source File: IFD.java    From scifio with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public IFD(final LogService log) {
	super();
	this.log = log;
}
 
Example #9
Source File: KeyPointPointRoiConverter.java    From IJ-OpenCV with GNU General Public License v3.0 4 votes vote down vote up
@Override
public LogService log() {
    return super.log();
}
 
Example #10
Source File: ParserErrorHandler.java    From scifio with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public ParserErrorHandler(final LogService log) {
	this.log = log;
}
 
Example #11
Source File: MetadataHandler.java    From scifio with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public MetadataHandler(final LogService log) {
	super(log);
}
 
Example #12
Source File: ValidationSAXHandler.java    From scifio with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public ValidationSAXHandler(final LogService log) {
	super(log);
}
 
Example #13
Source File: AbstractSCIFIOPlugin.java    From scifio with BSD 2-Clause "Simplified" License 4 votes vote down vote up
@Override
public LogService log() {
	return log;
}
 
Example #14
Source File: IniParser.java    From scifio with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public IniParser(final LogService log) {
	this.log = log;
}
 
Example #15
Source File: AxisGuesserTest.java    From scifio with BSD 2-Clause "Simplified" License 4 votes vote down vote up
/** Method for testing pattern guessing logic. */

	@Test
	public void testAxisguessing() throws FormatException, IOException {
		final Context context = new Context();
		final SCIFIO scifio = new SCIFIO(context);
		final LogService log = scifio.log();
		final DataHandleService dataHandleService = context.getService(
			DataHandleService.class);
		final URL resource = this.getClass().getResource(
			"img/axisguesser/test_stack/img_000000000_Cy3_000.tif");
		final FileLocation file = new FileLocation(resource.getFile());

		final String pat = scifio.filePattern().findPattern(file);
		if (pat == null) log.info("No pattern found.");
		else {
			assertEquals("Wrong pattern:", "img_00000000<0-1>_Cy3_00<0-4>.tif", pat);
			final FilePattern fp = new FilePattern(file, pat, dataHandleService);
			assertTrue(fp.isValid());
			final Location id = fp.getFiles()[0];

			// read dimensional information from first file
			final Reader reader = scifio.initializer().initializeReader(id);
			final AxisType[] dimOrder = reader.getMetadata().get(0).getAxes().stream()
				.map(CalibratedAxis::type).toArray(AxisType[]::new);
			final long sizeZ = reader.getMetadata().get(0).getAxisLength(Axes.Z);
			final long sizeT = reader.getMetadata().get(0).getAxisLength(Axes.TIME);
			final long sizeC = reader.getMetadata().get(0).getAxisLength(
				Axes.CHANNEL);
			final boolean certain = reader.getMetadata().get(0).isOrderCertain();

			assertArrayEquals("Dimension Order", new AxisType[] { Axes.X, Axes.Y },
				dimOrder);
			assertFalse(certain);

			assertEquals(1, sizeZ);
			assertEquals(1, sizeT);
			assertEquals(1, sizeC);

			// guess axes
			final AxisGuesser ag = new AxisGuesser(fp, dimOrder, sizeZ, sizeT, sizeC,
				certain);

			// output results
			final String[] blocks = fp.getBlocks();
			final String[] prefixes = fp.getPrefixes();
			final AxisType[] axes = ag.getAxisTypes();
			final AxisType[] newOrder = ag.getAdjustedOrder();
			final boolean isCertain = ag.isCertain();
			assertFalse(isCertain);

			assertEquals("<0-1>", blocks[0]);
			assertEquals("img_00000000", prefixes[0]);
			assertEquals(Axes.Z, axes[0]);

			assertEquals("<0-4>", blocks[1]);
			assertEquals("_Cy3_00", prefixes[1]);
			assertEquals(Axes.TIME, axes[1]);

			assertArrayEquals(dimOrder, newOrder);
		}
		context.dispose();
	}
 
Example #16
Source File: ValidationErrorHandler.java    From scifio with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public ValidationErrorHandler(final LogService log) {
	this.log = log;
}
 
Example #17
Source File: Point2fVectorPointRoiConverter.java    From IJ-OpenCV with GNU General Public License v3.0 4 votes vote down vote up
@Override
public LogService log() {
    return super.log();
}
 
Example #18
Source File: PointPointRoiConverter.java    From IJ-OpenCV with GNU General Public License v3.0 4 votes vote down vote up
@Override
public LogService log() {
    return super.log();
}
 
Example #19
Source File: AxisGuesserTest.java    From scifio with BSD 2-Clause "Simplified" License 4 votes vote down vote up
@Test
public void testAxisguessing2() throws FormatException, IOException {
	final Context context = new Context();
	final SCIFIO scifio = new SCIFIO(context);
	final LogService log = scifio.log();
	final DataHandleService dataHandleService = context.getService(
		DataHandleService.class);
	final URL resource = this.getClass().getResource(
		"img/axisguesser/leica_stack/leica_stack_Series014_z000_ch00.tif");
	final FileLocation file = new FileLocation(resource.getFile());

	final String pat = scifio.filePattern().findPattern(file);
	if (pat == null) log.info("No pattern found.");
	else {
		assertEquals("Wrong pattern:", "leica_stack_Series014_z00<0-2>_ch00.tif",
			pat);
		final FilePattern fp = new FilePattern(file, pat, dataHandleService);
		assertTrue(fp.isValid());
		final Location id = fp.getFiles()[0];

		// read dimensional information from first file
		final Reader reader = scifio.initializer().initializeReader(id);
		final AxisType[] dimOrder = reader.getMetadata().get(0).getAxes().stream()
			.map(CalibratedAxis::type).toArray(AxisType[]::new);
		final long sizeZ = reader.getMetadata().get(0).getAxisLength(Axes.Z);
		final long sizeT = reader.getMetadata().get(0).getAxisLength(Axes.TIME);
		final long sizeC = reader.getMetadata().get(0).getAxisLength(
			Axes.CHANNEL);
		final boolean certain = reader.getMetadata().get(0).isOrderCertain();

		assertArrayEquals("Dimension Order", new AxisType[] { Axes.X, Axes.Y },
			dimOrder);
		assertFalse(certain);

		assertEquals(1, sizeZ);
		assertEquals(1, sizeT);
		assertEquals(1, sizeC);

		// guess axes
		final AxisGuesser ag = new AxisGuesser(fp, dimOrder, sizeZ, sizeT, sizeC,
			certain);

		// output results
		final String[] blocks = fp.getBlocks();
		final String[] prefixes = fp.getPrefixes();
		final AxisType[] axes = ag.getAxisTypes();
		final AxisType[] newOrder = ag.getAdjustedOrder();
		final boolean isCertain = ag.isCertain();
		assertFalse(isCertain);

		assertEquals("<0-2>", blocks[0]);
		assertEquals("leica_stack_Series014_z00", prefixes[0]);
		assertEquals(Axes.Z, axes[0]);

		assertArrayEquals(dimOrder, newOrder);
	}
	context.dispose();
}
 
Example #20
Source File: RotatedRectPolygonRoiConverter.java    From IJ-OpenCV with GNU General Public License v3.0 4 votes vote down vote up
@Override
public LogService log() {
    return super.log();
}
 
Example #21
Source File: Point2fPointRoiConverter.java    From IJ-OpenCV with GNU General Public License v3.0 4 votes vote down vote up
@Override
public LogService log() {
    return super.log();
}
 
Example #22
Source File: Circle2fOvalRoiConverter.java    From IJ-OpenCV with GNU General Public License v3.0 4 votes vote down vote up
@Override
public LogService log() {
    return super.log();
}
 
Example #23
Source File: MatPolygonRoiConverter.java    From IJ-OpenCV with GNU General Public License v3.0 4 votes vote down vote up
@Override
public LogService log() {
    return super.log();
}
 
Example #24
Source File: MatVectorListPolygonRoiConverter.java    From IJ-OpenCV with GNU General Public License v3.0 4 votes vote down vote up
@Override
public LogService log() {
    return super.log();
}
 
Example #25
Source File: LineCVLineConverter.java    From IJ-OpenCV with GNU General Public License v3.0 4 votes vote down vote up
@Override
public LogService log() {
    return super.log();
}
 
Example #26
Source File: MatImagePlusConverter.java    From IJ-OpenCV with GNU General Public License v3.0 4 votes vote down vote up
@Override
public LogService log() {
    return super.log();
}
 
Example #27
Source File: RectfRoiConverter.java    From IJ-OpenCV with GNU General Public License v3.0 4 votes vote down vote up
@Override
public LogService log() {
    return super.log();
}
 
Example #28
Source File: KeyPointVectorPointRoiConverter.java    From IJ-OpenCV with GNU General Public License v3.0 4 votes vote down vote up
@Override
public LogService log() {
    return super.log();
}
 
Example #29
Source File: MatListOvalRoiConverter.java    From IJ-OpenCV with GNU General Public License v3.0 4 votes vote down vote up
@Override
public LogService log() {
    return super.log();
}
 
Example #30
Source File: Point2dVectorPointRoiConverter.java    From IJ-OpenCV with GNU General Public License v3.0 4 votes vote down vote up
@Override
public LogService log() {
    return super.log();
}