[OpendTect_Developers] Display filtering with threshold transparency

Yuancheng Liu yuancheng.liu at dgbes.com
Wed Oct 5 18:37:47 CEST 2011


Dear all,

I recently learned how to filter values in the display based on 
transparency threshold. For example,  I calculated isopatch for on 
horizon based on another horizon and I want to display only those parts 
with value greater(or less) than my threshold. Here is a simple example 
of how to code it.

As we know, we use ColTab::MapperSetup and ColTab::Sequency to do the 
color scale, clipping etc. So, we could get all the color related staff 
needed here and just have to set the transparency.

const float transparencythreshold (Given);
ColTab::MapperSetup  MyMS (Given);
ColTab::Sequence MySq (Given);
const Interval<float> scale = MyMS.range_;
const float border = ( transparencythreshold-scale.start) / 
scale.width();  //Of course width!=0
const float nbborder = border + 0.001;
MySq.removeTransparencies();   //clean up old transparency

if ( filter bigger than threshold )
{
    MySq.setTransparency( Geom::Point2D<float>( 0, 255 ) );
    MySq.setTransparency( Geom::Point2D<float>(  border, 255 ) );
    if ( nbborder<1 )
    {
            MySq.setTransparency( Geom::Point2D<float>( nbborder, 0 ) );
            MySq.setTransparency( Geom::Point2D<float>( 1, 0 ) );
      }
}
else
{
    MySq.setTransparency( Geom::Point2D<float>( 0, 0 ) );
    MySq.setTransparency( Geom::Point2D<float>( border, 0 ) );
    if ( nbborder<1 )
    {
            MySq.setTransparency( Geom::Point2D<float>( nbborder, 255 ) );
            MySq.setTransparency( Geom::Point2D<float>( 1, 255 ) );
     }
}

Now, you filtering transparency is set. Have fun!

Take care,

Yuancheng

-- 


-- dGB Earth Sciences
-- 1 Sugar Creek Center BLVD #935
-- Sugar Land, TX 77478; USA
-- Tel: +1 281-240-3939, Fax: +1 281-240-3944
-- (Skype) +1 281-968-0464






More information about the Developers mailing list