this->ImageMaps.clear( );
this->SliceMappers.clear( );
this->ImageActors.clear( );
+ this->AssociatedSlices.clear( );
this->AssociatedActors.clear( );
// Reconfigure unique objects
coord->SetValue( 0.01, 0.01 );
}
+// -------------------------------------------------------------------------
+void cpExtensions::Visualization::ImageSliceActors::
+AssociateSlice( Self* other )
+{
+ this->AssociatedSlices.push_back( other );
+ this->Modified( );
+}
+
+// -------------------------------------------------------------------------
+void cpExtensions::Visualization::ImageSliceActors::
+SetSlicesCommand( TCursorCommand cmd, void* data )
+{
+ this->SlicesCommand = cmd;
+ this->SlicesData = data;
+ this->Modified( );
+}
+
// -------------------------------------------------------------------------
vtkInteractorStyle* cpExtensions::Visualization::ImageSliceActors::
GetStyle( )
// Update text
this->UpdateText( );
+
+ // Associated slices
+ for( unsigned int i = 0; i < this->AssociatedSlices.size( ); ++i )
+ if( this->AssociatedSlices[ i ]->GetAxis( ) == this->GetAxis( ) )
+ this->AssociatedSlices[ i ]->SetSliceNumber( slice );
}
+// -------------------------------------------------------------------------
+void cpExtensions::Visualization::ImageSliceActors::
+SetSlice( double* pos )
+{
+ vtkImageData* image;
+ if( this->ImageMaps[ 0 ] != NULL )
+ image =
+ dynamic_cast< vtkImageData* >( this->ImageMaps[ 0 ]->GetInput( ) );
+ else
+ image = this->SliceMappers[ 0 ]->GetInput( );
+
+ int ijk[ 3 ];
+ double pcoords[ 3 ];
+ image->ComputeStructuredCoordinates( pos, ijk, pcoords );
+ this->SetSliceNumber( ijk[ this->GetAxis( ) ] );
+}
+
+// -------------------------------------------------------------------------
+/* TODO
+ void cpExtensions::Visualization::ImageSliceActors::
+ SetSlices( double pos[ 3 ] )
+ {
+ }
+*/
+
// -------------------------------------------------------------------------
void cpExtensions::Visualization::ImageSliceActors::
UpdateText( )
{
this->Clear( );
+ this->SlicesCommand = NULL;
+
// Connect this view with a controller
this->Style = vtkSmartPointer< ImageInteractorStyle >::New( );
this->Style->AssociateView( this );
}
else if( btn == ImageInteractorStyle::ButtonID_Left )
{
+ if( !alt && ctr && !sft && actors->SlicesCommand != NULL )
+ actors->SlicesCommand( pos, actors->GetAxis( ), actors->SlicesData );
}
else if( btn == ImageInteractorStyle::ButtonID_Middle )
{
if( btn == ImageInteractorStyle::ButtonID_Left )
{
if( !alt && !ctr && !sft )
- {
actors->SetCursor( pos );
-
- } // fi
+ else if( !alt && ctr && !sft && actors->SlicesCommand != NULL )
+ actors->SlicesCommand( pos, actors->GetAxis( ), actors->SlicesData );
}
else if( btn == ImageInteractorStyle::ButtonID_Middle )
{