-
Notifications
You must be signed in to change notification settings - Fork 108
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
From Radon2D to Image #345
Comments
Hi, There is a number of things that I worry you are not doing right. Radon2D is designed such that the model is in the (px, tau) space and the data in the (x,t) space. So if you apply the forward like you do, that should be done to the model. There if you place a single dot, the resulting data will have a line at that specific (px, tau) combination. If instead you have a line in the data, then you need to apply the adjoint and will get a dot in the model domain at the (px, tau) location. Also your px is way to large, see the parametric equation that Radon2D implements here https://pylops.readthedocs.io/en/latest/api/generated/pylops.signalprocessing.Radon2D.html Here is an example with a dot in the (px, tau) space:
and with a line in the (x t) space:
|
Perfect. I understood the working logic of RADON2D a little better. Thank you very much indeed for your contribution. However, I haven't been able to fully resolve the issue yet.
|
Hi again, I think what you are trying to do is not possible. The Radon operator as defined here is based on the idea of stacking the input (left plot) over straight lines with a certain span of slopes (chosen by px) and all intercept times where the h of the intercept is either the 0 in your h axis or the middle if
But still you won't be able to get vertical lines as those have a |
Thank you very much for the quick reply. I guess it might be difficult for me to implement the solution you mentioned. Because if I achieve my full purpose with 2d radon, I aim to use 3d radon. Therefore, a simple use is essential for me. Actually, Matlab's radon command works just fine for me. We can see this in the example below. Here, the Radon command takes the angle information as input. Thus, you can get the Radon projection at the angle you want. This is so awesome and exactly the solution I wanted. But firstly I have to achieve this with Python, secondly 3d radon command does not appear in Matlab. Despite all this, thank you for your interest. |
Alright, I see. MATLAB one is a polar Radon operator, our is a linear one... but you can make it look like the polar version by doing this https://pylops.readthedocs.io/en/stable/tutorials/ctscan.html#sphx-glr-tutorials-ctscan-py I was suggesting the extended offset as that one if even more general... |
Thanks Matteo for accurate guidance Exactly what I want is here: https://www.mathworks.com/help/images/detect-lines-using-the-radon-transform.html It works great. But I have to move forward with Python. That's why I care about doing it using your code.
|
Hi, let me take a look. I am quite sure I can get you the same result of matlab using this parametrization :) But I want to be sure of one thing. Are you planning to solve any inverse problem so that it makes sense to use our Radon which has an exact adjoint? If not, why not using https://scikit-image.org/docs/dev/auto_examples/transform/plot_radon_transform.html |
Thanks for be interested I only need "Forward Transformation", I don't need "Back Transformation". Because "I am looking for a line to put on the image so that the sum of the pixel values where the line intersects is maximum." I want to solve the question. Scikit Radon only works on 2D data. Whereas your software can run in 3d data. In a word, perfect. However, I guess I can't solve the math, no matter how much I play with the parameters, I can't get the result I want. I wish you good work. |
Oh I see. Ok, give me a couple of days to look into your code and see how it can be fixed. The 3D extension isn't that hard I think (need to extend from 2D polar to 3D polar and make sure you get all angles) but I can't promise I will have time to look into it for you. |
I am still doing some tests to figure out the best approach... can you provide me with a figure of the matlab radon for the 3 lines example in your code above please? I want to check how it compares to our codes and scikit-image |
Dear Matteo,
I am sending some sample images attached.
I hope we can achieve satisfactory test results.
I wish you good work.
Thanks
*Professor M. Fatih TALU*
e-mail | ***@***.***
web | https://sites.google.com/site/mfatihtalu/
address | Inonu University, Department of Computer Science, 44280,
Malatya/TURKEY
…On Tue, Mar 8, 2022 at 10:49 PM Matteo Ravasi ***@***.***> wrote:
I am still doing some tests to figure out the best approach... can you
provide me with a figure of the matlab radon for the 3 lines example in
your code above please? I want to check how it compares to our codes and
scikit-image
—
Reply to this email directly, view it on GitHub
<#345 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AFIDEYWTF36HNVN7O5NHGPLU66VNLANCNFSM5P7I7U2A>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Ok, where? |
Ohh, I accidentally replied to gmail. |
I wrote a DrawLine function.
|
Hi, However I am not sure I have what I need. I need to have something from matlab I can exactly reproduce. So far you gave me some figures but none of them matches what you show me in the Matlab figure above. Can you either give me that binary image or show me how the code that you pasted can be used to produce that figure. I need to know how the Radon of matlab looks to be able to reproduce it with our tools :) |
Therefore, I plan to first generate 2d images, find the longest line, and then move it to 3d. I am using the attached file to generate the image and apply the Radon. The Radon command in Matlab works regardless of the size of the input data. Regardless of the dimensions of the input data, it is positioned in the center of the data and obtains the Radon projection matrix with the determined angle and rho values. Actually this is exactly what I want. However, in your code, one dimension of the input data and the output radon data is equal. This makes the job difficult. However, if your code is independent of the input data sizes and is placed in the center of the data and transforms according to the angle and rho range determined by the user, the process will be solved. I wish you good work. |
Thanks. For now all I want to understand is why your matlab result is different from our result. In a way I believe this can be the case but I am surprised it is different from scikit-image. If I can reproduce it with scikit-image I then know how to make our code match it :) I am not going to change our code for you specifically, but I can tell you how to twick it so it does what you want it to do But in what you sent me I still don't see anything like your matlab result. What I need is a mat or png file with the image on the top right which I know it gives the Radon on the left... can you give me that? |
Right now, I can reproduce the Matlab tutorial results (https://www.mathworks.com/help/images/ref/radon.html) with both scikit-image and pylops:
If you could try this with one of your images and compare the MATLAB results with scikit-image and ours and show me what you get that would be great |
I am sending the Matlab radon result for the image with two rectangles. |
Dear Matteo, when I try to run the code you posted, I get the error message "RadonRotate function not found". Can you post this function? |
|
Try this :)
|
So far I am not sure why matlab looks higher-res than scikit and our... |
I got the error message at that line:
|
Sorry I’m using pylops on the dev branch.. change axis into dir |
Sorry, i dont know how to do it. |
just change
into
|
Dear Matteo,
I removed the bwmorp operator and ran it again. It seems that the result is the same. |
How do you set the "inner" variable based on the input image dimensions? I'm trying to arrive at theta and rho values using the horizontal and vertical indices of the maximum point in the projection. I am able to reach the correct theta. But I can't get the correct rho value. I guess it has to do with "inner". |
Oh great! Let me clean up our code and explain a bit better how it works. It is a bit of a workaround due to the fact that our implementation is not in polar coordinates. I will also go back to the first approach I suggested as that one should also work and may be easier for you. The one I gave you now works by rotating an image and stacking horizontally, so I’m not sure there is a Rho concept here, just there. Also in matlab I can’t really find an option to select rho. Can you explain what Rho means to you? |
Sorry, |
The current problem is: But Pylops just generates only R matrix. rho is missing. I know theta. |
I have a 2D binary image.
I get the sinogram of this with RADON2D.
Next I want to draw the line corresponding to the maximum value cell in the sinogram over my binary image in the spatial domain.
I get the theta and px values of the max valued cell in the sinogram, but I don't know how to draw the line on the image using these values.
Thank you
The text was updated successfully, but these errors were encountered: