Working on an extension with a scroll bar

Hi,

I am working on developing an extension to Qupath that would allow user to input value using a scrollbar in order to process an image. What would be the easiest way to acquire a scroll bar? Please guide me.

Not sure what you mean exactly, but most of the GUI stuff is done through JavaFX, so I would recommend looking there. I have only ever done some basic buttons, fields and dropdown menus, which can be seen in some of the posted scripts.
https://openjfx.io/openjfx-docs/
https://openjfx.io/javadoc/12/
https://docs.oracle.com/javafx/2/ui_controls/scrollbar.htm

I think you want a JavaFX Slider. There is more info about different JavaFX controls here.

You could create a ParameterList and add a bounded double parameter (see here), then wrap that in a ParameterPanelFX.

Some code that shows that in action:

guiscript=true
// Above line is to request the script is run in the JavaFX Application thread when run from the script editor

import qupath.lib.gui.helpers.DisplayHelpers
import qupath.lib.plugins.parameters.ParameterList

def key = "myParameter"
def params = new ParameterList()
   .addDoubleParameter(key, "Choose a number", 5.0, "units", 0.0, 10.0, "Some tooltip text")

DisplayHelpers.showParameterDialog("Some title", params)

print params.getDoubleParameterValue(key)

I’d suggest using JavaFX directly, since this is less likely to be affected by any future changes in the QuPath API (still a work in progress) and gives you a lot more control.

Also, note that, with the script above, the parameter value is changed even if ‘cancel’ is pressed.

1 Like

Thanks guys. I am trying to incorporate a new mechanism for annotation.

I have another question as well. Although its not related. I wonder if you can answer it.

I am trying to visualise the results of a model trained on HSV images in QuPath. I converted the images to HSV in the run_simple_server.py script but the results I see are strange. Also there is no difference in results whether I convert them or not.

I don’t understand the question well enough to be able to help and would need a lot more information about what exactly you’re doing, seeing and expecting.

I also don’t know run_simple_server.py is/does or if it’s something I once wrote and have since forgotten…

I think I cannot share the code or the results here as this is a public forum. Can we do it over email or Skype or something?

Thanks.