Extracting Velocity from Color Doppler Image
11 views (last 30 days)
Show older comments
How can I accurately extract velocities from a color Doppler image (the dicom header doesn't contain the velocity map)? I have an image with a color bar in the upper right of the image that gives the minimum and maximum velocities represented by colors in the image. I've been able to manually map the colors to velocities but am having difficulty accounting for aliasing.
0 Comments
Answers (1)
Fei Deng
on 23 Sep 2016
Hi Vibhav,
I presume you have an image generated in other software and you want to read the value each/a certain point/pixel according to the color bar you have, which is part of the image and not a colorbar object.
You can do that in several steps:
1) Open the image in MATLAB; 2) Get the range of the velocity from the old color bar; 3) Add a real color bar; 4) Get the RGB value for a certain location on the figure, associate it with the real color bar, and compute value represented by this RGB value (color).
Following script is an example to give you an idea how to do that.
close all
clear all
x = linspace(0,3*pi,200);
y = cos(x) + rand(1,200);
c = linspace(1,10,length(x));
scatter(x,y,50,c,'filled')
colorbar
saveas(gcf,'test','tif')
close all
X = imread('test.tif');
imshow(X)
colorbar,
cmap = colormap;
% you have to know the min and max of you data
% get that from the original color bar you have in the upper right of the image;
mindata = 1;
maxdata = 10;
% take location [351,314] for example, here location is the pixel location
% you can also check the RGB of this point by placing mouse and single
% click it at the location on MATLAB figure (enable Data Cursor mode).
locX = 351; locY = 314;
rvalue = double(X(locY,locX,1));
gvalue = double(X(locY,locX,2));
bvalue = double(X(locY,locX,3));
rgbInBar = [rvalue,gvalue,bvalue]/255;
compare = (repmat(rgbInBar,length(cmap),1)-cmap);
comparetotal = sum(compare,2);
[valuediff,rowLoc] = min(abs(comparetotal));
currentPointValue = mindata+(maxdata-mindata)*rowLoc/length(cmap)
See Also
Categories
Find more on Detection, Range and Doppler Estimation in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!