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

WIP: transition from pyclesperanto_prototype to pyclesperanto #73

Merged
merged 9 commits into from
Oct 18, 2024

Conversation

haesleinhuepf
Copy link
Member

Hey @StRigaud ,

just FYI: I'm just making this transition on this branch.

In order to complete, these functions are yet missing in pyclesperanto:

  • exclude_small_labels
  • exclude_large_labels
  • exclude_labels_with_map_values_out_of_range
  • exclude_labels_with_map_values_within_range
  • reduce_labels_to_centroids
  • extension_ratio_map
  • pixel_count_map
  • merge_labels_with_border_intensity_within_range
  • merge_touching_labels
  • sub_stack
  • reduce_stack
  • merge_annotated_touching_labels

I presume some are on the way, and some others (e.g. merge...) are not planned?

Best,
Robert

closes #72

@StRigaud
Copy link
Member

StRigaud commented Sep 5, 2024

Some are soon to be available, see clEsperanto/CLIc#335

For the other function, best is to decide which one we do and do not

@StRigaud
Copy link
Member

@haesleinhuepf

I have merge the PR clEsperanto/pyclesperanto#232 for the categories.

Can you tell me which, in the list of missing operation, we want to actually have in pyclesperanto side? I will try to implement asap to make the transition possible.

@haesleinhuepf
Copy link
Member Author

haesleinhuepf commented Sep 16, 2024

Can you tell me which, in the list of missing operation, we want to actually have in pyclesperanto side?

How about all? Lowest priority should have the merge_ methods because they require the graph stuff. But the others are all practically useful.

@StRigaud
Copy link
Member

Hi @haesleinhuepf

The following function should now be available with the 0.13.1
I skip the merge_* as they implied the mesh functions. I hope this can help toward the transition.

  • exclude_small_labels
  • exclude_large_labels
  • exclude_labels_with_map_values_out_of_range
  • exclude_labels_with_map_values_within_range
  • reduce_labels_to_centroids
  • extension_ratio_map
  • pixel_count_map
  • merge_labels_with_border_intensity_within_range
  • merge_touching_labels
  • sub_stack
  • reduce_stack
  • merge_annotated_touching_labels

@haesleinhuepf
Copy link
Member Author

Hey @StRigaud

pixel_count_map seems not available in 0.13.1 ...

image

@haesleinhuepf
Copy link
Member Author

Also exclude_labels_with_map_values_within_range is missing yet.

image

@haesleinhuepf
Copy link
Member Author

Also exclude_labels_with_map_values_out_of_range is missing

image

@StRigaud
Copy link
Member

exclude_labels_with_map_values_out_of_range & exclude_labels_with_map_values_within_range

I forgot the _map_ in the name -> exclude_labels_with_values_out_of_range

pixel_count_map

is label_pixel_count_map no? I did not find a reference to just pixel_count_map at first but after looking It appreas to be an alias in the prototype:

from ._label_pixel_count_map import label_pixel_count_map
from ._label_pixel_count_map import label_pixel_count_map as pixel_count_map

Which name do we keep then?

I will fix these in a 0.13.2 version

@haesleinhuepf
Copy link
Member Author

Which name do we keep then?

No matter which, we need aliases for backwards compatibility. I'm hitting the same roadblock in multiple places. If the old names would be still accessible, everything would be easier to update.

@StRigaud
Copy link
Member

No matter which, we need aliases for backwards compatibility. I'm hitting the same roadblock in multiple places. If the old names would be still accessible, everything would be easier to update.

Got this, but there 2 ways to do this: an alias in the python only code or an alias in the C++ code which should then also impact the java part.

I will make it in the C++ for now, but it is getting difficult to adapt to all name changes and aliases. Same, I am loosing tracks on the different categories. Error like that will continue to build up 😞

I will make the changes today, all this should be fix before monday noon.

@StRigaud
Copy link
Member

Okay, it will be with the 0.13.3. This should be available on pypip anytime soon, and on conda later in the day or tomorrow.

Hopefully this time is the good one :)

@StRigaud
Copy link
Member

StRigaud commented Oct 2, 2024

ready to be tested with 0.13.3 😄

@haesleinhuepf
Copy link
Member Author

It works! Now, only the "merge*" functions are missing. I guess this will stay like this for a while.

@haesleinhuepf
Copy link
Member Author

Btw. also the code generation works now with pyclespernanto. I'm going to merge this, release some new versions and then everything should be ready for I2K. Great work @StRigaud !

image

@haesleinhuepf haesleinhuepf marked this pull request as ready for review October 10, 2024 13:36
@haesleinhuepf
Copy link
Member Author

Ah ok, tests are failing. I would wait for a comment / fix on clEsperanto/pyclesperanto#255 before merging.

@StRigaud
Copy link
Member

Should be fixed with the incoming 0.13.4, just waiting for the conda bot to push the new release

@StRigaud
Copy link
Member

Need to fix clEsperanto/CLIc#372

@haesleinhuepf
Copy link
Member Author

Tests pass locally on Windows, so I'm going to merge this. Shall the CI go to hell.

(dne2) C:\structure\code\napari_pyclesperanto_assistant>pytest
================================================= test session starts =================================================
platform win32 -- Python 3.12.7, pytest-8.3.3, pluggy-1.5.0
PyQt5 5.15.9 -- Qt runtime 5.15.8 -- Qt compiled 5.15.8
rootdir: C:\structure\code\napari_pyclesperanto_assistant
plugins: anyio-3.7.1, napari-0.5.0, napari-plugin-engine-0.2.0, npe2-0.7.7, qt-4.4.0
collected 7 items

