
Quick change the scale of the active NewImage

ggermer
This snippet allows to change the minima and maxima of the scaling of the active newimage. This function is especially useful if you want to change the scaling of a large number of NewImages. In contrast to the normal command, the name of the waves does not have to be known. The color scale and, whether it is reversed or not, remains unchanged.
If v_min and/or v_max = NaN or inf, the minimum and/or maximum is Igors's automatic value (*).
The variable v_wave is used to select the wave for NewImages with multiple displayed waves. The lowest wave is v_wave = 0, for the wave on top of the NewImage v_wave=inf can be used.
Example: f_newimage_scale(0,1,inf)
function f_newimage_scale(variable v_min, variable v_max, variable v_wave) string s_active_waves=ImageNameList("", ";" ) if (stringmatch(s_active_waves,"")==1) print "Active NewImage contains no multidimensional wave." return 0 endif if (numtype(v_wave)!=0) v_wave=itemsInList(s_active_waves)-1 else v_wave=round(v_wave) if (v_wave<0) v_wave=0 endif if (v_wave>itemsInList(s_active_waves)-1) v_wave=itemsInList(s_active_waves)-1 endif endif string s_first_active_wave=StringFromList(v_wave,s_active_waves) variable v_hold=0 if (numtype(v_min)!=0) v_hold+=1 endif if (numtype(v_max)!=0) v_hold+=2 endif string s_color variable v_reverse string s_imageinfo, s_recreation s_imageinfo=ImageInfo("",s_first_active_wave,0) s_imageinfo=ReplaceString(";",s_imageinfo,"_") s_imageinfo=ReplaceString("{",s_imageinfo,";") s_imageinfo=ReplaceString("}",s_imageinfo,";") s_recreation=StringFromList(1,s_imageinfo) s_recreation=ReplaceString(",",s_recreation,";") s_color= StringFromList(2,s_recreation) v_reverse=str2num(StringFromList(3,s_recreation)) switch (v_hold) case 0: ModifyImage $s_first_active_wave ctab= {v_min,v_max,$s_color,v_reverse} break case 1: ModifyImage $s_first_active_wave ctab= {*,v_max,$s_color,v_reverse} break case 2: ModifyImage $s_first_active_wave ctab= {v_min,*,$s_color,v_reverse} break case 3: ModifyImage $s_first_active_wave ctab= {*,*,$s_color,v_reverse} break endswitch end

Forum

Support

Gallery
Igor Pro 9
Learn More
Igor XOP Toolkit
Learn More
Igor NIDAQ Tools MX
Learn More