As a project, I'm trying to decipher raw data coming from a medical ultrasound device.
The data contains a 128x1008 matrix. Each one of the 128 columns represents a sensor element. Each row in each column indicates that an object has been detected with certain reflected energy (in a scale of 0-255.)
I'm trying to make the appropriate image, knowing the sensor location are as follows: (with Alpha=0.469 degrees):
As I know what the final image is (it was given to me,) I know that I'm close but I have a few difficulties.
The raw data and the solution:
What I have done so far:
My idea was to start with a black image and represent each one of its pixels with a radius and angle, then for each one of the 128 columns of the raw data, run through all of the black image pixels, and replace those with the appropriate angle with the raw data.
This is the image I get:
I expected those black lines between the raw data, but I have no idea how to deal with them so I could get a clearer image. As you can see, it's close to what I should get but those black lines are to be handled first. I have tried different kinds of filters but to no avail. Any help?
The MATLAB code:
blankImage=zeros(1501,1501); %create blank image %imshow(blankimage) A = imread('zframe29.bmp'); %imshow(A) %we calc the relative raduis (relative to the real pysichal size) %180mm is 1501 pixels R is 59.739263mm (using trigu-in the pdf) then R_pixels=398.6 pixels %we go in a loop, for every pixel with raduis bigger then 498.1590765 and with %angel alpha, we copy the raw data row to the blank image initial_radius=498.1590765; alpha=0.469; %degree %alpha=0.2; %degree for row=1:128 raw_data_row=A(:,row); raw_data_counter=1; for i=1:size(blankImage) for j=1:size(blankImage) [r,teta]=KartezToRad(i,j); if r>=initial_radius % if (119.7815-alpha*(row-1)-0.2) < teta && teta < (119.7815-alpha*(row-1)+0.2) if (0.5*alpha+(63-row)*alpha-0.1) < teta && teta < (0.5*alpha+(63-row)*alpha+0.1) [x,y] = RadToKartez(r,teta); blankImage(y,x)=A(raw_data_counter,row); if raw_data_counter==1024 break else raw_data_counter=raw_data_counter+1; end end end end end end imshow(blankImage, [0 256]) %[r,t]=KartezToRad(200,200); %[a,b]=RadToKartez(399,0); %Kartezian to Radiel + mideling to coord sys function [R,Teta] = KartezToRad(x,y) x_mid=x; y_mid=y-700; R=(sqrt(x_mid^2+y_mid^2)); Teta=atand(y_mid/x_mid); if x_mid<0 Teta=(Teta+180); else Teta=(Teta); end end %Radiel to Kartizian + demideling to coord sys function [x,y] = RadToKartez(R,Teta) x_mid= round(R*cosd(Teta)); y_mid= round(R*sind(Teta)); x=x_mid; y=y_mid+700; if y==0 y=1; end if x==0 x=1; end end