napari_pyclesperanto_assistant\_tests\test_functions.py ......                                                   [ 85%]
napari_pyclesperanto_assistant\_tests\test_neighborhood_statistics.py .                                          [100%]

================================================== warnings summary ===================================================
..\..\..\Users\rober\miniforge3\envs\dne2\Lib\copy.py:151
  C:\Users\rober\miniforge3\envs\dne2\Lib\copy.py:151: DeprecationWarning: Pickle, copy, and deepcopy support will be removed from itertools in Python 3.14.
    rv = reductor(4)

..\..\..\Users\rober\miniforge3\envs\dne2\Lib\copy.py:261
  C:\Users\rober\miniforge3\envs\dne2\Lib\copy.py:261: DeprecationWarning: Pickle, copy, and deepcopy support will be removed from itertools in Python 3.14.
    y.__setstate__(state)

..\..\..\Users\rober\miniforge3\envs\dne2\Lib\site-packages\jupyter_client\connect.py:27
  C:\Users\rober\miniforge3\envs\dne2\Lib\site-packages\jupyter_client\connect.py:27: DeprecationWarning: Jupyter is migrating its paths to use standard platformdirs
  given by the platformdirs library.  To remove this warning and
  see the appropriate new directories, set the environment variable
  `JUPYTER_PLATFORM_DIRS=1` and then run `jupyter --paths`.
  The use of platformdirs will be the default in `jupyter_core` v6
    from jupyter_core.paths import jupyter_data_dir

napari_pyclesperanto_assistant/_tests/test_functions.py::test_labeling_and_statistics
napari_pyclesperanto_assistant/_tests/test_functions.py::test_numpy_functions
  C:\structure\code\napari_pyclesperanto_assistant\napari_pyclesperanto_assistant\_statistics_of_labeled_pixels.py:80: UserWarning: 'Statistics of labeled pixels' is deprecated. Use 'Label statistics' instead.
    warnings.warn("'Statistics of labeled pixels' is deprecated. Use 'Label statistics' instead.")

napari_pyclesperanto_assistant/_tests/test_functions.py::test_numpy_functions
napari_pyclesperanto_assistant/_tests/test_functions.py::test_numpy_functions
napari_pyclesperanto_assistant/_tests/test_functions.py::test_cle_functions
napari_pyclesperanto_assistant/_tests/test_functions.py::test_advanced_statistics
napari_pyclesperanto_assistant/_tests/test_functions.py::test_example_data
napari_pyclesperanto_assistant/_tests/test_neighborhood_statistics.py::test_neighborhood_statistics
  C:\Users\rober\miniforge3\envs\dne2\Lib\site-packages\pyopencl\cache.py:495: CompilerWarning: Non-empty compiler output encountered. Set the environment variable PYOPENCL_COMPILER_OUTPUT=1 to see more.
    _create_built_program_from_source_cached(

napari_pyclesperanto_assistant/_tests/test_functions.py::test_cle_functions
  C:\Users\rober\miniforge3\envs\dne2\Lib\site-packages\pyclesperanto_prototype\_tier3\_generate_touch_mean_intensity_matrix.py:30: UserWarning: generate_touch_mean_intensity_matrix is supposed to work with images of integer type only.
  Loss of information is possible when passing non-integer images.
    warnings.warn("generate_touch_mean_intensity_matrix is supposed to work with images of integer type only.\n" +

napari_pyclesperanto_assistant/_tests/test_functions.py::test_cle_functions
  C:\Users\rober\miniforge3\envs\dne2\Lib\site-packages\pyclesperanto_prototype\_tier0\_opencl_execute.py:281: RuntimeWarning: overflow encountered in cast
    arguments.append(np.array([value], np.float32))

napari_pyclesperanto_assistant/_tests/test_functions.py::test_advanced_statistics
  C:\structure\code\napari_pyclesperanto_assistant\napari_pyclesperanto_assistant\_advanced_statistics.py:18: UserWarning: 'Statistics of labeled pixels including neighborhood statistics' is deprecated. Use 'Label statistics' instead.
    warnings.warn("'Statistics of labeled pixels including neighborhood statistics' is deprecated. Use 'Label statistics' instead.")

napari_pyclesperanto_assistant/_tests/test_neighborhood_statistics.py::test_neighborhood_statistics
  C:\Users\rober\miniforge3\envs\dne2\Lib\site-packages\pyclesperanto_prototype\_tier2\_touch_matrix_to_adjacency_matrix.py:34: DeprecationWarning: touch_matrix_to_adjacency_matrix is deprecated, use symmetric_maximum_matrix or symmetric_minimum_matrix or symmetric_mean_matrix instead.
    warnings.warn("touch_matrix_to_adjacency_matrix is deprecated, use symmetric_maximum_matrix or symmetric_minimum_matrix or symmetric_mean_matrix instead.", DeprecationWarning)

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
=========================================== 7 passed, 15 warnings in 8.20s ============================================

@haesleinhuepf haesleinhuepf merged commit ecc2152 into master Oct 18, 2024
0 of 3 checks passed
@haesleinhuepf haesleinhuepf deleted the pyclesperanto-without-prototype branch October 18, 2024 09:18
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.

Switch from pyclesperanto_prototype to pyclesperanto?
2 participants