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

Feature/cen 13988 add wkt to dicomseg recipe #26

Merged
merged 8 commits into from
Jan 23, 2025

Conversation

lyndankwuda
Copy link
Collaborator

No description provided.

Copy link

@efimfurman efimfurman left a comment

Choose a reason for hiding this comment

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

@lyndankwuda @gordonwade

I am not 100% certain if this recipe is usable without the source DCM file. Typically the DicomSeg files is loaded together with the source - that viewers can display the masks on top of pixel data.

It might be more useful to include an example source DCM file, or use Centaur API to retrieve the DCM file w/ any WKTs.

The code was failing for me until I manually created "output" directory.

Copy link
Collaborator Author

I'll investigate and update accordingly, thanks Fima

Copy link

@efimfurman efimfurman left a comment

Choose a reason for hiding this comment

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

Looks, good, but please add the requirements.txt file so that anyone can run this notebook.

I would also ensure the dicomseg file loads along with the source DCM file into one of the open source viewers like 3dSlicer

@efimfurman
Copy link

Lynda, I followed instructions and installed from requirements.txt, but got these import errors in the notebook.

Not sure if it is because I am on python 3.11

A module that was compiled using NumPy 1.x cannot be run in
NumPy 2.2.1 as it may crash. To support both 1.x and 2.x
versions of NumPy, modules must be compiled with NumPy 2.0.
Some module may need to rebuild instead e.g. with 'pybind11>=2.12'.

If you are a user of the module, the easiest solution will be to
downgrade to 'numpy<2' or try to upgrade the affected module.
We expect that some modules will need time to support NumPy 2.

Traceback (most recent call last): File "", line 198, in _run_module_as_main
File "", line 88, in _run_code
File "/Users/fimafurman/miniconda3/lib/python3.11/site-packages/ipykernel_launcher.py", line 17, in
app.launch_new_instance()
File "/Users/fimafurman/miniconda3/lib/python3.11/site-packages/traitlets/config/application.py", line 1043, in launch_instance
app.start()
File "/Users/fimafurman/miniconda3/lib/python3.11/site-packages/ipykernel/kernelapp.py", line 736, in start
self.io_loop.start()
File "/Users/fimafurman/miniconda3/lib/python3.11/site-packages/tornado/platform/asyncio.py", line 195, in start
self.asyncio_loop.run_forever()
File "/Users/fimafurman/miniconda3/lib/python3.11/asyncio/base_events.py", line 607, in run_forever
self._run_once()
File "/Users/fimafurman/miniconda3/lib/python3.11/asyncio/base_events.py", line 1922, in _run_once
handle._run()
File "/Users/fimafurman/miniconda3/lib/python3.11/asyncio/events.py", line 80, in _run
self._context.run(self._callback, *self._args)
File "/Users/fimafurman/miniconda3/lib/python3.11/site-packages/ipykernel/kernelbase.py", line 516, in dispatch_queue
await self.process_one()
File "/Users/fimafurman/miniconda3/lib/python3.11/site-packages/ipykernel/kernelbase.py", line 505, in process_one
await dispatch(*args)
File "/Users/fimafurman/miniconda3/lib/python3.11/site-packages/ipykernel/kernelbase.py", line 412, in dispatch_shell
await result
File "/Users/fimafurman/miniconda3/lib/python3.11/site-packages/ipykernel/kernelbase.py", line 740, in execute_request
reply_content = await reply_content
File "/Users/fimafurman/miniconda3/lib/python3.11/site-packages/ipykernel/ipkernel.py", line 422, in do_execute
res = shell.run_cell(
File "/Users/fimafurman/miniconda3/lib/python3.11/site-packages/ipykernel/zmqshell.py", line 546, in run_cell
return super().run_cell(*args, **kwargs)
File "/Users/fimafurman/miniconda3/lib/python3.11/site-packages/IPython/core/interactiveshell.py", line 3009, in run_cell
result = self._run_cell(
File "/Users/fimafurman/miniconda3/lib/python3.11/site-packages/IPython/core/interactiveshell.py", line 3064, in run_cell
result = runner(coro)
File "/Users/fimafurman/miniconda3/lib/python3.11/site-packages/IPython/core/async_helpers.py", line 129, in pseudo_sync_runner
coro.send(None)
File "/Users/fimafurman/miniconda3/lib/python3.11/site-packages/IPython/core/interactiveshell.py", line 3269, in run_cell_async
has_raised = await self.run_ast_nodes(code_ast.body, cell_name,
File "/Users/fimafurman/miniconda3/lib/python3.11/site-packages/IPython/core/interactiveshell.py", line 3448, in run_ast_nodes
if await self.run_code(code, result, async
=asy):
File "/Users/fimafurman/miniconda3/lib/python3.11/site-packages/IPython/core/interactiveshell.py", line 3508, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "/var/folders/y
/6mcmk9pd70d9tqmd0yqhx_d80000gn/T/ipykernel_75846/2110877878.py", line 12, in
from shapely import wkt
File "/Users/fimafurman/miniconda3/lib/python3.11/site-packages/shapely/init.py", line 1, in
from .lib import GEOSException # NOQA

AttributeError Traceback (most recent call last)
AttributeError: _ARRAY_API not found

ImportError Traceback (most recent call last)
Cell In[1], line 12
7 from highdicom.content import (
8 AlgorithmIdentificationSequence,
9 CodedConcept
10 )
11 import highdicom as hd
---> 12 from shapely import wkt
13 import matplotlib.pyplot as plt

File ~/miniconda3/lib/python3.11/site-packages/shapely/init.py:1
----> 1 from .lib import GEOSException # NOQA
2 from .lib import Geometry # NOQA
3 from .lib import geos_version, geos_version_string # NOQA

Copy link

@efimfurman efimfurman left a comment

Choose a reason for hiding this comment

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

Apprving, but the imports did not work for me for some reason as is

Copy link

axolo-co bot commented Jan 23, 2025

gordonwade commented:
I was able to successfully create a fresh virtual environment on python 3.9 and install all the requirements. With python 3.11, I had errors that were resolved by removing the specific version constraints.

For recipes in general, we want to have the most relaxed version constraints possible. Unless we have specific reasons to require a version (specific version, minimum version, etc.) we should remove those from the requirements file @lyndankwuda

@lyndankwuda lyndankwuda merged commit 9553d12 into main Jan 23, 2025
Copy link
Collaborator

@gordonwade gordonwade left a comment

Choose a reason for hiding this comment

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

This does seem to work for me as-is, but I have some questions on streamling it.

wkt_to_dicomseg/main.ipynb Show resolved Hide resolved
wkt_to_dicomseg/example/input/wkt.json Show resolved Hide resolved
wkt_to_dicomseg/main.ipynb Show resolved Hide resolved
wkt_to_dicomseg/main.ipynb Show resolved Hide resolved
wkt_to_dicomseg/main.ipynb Show resolved Hide resolved
wkt_to_dicomseg/main.ipynb Show resolved Hide resolved
wkt_to_dicomseg/main.ipynb Show resolved Hide resolved
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