AxisError when processing BMP grayscale images with shape (H, W)
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 60/100
Research direction
Open pyopia/instrument/silcam.py and find the ImagePrep class where data['im_minimum'] is computed with np.min(image, axis=2). Add a check for 2-dimensional images so grayscale (H, W) input is passed through without the axis reduction. Reproduce with a monochrome BMP, then verify RGB processing still works with the existing pipeline tests.
Written by the indexing model from the issue text.
Description
Hi, I ran into an issue when processing grayscale (monochrome) BMP images of the second deployment of Spartacus in Trondheim fjord.
In ImagePrep class of the pyopia.instrument.silcam module, the "im_minimum" is computed using:
data['im_minimum'] = np.min(image, axis=2)
but this assumes that all images have a channel dimension (axis=2), which is true for RGB images with shape (H, W, 1 or 3). However, this raises the following error for grayscale images with shape (H, W):
"AxisError: axis 2 is out of bounds for array of dimension 2"
data['im_minimum'] is computed unconditionally in ImagePrep and cannot be disabled via user preferences, so processing monochrome images breaks at this step if they don't have channel dimension. The following correction can easily solve the problem:
data['im_minimum'] = image if image.ndim==2 else np.min(image, axis=2)
** Another approach is to comment out the imageprep step in the config file, but the user must set segment_source= "im_corrected" or segment_source="imraw". This can be confusing for users.......
- Dominant language
- Jupyter Notebook
- Stars
- 19
- Forks
- 7
- Avg merge
- 10d 11h
- Merged PRs (30d)
- 1
Getting set up
- Ships a Dockerfile or Docker Compose file
- No pull request template
- No contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from SINTEF/pyopia
-
Guard clean_bw against the scikit-image remove_small_objects change before lifting the <0.25 pinMay be free again @riyagoyal01 claimed this 12 days ago, and no pull request is open. Openpatch / enhancement testing
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
Use explicit, per-instrument-configurable timestamp format when parsing filenames (SilCam/Holo/UVP)Open
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
patch / enhancement priority-medium
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
-
Document running Python directly in the Docker image, and which functions are publicPossibly taken @emlynjdavies claimed this 17 days ago. Opendocumentation question
-
patch / enhancement
Difficulty 3/5 1-2 days Newbie friendliness 72/100
Similar issues
-
v3
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
pluginkollektiv/antispam-bee#952 ·
Maintainers usually reply within 1 day
-
area: middleware enhancement good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
config: reject Proxy-Authorization and Proxy-Authenticate in server headersPossibly taken @haseemajaz claimed this today. Openbug good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
rohitgollarahalli/mcpx#38 · 1 comment ·
Maintainers usually reply within 1 day
-
area: API good first issue size/xs
Difficulty 2/5 1-3 hours Newbie friendliness 92/100
DahanItamar/DockNest#354 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100