Git Product home page Git Product logo

Comments (5)

haesleinhuepf avatar haesleinhuepf commented on May 29, 2024

I just figured out how to make the tutorial work: If I replace the line

final AnimalService animals = ij.get(AnimalService.class);

with these lines:

Context context = new Context(AnimalService.class);
final AnimalService animals = context.getService(AnimalService.class);

It works. But is it intended to be like that? Is there an alternative of adding a new service to an existing Context?

Thanks!
Robert

from tutorials.

stelfrich avatar stelfrich commented on May 29, 2024

@haesleinhuepf I can reproduce the issue.

It is due to some changes on how the ImageJ gateway works. Prior to imagej/ImageJ@2f1ecc3 new ImageJ() would create a Context with all available services (including AnimalService). Introduced with the mentioned commit, the created Context only contains relevant services.

I think this example could be a good point to introduce custom Contexts. If I am not mistaken, all the other examples use a Context generated by ImageJ. What do you think, @ctrueden?

from tutorials.

ctrueden avatar ctrueden commented on May 29, 2024

We can either write new Context() or else make AnimalService implement ImageJService. I think I prefer the former solution.

from tutorials.

ctrueden avatar ctrueden commented on May 29, 2024

Looking at the tutorial, it is very ImageJ-centric. (Even though it doesn't really do anything with images, and could be repurposed as a SciJava-level service.)

So I'm going to change it to implement ImageJService, and then this problem goes away.

from tutorials.

haesleinhuepf avatar haesleinhuepf commented on May 29, 2024

Thanks a lot guys! :)

from tutorials.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.