+// -------------------------------------------------------------------------
+double cpExtensions::Visualization::ImageSliceActors::
+GetWindow( ) const
+{
+ if( this->m_Actor.GetPointer( ) != NULL )
+ return( this->m_Actor->GetProperty( )->GetColorWindow( ) );
+ else
+ return( double( 0 ) );
+}
+
+// -------------------------------------------------------------------------
+double cpExtensions::Visualization::ImageSliceActors::
+GetLevel( ) const
+{
+ if( this->m_Actor.GetPointer( ) != NULL )
+ return( this->m_Actor->GetProperty( )->GetColorLevel( ) );
+ else
+ return( double( 0 ) );
+}
+
+// -------------------------------------------------------------------------
+void cpExtensions::Visualization::ImageSliceActors::
+Render( )
+{
+ auto ren = this->m_Style->GetCurrentRenderer( );
+ if( ren == NULL )
+ return;
+ auto win = ren->GetRenderWindow( );
+ if( win == NULL )
+ return;
+ win->Render( );
+}
+
+// -------------------------------------------------------------------------
+cpExtensions::Visualization::ImageSliceActors::
+ImageSliceActors( )
+ : Superclass( ),
+ m_ManualScalarRange( false )
+{
+ this->Clear( );
+}
+
+// -------------------------------------------------------------------------
+cpExtensions::Visualization::ImageSliceActors::
+~ImageSliceActors( )
+{
+}
+
+// -------------------------------------------------------------------------
+void cpExtensions::Visualization::ImageSliceActors::
+_ConfigureInput( int orientation )
+{
+ // Prepare main image
+ this->m_Mapper->SetOrientation( orientation );
+ this->m_Mapper->Update( );
+ this->m_Actor->GetProperty( )->SetOpacity( 0.8 );
+ this->m_Actor->Modified( );
+ auto st = this->GetStyle( );
+ if( st != NULL )
+ st->AssociateImageActor( this->m_Actor );
+ this->AddItem( this->m_Actor );
+
+ // Prepare main cursor
+ this->_ConfigureCursor( );
+ this->AddItem( this->m_Cursor.Actor );
+
+ // Prepare window/level
+ if( !( this->m_ManualScalarRange ) )
+ this->UnsetScalarRange( );
+
+ // Add all other actors
+ this->AddItem( this->m_TextActor );
+
+ // Put it in the first slice
+ auto image = this->m_Mapper->GetInput( );
+ int ext[ 6 ];
+ image->GetExtent( ext );
+ this->SetSliceNumber( ext[ orientation << 1 ] );
+
+ /*
+ if( this->m_Style.GetPointer( ) != NULL )
+ this->AddItem( this->m_Actor );
+
+ this->SetSliceNumber( this->GetSliceNumberMinValue( ) );
+ this->ResetCursor( );
+ this->Modified( );
+
+ // Reset cursors
+ this->ResetCursor( );
+ this->ResetAxesCursor( );
+
+ // Update window/level ranges
+ vtkImageData* data = this->GetInputImage( );
+ if( data != NULL )
+ {
+ double r[ 2 ];
+ data->GetScalarRange( r );
+ this->m_WLRange[ 0 ] = double( 0 );
+ this->m_WLRange[ 1 ] = r[ 1 ] - r[ 0 ];
+ this->m_WLRange[ 2 ] = r[ 0 ];
+ this->m_WLRange[ 3 ] = r[ 1 ];
+ this->ResetWindowLevel( );
+
+ // Configure blender
+ this->m_BlenderBase = vtkSmartPointer< vtkImageData >::New( );
+ this->m_BlenderBase->ShallowCopy( data );
+ this->m_BlenderBase->AllocateScalars( VTK_UNSIGNED_CHAR, 1 );
+ std::memset(
+ this->m_BlenderBase->GetScalarPointer( ), 0,
+ this->m_BlenderBase->GetActualMemorySize( )
+ );
+ this->m_Blender->AddInputData( this->m_BlenderBase );
+
+ } // fi
+ */
+}
+
+// -------------------------------------------------------------------------
+void cpExtensions::Visualization::ImageSliceActors::
+_ConfigureCursor( )
+{
+ int a = this->m_Mapper->GetOrientation( );
+ double bounds[ 6 ];
+ this->m_Actor->GetBounds( bounds );
+ bounds[ a << 1 ] += 1e-5;
+ bounds[ ( a << 1 ) + 1 ] += 1e-5;
+
+ this->m_Cursor.Source->SetModelBounds( bounds );
+ this->m_Cursor.Source->AllOn( );
+ this->m_Cursor.Actor->GetProperty( )->SetOpacity( 1 );
+ this->m_Cursor.Actor->GetProperty( )->SetLineWidth( 3 );
+ this->m_Cursor.Modified( );
+}
+
+// -------------------------------------------------------------------------
+void cpExtensions::Visualization::ImageSliceActors::
+_MouseMoveCommand(
+ void* data,
+ const TStyle::ButtonID& btn,
+ int* idx, double* pos,
+ bool alt, bool ctr, bool sft
+ )
+{
+ ImageSliceActors* self = reinterpret_cast< ImageSliceActors* >( data );
+ if( self == NULL )
+ return;
+
+ if( btn == TStyle::ButtonID_None )