Create Stand-Alone Color Calibrator Scale Bar
jjweimer
This function creates a stand-alone color bar.
cscale - the color scale number to find in CTab list
bit depth - the image bit depth
wcm - width of color bar (cm)
hcm - height of color bar (cm)
imin, imax - optional range of color bar (otherwise from 0 to 2^bitdepth - 1)
caveat -- you may need to substitute 72 with 96 to run the sizes properly on windows systems
Function make_CalibrationBar(cscale, bitdepth, wcm, hcm, [imin, imax])
variable cscale, bitdepth, wcm, hcm, imin, imax
variable iwpixels, ihpixels
string theColorScale = StringFromList(cscale,CTabList())
// min / max of calibration scale
if (ParamIsDefault(imin))
imin = 0
endif
if (ParamIsDefault(imax))
imax = 2^bitdepth - 1
endif
// calibator scale size
iwpixels = ceil(2.54*wcm*72)
ihpixels = ceil(2.54*hcm*72)
// make the image
make/O/N=(iwpixels,ihpixels) calibratorimage
switch(bitdepth)
case 16:
Redimension/W/U calibratorimage
break
default:
Redimension/B/U calibratorimage
break
endswitch
calibratorimage = imin
calibratorimage[iwpixels/2][ihpixels/2] = imax
// display it
NewImage/N=CImage calibratorimage
ModifyGraph/W=CImage width=iwpixels, height=ihpixels
ModifyGraph/W=CImage nticks=0,axThick=0
// add the color bar
ColorScale/C/N=textCS/F=0/B=1/D={0.1,1,0}/A=MC/X=0.00/Y=0.00 side=2,widthPct=100,heightPct=100,frame=0.00,nticks=0
ColorScale/C/N=textCS ctab={imin,imax,$theColorScale,0}
return 0
end
variable cscale, bitdepth, wcm, hcm, imin, imax
variable iwpixels, ihpixels
string theColorScale = StringFromList(cscale,CTabList())
// min / max of calibration scale
if (ParamIsDefault(imin))
imin = 0
endif
if (ParamIsDefault(imax))
imax = 2^bitdepth - 1
endif
// calibator scale size
iwpixels = ceil(2.54*wcm*72)
ihpixels = ceil(2.54*hcm*72)
// make the image
make/O/N=(iwpixels,ihpixels) calibratorimage
switch(bitdepth)
case 16:
Redimension/W/U calibratorimage
break
default:
Redimension/B/U calibratorimage
break
endswitch
calibratorimage = imin
calibratorimage[iwpixels/2][ihpixels/2] = imax
// display it
NewImage/N=CImage calibratorimage
ModifyGraph/W=CImage width=iwpixels, height=ihpixels
ModifyGraph/W=CImage nticks=0,axThick=0
// add the color bar
ColorScale/C/N=textCS/F=0/B=1/D={0.1,1,0}/A=MC/X=0.00/Y=0.00 side=2,widthPct=100,heightPct=100,frame=0.00,nticks=0
ColorScale/C/N=textCS ctab={imin,imax,$theColorScale,0}
return 0
end
Forum
Support
Gallery
Igor Pro 9
Learn More
Igor XOP Toolkit
Learn More
Igor NIDAQ Tools MX
Learn More