Converting a Dataset object into an ImageDisplay one

converters
dataset
display
Tags: #<Tag:0x00007fd540898cb8> #<Tag:0x00007fd540898b50> #<Tag:0x00007fd5408989e8>

#1

Hi guys,

I have been working on the ImageJ server enabling remote execution of ImageJ plugins. Some plugins need a Dataset object as an input, whereas others require an ImageDisplay object.

Consequently, I am looking for a clean way how to convert Dataset objects into ImageDisplay ones or, to be more precise, how to create an ImageDisplay object based on a Dataset one.

Thank you very much for your help in advance.

Best regards,
Petr


#2

You should be able to use the respective SciJava services:

  • Dataset > ImageDisplay using DisplayService:

    display = displayService.createDisplay(dataset);
    
  • ImageDisplay > Dataset using ImageDisplayService:

    dataset = imageDisplayService.getActiveDataset(display);
    

Plugins that are running headless should however not require an ImageDisplay, no? Which plugins do you have in mind?


#3

Hi @imagejan,

Many thanks for your help! Your solution works very well.

So far I have been dealing with simple image transformations. For example, the RotateImageXY plugin works with Dataset objects, whereas the FlipHorizontally plugin requires an ImageDisplay object on input, even though it is marked as a headless-running plugin.