I need to make a B-scan data from a chunk of A-scan data. The A-scan data that I received are arranged in such a way that the row resembles the amplitude of the each point of the A-scan data and the column represents each A-scan data gathered. This is how my data looks like:
4855 4641 4891 4791 4812 4812
4827 4766 4862 4745 4767 4785
6676 5075 6903 6879 6697 6084
7340 6829 7678 7753 7263 6726
6176 6237 6708 6737 6316 5943
12014 10467 10915 10914 10124 10642
8251 7538 7641 7619 7269 7658
6522 6105 6132 6136 5921 6227
5519 5287 5330 5376 5255 5237
4904 4784 4835 4855 4794 4758
4553 4527 4472 4592 4469 4455
4298 4323 4291 4293 4221 4238
4167 3957 4089 3991 3938 3907
3789 3721 3777 3777 3643 3596
3736 4615 3639 2814 3638 2782
4413 5286 4248 3998 4370 4199
5994 6896 6134 5548 6102 6161
8506 9020 7841 8060 8663 8941
12347 12302 10639 11151 12533 12478
18859 18175 15035 15938 18358 18160
27106 26261 22613 24069 27015 27114
32767 32601 32767 32767 32767 32767
32767 32767 32767 32767 32767 32767
32767 32767 32767 32767 32767 32767
32767 32767 32767 32767 32767 32767
32767 32767 32767 32767 32767 32767
32767 32767 32767 32767 32767 32767
26416 26459 32767 32767 26308 26945
6523 6900 13327 16665 6616 6477
-14233 -14011 -8554 -5649 -13956 -13858
-28128 -26784 -26157 -24055 -27875 -28374
-28775 -27905 -30348 -26285 -28918 -29066
-20635 -19776 -21144 -21548 -22107 -22759
-16915 -15742 -15908 -17398 -19600 -20143
This is just the sample of the data. It is in .txt format.
The problem I am facing is to plot this data into a b-scan data. Matlab would be great (Though other methods would be great too). Please share your way of plotting this B-scan data.
On Scilab you can use the read
function. It reads formatted texted files, and you need to know at least the number of columns. To add vertical spacing, you should add a constant value i*d
for each whole column, where i
is the column number.
I put the example you gave in a text file so I could read it, than I plotted it.
//read(): first argument is file path
// (or file name, if you change current directory)
// second argument is number of lines (-1 if unknown)
// third argument is the number of columns
B = read("file.txt",-1,6);
d = 1000; //vertical spacing
Bs = B; //copy of the original data
for i = 1 : size(Bs,'c')
//loop adding constant to each column
Bs(:,i) = Bs(:,i) + (i-1) * d;
end
//simply plot the matrix
plot2d(Bs);
In MATLAB, you can use the importdata
function, which also reads formatted text files, but the minimum necessary is the file name. You should also add the vertical spacing manually.
%call importdata() after changing current directory
B = importdata("file.txt");
d = 1000; %vertical spacing
Bs = B; %copy of the original data
for i = 1 : size(Bs,2)
%loop adding constant to each column
Bs(:,i) = Bs(:,i) + (i-1) * d;
end
%plot the modified matrix
plot(Bs);