Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modern import (from BDV) plugin #9

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

xulman
Copy link

@xulman xulman commented Feb 20, 2018

Hi,

I wanted to extract "raw"/orig data from XML/HDF5 BDV dataset and I found File->Import->BigDataViewer... plugin/menu item that can do it. This one, however, was doing GUI dialog by its own, and I couldn't use it in --headless mode.

So, I rewrote it into IJ2 environment. This changed the GUI-pieces of the code completely but otherwise (figuring out how many timepoints, setups, mipmaps as well as creating ImagePlus as a result) I haven't changed the functionality.

I also gave it a bit of love to the way GUI dialog behaves now.

As a side effect, the new plugin can run --headless:
~/Apps/Fiji.app/Contents/MacOS/ImageJ-macosx --headless --run "BigDataViewer..." 'xmlFile="/path_to/dataset.xml",timepointVal=15,setupVal=0,mipmapVal=0,openAsVirtualStack=false'
and/or one can batch/headless extract a sequence of timepoints...
(because it is not attempting to build a GUI dialog and img.show() as it was in the original code).

The GUI:
screen shot 2018-02-20 at 14 51 54

Vlado

Vladimír Ulman added 4 commits February 20, 2018 15:21
     to the new/modern scijava plugin environment (which auto-generated
     dialogs, etc.). Allows also to be run from command line, also head-less.

Example from command line:
~/Apps/Fiji.app/Contents/MacOS/ImageJ-macosx --headless --run "BigDataViewer..."  'xmlFile="/path_to/dataset.xml",timepointVal=15,setupVal=0,mipmapVal=0,openAsVirtualStack=false'
     made public so the class can be used outside IJ2 plugin system

Example Jython script:

import bdv.ij.ImportPlugIn
import java.io.File

fn = "/Users/ulman/Downloads/2018-02-15 Mastodon Tutorial/tgmm-mini/dataset.xml"
loader = bdv.ij.ImportPlugIn()
loader.xmlFile = java.io.File(fn)
loader.timepointVal = 5
loader.run()
loader.imp.show()
…alog,

     Also ranges are not checked anymore when the attempt failed.
@tpietzsch
Copy link
Member

@xulman sorry for taking so long to look at it.

What happened if you tried to run the old plugin in headless mode. In principle the GenericDialogPlus should be able to handle that? Maybe all that is required it to add headless=true to the @Plugin annotation.

What you did is still quite nice. It would be cool to have the plugin IJ2-style (regardless of headless issue).
A few things I still don't like:

  • When the plugin opens, the xml filename is populated with previous value, but the bounds are not.
    image
  • When I then click into the filename field and press ENTER, I would expect that the filename is updated and the bounds are set. Instead, this basically clicks OK.
  • (a bug) The maxes are off by one. Instead of timepointMax = seq.getTimePoints().size() should be size()-1.
  • To get back something like the sliders in the current dialog, I tried to use style = NumberWidget.SLIDER_STYLE. But that does not work properly, because the slider max is not updated when a new max is set. Would be interesting to know how to do that (and whether it's possible).
  • The new code is quite a bit longer than the old one which is a bit ironic because everything should be easier with @Parameter. Maybe some of it could be simplified with the standard way of setting min/max ranges in existing dialog. But I don't know how to do that / whether it is possible. Maybe @imagejan @ctrueden could comment?

@ctrueden
Copy link
Member

ctrueden commented Apr 22, 2019

setting min/max ranges in existing dialog. But I don't know how to do that / whether it is possible

Not currently possible, sorry.

There is no issue precisely about that, but here are the closest ones:

Perhaps could be tackled as part of the SJC3 dialog generator redesign. I am working on some necessary underpinnings for that over the next couple of months, but I don't know how far along the dialog stuff specifically will get in that time-frame.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants