scijava-common icon indicating copy to clipboard operation
scijava-common copied to clipboard

Generic Object Manager

Open imagejan opened this issue 6 years ago • 3 comments

We should complement the ObjectService with some kind of ObjectManager that allows to add/remove objects of a given type manually (i.e. via a UI in most cases); similar to ImageJ1's ROI Manager, but for other reusable objects as well.

For example:

  • Manager<RealTransform> (@NicoKiaru, @tischi) to keep a list of RealTransforms that can be:

    • named,
    • used as inputs for commands,
    • and maybe optionally be concatenated.
  • Manager<BdvHandle> to keep a list of open BDV instances (the advantage of having a dedicated manager is less clear here, maybe ObjectService is sufficient).

  • Manager<RealMask>, the new ROI Manager 🙂

While the interface (such as Manager<T>) should probably live here, the actual UI implementation (such as SwingManager<T>) should go in scijava-ui-swing, and the actual instances (TransformManager implements Manager<RealTransform>) in the project where they're needed.

@ctrueden and others, what do you think about that idea? Would it be worth going that route?

imagejan avatar Dec 12 '19 13:12 imagejan

This would be awesome!

What do you think of a tree view with objects sorted by class (or even a more configurable way to sort objects) ? What could be cool is also an convenient way to pop the uiviewer of these objects, when available.

And - big digression - imagine the user selects some objects of different class (let's say an affinetransform and an image), then you could try to guess and suggest which command the user wants to do, based on compatibility and usage statsitics ? This could be a bit similar to implicit Intent in the Android world.

NicoKiaru avatar Dec 12 '19 15:12 NicoKiaru

I did some preliminary work on this in imagejan/object-manager@wip (merely a proof of concept), but likely won't have time to pursue it a lot more, so I thought I'll at least link to it here.

The idea is to have a Manager<T> where T can be any type of object. Because there are many Service and Display objects registered to ObjectService already, I didn't want to make a manager of all objects. Displaying in the UI works via a ManagerDisplay.

An example for a real-world manager is RealTransformManager.

My idea was to be able to call Manager<Anything> = new Manager<>() to create this kind of manager for any target class at runtime, but I didn't get there because I was struggling with generics...

imagejan avatar Jan 13 '20 12:01 imagejan

Ok, I'll try to see if I can follow through. This would be really useful to deal with transforms.

NicoKiaru avatar Jan 13 '20 13:01 NicoKiaru