Calculate reconstructionmatrix for ART

  • Thread starter Fiboehh
  • Start date
  • Tags
    Art
In summary, the student engineer is trying to find the weighted reconstruction matrix used for ART image reconstruction. The weighted matrix gives for each projection what pixels are influenced by a ray from a laser. The matrix must be rotated a given time for a given rotationangle each time. The student is also trying to calculate when a cell falls into the ray and give that cell a one, while cells outside of the ray get a zero. They are also facing difficulties with the detection of the ray when it is oblique. They have provided MATLAB code for reference and are seeking help with finding the formula for rotating coordinates and calculating the intersection of a square with a quadrilateral.
  • #1
Fiboehh
3
0
Hello I'm a student engineer and I'm trying to find the weighted reconstruction matrix used for ART image reconstruction. The weighted matrix gives for each projections what pixels are influenced by a ray from a laser.

In attachment you see an image of what the problem is. The matrix must be rotated a given time for a given rotationangle each time. For this example it is 40 degrees and 8 times. I must calculate whenever a cell falls into the ray and give that cell a one. The cells outside the ray get a zero. So for every rotation i have to calculate which cells fall in the ray. I have the begin coordinates, and tried so to find out the next. But i don't what i do wrong, tried with poolcoordinates but i can't find it.

My second problem is with the detection, The ray is lineair but how can I calculate when the cell is in the ray. If its a rectangle its simple, but i can't find it when its oblique.
The coordinates are given and the all the distances in the second attachment. I really hope someone can help me.

Here the MATLAB code i already have:

Code:
 function f = reconmatrix( projections, angle , Lx ,Ly , Dx , Dy , HRD , HDS )
%%functie die reconstructiematrix berekent adhv bovenstaande parameters
% projecties: aantal projecties moeten gemaakt worden
%angle: de hoek waarover moet verdraaid worden
% Lx en Ly het aantal cellen in respec x en y lengte
% Dx en Dy de werkelijke afstand van 1 cel in respec x en y lengte
% HRD= half ray distance , halfe astand van de laserstraal
% HDS = half distance to source, halfe afstand laser - detector

%%Hulp variablen
if ( mod(Lx,2) == 0)
    Mx = Lx/2;
else
    Mx=(Lx+1)/2;
end
if ( mod(Ly,2) == 0)
    My = Ly/2;
else
    My=(Ly+1)/2;
end
dx=Dx/2;
dy=Dy/2;
siz=Lx*Ly;
w = zeros(projections,siz);
alfa=angle;

%opvullen alle projecties
for p=1:projections %aantal projectie keer berekenen  
            for j=0:(Lx-1)
                for i=1:Lx
                    if i==1   % voor de eerste projectie
                        a = (-Mx+dx+(i-1)*Dx);
                        b = (My-dy-j*Dy);
                    else    % voor de volgende projectie verder gaan met
                        a = x;
                        b = y;
                    end
                    len = a*a + b*b;
                    l = sqrt(len);
                    if a > 0
                        gamma = atand(b/a);
                    else if b >= 0
                            gamma = atand(b/a)+180;
                        else
                            gamma = atand(b/a)-180;
                        end
                        if a == 0 && b > 0
                            gamma = 90;
                        else
                            gamma = -90;
                        end 
                    end
                    beta = gamma - alfa;
                    x = l * cosd(beta);
                    y = l * sind(beta);
                    if (x  > (-1*HDS) ) && ( x < HDS ) && (y < HRD ) && (y > (-1*HRD))%controleren wanneer binnen rechthoek valt
                        w(p,i+j*Lx)= 1;
                    end
                end
            end  
end
 

Attachments

  • vraagart.JPG
    vraagart.JPG
    21.3 KB · Views: 338
  • totaal.JPG
    totaal.JPG
    26.5 KB · Views: 380
Physics news on Phys.org
  • #2
I don't use Matlab enough to evaluate your code. The way to compute the coordinates of a point in 2D when coordinates are rotated about a given point for a given angle is well known. Do you need to know that formula?

The "ray" looks like a quadrilateral. There are several ways to find if a square is totally within, totally without or partly-in and partly-out of a quadrilateral. Is that what you're asking? Or do you need to compute the area of overlap between the square (the grid cell and the quadrilateral?
 
  • #3
