- if (_color_type)
- {
- for (int i = 0; i < GetBaseColorNb(); i++)
- {
- delta = GetGreyLevelBoundaries(i+1) - GetGreyLevelBoundaries(i);
- for (int ii = 1; ii <= delta; ii++)
- {
- thresholdTable->SetTableValue(GetGreyLevelBoundaries(i) + ii,
- GetBaseColors(i*3),
- GetBaseColors(i*3 + 1),
- GetBaseColors(i*3 + 2),
- 1);
- }
- }
- } // End Of if (_color_type)
-
-
- // _color_type false, i.e. gradient color
- else
- {
- // First color:
- // Creates a linear range from white to the first color.
- delta = GetGreyLevelBoundaries(1) - GetGreyLevelBoundaries(0);
- for (int ii = 1; ii <= delta ; ii++)
- {
- thresholdTable->SetTableValue( GetGreyLevelBoundaries(0) + ii, GetBaseColors(0) * ii/delta,
- GetBaseColors(1) * ii/delta, GetBaseColors(2) * ii/delta, 1);
- }
-
- // If other colors exist:
- // Creates linear ranges between one color and the following in the color vector.
+ if (_color_type) // Plain
+ {
+ if ( minRange<GetGreyLevelBoundaries(0) )
+ {
+ start = 0;
+ end = GrayLevel_TO_colorTableIndex( GetGreyLevelBoundaries(0) );
+ FillColorTable(start,end, 0,0,0, 0,0,0, 0,0);
+ }
+
+ if ( maxRange>GetGreyLevelBoundaries( _grey_level_boundary.size()-1 ) )
+ {
+ start = GrayLevel_TO_colorTableIndex( GetGreyLevelBoundaries( _grey_level_boundary.size()-1 ) );
+ end = GrayLevel_TO_colorTableIndex( maxRange );
+ FillColorTable(start,end, 0,0,0, 0,0,0, 0,0);
+ }
+ for (int iColor = 0; iColor < GetBaseColorNb(); iColor++)
+ {
+ r1 = GetBaseColors(iColor*3+0);
+ g1 = GetBaseColors(iColor*3+1);
+ b1 = GetBaseColors(iColor*3+2);
+ start = GrayLevel_TO_colorTableIndex( GetGreyLevelBoundaries(iColor) );
+ end = GrayLevel_TO_colorTableIndex( GetGreyLevelBoundaries(iColor+1) );
+ t1 = _transparence_level_boundary[iColor];
+// t2 = _transparence_level_boundary[iColor+1];
+ FillColorTable(start,end, r1,g1,b1,r1,g1,b1,t1,t1);
+ } // for i
+ } else { // _color_type false, i.e. gradient color