distro release 2.1.1
This commit is contained in:
@ -314,6 +314,59 @@ function /s ad_display_profiles(image, [filter])
|
||||
return graphname
|
||||
end
|
||||
|
||||
/// add an overlay on top of the displayed image
|
||||
///
|
||||
/// the function creates the overlay wave and returns it as function result.
|
||||
/// the name of the wave is "view_overlay" and is created in the same folder as the "view_image" wave.
|
||||
///
|
||||
/// @param image image wave that identifies the profiles window.
|
||||
///
|
||||
/// @return overlay overlay wave.
|
||||
/// same dimensions and scales as image, but unsigned binary.
|
||||
/// pixels that are 0 are overlaid with semi-transparent color.
|
||||
/// other pixels should be 64 (igor's mask convention).
|
||||
///
|
||||
function /wave ad_add_overlay(image, [rgba])
|
||||
wave image
|
||||
string rgba
|
||||
|
||||
if (ParamIsDefault(rgba))
|
||||
rgba = "65535,65532,16385,32767"
|
||||
elseif (ItemsInList(rgba, ",") == 3)
|
||||
rgba += ",32767"
|
||||
endif
|
||||
|
||||
dfref savedf = GetDataFolderDFR()
|
||||
wave view_image = get_view_image(image)
|
||||
dfref viewdf = GetWavesDataFolderDFR(view_image)
|
||||
svar /sdfr=viewdf graphname = prof_graphname
|
||||
setdatafolder viewdf
|
||||
|
||||
string overlayname = "view_overlay"
|
||||
duplicate /o image, $overlayname /wave=overlay
|
||||
redimension /b/u overlay
|
||||
overlay = 64
|
||||
|
||||
string imagenames = ImageNameList(graphname, ";")
|
||||
if (whichlistItem(overlayname, imagenames, ";") < 0)
|
||||
AppendImage /w=$graphname $overlayname
|
||||
rgba = replacestring("(", rgba, "")
|
||||
rgba = replacestring(")", rgba, "")
|
||||
variable rr = str2num(StringFromList(0, rgba, ","))
|
||||
variable gg = str2num(StringFromList(1, rgba, ","))
|
||||
variable bb = str2num(StringFromList(2, rgba, ","))
|
||||
variable aa = str2num(StringFromList(3, rgba, ","))
|
||||
#if IgorVersion() >= 8
|
||||
ModifyImage /w=$graphname $overlayname explicit=1,eval={0,rr,gg,bb,aa},eval={255,-1,-1,-1}
|
||||
#else
|
||||
ModifyImage /w=$graphname $overlayname explicit=1,eval={0,rr,gg,bb},eval={255,-1,-1,-1}
|
||||
#endif
|
||||
endif
|
||||
|
||||
setdatafolder savedf
|
||||
return overlay
|
||||
end
|
||||
|
||||
/// update a profiles graph with new data.
|
||||
///
|
||||
/// @param image wave which contains the image data.
|
||||
@ -333,7 +386,12 @@ function ad_update_profiles(image)
|
||||
// data structures
|
||||
string viewname = "view_image"
|
||||
duplicate /o image, $viewname /wave=view
|
||||
|
||||
string overlayname = "view_overlay"
|
||||
wave /z overlay = $overlayname
|
||||
if (waveexists(overlay))
|
||||
redimension /n=(dimsize(view,0), dimsize(view,1)) overlay
|
||||
endif
|
||||
|
||||
// data processing
|
||||
svar view_filter
|
||||
svar view_filter_options
|
||||
|
Reference in New Issue
Block a user