Skip to content

Eliminate toarray() for spectral/spatial metrics#1719

Open
Bisho2122 wants to merge 22 commits into
masterfrom
Fix/eliminate-toarray
Open

Eliminate toarray() for spectral/spatial metrics#1719
Bisho2122 wants to merge 22 commits into
masterfrom
Fix/eliminate-toarray

Conversation

@Bisho2122
Copy link
Copy Markdown
Collaborator

Problem

Follow-up to #1718 . The annotation pipeline sometimes crashes with OOM on datasets where spectra form isolated blobs inside a large bounding box. After #1718 fixed chaos_metric, the remaining crash point is formula_validator.py which still materialises the full h×w dense array for every peak of every formula when building iso_imgs_flat.

Change

  • imzml_reader gets a pixel_to_flat_idx lookup table built once at init — maps any pixel coordinate directly to its position in the
    masked-flat metrics array.
  • formula_validator.py uses it to scatter sparse coo values directly into a 1D array of size n_spectra, removing the toarray() call and the intermediate dense iso_imgs list entirely.
  • pipeline.py logs a warning when pixel density is below 5% so blob datasets are visible in logs.

@Bisho2122 Bisho2122 requested a review from lmacielvieira April 17, 2026 16:31
@Bisho2122 Bisho2122 self-assigned this Apr 17, 2026
@Bisho2122 Bisho2122 added the enhancement New feature or request label Apr 17, 2026
Bisho2122 and others added 20 commits April 17, 2026 18:32
* Webapp docs initial setup

* Fixed docs deploy tasks

* gitignore for vitepress

* Add Vitepress configuration

* Add docs markdown

* Add screenshot images

* [docs] commented unused references

* Few text modifications

* Add "what's new"

* [Header] Added link to docs

---------

Co-authored-by: Bishoy Wadie <bwadie298@gmail.com>
…1706)

Bumps [picomatch](https://github.com/micromatch/picomatch) from 2.3.1 to 2.3.2.
- [Release notes](https://github.com/micromatch/picomatch/releases)
- [Changelog](https://github.com/micromatch/picomatch/blob/master/CHANGELOG.md)
- [Commits](micromatch/picomatch@2.3.1...2.3.2)

---
updated-dependencies:
- dependency-name: picomatch
  dependency-version: 2.3.2
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [requests](https://github.com/psf/requests) from 2.32.4 to 2.33.0.
- [Release notes](https://github.com/psf/requests/releases)
- [Changelog](https://github.com/psf/requests/blob/main/HISTORY.md)
- [Commits](psf/requests@v2.32.4...v2.33.0)

---
updated-dependencies:
- dependency-name: requests
  dependency-version: 2.33.0
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…pp (#1709)

Bumps [lodash-es](https://github.com/lodash/lodash) from 4.17.23 to 4.18.1.
- [Release notes](https://github.com/lodash/lodash/releases)
- [Commits](lodash/lodash@4.17.23...4.18.1)

---
updated-dependencies:
- dependency-name: lodash-es
  dependency-version: 4.18.1
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…#1710)

Bumps [picomatch](https://github.com/micromatch/picomatch) from 2.2.2 to 2.3.2.
- [Release notes](https://github.com/micromatch/picomatch/releases)
- [Changelog](https://github.com/micromatch/picomatch/blob/master/CHANGELOG.md)
- [Commits](micromatch/picomatch@2.2.2...2.3.2)

---
updated-dependencies:
- dependency-name: picomatch
  dependency-version: 2.3.2
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…1712)

Bumps [lodash](https://github.com/lodash/lodash) from 4.17.23 to 4.18.1.
- [Release notes](https://github.com/lodash/lodash/releases)
- [Commits](lodash/lodash@4.17.23...4.18.1)

---
updated-dependencies:
- dependency-name: lodash
  dependency-version: 4.18.1
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…#1713)

Bumps [lodash](https://github.com/lodash/lodash) from 4.17.23 to 4.18.1.
- [Release notes](https://github.com/lodash/lodash/releases)
- [Commits](lodash/lodash@4.17.23...4.18.1)

---
updated-dependencies:
- dependency-name: lodash
  dependency-version: 4.18.1
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [follow-redirects](https://github.com/follow-redirects/follow-redirects) from 1.15.3 to 1.16.0.
- [Release notes](https://github.com/follow-redirects/follow-redirects/releases)
- [Commits](follow-redirects/follow-redirects@v1.15.3...v1.16.0)

---
updated-dependencies:
- dependency-name: follow-redirects
  dependency-version: 1.16.0
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…1717)

Bumps [dompurify](https://github.com/cure53/DOMPurify) from 3.3.2 to 3.4.0.
- [Release notes](https://github.com/cure53/DOMPurify/releases)
- [Commits](cure53/DOMPurify@3.3.2...3.4.0)

---
updated-dependencies:
- dependency-name: dompurify
  dependency-version: 3.4.0
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [brace-expansion](https://github.com/juliangruber/brace-expansion) from 1.1.12 to 1.1.14.
- [Release notes](https://github.com/juliangruber/brace-expansion/releases)
- [Commits](juliangruber/brace-expansion@v1.1.12...v1.1.14)

---
updated-dependencies:
- dependency-name: brace-expansion
  dependency-version: 1.1.14
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…1711)

Bumps [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) from 5.4.21 to 6.4.2.
- [Release notes](https://github.com/vitejs/vite/releases)
- [Changelog](https://github.com/vitejs/vite/blob/v6.4.2/packages/vite/CHANGELOG.md)
- [Commits](https://github.com/vitejs/vite/commits/v6.4.2/packages/vite)

---
updated-dependencies:
- dependency-name: vite
  dependency-version: 6.4.2
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* Add image_segmentation postprocessing python package as a new service

* Add docker, requirements and app for image segmentation service

* Add segmentation_wrapper.py and sm/rest/segmentation.py

* Add segmentation to update_daemon, dataset manager, and daemon actions

* Mount segmentation app

* Graphql for segmentation

* Add image segmentation docker config to docker compose and modify .env

* Add segmentation_data_loader from inside engine

* Modify S3 I/O and update diagnostics

* Update graphql schema and model.ts

* Update docker

* Update config and add config to postprocessing upstream

* Add migration and update db_schema

* Fix isoimage bug

* Remove anndata and metaspace_converter dependancy

* Implement callback and update segmentation app

* Fix image_segmentation docker

* Update segmentation config.json

* fixed tests

* fixed pytest

* Add assignment confidence histogram

* [Segmentation] added segmentation dialog and fixed back to run with docker

* [SegmentationPage] started segmentation resul page

* [SegmentationPage] added segment markers component

* [SegmentationPage] started segnebtatuib diagnostics component

* [SegmentationPage] added optical image and opacity controls

* [SegmentationPage] updated diagnostics charts

* [Segmentation] starter deploy setup

* [Segmentation] optimized tables

* [Segmentation] fixed callback default value

* [Segmentation] Compatibility with python 3.8

* simplified segmentation supervisor

* [Segmentation] adjusts backend to se database id and segmentation manager

* [Added segment name]

* updated db schema

* [Segmentation] Segmentation table and better logger

* [Postprocessing] added detailed logs

* [Segmentation] added feature as feature flagged

* [Segmentation] added error on job mail

* [segmentation] enabled admin access

* Use AUC instead of FE for segmentation profiles

* fixed actions test

* [Segmentation] restart pending jobs on seg service restart

* [Segmentation] waiting for api to request pending processing

* fixed linting issues

* [Segmentation] fixed Cluster name

* [Graphql] Added segmentation tests

---------

Co-authored-by: Bishoy Wadie <bwadie298@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants