Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add volume rendering contrast limits #25

Merged
merged 61 commits into from
Oct 31, 2024
Merged

Conversation

seankmartin
Copy link
Collaborator

@seankmartin seankmartin commented Oct 17, 2024

This PR introduces the following main things:

  1. A contrast limit calculation method to determine reasonable contrast limits for 3D volume rendering in neuroglancer.
  2. Updates to the JSON state generation and shader generation to support using this.
  3. A Python implementation of the volume rendering algorithm in neuroglancer. The implementation is limited, and currently not used by any public functions. It was created to explore if the volume rendering image output could be used to feed back into the contrast limits. This is so that if the output was completely black for example, then new tighter limits could be created. Due to some intracies of the neuroglancer application, this is not an exact recreation, but a close approximation.

@seankmartin seankmartin requested a review from aranega October 17, 2024 11:29
Copy link
Collaborator

@aranega aranega left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mainly all looks good :) ! There is few modifications that could be done (removing the use of Optional for example), but there is a design decision to take regarding the calculator, should they be state free when it comes to the volume, or should they keep information about the volume as internal state.

cryoet_data_portal_neuroglancer/models/json_generator.py Outdated Show resolved Hide resolved
cryoet_data_portal_neuroglancer/state_generator.py Outdated Show resolved Hide resolved
manual_tests/tuning_contrast_limits_from_api.py Outdated Show resolved Hide resolved
manual_tests/volume_contrast_limits.py Outdated Show resolved Hide resolved
Copy link
Collaborator

@aranega aranega left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@seankmartin Thanks a lot for the modifications! It looks just perfect! :)

@seankmartin seankmartin merged commit 10669d5 into main Oct 31, 2024
5 checks passed
@seankmartin seankmartin deleted the feature/contrast-limits branch October 31, 2024 15:25
manasaV3 pushed a commit that referenced this pull request Dec 24, 2024
🤖 I have created a release *beep* *boop*
---


##
[1.1.0](v1.0.0...v1.1.0)
(2024-12-06)


### ✨ Features