Hey thanks for your return. Finally someone who can help me :)

Yes indeed i need the formules to compute the coordinates of a point in a 2D when the coordinates are rotated round a given point (0,0) for a given angle.

And the ray is indeed quadritlateral, the goal is to compute when a square ( given with the coordinates) is for a part in the quadritlateral.
Better would be the total area of the overlap between the square and the ray. So when a square is totally in the quadrilateral (ray) it gets a 1 and for a half 0.5 and so on... but i can't find it for a part so i totally don't know how to do that.
I would really be very gracefull if you could help me with this!
 
  • #4
To rotate [itex] (x,y) [/itex] about the point [tex] (cx,cy) [/itex] counter clockwise by angle [itex] \theta [/tex]:

Transform [itex] (x,y) [/itex] to a coordinate systems whose origin is [itex] (cx,cy) [/itex]:

[tex] x_1 = (x - cx) [/tex]
[tex] y_1 = (y - cy) [/tex]

Then rotate [tex] (x_1,y_1) [/itex] by angle [itex] \theta [/itex] about the origin:

[tex] x2 = x_1 cos(\theta) - y_1 sin(\theta) [/tex]
[tex] y2 = x_1 sin(\theta) + y_1 cos(\theta) [/tex]Then transform [itex] (x_2,y_2) [/itex] back to a coordinate system with the original origin:

[tex] x_3 = x_2 + cx [/tex]
[tex] y_3 = y_2 + cy [/tex]

I'll have to think about the intersection a square with a quadrilateral. In the meantime, you can find many web pages that explain how to find if a vertex is in the quadrilateral by searching for "point in polygon algorithm".
 
  • #5
Okj so many thanks man, I'm working now on the implementation in MATLAB and will then look for the algorithm.

If you find anything about the intersection please let me now.
 

Related to Calculate reconstructionmatrix for ART

1. What is ART and how does it relate to reconstruction matrix calculation?

ART stands for Algebraic Reconstruction Technique and is a mathematical algorithm used in medical imaging to reconstruct a 3D image from a series of 2D images. The reconstruction matrix is a key component in the ART algorithm as it helps to determine the accuracy and quality of the final reconstructed image.

2. Why is the reconstruction matrix important in ART?

The reconstruction matrix is important in ART as it helps to determine the accuracy and quality of the final reconstructed image. It is used to calculate the relationship between the measured data and the unknown image values, and therefore plays a crucial role in obtaining an accurate 3D image.

3. How is the reconstruction matrix calculated?

The reconstruction matrix is calculated using a process called backprojection, which involves projecting the measured data back onto the image space. This process is repeated multiple times, with slight variations, until the final reconstructed image is obtained. The reconstruction matrix is updated with each iteration, resulting in a more accurate final image.

4. What factors can affect the accuracy of the reconstruction matrix?

There are several factors that can affect the accuracy of the reconstruction matrix, including the number of projections, the angles at which the projections are taken, and the quality of the measured data. Other factors such as noise, artifacts, and patient movement can also impact the accuracy of the reconstruction matrix and should be minimized to obtain a high-quality 3D image.

5. Are there any limitations to using the reconstruction matrix in ART?

While the reconstruction matrix is a key component in the ART algorithm, it does have some limitations. It is highly dependent on the accuracy and quality of the measured data and can be affected by factors such as noise, artifacts, and patient movement. Additionally, the reconstruction matrix may not be suitable for certain types of medical imaging, such as imaging of highly complex structures or areas with high levels of attenuation.

Similar threads

  • Atomic and Condensed Matter
Replies
3
Views
1K
  • Programming and Computer Science
Replies
1
Views
1K
Replies
4
Views
1K
  • Special and General Relativity
Replies
10
Views
1K
  • Calculus and Beyond Homework Help
Replies
3
Views
516
  • Set Theory, Logic, Probability, Statistics
Replies
3
Views
1K
  • Calculus and Beyond Homework Help
Replies
12
Views
1K
Replies
14
Views
1K
  • Classical Physics
Replies
0
Views
541
  • Calculus and Beyond Homework Help
Replies
1
Views
1K
Back
Top