Closed mahaa2 closed 6 months ago
Getting the Radon matrix directly it not implemented as this matrix is potentially much larger than your memory.
Potentially you can build such a matrix by sending delta peaks into the image and then extract the entries which are non-zero. Building such a matrix is a bit expensive but maybe you can do it once only?
Note that RadonKA has currently the limitation to projections inside a circle of the image.
julia> x = reshape([0, 0, 1.0, 0, 0], :, 1)
5×1 Matrix{Float64}:
0.0
0.0
1.0
0.0
0.0
julia> y = backproject(x, [0])
6×6 view(::Array{Float64, 3}, :, :, 1) with eltype Float64:
0.0 0.0 0.0 0.0 0.0 0.0
0.0 0.0 0.0 1.0 0.0 0.0
0.0 0.0 0.0 1.0 0.0 0.0
0.0 0.0 0.0 1.0 0.0 0.0
0.0 0.0 0.0 1.0 0.0 0.0
0.0 0.0 0.0 1.0 0.0 0.0
julia> findall(isone, y)
5-element Vector{CartesianIndex{2}}:
CartesianIndex(2, 4)
CartesianIndex(3, 4)
CartesianIndex(4, 4)
CartesianIndex(5, 4)
CartesianIndex(6, 4)
Hi,
Thanks for the fast reply. I understand now the issue of forming the whole matrix A.
That's is good, because what I aim at now (as before) is to form a vector that would represent one given line.
For example, if the image is of dim N x N pixels, I would like to form one vector of 0's and 1's. The entries of this vector would follow the same "indexing" of, say, vec(Image), and it only would store the non zero entries where the line have traveled through.
Moreover, I aim to form a sparse vector (SparseArray) so that it would minimize the memory costs.
Then, the question (again) in a better shape.
Can I form a sparse vector representing only one line that would have 1's where the line have traveled through and 0's otherwise ?
For example, if a ask for a line traveling the "main diagonal" of the image, could the package somehow create one-zero vector representing such a line with the same order/indexing of "vec(image)" ?
Thanks.
Do you only have one propagation direction or many? (one angle or many?)
Because, what sounds like is you want to traverse the grid and find the traversal points? Does the direction change?
There is no efficient way right now with this package. Only what I described above this has a bad time complexity.
But the traversal I do, is based on this https://cs.stackexchange.com/questions/132887/determining-the-intersections-of-a-line-segment-and-grid
For you I think the best would be to use this to find the intersections, and store them for all your Rays.
I used at some point this function, to find all intersection points: https://github.com/roflmaostc/RadonKA.jl/blob/5b8de5d89860a66e435a383180e7697e4f2a74ea/src/utils.jl#L43
I think you have answered the issue.
So, I would have only one propagation direction at a time.
Yes, I would like to traverse the grid and find those points in which the line has passed through.
The direction will change but only for the next step (I can share the ideas I have drafted in your email if you would like to see)
The link and the function your send inside the package seems to do the trick.
I will try your package since you have this function in it.
Thanks.
Yeah this function is not present in the current version anymore. So better copy paste. For me it was inefficient to find all points beforehand, I calculate them on the fly rather.
One last question. You mentioned, "you calculate then on the fly". Even though you do not use this function entirely, do you compute one traverse at time on the fly ?
Yeah, instead I used the previous position and the end position and calculate the next one. This avoids that I have to save an array of unknown size because the length of intersected points varies quite a bit. Also less memory overhead.
Actually, you can also use this function! @inline function next_cell_intersection(x₀, y₀, x₁, y₁)
Hi,
Is there a way to obtain the "Radom matrix" ?
I will try to be more clear.
Based on the direction the signal (the electromagnetic wave), we could define a matrix of zeros and ones where each row would represent where the signal traveled through the image.
So that we could write something like A * f, where f would be representative of the image, say vec(Image). Here we can think of the first row of A[1, :] as a row-vector whose components that are 1 represent where the signal traveled through the image.
More precisely, check this self-consistent material slide 38.
I been to developing some Gaussian process regression approach computing things in a recursive way without any matrix inversion and would be of great help if I could recover such matrix A from this package.
Any help on this ?
Thank you.