DCC-Lab / DCC-Lab/PyTissueOptics

Version incompatibility and packages problems

Đang mở
#147 1 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Python
Star
49
Fork
9
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

**Description of the bugs**

There are two problems with the PyTissueOptics package in this moment:
- Version incompatibilities: The other packages that PyTissueOptics uses (Numpy, Mayavi, and VTK) are not compatible on 3D visualisation, and I don't know a other way to make a 3D view of the results;
- Packages: I found that in some files of the PyTissueOptics package cannot detect other files, like 'scene.solids' or 'scene.viewer.abstract3DViewer' on the null3DViewer.py

**To Reproduce**

Just run the given example on the webpage https://pypi.org/project/pytissueoptics/ :

```

from pytissueoptics import *

# Define (scene, source, logger)
N = 500_000
scene = samples.PhantomTissue()
source = DivergentSource(
position=Vector(0, 0, -0.1), direction=Vector(0, 0, 1), N=N, diameter=0.2, divergence=0.78
)
logger = EnergyLogger(scene)

# Run
source.propagate(scene, logger=logger)

# Stats & Visualizations
viewer = Viewer(scene, source, logger)
viewer.reportStats()

viewer.show2D(View2DProjectionX())
viewer.show2D(View2DProjectionX(solidLabel="middleLayer"))
viewer.show2D(View2DSurfaceZ(solidLabel="middleLayer", surfaceLabel="interface0"))
viewer.show1D(Direction.Z_POS)
viewer.show3D()

```

**Expected behavior**

It was expected to give every plot of the results, but only gave the 2D plots.

**Screenshots**

Image

Image

Image

Image

Image

**Desktop**
- Windows 11
- Python Version 3.13.0

**Packages versions**

- Numpy: 2.4.2
- Mayavi: 4.8.3.dev0
- PyTissueOptics: 2.0.0
- VTK: 9.4.2

**Output of the running program**