* add all hyperopts to contrast limits
([1fa9d6a](1fa9d6a))
* add decimation algorithm for contrast limit computation
([9499967](9499967))
* Add default opacity to 1 and blend to additive
([cb32980](cb32980))
* Add default opacity to 1 and blend to additive (CC-165)
([#27](#27))
([3316c78](3316c78))
* add hide high noise option
([bf97c93](bf97c93))
* add initial hyperopt
([05ab24d](05ab24d))
* add optimisation for hyperparams to the contrast limit class w test
([17a311b](17a311b))
* add segmentation property objects
([d7664bc](d7664bc))
* add v1 of GMM and k-means contrast limits
([eda99a9](eda99a9))
* Add volume rendering contrast limits
([#25](#25))
([10669d5](10669d5))
* Adding release please
([#19](#19))
([4ec9ca7](4ec9ca7))
* allow seg gen to control the segments shown, have random colours, and
the mesh render scale
([759def1](759def1))
* allow to not persist big zarrs
([62166af](62166af))
* better window limits from contrast
([96ece94](96ece94))
* change print to logging of chunk comparison size
([878a7a7](878a7a7))
* clean up contrast limits
([87e25e5](87e25e5))
* contrast limit improvements
([ff5ef94](ff5ef94))
* datasets for contrast limit testing
([25b7861](25b7861))
* Disable "pick" by default for segmentation layer.
([#28](#28))
([8287be7](8287be7))
* Disable "pick" for default value in segmentation layer
([3af57f4](3af57f4))
* improve CDF based contrast limits
([822be9f](822be9f))
* improve high value hide control
([5d3a8ae](5d3a8ae))
* improve manual limits testing and add auto screenshots
([a24ad8c](a24ad8c))
* include manual test for contrast
([1882a91](1882a91))
* include new contrast limit methods
([75b1a2e](75b1a2e))
* incorportate hyperopt in api test
([0003de9](0003de9))
* link seg properties into mesh and seg creation
([dfbd34a](dfbd34a))
* main public API to limits tuning
([71112c9](71112c9))
* make public API to contrast limits
([30eaa75](30eaa75))
* mesh precompute functions and state generation
([#23](#23))
([02439d8](02439d8))
* more control over image JSON generator
([e15bace](e15bace))
* more control over mesh from segmentation
([e1af340](e1af340))
* per comp GMM standard deviation
([94240a7](94240a7))
* progress on contrast limits
([5f9e7e0](5f9e7e0))
* tuned two best methods, need removal of tuning params
([f4c076f](f4c076f))
* tuning contrast limits
([356ca03](356ca03))
* update gmm sample size
([ff01ae5](ff01ae5))
* update shader names
([2dfe36f](2dfe36f))
* update tuning
([65c3f93](65c3f93))


### 🐞 Bug Fixes

* allow segmentation to overwrite existing segment properties
([#26](#26))
([dc38b7d](dc38b7d))
* allow segmentation to overwrite existing segment properties on new run
([54c1b14](54c1b14))
* calculate grid size over all LODs, not LOD 0 only
([2753486](2753486))
* correct flag for projection_quaternion default
([2692a6d](2692a6d))
* correct numpy array in type hint after using | None
([945fbc8](945fbc8))
* correct octree processing at borders
([02cd34e](02cd34e))
* correct val typo for value in shader builder
([16b89ca](16b89ca))
* don't crash on projection quaternion, allow axis line hiding
([683babf](683babf))
* first round of octree improvements
([0f3d863](0f3d863))
* gmm limits don't go out of data bounds
([ae99495](ae99495))
* have VR limits inverted using our control not builtin
([ebc8911](ebc8911))
* improve contrast limits
([452a7bf](452a7bf))
* include patched octree in multires code
([1df1024](1df1024))
* issue with empty screenshots
([c4ff38a](c4ff38a))
* json scale typing and also processing for meshes
([4c5123c](4c5123c))
* process data in chunks for bounding box to not run out of memory
([7e09ce4](7e09ce4))
* remove accidental debug print
([b52ea24](b52ea24))
* remove top level matplotlib import
([62dddaa](62dddaa))
* **test:** test fixes after shader and limit changes
([7923a2a](7923a2a))
* update docstring for decimation aggressiveness
([2516420](2516420))


### 📝 Documentation

* add docstring
([bcc2c14](bcc2c14))
* improve docs on window from limits
([653cea1](653cea1))
* update notes about meshes
([29d7010](29d7010))


### 💅 Styles

* rename oriented point JSON generator
([#21](#21))
([d1fd921](d1fd921))


### 🧹 Miscellaneous Chores

* formatting
([b19dd7d](b19dd7d))
* linting fix
([a066566](a066566))
* update lock file
([5fdc75c](5fdc75c))


### ♻️ Code Refactoring

* make calculator not intended to be reusable, but tied to a volume.
Also make the base calc abstract
([b108b2d](b108b2d))
* remove Optional and more generic dirs, fix redundant code line
([f1a179a](f1a179a))
* remove timing function for experiment
([aeb13db](aeb13db))
* rename oriented point JSON generator
([2f2c8e9](2f2c8e9))


### 🧪 Tests

* add contrast limit test
([d70c05f](d70c05f))
* add manual test for mask from segmentation
([ea3ffd7](ea3ffd7))
* add other URLs for contrast limits
([4cef902](4cef902))
* better contrast limit manual test
([9a60925](9a60925))
* better mesh from seg test
([7d29fd6](7d29fd6))
* disable long running test
([d8af9d4](d8af9d4))
* update manual tests with seg properties
([b482f6e](b482f6e))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
twodee_contrast_limits: tuple[float, float] | None = None,
threedee_contrast_limits: tuple[float, float] | None = None,
volume_rendering_is_visible: bool = False,
volume_rendering_gain: float = -7.8,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think having this be a static value would not be ideal for the diverse cases of tomograms. We should look into generating this dynamically.

@uermel would you have any recommendation on how to address this?

await browser.close()


def run_screenshot_loop(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔥

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants