The Imaris session you talk to can be located from the "aImarisId" variable passed to your xtension. Then you can call methods from ImarisLib (provided by Bitplane) to locate various variables from your session. A very rough example to retrieve the "dataset" would be:

If you execute this code before you call the shell.interact() you can get interactive access to any and all Imaris objects exposed through the Ice server (since your local variables are visible from within the interactive console).

In my jupyter xtension, the interactive shell is replaced by the launching of a jupyter server but the end result is the same.

So to reproduce this in CellProfiler, we would need some kind of CellProfiler object, the children of which would represent various aspects of the CellProfiler session, data, preferences etc...

Unfortunately for now, if you close the Inspection tool, relaunching it from the menu will crash CellProfiler (I really meant my "quick and dirty").

Where do we go from here? Any interesting objects we can get at?

This is where defining some "IPython magic" would really help for command line interaction with CellProfiler. For example, substitute (if this is the right way to go about it) %analyse for app.frame.pipeline_controller.do_analyze_images()