vigra
vigra copied to clipboard
Vigranumpy vigra.filters.gaussianDivergence doesn't work with taggedView
ipython 7.26.0 numpy 1.21.2 python 3.9.6 vigra 1.11.1 from "conda install -c conda-forge vigra" gcc 4.8.5 20150623 (Red Hat 4.8.5-44)
import numpy as np
import vigra as v
test = np.random.rand(3,10,20,30) #test.dtype is float64
array = v.VigraArray(test, axistags=v.defaultAxistags('cxyz')) #array.dtype is float32
divarray=v.filters.gaussianDivergence(array) #works fine
view = v.taggedView(test, axistags=v.defaultAxistags('cxyz')) #view.dtype is float64
print(type(vview)==type(varray)) #outputs True
divview = v.filters.gaussianDivergence(view) #ValueError, see below
<ipython-input-14-410d6fe7acbf> in <module>
----> 1 divview = v.filters.gaussianDivergence(view)
ValueError: No C++ overload matches the arguments. This can have three reasons:
* The array arguments may have an unsupported element type. You may need
to convert your array(s) to another element type using 'array.astype(...)'.
The function currently supports the following types:
float32, float64
* The dimension of your array(s) is currently unsupported (consult the
function's documentation for information about supported dimensions).
* You provided an unrecognized argument, or an argument with incorrect type
(consult the documentation for valid function signatures).
Additional overloads can easily be added in the vigranumpy C++ sources.
Please submit an issue at http://github.com/ukoethe/vigra/ to let us know
what you need (or a pull request if you solved it on your own :-).
Type 'help(vigra.filters.gaussianDivergence)' to get full documentation.
The types of the inputs to the function vigra.filters.gaussianDivergence all have the same type at least in the python/vigranumpy interface. So why is there no overload for one (view), but for the other (not view, new array) it works?
the difference I can see there is that
-
array
is F-Contiguous, while -
view
is C-Contiguous...
seems like creating a VigraArray
will change to fortran order, while creating a view preserves original ordering....
test2 = numpy.asfortranarray(test)
fview = v.taggedView(test, axistags=v.defaultAxistags('cxyz'))
filtered = v.filters.gaussianDivergence(fview)
works...