imagej / imagej/pyimagej

Make ImagePlus subscriptable

Open
#194 4 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Python
Stars
534
Forks
95
PR merge metrics
No merged PRs in 30d

Description

PyImageJ lets you subscript RandomAccessibleInterval objects, but not ImagePlus objects.

For single-element access:

* GRAY8 (ByteProcessor) is the equivalent of `numpy.uint8`.
* GRAY16 (ShortProcessor) is the equivalent of `numpy.uint16`.
* GRAY32 (FloatProcessor) is the equivalent of `numpy.float32`.
* COLOR_RGB (IntProcessor) [has no numpy dtype equivalent](https://towardsdatascience.com/exploring-the-mnist-digits-dataset-7ff62631766a#a65a) to my knowledge.
* COLOR_256 is apparently [also done in numpy with `numpy.uint8`](https://stackoverflow.com/q/50267606/1207769)...
* Does ImageJ support for uint32 now? I vaguely remember reading on a thread during 2021-2022 about it, but I can't find it now.

Note also that to be consistent with numpy and ImgLib2's behavior, the `dtype` function should also be implemented, and it should return a class object corresponding to the returned type of single elements.

For slicing: maybe we can use the Duplicator's crop and/or run to limit dimensional min/maxes. But step values other than 1 require more effort. Better to wrap the ImagePlus into some kind of Python-side view object?

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by tracing PyImageJ’s existing RandomAccessibleInterval subscription behavior, then examine ImagePlus and the mentioned Duplicator approach for single-element access, dtype, and slicing. Done means the project has agreed indexing and slicing semantics for ImagePlus, including step values, and dtype returns the corresponding element type; uint32 behavior also needs clarification.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, python
Domain
api, computer-vision
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.