Skip to content

Commit c93e516

Browse files
bethac07hinerm
andauthored
Fix RunImageJScript parameter detection, add DOI (#200)
* CP-IJ: fix image parameter detection Fixes the previous logic to no longer claim every param type as an image, restricting things appropriately to just the classes defined in img_strings. * CP-IJ: fully support parameter deletion We were tracking input/output params in addition to the overall settings, so both locations need to be updated when removing. * Add DOI --------- Co-authored-by: hinerm <hinerm@gmail.com>
1 parent be7e6e9 commit c93e516

2 files changed

Lines changed: 17 additions & 1 deletion

File tree

active_plugins/runimagejscript.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@
2424
import skimage.io
2525
import cpij.bridge as ijbridge, cpij.server as ijserver
2626

27+
imagej_link = "https://doi.org/10.1038/nmeth.2089"
28+
imagej2_link = "https://doi.org/10.1186/s12859-017-1934-z"
29+
pyimagej_link = "https://doi.org/10.1038/s41592-022-01655-4"
30+
2731
__doc__ = """\
2832
RunImageJScript
2933
=================
@@ -51,6 +55,10 @@
5155
^^^^^^^^
5256
5357
ImageJ Scripting: https://imagej.net/Scripting
58+
Schneider, C. A., Rasband, W. S., & Eliceiri, K. W. (2012). NIH Image to ImageJ: 25 years of image analysis. Nature Methods, 9(7), 671–675. {imagej_link}
59+
Rueden, C. T., Schindelin, J., Hiner, M. C., DeZonia, B. E., Walter, A. E., Arena, E. T., & Eliceiri, K. W. (2017). ImageJ2: ImageJ for the next generation of scientific image data. BMC Bioinformatics, 18(1). {imagej2_link}
60+
Rueden, C.T., Hiner, M.C., Evans, E.L. Pinkart, M.A., Lucas, A.M., Carpenter, A.E., Cimini, B.A., & Eliceiri, K. W. (2022). PyImageJ: A library for integrating ImageJ and Python. Nat Methods 19, 1326–1327 . {pyimagej_link}
61+
5462
5563
"""
5664

@@ -112,6 +120,8 @@ class RunImageJScript(Module):
112120
variable_revision_number = 3
113121
category = "Advanced"
114122

123+
doi = {"If you are using RunImageJScript please cite the following": pyimagej_link }
124+
115125
def __init__(self):
116126
super().__init__()
117127
self.parsed_params = False # Used for validation
@@ -504,6 +514,12 @@ def validate_module_warnings(self, pipeline):
504514
def run(self, workspace):
505515
self.init_pyimagej()
506516

517+
# Unwrap the current settings from their SettingsGroups
518+
all_settings = list(map(lambda x: x.settings[0], self.script_parameter_list))
519+
# Update the script input/output settings in case any were removed from the GUI
520+
self.script_input_settings = {k: v for (k,v) in self.script_input_settings.items() if v in all_settings}
521+
self.script_output_settings = {k: v for (k,v) in self.script_output_settings.items() if v in all_settings}
522+
507523
if self.show_window:
508524
workspace.display_data.script_input_pixels = {}
509525
workspace.display_data.script_input_dimensions = {}

cpij/server.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ def set_directory_fn_app(path):
209209
browse_msg=f'Choose {param_label} file'
210210
)
211211
return (param_dir, param_file)
212-
elif bool((img_string for img_string in img_strings if type_string == img_string)):
212+
elif type_string in img_strings:
213213
return ImageSubscriber(param_label)
214214
elif OUTPUT_CLASS == param_class:
215215
if bool((img_string for img_string in img_strings if type_string == img_string)):

0 commit comments

Comments
 (0)