Multiple Image Line Profiles?
BMangum
Is there a way to have multiple image line profiles on the same image?
I don't really care if the actual profiles are on the same graph or not, but I would like to display one image showing the corresponding profile lines.
Also, when making a freehand image line profile how come the scaling is not preserved as is done in both the horizontal and vertical cuts?
I can manually calculate this I guess and rescale the wave, but it would be nice if this were done automatically.
Lastly, when making a freehand line profile does opening the WMLineProfileGizmo window seem annoying and unnecessary to anyone else?
Normally image line profiles are not displayed on the image. You may however display any number of sampling paths over an image; these are displayed as an XY pair of waves. The main thing that you need to worry about is making sure that your XY pair of waves and the image are displayed relative to the same axes. This may take the form of
vs.
If you have more than one path you may want to concatenate the pairs of waves with a NaN separator so that you have a single pair of waves representing all your paths (it is just cleaner).
This suggests that you are working with the IP procedures...
The notion of the freehand mode is to allow you to sample along an arbitrary path over the image. I'd hope that a quick reflection would convince you that, in general, sampling along a line that makes an arbitrary angle to two orthogonal axes having arbitrary scaling cannot result in a meaningful scaling or units. If you don't see that consider sampling a 2D matrix where the x-direction corresponds to time in seconds, the y-direction corresponds to volts and the path is a 30-degree periodic saw-tooth.
You may have not noticed, but there are three freehand modes. Two display your data on a regular graph and the third displays it in Gizmo. Obviously I am sorry that you find this last choice annoying but that may largely be a matter of taste. However, calling this choice "unnecessary" suggests that you failed to understand what it does or why other people may find it useful. Specifically, in this mode you sample data along an arbitrary path in two dimensions. The path together with the sampled profile form a 3D path. The most common way to display a 3D path in IGOR is using Gizmo so it is a natural choice for the procedures to offer this option so "annoying and unnecessary" is not exactly viewed with a wide-angle lens...
Obviously, if you are not convinced by my response above you have the complete freedom to remove this "annoying" feature. One way of doing so is to remove the Gizmo.xop from your Igor Extensions folder. If you only want to remove this feature from the IP Procedures open the Image Line Profile.ipf file (in the WaveMetrics Procedures:Image Processing folder), search for the line that defines "PopupMenu profileModePop", and remove the last option.
Please note:
1. removing Gizmo.xop will disable any 3D plotting in your copy of IGOR. This may not be affect you if you have no use for 3D graphs.
2. if you edit the procedures you may want to either create your own sets of procedures or keep a copy somewhere so you do not overwrite it when you update IGOR.
I hope this helps,
A.G.
WaveMetrics, Inc.
August 2, 2011 at 10:11 am - Permalink
This is helpful, but as I make a new profile, the default profile wave names get overwritten. So it seems that before each new line drawn I must rename both of the old profile waves. Is this the best solution?
Your point about the units for freehand profiles is well taken.
Thanks!
August 2, 2011 at 11:23 am - Permalink
To automate this part you would have to modify the procedure file:
1. Open the Image Line Profile.ipf file for editing.
2. Find the function Function WMDoLineProfile(wsrc,pos,width,profileMode)
3. Towards the end of the function you will find the line:
4. Right before this line you would have the opportunity to duplicate the path waves or concatenate them so add a line e.g.:
myAddProfile(xWave,yWave)
5. Somewhere else in your procedure file define this function, for example:
Wave xWave,yWave
Wave/Z myPathX=root:myPathX
Wave/Z myPathY=root:myPathY
if(WaveExists(myPathX)==0)
Duplicate/O xWave,root:myPathX
Duplicate/O yWave,root:myPathY
else
Variable len=numpnts(myPathX)
InsertPoints (len),1,myPathX,myPathY
myPathX[len]=nan
myPathY[len]=nan
Concatenate/NP/O {myPathX,xWave},t_xxx
Duplicate/O t_xxx,root:myPathX
Concatenate/NP/O {myPathY,yWave},t_yyy
Duplicate/O t_yyy,root:myPathY
KillWaves/z t_xxx,t_yyy
endif
End
I hope this helps,
A.G.
WaveMetrics, Inc.
August 2, 2011 at 02:55 pm - Permalink
You can't easily modify a WaveMetrics procedure, and you shouldn't, so make your own copy of the file.
But the WaveMetrics Procedures' version of the file is #included by "All IP Procedures.ipf". The original, not your copy, would be #included. You could fix that by overwriting the WaveMetrics Procedures' version with your version but your version might be overridden by an Igor update.
It may be easier to just rename the waves. Or perhaps create your own procedure file that can complement rather than replace the WaveMetrics procedure files.
August 2, 2011 at 03:06 pm - Permalink
Override Function WMDoLineProfile(wsrc,pos,width,profileMode)
Then modify this override function with the changes AG is suggesting.
--Jim Prouty
Software Engineer, WaveMetrics, Inc.
August 5, 2011 at 03:03 pm - Permalink