-
Notifications
You must be signed in to change notification settings - Fork 8
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
Mutiple voxels as illumination sources #19
Comments
This feature is not yet included in the repository (it will be likely included with the next major commit). In the meantime you can try to use the code from the attached files:
The attached example isotropicvoxels.py includes a multi-voxel source (IsotropicVoxels) where light is emitted from centrally positioned line of isotropic voxels along the z axis. All voxels have equal intensity in this example. Use the weights property of the source to set the intensities of voxels to custom values (from 0.0 to 1.0). Please note that this is an experimental implementation. |
Thank you for your prompt reply.
I tried to fix first two errors, as it was self explainable in code, but stuck at last error:
Kestutis |
IsotropicVoxels class must be used instead of IsotropicVoxel (this gives ValueError: could not broadcast input array from shape (100,3) into shape (3,)). A couple of things to check.
Let us know if this solves the issues. |
It worked, many thanks. Problem was because earlier I installed pyxopto with pip, while later cloned with git. So some files were conflicting and I was editing wrong files. |
The fluence seems stretched because the axes units in the posted plot are indices instead of mm. Note that the z-axis ends at 25 (index of the last voxel along the z-axis). A plot displayed in mm units would cover a span of 10 mm in all 3 axes and there would be no stretch (x and y axis from -5 to 5 mm, z-axis from 0 to 10 mm). If you are displaying images with matplotlib.pyplot.imshow, use the extent parameter to specify the physical dimensions of the slice/image along the individual axes. Without this information, imshow assumes that pixel/voxel size is equal in all axes and that the size is 1. The unknown error usually means that the OpenCL engine ran out of resources (e.g. too many Mc instances are created) but there can be many other reasons for this error. Unfortunately, it is not possible to reproduce the error with the provided code. The shape of the index array ((1, 3) or (3,)) is not triggering the error (at least not directly). |
Thank you very much for quick response, I see now. The code generating -9999 error:
I just modified line: |
I set correct aspect radio of dimensions in mm, and fluence now looks like expected. But I still got |
If I set domain dimensions to (10,20,30) then I do not get -9999 error. |
I just modified line 389 in voxel.py:
and this error is gone, and fluence looks good:
this error was because arrays are addressed zyx in opencl, while python xyz, Thank you, |
There was/is some inconsistency in the implementation of arguments that define voxel indices. Some functions were assuming (ind_x, ind_y, ind_z) while others (ind_z, ind_y, ind_x). This resulted in improper validation of arguments leading to unexpected errors. The API is now pushed towards (ind_x, ind_y, ind_z) except when directly indexing/slicing the numpy arrays. The two attached files should fix the issue. Note that with these modifications the indices of source voxels must be given as (x, y, z). mcgeometry_voxel.zip mcsource_voxel.zip We are currently preparing a major update of the master branch so updating your local repository with these changes is the simplest solution. |
Hi @xopto I still often get error if count of iterations is more than 10-20:
I am on Linux, NVIDIA Quadro P2200 GPU, which mem usage is ~1.5GB out of 5 GB, when calculating.
Where could be the cause of such behaviour? |
Interesting note, dimensions 4x4x4 works till end (400 iterations), but 8x8x8 gives same -9999 error after few dozens iterations (sometimes more. sometime less). |
Can you prepare and post a minimal example that reproduces this error? |
I did simple test script and it works with dummy input data. |
Could you please confirm that error is reproducible using minimal example? |
Hey, I've found solution. I just removed voxel sources from last elements in z direction (z = z -1). Now I got no error. |
Dear pyxopto Team,
I am tying to model fluorescence of voltage sensitive dyes in cardiac tissue as wave of excitation propagates. So, I need to define multiple voxels as illumination sources. I read that it is possible to define singe voxel as source https://xopto.github.io/pyxopto/docs/html/apidoc/xopto.mcvox.mcsource.voxel.html. I've done good bit of digging docs and code examples without any luck.
Is it possible to define multiple voxels as source?
Best,
Kestutis
The text was updated successfully, but these errors were encountered: