autooptions package
Submodules
- autooptions.array_util module
- autooptions.napari_util module
NapariUtilNapariUtil.copyOriginalPath()NapariUtil.getDataAndScaleOfLayerWithName()NapariUtil.getDataOfLayerWithName()NapariUtil.getFFTLayers()NapariUtil.getImageLayers()NapariUtil.getLabelLayers()NapariUtil.getLayerWithName()NapariUtil.getLayersOfType()NapariUtil.getOriginalPath()NapariUtil.getPointsLayers()
- autooptions.options module
OptionsOptions.addBool()Options.addChoice()Options.addFFT()Options.addFloat()Options.addImage()Options.addInt()Options.addLabels()Options.addPoints()Options.addStr()Options.get()Options.getBaseOption()Options.getCallbackName()Options.getItems()Options.load()Options.save()Options.set()Options.setDefaultValues()Options.setValue()Options.value()
- autooptions.qtutil module
- autooptions.widget module
Module contents
- class autooptions.Options(applicationName, optionsName)[source]
Bases:
objectOptions are a list of parameters that are intended to be passed to an operation. Options have a name, a type and a value.
- addBool(name, value=False, transient=False, position=None, callback=None)[source]
An option that represents a binary choice.
- Parameters:
name – The name of the option
value – The boolean value, True or False
transient – Whether the option is transient. Transient options are not saved and reloaded.
position – The position of the option within the options. (Could be used when dictionaries are not ordered). If none is given, the next free position is used.
callback – A callback function, that is called whenever the selected item is changed, whether via the gui or programmatically. The implementer must take care to avoid endless loops.
- addChoice(name, value=None, choices=None, transient=False, position=None, callback=None)[source]
An option that represents a choice in a list of given values.
- Parameters:
name – The name of the option
value – The text of the selected choice
choices – A collection of possible values
transient – Whether the option is transient. Transient options are not saved and reloaded.
position – The position of the option within the options. (Could be used when dictionaries are not ordered). If none is given, the next free position is used.
callback – A callback function, that is called whenever the selected item is changed, whether via the gui or programmatically. The implementer must take care to avoid endless loops.
- addFFT(name='fft', value=None, transient=True, position=None, callback=None)[source]
Add an option that represents the selection of an FFT image. Image options are often transient. The FFT is not a standard image, since only the amplitude information is in the image, while the phase information is kept in the metadata.
- Parameters:
name – The name of the option
value – The name of the fft layer
transient – Whether the fft option is transient. Transient options are not saved and reloaded.
position – The position of the fft option within the options. (Could be used when dictionaries are not ordered). If none is given, the next free position is used.
callback – A callback function, that is called when the selected fft layer changes
- addFloat(name, value=0.0, transient=False, position=None, widget='input', callback=None)[source]
An option that represents a float value.
- Parameters:
name – The name of the option
value – The float value
transient – Whether the option is transient. Transient options are not saved and reloaded.
position – The position of the option within the options. (Could be used when dictionaries are not ordered). If none is given, the next free position is used.
widget – Currently only the input-widget, which means entering the number into an input field, is implemented. However, a float could also be entered in a different way, for example using a slider.
callback – A callback function, that is called when the value is changed via the graphical interface.
- addImage(name='image', value=None, transient=True, position=None, callback=None)[source]
Add an option that represents the selection of an image. Image options are often transient.
- Parameters:
name – The name of the image option
value – The value of the image option
transient – Whether the image option is transient. Transient options are not saved and reloaded.
position – The position of the image option within the options (Could be used when dictionaries are not ordered). If none is given, the next free position is used.
callback – The callback function, that is called when the value of the option is changed.
- addInt(name, value=1, transient=False, position=None, widget='input', callback=None)[source]
An option that represents an integer value.
- Parameters:
name – The name of the option
value – The integer value
transient – Whether the option is transient. Transient options are not saved and reloaded.
position – The position of the option within the options. (Could be used when dictionaries are not ordered). If none is given, the next free position is used.
widget – Currently only the input-widget, which means entering the number into an input field, is implemented. However, an integer could also be entered in a different way, for example using a slider.
callback – A callback function, that is called when the value is changed via the graphical interface.
- addLabels(name='labels', value=None, transient=True, position=None, callback=None)[source]
Add an option that represents the selection of a labels image. Labels options are often transient.
- Parameters:
name – The name of the labels option
value – The value of the labels option
transient – Whether the labels option is transient. Transient options are not saved and reloaded.
position – The position of the labels option within the options (Could be used when dictionaries are not ordered). If none is given, the next free position is used.
callback – The callback function, that is called when the value of the option is changed.
- addPoints(name='points', value=None, transient=True, position=None, callback=None)[source]
Add an option that represents the selection of a points layer. Points options are often transient.
- Parameters:
name – The name of the points option
value – The value of the points option
transient – Whether the points option is transient. Transient options are not saved and reloaded.
position – The position of the points option within the options (Could be used when dictionaries are not ordered). If none is given, the next free position is used.
callback – The callback function, that is called when the value of the option is changed.
- addStr(name, value='', transient=False, position=None, callback=None)[source]
An option that represents a textual value.
- Parameters:
name – The name of the option
value – The text
transient – Whether the option is transient. Transient options are not saved and reloaded.
position – The position of the option within the options. (Could be used when dictionaries are not ordered). If none is given, the next free position is used.
callback – A callback function, that is called when the value is changed via the graphical interface.
- get(name)[source]
Answer the option with the given name.
- Parameters:
name – The name of an option
- Returns:
Answers the option with the given name as a dictionary
- getBaseOption(value, transient, position, callback)[source]
A helper method to set the parts of an option that a common to all kinds of options.
- Parameters:
value – The value of the option
transient – Whether the option is transient. Transient options are not saved and reloaded.
position – The position of the option within the options. (Could be used when dictionaries are not ordered). If none is given, the next free position is used.
callback – A callback function, that is called when the value of the option changes.
- getItems()[source]
Return the items stored in the options object.
- Returns:
A dictionary of all options in the options object.
- set(name, option)[source]
Set the option in options under the given name.
- Parameters:
name – The name of an option
option – The new option
- setDefaultValues(defaultItems)[source]
Set the default values for all options in the options object. Currently unused. The idea is that it might be useful to have default values, other than in the code, to which the option can be reset.
- Parameters:
defaultItems – A dictionary of default values for all options in the options object.
- class autooptions.OptionsWidget(viewer, options, client=None)[source]
Bases:
QWidgetAutomatically creates a widget from an options object. The option values can be changed in the dialog. When the Apply or the Ok-button is pressed the values are copied from the dialog to the options object and saved to the options file.
- addApplyButton(callback)[source]
Add an apply button to the options widget. When the button is pressed the value are copied from the dialog to the options object. The dialog remains open.
- Parameters:
callback – The client can register a callback that is called when the apply button is pressed
- addCancelButton(callback)[source]
Add a cancel button to the options widget. When the button is pressed the dialog is closed, the values in the dialog are not copied to the options object.
- Parameters:
callback – The client can register a callback that is called when the ok button is pressed
- addOKButton(callback)[source]
Add an ok button to the options widget. When the button is pressed the value are copied from the dialog to the options object. The dialog is closed.
- Parameters:
callback – The client can register a callback that is called when the ok button is pressed
- getImageLayer(name)[source]
Answer the image layer that has the name of the value of the option with the given name. The option must be a layer selection option (image, labels, points, fft).
- Parameters:
name – The name of an option
- Returns:
The layer that has the name corresponding to the value of the option