Image profile

Dear all,

I would like to get a multiple automatic horizontal profile (line by line) for the enclosed image

Do you know of the existence of such a procedure?

Thanks!

image.pxp

This function will extract the line profiles. It works on an image wave in the current data folder. Input the wave name.

Function get_HorizontalProfiles(string wname)

    wave wimg = $wname
    string theLine 
    variable ic, nlines, xo, xs, npts
   
    if (!waveexists(wimg))
        return 0
    endif
   
    nlines = DimSize(wimg,1)
    npts = DimSize(wimg,0)
    xo = DimOffset(wimg,1)
    xs = DimDelta(wimg,1)
   
    for (ic=0;ic<nlines;ic+=1)
        sprintf theLine "profile_%03d", ic
        duplicate/O/R=[][ic] wimg, $theLine
    endfor
   
    return 0
end

Instead of creating a new wave with Make and filling it with values, you could use Duplicate/R=[][ic]. That will also automatically copy the SetScale information.

Thank you Chozo,

Your spectra tools works very well!

I have a question:

How can I use the image in the format generated by your app?
It is not possible with the duplicate command
Here is an example

Best regards

I assume you want the graph of the Image Profile for display purposes? This is currently not possible. These tools a meant for processing data, so the idea is to close it when you are done and then build your own graphs. Do you just want the image with a vertically attached profile (like the example in the attachment)? This is easily done with one of my other packages:

https://www.wavemetrics.com/node/21562

The steps are as follows:

  • save the profile from your data using Image Profile
  • display your image as a new image plot (not using NewImage)
  • open Spectra Tools => Trace Offset Panel
  • select the saved profile wave under Profile at the bottom of the panel

If you don't want to use yet another package, you could also build such a graph manually. Let me know if you rather want to go this route.

Plot_29.pxp

Dear Chozo,

Thank you for your help

I have another question:

I have been normalizing this image (enclosed here) with your package without success.
Do you know any way to do it?

Best,

Luis

Graph1.pxp

Could you please also tell me how (in which way) you want to normalize the data and what is not working here? Basically, you have three options for normalization:

- Each Maximum: Find the maximum in each row (horizontal mode) or column (vertical mode) and normalize to this value

- Div. by Profile: Simply divide by the current profile, so that the selected region (between the red lines) is normalized on average

- Custom user code: You can also write your own normalization function, which is invoked via the user button.