Closed gnoeyp closed 3 years ago
I realized that the volume is transposed as [2, 1, 0] in every function.
Hi. Thanks for trying out the library! It sure does sound like a bug. However, I can't reproduce it on my end.
I'm likely misunderstanding you. Could provide an example of what you're seeing? Then I'll take a closer look.
![Screenshot from 2020-12-15 08-41-07]() This is what I see. The output is transposed by [2, 1, 0] .
And I have just found that it works well if I input a copy of the numpy array or use np.ascontiguousarray().
![Screenshot from 2020-12-15 09-11-55]()
Maybe there is an issue when a numpy array is converted to ctype array. But I am not sure ..
Thanks, that's perfect, now I see. I have some ideas for what it is. I'll take a look and try to get a fix out during this week.
Thank you for reporting the bug!
Hi again. After looking more closely I think I identified the issue.
It is likely related to memory order. If you pass in a volume stored in Fortran order the output would appear transposed as I allocate a 'result' volume in C order. Since numpy.ascontiguousarray
or numpy.ndarray.copy
by default converts to C order that is likely why it fixed your issue.
This should now be fixed in version 0.7.1. To upgrade, run pip install pygorpho --upgrade
. If this doesn't fix your issue, feel free to reopen the issue! Thanks again.
Note: if the memory order of your input volume and structuring element is different, you may still get unexpected results for non-symmetric structuring elements. I will look into this for a later release.
That is great! Thank you for quick update :)
Hi! Thank you for sharing this awesome library. I wanted to use it for quick augmentation for training a deep learning model. But I found that after applying erode or dilate method, the output image is rotated 90 degrees. Is it a bug, or I misunderstood the usage?