// Objects
os << indent << "Colors: " << std::endl;
- auto i = this->m_Colors.begin( );
- for( ; i != this->m_Colors.end( ); ++i )
+ auto i = this->Colors.begin( );
+ for( ; i != this->Colors.end( ); ++i )
os
<< indent << indent << i->first << " : ["
<< i->second.R << ", "
unsigned int cpExtensions::Visualization::ImageBlender::
GetNumberOfImages( ) const
{
- return( ( const_cast< Self* >( this ) )->GetNumberOfInputConnections( 0 ) );
-}
-
-// -------------------------------------------------------------------------
-const double& cpExtensions::Visualization::ImageBlender::
-GetMaxWindow( ) const
-{
- return( this->m_MaxWindow );
-}
-
-// -------------------------------------------------------------------------
-const double& cpExtensions::Visualization::ImageBlender::
-GetMaxLevel( ) const
-{
- return( this->m_MaxLevel );
-}
-
-// -------------------------------------------------------------------------
-const double& cpExtensions::Visualization::ImageBlender::
-GetMinWindow( ) const
-{
- return( this->m_MinWindow );
-}
-
-// -------------------------------------------------------------------------
-const double& cpExtensions::Visualization::ImageBlender::
-GetMinLevel( ) const
-{
- return( this->m_MinLevel );
-}
-
-// -------------------------------------------------------------------------
-const double& cpExtensions::Visualization::ImageBlender::
-GetWindow( ) const
-{
- return( this->m_Window );
-}
-
-// -------------------------------------------------------------------------
-const double& cpExtensions::Visualization::ImageBlender::
-GetLevel( ) const
-{
- return( this->m_Level );
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::Visualization::ImageBlender::
-SetWindow( const double& w )
-{
- if( this->m_Window != w )
- {
- this->m_Window = w;
- this->Modified( );
-
- } // fi
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::Visualization::ImageBlender::
-SetLevel( const double& l )
-{
- if( this->m_Level != l )
- {
- this->m_Level = l;
- this->Modified( );
-
- } // fi
+ return(
+ ( const_cast< Self* >( this ) )->GetNumberOfInputConnections( 0 )
+ );
}
// -------------------------------------------------------------------------
double& b
) const
{
- auto c = this->m_Colors.find( i );
- if( c != this->m_Colors.end( ) )
+ auto c = this->Colors.find( i );
+ if( c != this->Colors.end( ) )
{
r = c->second.R;
g = c->second.G;
const double& b
)
{
- this->m_Colors[ i ] = TColor( r, g, b );
+ this->Colors[ i ] = TColor( r, g, b );
this->Modified( );
}
cpExtensions::Visualization::ImageBlender::
ImageBlender( )
: Superclass( ),
- m_MaxWindow( double( 0 ) ),
- m_MaxLevel( double( 0 ) ),
- m_MinWindow( double( 0 ) ),
- m_MinLevel( double( 0 ) ),
- m_Window( double( 0 ) ),
- m_Level( double( 0 ) )
+ MaxWindow( double( 1 ) ),
+ MaxLevel( double( 1 ) ),
+ MinWindow( double( 0 ) ),
+ MinLevel( double( 0 ) ),
+ Window( double( 1 ) ),
+ Level( double( 0.5 ) )
{
this->SetNumberOfInputPorts( 1 );
}
this->m_Extent[ 5 ] += 1;
// Configure window/level
- double range[ 2 ];
- inData->GetScalarRange( range );
- this->m_MaxWindow = range[ 1 ] - range[ 0 ];
- this->m_MinWindow = this->m_MaxWindow * double( 1e-2 );
- this->m_MinLevel = range[ 0 ];
- this->m_MaxLevel = range[ 1 ];
- if( this->m_Window < this->m_MinWindow )
- this->m_Window = this->m_MinWindow;
- if( this->m_Window > this->m_MaxWindow )
- this->m_Window = this->m_MaxWindow;
- if( this->m_Level < this->m_MinLevel )
- this->m_Level = this->m_MinLevel;
- if( this->m_Level > this->m_MaxLevel )
- this->m_Level = this->m_MaxLevel;
- this->m_WLSlope = double( 1 ) / this->m_Window;
- this->m_WLOffset = double( 0.5 ) - ( this->m_Level / this->m_Window );
+ this->m_WLSlope = double( 1 ) / this->Window;
+ this->m_WLOffset = double( 0.5 ) - ( this->Level / this->Window );
// Configure output type
vtkDataObject::SetPointDataActiveScalarInfo(
outputVector->GetInformationObject( 0 ),
- VTK_UNSIGNED_CHAR, 4
+ VTK_UNSIGNED_CHAR, 3
);
return( 1 );
}
vtkImageData** inDatas,
int numInputs,
vtkImageData* outData,
- int outExt[6],
+ int outExt[ 6 ],
int id
)
{
int mType = inDatas[ 0 ]->GetScalarType( );
int mSize = inDatas[ 0 ]->GetScalarSize( );
- double r, g, b, a;
+ double r, g, b;
int e13 = this->m_Extent[ 1 ] * this->m_Extent[ 3 ];
for( int k = outExt[ 4 ]; k <= outExt[ 5 ]; ++k )
{
// Prepare color
r = g = b = v;
- a = _1;
// Blend colors
for( int i = 1; i < numInputs; ++i )
);
if( c > double( 0 ) )
{
- TColor rgb = this->m_Colors[ i ];
+ TColor rgb = this->Colors[ i ];
r *= rgb.R * rgb.N;
g *= rgb.G * rgb.N;
b *= rgb.B * rgb.N;
- a = _1;
} // fi
} // rof
// Update color
- int di4 = di << 2;
- oBuffer[ di4 + 0 ] = static_cast< unsigned char >( r * _255 );
- oBuffer[ di4 + 1 ] = static_cast< unsigned char >( g * _255 );
- oBuffer[ di4 + 2 ] = static_cast< unsigned char >( b * _255 );
- oBuffer[ di4 + 3 ] = static_cast< unsigned char >( a * _255 );
+ int di3 = di * 3;
+ oBuffer[ di3 + 0 ] = static_cast< unsigned char >( r * _255 );
+ oBuffer[ di3 + 1 ] = static_cast< unsigned char >( g * _255 );
+ oBuffer[ di3 + 2 ] = static_cast< unsigned char >( b * _255 );
} // rof