Adjusting DatasetView for display

Hi everyone,

I’m trying to adjust a DatasetView so that the data in my Dataset would get displayed correctly. Basically I’m trying to achieve what in ImageJ1 world would look like

ImagePlus foo = new ImagePlus();
foo.getProcessor().setMinAndMax(0, value);"Fire");;

What I’ve tried so far in my ImageJ2 plugin:

private ImageDisplay imageDisplay;

private UIService uiService;

public void run() {
    // Calls the LocalThickness_ plugin and wraps the result in a Dataset
    Dataset dataset = createMap();;
    final DatasetView activeView = (DatasetView) imageDisplay.getActiveView();
    activeView.setColorTable(net.imagej.display.ColorTables.FIRE, 0);

However the Dataset is shown all white except for the last slide. You can’t tell the difference between the values by eye. They range from 0.0 to about 16.0 (LocalThickness produces a floating point ImagePlus).

Best Regards,
Richard Domander

Hi @rimadoma,

I have been playing with this as well. Are you displaying in the IJ2 or legacy UI? Using DatasetView to set display parameters seems to be largely unsupported in the legacy UI. It should work in the IJ2 UI.

If you want to make it work for both, I suggest modifying Dataset parameters instead of DatasetView:

# Dataset image
# ColorTable colorTable
channel = 0
image.setChannelMinimum(channel, 0)
image.setChannelMaximum(channel, 4096)
image.setColorTable(colorTable, channel)

I hope it helps!


EDIT: You don’t need to call dataset.getImgPlus() to call setColorTable


Cool, thanks for the tip!

Actually, things are weirder than I expected. See this forum thread for details: ImageJ2 misbehaves with XYZC images