SpHr_ColorTable [ /N=numRows /P=peak /Dest=ColorTableWaveName /RGB={Index, startIndex, endIndex} /RGBi=Index /R=reverse /A=alpha]  ColorTableString


Creates a Color table or obtains red, green, blue, and alpha (r,g,b,a) values from a Color table.


Parameters

ColorTableString  Name of Color table passed as a string. The name can be a built-in Igor Color table returned by CTabList() or one of the following internally generated tables:

"GrayBlueGreenRed" 

    Similar to Igor's built-in SeaLandAndFire color table but with a smooth transition from blue to green.

"GrayBlueGreenRedBlack"

    Similar to GrayBlueGreenRed with red fading to black.

"GrayBlueYellowRedBlack" 

    Similar to GrayBlueGreenRedBlack with less green.

"RedGrayBlue"

    Similar to Igor's built-in RedWhiteBlue table but with a gray middle. Use /M=v to set gray level (default is v=0.6; v=0.5 is equivalent to the RedWhiteBlue).

"RedGrayBlueDark"

    Similar to RedGrayBlue  (see above) with darkened ends.

"RedGrayBlueLight"

    Similar to RedGrayBlue  (see above) with lightened ends.

"RedGreenBlue"

    Similar to built-in RedGrayBlue  (see above) but with a green middle. Use /M=v to set green level (default is v=1.5).

"RedGreenBlueDark"

    Similar to RedGreenBlue  (see above) with darkened ends.

"RedGreenBlueLight"

    Similar to RedGreenBlue  (see above) with lightened ends.

"BlueBlackRedPow"

    Similar to Igor's built-on BlueBlackRed color table but with power function shaped curves.

    Use /M=v to specify how wide the black region is. Default value for v is 3.

        red[N/2,N-1] = 65535*(1-((N-x)^v / ((N/2)^v)))

        blue[0,N/2-1] = 65535*(1- (x^v/((N/2)^v))).

    use /M={v, v2} to specify how white the most extreme values become. Set v2 to 0 for no white. Set v2 to 1 for completely white extrema. Default value of v2 is 0.85.

    use /M={v, v2, v3} to specify how rapidly extrema lighten.

        red and green[0,N/2-1] = (65535/v2) * abs(-((x-N/2)^v3/(N/2)^v3))

        glue and green [N/2,N-1] = (65535/v2) * abs( (x-N/2)^v3 / (N/2)^v3))

"WhiteRed"

    Similar to Igor's built-in Red color table but does not fade all the way to white. Alpha also increases for white values unless specified by the /A flag.

    Use /M=v to specify how red the first Color Table values are (default is =0.25).

    Use /M={v,v2} to specify how red the last Color Table values are (default is v2=1).

    Use /M={v,v2,v3} to specify the first alpha value (default is v3=0.25).

    Use /M={v,v2,v3,v4} to specify the last alpha value (default is v4=0.75).

"WhiteGreen"

    Same as WhiteRed (see above) but fades from whitish to green.

"WhiteBlue"

    Same as WhiteRed  (see above) but fades from whitish to blue.

"WhiteBlack"

    Same as WhiteRed  (see above) but fades from whitish to black.

"Solid"    Use /M={r,g,b} to set solid color and /A flag to set alpha.

"White”

    Use/A flag to set alpha. Same as "Solid" with /M={65535,65535,65535}.

"Black"

    Use/A flag to set alpha. Same as "Solid" with /M={0,0,0}.


Flags

/List

    Creates a list named S_ColorTableList of available color tables. 


/Dest [ = destWaveName ]

    Specifies a Color table wave. If destWaveName is omitted, a wave named M_colors is created in the current datafolder (same name as created by ColorTab2Wave).

/RBGi = index    Specifies the row index into the Color table for which V_R, V_G, V_B, and V_A colors variables are set (corresponding to red, green, blue, and alpha values). This may be used together with the /N flag to obtain specific RGBA values.


/RBG = proportion 

    Calculates the row index into the Color table as: index = (N-1)*proportion. The following variables are set: V_R, V_G, V_B, V_A (corresponding to red, green, blue, and alpha values), V_Index, and V_Rows. 


/RBG = { index, minIndex, maxIndex }

    Calculates proportion as: proportion = (index - minIndex) / (maxIndex - minIndex + 1). See above for description of proportion.


/N = n

    Number of Color Table rows when the Color table is internally generated. The /N flag has no effect if ColorTableString is a built-in Igor table. The maximum number of rows is 1001. The default value of n is 201 or 200 when using the /P flag.


/P = peak    Reflects colors in the table about peak, which is a proportion that can range from 0.0 to 1.0. Table values from 0 to n*peak span the full color range. A second table from n*(1-peak) spans the same, reversed, color range. This flag currently only works with the table returned by the /Dest flag.


/R [ = r ]    Reverse Color Table. /R=0: Same as no /R flag. Colors are not reversed. (Default). /R=1: Same as /R flag alone. Colors are reversed.


/A = {a [ , a2, a3 ] } Sets alpha values in the fourth column of the Color table wave. Values of a should range between 0 and 1.0 corresponding to alpha values ranging from 65535 to 0.

    If a2 is passed, alpha values transition linearly from a to a2.

    If a3 is passed, alpha values transition in a V shape: a to a2 to a3.


/M = { v [ , v2, v3, v4 ] }

    Modifier variables for use with some internally generated Color Tables. 


/FREE     destWaveName is created as a free wave.


Example

Function SpHr_ColorTable_Example()

    SpHr_ColorTable/List // list available color tables

    // S_ColorTableList += CTabList() // append Igor built-in tables

    Print S_ColorTableList

    //////////////////////////

    String ColorTableStr = "RedGreenBlueLight"

    Make/O/N=(10,10) data

    data = x+y

    //////////////////////////

    // Display colorized image //

    Display/K=1 

    AppendImage data

    SpHr_ColorTable/Dest=ColorTable ColorTableStr

    ColorScale/C/N=text0/F=0/A=MT/E vert=0,width=200,heightPct=6,frame=0.00,ctab={0,10,ColorTable,0}

    ModifyImage data ctab= {*,*,ColorTable,0}

    /////////////////////////

    // Display colorized lines //

    int i

    Display/K=1 data[][0]

    SpHr_ColorTable/RGB={0,0,10} ColorTableStr

    ModifyGraph rgb(data)=(V_R, V_G, V_B, V_A)

    for(i=1;i<10;++i)

        Appendtograph data[][i]

        SpHr_ColorTable/RGB={i,0,10} ColorTableStr

        ModifyGraph rgb($"data#"+num2str(i))=(V_R, V_G, V_B, V_A)

    endfor

End

Contact: Brian