```

PS C:\Users\mrafa\Desktop\Universidade\Disciplinas\3ºano-2ºsem\Projeto final\Codigo> & C:\Users\mrafa\AppData\Local\Programs\Python\Python313\python.exe "c:/Users/mrafa/Desktop/Universidade/Disciplinas/3ºano-2ºsem/Projeto final/Codigo/Tests/example1.py"
Propagating 500000 photons with hardware acceleration on device Intel(R) Iris(R) Xe Graphics...

=============================== SIMULATION PROGRESS ===============================
[BATCH #] :: [PHOTON COUNT] :: [SPEED (ph/ms)] :: [TIME ELAPSED] :: [TIME LEFT]
Non-empty compiler output encountered. Set the environment variable PYOPENCL_COMPILER_OUTPUT=1 to see more.
1 :: 82833 (16.6%) :: 288.60 :: 0.29 s :: 1.45 s
2 :: 174983 (35.0%) :: 356.28 :: 0.49 s :: 0.91 s
3 :: 268857 (53.8%) :: 385.67 :: 0.70 s :: 0.60 s
4 :: 362856 (72.6%) :: 391.53 :: 0.93 s :: 0.35 s
5 :: 464309 (92.9%) :: 412.37 :: 1.13 s :: 0.09 s
6 :: 497077 (99.4%) :: 383.64 :: 1.30 s :: 0.01 s
7 :: 500000 (100.0%) :: 348.20 :: 1.44 s :: 0.00 s

Computation splits:
Propagation: 29.6%
Data transfer: 16.2%
Data conversion: 46.4%
==================================================================================

Report of solid 'frontLayer'
Absorbance: 60.82% (59.91% of total power)
Absorbance + Transmittance: 100.0%
Transmittance at 'frontLayer_front': 1.3%
Transmittance at 'frontLayer_left': 0.2%
Transmittance at 'frontLayer_right': 0.2%
Transmittance at 'frontLayer_bottom': 0.2%
Transmittance at 'frontLayer_top': 0.2%
Transmittance at 'interface1': 37.0%
Report of solid 'backLayer'
Absorbance: 86.68% (13.44% of total power)
Absorbance + Transmittance: 100.0%
Transmittance at 'backLayer_back': 9.5%
Transmittance at 'backLayer_left': 0.4%
Transmittance at 'backLayer_right': 0.4%
Transmittance at 'backLayer_bottom': 0.4%
Transmittance at 'backLayer_top': 0.4%
Transmittance at 'interface0': 2.2%
Report of solid 'middleLayer'
Absorbance: 53.03% (19.49% of total power)
Absorbance + Transmittance: 100.0%
Transmittance at 'middleLayer_left': 0.3%
Transmittance at 'middleLayer_right': 0.3%
Transmittance at 'middleLayer_bottom': 0.3%
Transmittance at 'middleLayer_top': 0.3%
Transmittance at 'interface0': 42.2%
Transmittance at 'interface1': 3.5%

Mayavi is not available. Falling back to a null 3D viewer. Fix the following error to use the Mayavi backend or select another backend by setting the PTO_3D_BACKEND environment variable (available backends: ('mayavi', 'null')).
module 'numpy' has no attribute 'in1d'
Traceback (most recent call last):
File "C:\Users\mrafa\AppData\Local\Programs\Python\Python313\Lib\site-packages\pytissueoptics\scene\viewer\provider.py", line 13, in get3DViewer
from .mayavi.mayavi3DViewer import Mayavi3DViewer
File "C:\Users\mrafa\AppData\Local\Programs\Python\Python313\Lib\site-packages\pytissueoptics\scene\viewer\mayavi\mayavi3DViewer.py", line 2, in
from mayavi import mlab
File "C:\Users\mrafa\AppData\Local\Programs\Python\Python313\Lib\site-packages\mayavi\mlab.py", line 16, in
from mayavi.tools.camera import view, roll, yaw, pitch, move
File "C:\Users\mrafa\AppData\Local\Programs\Python\Python313\Lib\site-packages\mayavi\tools\camera.py", line 24, in
from .engine_manager import get_engine
File "C:\Users\mrafa\AppData\Local\Programs\Python\Python313\Lib\site-packages\mayavi\tools\engine_manager.py", line 14, in
from mayavi.core.registry import registry
File "C:\Users\mrafa\AppData\Local\Programs\Python\Python313\Lib\site-packages\mayavi\core\registry.py", line 16, in
from mayavi.core.metadata import Metadata, import_symbol
File "C:\Users\mrafa\AppData\Local\Programs\Python\Python313\Lib\site-packages\mayavi\core\metadata.py", line 11, in
from mayavi.core.pipeline_info import PipelineInfo
File "C:\Users\mrafa\AppData\Local\Programs\Python\Python313\Lib\site-packages\mayavi\core\pipeline_info.py", line 12, in
from .utils import get_tvtk_dataset_name
File "C:\Users\mrafa\AppData\Local\Programs\Python\Python313\Lib\site-packages\mayavi\core\utils.py", line 4, in
from vtk.numpy_interface import algorithms as algs
File "C:\Users\mrafa\AppData\Local\Programs\Python\Python313\Lib\site-packages\vtkmodules\numpy_interface\algorithms.py", line 984, in
in1d = _make_ufunc(numpy.in1d)
^^^^^^^^^^
File "C:\Users\mrafa\AppData\Local\Programs\Python\Python313\Lib\site-packages\numpy\__init__.py", line 805, in __getattr__
raise AttributeError(f"module {__name__!r} has no attribute {attr!r}")
AttributeError: module 'numpy' has no attribute 'in1d'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "c:\Users\mrafa\Desktop\Universidade\Disciplinas\3ºano-2ºsem\Projeto final\Codigo\Tests\example1.py", line 22, in
viewer.show3D()
~~~~~~~~~~~~~^^
File "C:\Users\mrafa\AppData\Local\Programs\Python\Python313\Lib\site-packages\pytissueoptics\rayscattering\display\viewer.py", line 123, in show3D
self._viewer3D = get3DViewer()
~~~~~~~~~~~^^
File "C:\Users\mrafa\AppData\Local\Programs\Python\Python313\Lib\site-packages\pytissueoptics\scene\viewer\provider.py", line 22, in get3DViewer
from .null3DViewer import Null3DViewer
File "C:\Users\mrafa\AppData\Local\Programs\Python\Python313\Lib\site-packages\pytissueoptics\scene\viewer\null3DViewer.py", line 4, in
from scene.solids import Solid
ModuleNotFoundError: No module named 'scene'
PS C:\Users\mrafa\Desktop\Universidade\Disciplinas\3ºano-2ºsem\Projeto final\Codigo>

```

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.