- int N = this->Slices[ 0 ][ 0 ]->GetNumberOfImageActors( );
- if( N == 0 )
- {
- this->Slices[ 0 ][ 0 ]->AddInputData( new_image, 0 );
- vtkImageMapToColors* imap = this->Slices[ 0 ][ 0 ]->GetImageMap( 0 );
- for( unsigned int i = 0; i < 2; ++i )
- for( unsigned int j = 0; j < 3; ++j )
- if( i != 0 || j != 0 )
- {
- if( imap != NULL )
- this->Slices[ i ][ j ]->AddInputConnection(
- imap->GetOutputPort( ), j
- );
- else
- this->Slices[ i ][ j ]->AddInputData( new_image, j );
-
- } // fi
-
- // Create 3D outline
- double bb[ 6 ];
- new_image->GetBounds( bb );
-
- vtkSmartPointer< vtkOutlineSource > img_ol =
- vtkSmartPointer< vtkOutlineSource >::New( );
- img_ol->SetBounds( bb );
-
- vtkSmartPointer< vtkPolyDataMapper > img_ol_mapper =
- vtkSmartPointer< vtkPolyDataMapper >::New( );
- img_ol_mapper->SetInputConnection( img_ol->GetOutputPort( ) );
- this->ImageOutlineActor->SetMapper( img_ol_mapper );
- this->ImageOutlineActor->GetProperty( )->SetColor( 1, 1, 1 );
- this->ImageOutlineActor->GetProperty( )->SetLineWidth( 1 );
-
- this->AddItem( this->ImageOutlineActor );
- }
- else
- {
- // Check if the image share the same space
- vtkAlgorithmOutput* ref_aout =
- this->Slices[ 0 ][ 0 ]->GetImageMap( 0 )->GetOutputPort( );
- vtkImageData* ref_image = dynamic_cast< vtkImageData* >(
- ref_aout->GetProducer( )->GetOutputDataObject( ref_aout->GetIndex( ) )
- );
- if( ref_image != NULL )
- {
- int ref_ext[ 6 ], new_ext[ 6 ];
- ref_image->GetExtent( ref_ext );
- new_image->GetExtent( new_ext );
- if(
- ref_ext[ 0 ] == new_ext[ 0 ] && ref_ext[ 1 ] == new_ext[ 1 ] &&
- ref_ext[ 2 ] == new_ext[ 2 ] && ref_ext[ 3 ] == new_ext[ 3 ] &&
- ref_ext[ 4 ] == new_ext[ 4 ] && ref_ext[ 5 ] == new_ext[ 5 ]
- )
- {
- this->Slices[ 0 ][ 0 ]->AddInputData( new_image, 0 );
- vtkImageMapToColors* imap = this->Slices[ 0 ][ 0 ]->GetImageMap( N );
- for( unsigned int i = 0; i < 2; ++i )
- for( unsigned int j = 0; j < 3; ++j )
- if( i != 0 || j != 0 )
- {
- if( imap != NULL )
- this->Slices[ i ][ j ]->AddInputConnection(
- imap->GetOutputPort( ), j
- );
- else
- this->Slices[ i ][ j ]->AddInputData( new_image, j );
-
- } // fi
- }
- else
- N = -1;
- }
- else
- N = -1;
+ this->Slices[ 0 ][ 0 ]->AddBinaryConnection( aout, r, g, b );
+ this->Slices[ 0 ][ 1 ]->AddBinaryConnection( aout, r, g, b );
+ this->Slices[ 0 ][ 2 ]->AddBinaryConnection( aout, r, g, b );
+ this->Slices[ 1 ][ 0 ]->AddBinaryConnection( aout, r, g, b );
+ this->Slices[ 1 ][ 1 ]->AddBinaryConnection( aout, r, g, b );
+ return( this->Slices[ 1 ][ 2 ]->AddBinaryConnection( aout, r, g, b ) );
+}