Adjusting DatasetView for display

luts
dataset
imagej2
Tags: #<Tag:0x00007fb87d6872d8> #<Tag:0x00007fb87d686f18> #<Tag:0x00007fb87d686d88>

#1

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);
IJ.run("Fire"); 
foo.show();

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

@Parameter
private ImageDisplay imageDisplay;

@Parameter
private UIService uiService;

@Override
public void run() {
    // Calls the LocalThickness_ plugin and wraps the result in a Dataset
    Dataset dataset = createMap();
    uiService.show(dataset);
    final DatasetView activeView = (DatasetView) imageDisplay.getActiveView();
    activeView.autoScale(0);
    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


#2

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!

Radek

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


#3

Cool, thanks for the tip!


#4

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