ImagePlus object from QuPath: how is the the active Channel assigned so that affect the active channel of this object?

By calling RegionRequest.createInstance method, we can get imageplus object of a part of image showing in QuPath window.

We can get stats from this object. However, it is confusing which channel is selected as active channel for this object.

For example, in ImageJ, if we open a multiple-channel hyperstack and select an roi, then call:

stat = ips.getStatistics;

stat =
stats[count=5780, mean=3176.4382352941175, min=2596.0, max=3318.0]

The min and max varies if we switch different channels to active in image window.

However, in QuPath window, all the channels can be turned on/off in versatile manner by key press, how does this affect the active channel of the requested ips object, and thus affecting the stat of imageplus object?

It shouldn’t. I don’t know precisely what you are doing, but in general if you request a region in QuPath via scripting the viewer (and viewer settings) would not be directly involved.

When scripting with an ImagePlus (in general, not just through QuPath), you should not make any assumptions about what slice is active - but you can control it with methods like ImagePlus.setSlice(int) and ImagePlus.setC(int). See

1 Like