imagej / imagej/imagej-matlab

Multiple #@matrix parameters not supported

Open
#25 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
16
Forks
6
PR merge metrics
No merged PRs in 30d

Description

In a Matlab script started from ImageJ's script editor, a single `#@matrix` parameter works as expected and takes the current active image from ImageJ.

In analogy to `#@ Dataset`, I'd expect to get dropdown choice widgets for my parameters if I have more than one of them:

```
#@ matrix input1
#@ matrix input2
```

Instead, this show an error that a MatlabNumericArray is required but none is available.

---

While [`MATLABNumericArrayPreprocessor`](https://github.com/imagej/imagej-matlab/blob/da50b03b539b0a5d608e63427ddf5ca1c9aa5027/src/main/java/net/imagej/matlab/MATLABNumericArrayPreprocessor.java) (`extends SingleInputPreprocessor`) deals with the former case, the latter currently doesn't work presumably because there is no direct conversion support for `ImagePlus` -> `MatlabNumericArray`.

We could add support for all the common image-type objects (e.g. `ImagePlus`, `Img`, `Dataset`) by chained conversion using a [delegate converter](https://github.com/scijava/scijava-common/blob/3ab383f20b69fe3a14d795215911025760ca1427/src/main/java/org/scijava/convert/AbstractDelegateConverter.java), but is this repository the right place to e.g. also contain the legacy `ij.ImagePlus <-> matlabcontrol.extensions.MatlabNumericArray`? @ctrueden?

---

As an aside: the `#@matrix` script parameter alias is added in `scripting-matlab` by [`DefaultMATLABService`](https://github.com/scijava/scripting-matlab/blob/f9943e066c7aabb02f5376917c0e13fdac2b7adb/src/main/java/org/scijava/plugins/scripting/matlab/DefaultMATLABService.java#L88-L89)

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with src/main/java/net/imagej/matlab/MATLABNumericArrayPreprocessor.java and compare its SingleInputPreprocessor behavior with the multiple-parameter case. Read the linked AbstractDelegateConverter and DefaultMATLABService references to determine where the conversion support belongs. Done means two #@ matrix parameters produce the expected dropdown choices and no missing MatlabNumericArray error.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, matlab
Domain
backend
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.