I have csv files and png files that contains temperatures disribution (with different temperature scales) in a wire bond in a power module. I want to know how to plot temperature along the (x) axis of the wire (using matlab) and I don’t know which type of file should I use. Then I don’t know how if there is an example in which I can find steps that I should follow in coding. the attach containg an example of pnj photo and a csv file.
125-1.csv (4.1 MB)
there are few ways.
The easiest one is just to take max intensity projection from image. Load the image, or load the values from csv file and calculate the projection as
g = max(I,,2); figure(1) plot(g)
If you want to be more precise and follow the track you may check the Measure Tool (Menu->Tools->Measure length->Measure tool) of MIB (mib.helsinki.fi), where you can draw a custom line and get intensities under the line.
Thank you so much it works ! Can you tell me where can I find tool measurement exactly in your link please ? I found a lot of topics.
and Can I just code this instead of clicking on measure tools etc…( and I think I will need to filter these images)
Thank you for your help
(I couldnt make the connection between the PNG and CSV)
You could use improfile too.
You could auto segment the wire - but it depends on what the family of pictures look like. If its always fixed w.r.t camera - you can just manually outline a template once. If its always a single wire more or less vertical, you can use the MAX trick above and capture the second output to get the column index of the max value (which likely will correlate with the wire position). If its all bendy - you could try using say EDGE with the canny option and do some post processing with REGIONPROPS to extract the longest ‘edge’ (which hopefully maps to the wire :)).
Thank you for the information. well the images are alomost same but sometimes the positions of the wire differs just a bit. and if I use improfile I need to know the location of the wire ,no ?
you can get the program from here: http://mib.helsinki.fi/web-update/MIB2_Matlab.zip,
- unzip it
- change matlab current path to a folder, where you unzip it
- start by typing ‘mib’
- open image(s) and from Menu->Tools->Measure length->Measure tool start the measuring tool.
I have not checked csv file, but I guess it may have better resolution (than PNGs) due to float numbers. Thus, it may be better to work with them. In this sense, max-method will give you good results (assuming that most of your images look like your example) with minimum time investment.
When doing the plots you may need to specify the x-axes and for that you will need pixel size of your sampling and generate the x-axes by multiplying its index with the pixel size. If the starting point are not fixed you may also need to shift the x-axes with respect to the starting point of the signal. You can get it by taking a diff of the acquired max-signal.
If you want to do some averaging, i.e. not take just max point in each line, you can calculate histogram for each line and get average of ~10 points from the right-hand side of hist-distribution.
Other alternative is to do black-and-white thresholding of the signal, calculate skeleton and get intensities within that skeleton profile, but it is more work as you will probably have to check skeletons… which is overkill for such good looking data.
Thank you. you said multiplying its index , what index ?
and when I opened the csv file by MIB it requires this for me
you said multiplying its index , what index ?
I was meaning that when you do “plot(g)”, your x-vectror is just an index of a point in y-dimension of your image. I guess it should be recalculated to be in physical units.
For example, the image has pixel size 0.1 um/pixel, this should be used as
plot( 1:numel(g))*pixSize, g)
when I opened the csv file by MIB it requires this for me
can you open csv with it? interesting, never tried… this window allows you to select pixel size (as above) for each dimension. When images calibrated your measurements will be in physical units rather than in pixels.
it’s okay thank youuu. it’s just that am still not used to image processing. I can’t find the link between the MIB and the code you wrote. after taking measurement what should I do ?
thank you how can I get column index of maximum values ?
it’s okay thank youuu. it’s just that am still not used to image processing.
there are just 2 parallel paths, either work with csv-values (which I would recommend in your case) or work with images either with MIB or directly in Matlab.
For example, you can use this code:
T = readtable('d:\125-1.csv'); % read csv T2 = table2array(T); % convert to standard matrix % show as image figure(1) subplot(2,1,1) imshow(T2, ); % calculate max intensity projection maxIntProj = max(T2, , 2); % get difference to find a starting point difVec = diff(maxIntProj); [~, maxPointId] = max(difVec); pixSize = 0.234; % pix size for the y-axes subplot(2,1,2) plot((1:numel(maxIntProj)) *pixSize, maxIntProj); hold on plot([maxPointId*pixSize maxPointId*pixSize], [min(maxIntProj), max(maxIntProj)]);
While in MIB you need to start with a similar file loading and converting the data to uint16 or uint32:
T = readtable('d:\125-1.csv'); % read csv T2 = table2array(T); % convert to standard matrix % as MIB can't work with floats, % mutliply the image by 1000 and convert to uint16, % alternatively a larger coefficient may be used with uint32 class T3 = uint16(T2*1000);
T3 may be saved and loaded into MIB as a single or collection of images. Or imported directly:
Add measurements and the intensity profile will be shown in the bottom plot. You can export it or save to a file. But remember to divide the values by 1000.
Thank you very much
I understand what you did in the first code( welI need to do it without MIB because I have a lot of pictures).
Well the long of the wire phisically is 1,3 cm (along the axis/projection) and 1,5cm real length, so I tried what you did but it doesn’t reflect reality to me. it gives me that picture you got (x axis from 0 to 120). how can you get the size of y axis and it’s unit ! and if I know these distances like in this picture
Thanks for your help
I just put a dummy value of “pixSize = 0.234;”, which scaled the image. In your case, you need to get that value, which would be something like
imageHeightInPixels = size(T2, 1); # number of pixels in height pixSize = imageHeightInMeters / imageHeightInPixels; # calculate the pixel size from the known size of the image
Thank you brother
I just couldn’t find how can I pick the starting point of the wire from the csv without MIB because I have to write a code ( knowing that the size of csv is not the same of PNG)
you should shift all vectors to make point with index (“maxPointId”) as 0.
xVector = (maxPointId:numel(maxIntProj)) *pixSize - maxPointId*pixSize; plot(xVector, maxIntProj(maxPointId:end));
Thanks !! does the pixel size on the x axis differes from the y axis. because I know one dimension on the y axis which is this
Only you can tell this. Naturally, it depends on a method/equipment used, sometimes pixels are isotropic, sometimes anisotropic. The point that you need to know the pixel size in order to recalculate distances from pixels to physical units, otherwise you can only do relative analysis.
You need to find how many pixels form a line that spans across that 9.6mm and divide 9.6 by that value
That’s what I did exactly
in this case, calculation of the x-vector for the plot is wrong; you can plot that in pixels and check.