Add method to save Fiji script parameters, and add example to opening an image#111
Add method to save Fiji script parameters, and add example to opening an image#111ehrenfeu merged 15 commits intoimcf:develfrom
Conversation
Calls on scijava.script.ScriptModule through Python globals to access only the user-given parameters and not other variables at run-time.
The method now ignores password in a clean way, and skips some other non-essential runtime keys.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## devel #111 +/- ##
====================================
- Coverage 25% 24% -1%
====================================
Files 25 25
Lines 1688 1742 +54
====================================
+ Hits 421 425 +4
- Misses 1267 1317 +50 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
src/imcflibs/imagej/misc.py
Outdated
| # Skip if parameter is declared with style="password" | ||
| style = item.getWidgetStyle() | ||
| if style is not None and style.lower() == "password": | ||
| continue |
There was a problem hiding this comment.
You could use WidgetStyle.isStyle(ModuleItem<?> item, String target) here:
| # Skip if parameter is declared with style="password" | |
| style = item.getWidgetStyle() | |
| if style is not None and style.lower() == "password": | |
| continue | |
| # Skip if parameter is declared with style="password" | |
| if WidgetStyle.isStyle(item, TextWidget.PASSWORD_STYLE): | |
| continue |
Note also the use of public constants instead of hard-coded strings here 😉
There was a problem hiding this comment.
I like @imagejan's suggestion. @rohangirishrao could you look into it?
|
Add to changelog #126 |
|
From the GitHub Actions checks: Looks like you need to update |
|
Yep: https://github.com/imcf/imcf-fiji-mocks/releases/tag/v0.12.0 😁 Thanks for spotting!
|
|
🕵🏼 Need to investigate why |
Using UTF-8 is still shaky in the Jython 2.7 environment, so if there is no strong need for it, simply stick to ASCII.
src/imcflibs/imagej/misc.py
Outdated
| # Skip if parameter is declared with style="password" | ||
| style = item.getWidgetStyle() | ||
| if style is not None and style.lower() == "password": | ||
| continue |
There was a problem hiding this comment.
I like @imagejan's suggestion. @rohangirishrao could you look into it?
| val = inputs.get(key) | ||
| f.write("%s: %s\n" % (key, str(val))) | ||
|
|
||
| print("Saved script parameters to: %s" % out_path) |
Safe way of parsing Fiji script params by ignoring the passwords field automatically.