Open xp1632 opened 2 months ago
we can see, to batch or not to batch, depending on the code snippet, let's see if offering a code template that would vary based on different type of Ops would work
And i checked the JIPipe code again, only find they are justing calling Op based on scijava Module, nothing special
but they carefully defined all types of inputs and outputs:
inputs
and outputs
from OpService
module
: https://javadoc.scijava.org/SciJava/org/scijava/module/class-use/ModuleService.html
For us, firstly in Python we don't have this scijava module
besides, for some complex datatype in java, for example, HyperSphereShape
, which is a subclass of Shape
, we don't have an equivalent type in python
We have to import this java class with jimport
and use it in a specific way: HyperSphereShape(5)
which makes it hard for us to call all ops in a unified way
we defined a rough mapping relationship between input java type and the python datatype in VP project
In this case, net.imglib2.algorithm.neighborhood.Shape
input type provided by filter.median
plugin's OpInfo
is roughly represented as int
, which is 5
when we use it as HyperSphereShape(range)
range
is 5
, and HyperSphereShape(range)
is defined by us in the code snippet
should import
and the format
of correct use itmanual jimport
in code snippet
jargs
as described in https://github.com/Max-ChenFei/VPE_IP/issues/75#issue-2179252228filter.median
to Second Node threshold.otsu
Problem 1 : Multi Operation list for one Op_name
filter. median
OpInfo
when we search by its Op_name
threshold. otsu
may return a list of operations under the same Op_name
Solution 1: Op Matching based on Parameter Number and default priority:
As we detailed explained here: https://github.com/Max-ChenFei/VPE_IP/issues/72#issuecomment-1981361593
We referred to ImageJ's own Op matching:
And Solution is:
Because by then, we can not get type
information from static code snippet
However, while we are batching
the pipeline, and the code snippet itself would be generated by us
We could consider other solutions
Solution 2: Multi-Node for Multi-Operation
Now we are not generating One Node
but Batched Node
So actually we don't have to pick from the Operation List
We can create all of them and let the user choose which operation node they want to use
We can distinguish the operations under same Op_name
by adding hints in nodes or give them Node1, Node2, Node3, etc
Problem 2: Should we modify extraction rule of the extract_op_parameter
method?
threshold.otsu
: extract_op_parameter()
, we only wrote the extraction rule to extract op parameter in ij.op().run("filter.median", ij.py.jargs( ** Extracted parameters **))
- And for calling "threshold.otsu", we didn't use jargs()
, should we add another extraction rule for it?
The answer is No!
jargs()
method definition in PyImageJ:You may see jargs()
is just call to_java()
method for every arguments inside
Then let's check the code snippet of calling threshold.otsu
again
jargs()
in this case to_java
for the input parameter process_image
and turn it into jimage
ij.op().run("op_name", ij.py.jargs( ** Input parameters **))
link code
between each op callinglink code
is not what we should provide, we only provide op_running
, the prep link code should be provided with other link node
, not inside of each op nodeis to generate the Code Snippet
more detailed mapping table
could solveHowever, two problems left to be solved :
Tuple
related processing code adding in Format module in JSON generation
code snippet generation
scope problem, but also how the node spec generation
handle a one op name(filter.median
), multi operations under(operation 1
, operation2
) We want our ImageJ nodes look like this in VP project's search menu:
The file structure layer should be
filter
as a subfolderfilter_xxx_xxx
nodes in one JSON fileNodeTypePackage
:
one op_name--> multi Op method
demandWe've finished the initial version of generation pipeline for ImageJ library in commit 01fc242d647acd8cfd6b7ed9043854ecb94f09db and issue https://github.com/xp1632/VPE_IP/issues/91#issuecomment-2074862790
We generate node specifications that are grouped by its namespace:
We try to install the whole ImageJ_Package
in NodeExtension's FilePond:
Reason could be
__init__.json
for the packageNodeTypePackage
as Kornia
do in here__init__.json
for the package
tuple
, list
type in Chaldenetuple
, list
input that Chaldene as a visual programming language doesn't support for now__init__.json
to achieve package import
It looks like path 2 in Possible Enhancement is in demand
To achieve the
general
andbatch
in the pipelineWe need to modify the current pipeline
Difference in Pipeline v1 and v2: https://github.com/Max-ChenFei/VPE_IP/issues/78#issuecomment-2027343270
Pipeline Feasibility for Python Library