+++ /dev/null
-#include "VolumeActors.h"
-
-#include <cmath>
-
-#include <vtkAlgorithmOutput.h>
-#include <vtkImageData.h>
-#include <vtkInformation.h>
-#include <vtkLookupTable.h>
-#include <vtkPlane.h>
-#include <vtkProperty.h>
-#include <vtkRenderer.h>
-#include <vtkRendererCollection.h>
-#include <vtkRenderWindow.h>
-#include <vtkRenderWindowInteractor.h>
-#include <vtkStreamingDemandDrivenPipeline.h>
-#include <vtkTextProperty.h>
-
-#include <vtkOrientedGlyphContourRepresentation.h>
-#include <vtkContourWidget.h>
-
-
-// -------------------------------------------------------------------------
-idms::VolumeActors::SliceActor::
-SliceActor( )
-{
- this->SliceMapper = vtkSmartPointer< vtkImageSliceMapper >::New( );
- this->PlaneSource = vtkSmartPointer< vtkPlaneSource >::New( );
- this->PlaneMapper = vtkSmartPointer< vtkPolyDataMapper >::New( );
- this->PlaneActor = vtkSmartPointer< vtkActor >::New( );
- this->ImageActor = vtkSmartPointer< vtkImageActor >::New( );
- this->TextActor = vtkSmartPointer< vtkTextActor >::New( );
- this->RegionCutterPlane = vtkSmartPointer< vtkPlane >::New( );
-
- this->PlaneSource->SetXResolution( 1 );
- this->PlaneSource->SetYResolution( 1 );
- this->PlaneMapper->
- SetInputConnection( this->PlaneSource->GetOutputPort( ) );
- this->PlaneActor->SetMapper( this->PlaneMapper );
-
- this->TextActor->SetTextScaleModeToNone( );
- vtkTextProperty* textprop = this->TextActor->GetTextProperty( );
- textprop->SetColor( 1, 1, 1 );
- textprop->SetFontFamilyToCourier( );
- textprop->SetFontSize( 18 );
- textprop->BoldOff( );
- textprop->ItalicOff( );
- textprop->ShadowOff( );
- textprop->SetJustificationToLeft( );
- textprop->SetVerticalJustificationToBottom( );
- vtkCoordinate* coord = this->TextActor->GetPositionCoordinate( );
- coord->SetCoordinateSystemToNormalizedViewport( );
- coord->SetValue( 0.01, 0.01 );
-}
-
-// -------------------------------------------------------------------------
-void idms::VolumeActors::SliceActor::
-Configure( vtkAlgorithmOutput* aout, int axis )
-{
- this->SliceMapper->SetInputConnection( aout );
- this->SliceMapper->SetOrientation( axis );
- this->ImageActor->SetMapper( this->SliceMapper );
- this->ImageActor->Modified( );
-}
-
-// -------------------------------------------------------------------------
-void idms::VolumeActors::SliceActor::
-ConfigureRegion( vtkAlgorithmOutput* aout )
-{
- this->RegionCutter = vtkSmartPointer< vtkCutter >::New( );
- this->RegionCutterMapper = vtkSmartPointer< vtkPolyDataMapper >::New( );
- this->RegionCutterActor = vtkSmartPointer< vtkActor >::New( );
-
- this->RegionCutter->SetInputConnection( aout );
- this->RegionCutter->SetCutFunction( this->RegionCutterPlane );
- this->RegionCutterMapper->
- SetInputConnection( this->RegionCutter->GetOutputPort( ) );
- this->RegionCutterActor->SetMapper( this->RegionCutterMapper );
- this->RegionCutterActor->GetProperty( )->SetColor( 0, 0, 1 );
-}
-
-// -------------------------------------------------------------------------
-void idms::VolumeActors::SliceActor::
-SetSegmentation( vtkAlgorithmOutput* aout )
-{
- this->SegmentationSliceMapper =
- vtkSmartPointer< vtkImageSliceMapper >::New( );
- this->SegmentationSliceMapper->SetInputConnection( aout );
- this->SegmentationSliceMapper->
- SetOrientation( this->SliceMapper->GetOrientation( ) );
- this->SegmentationSliceMapper->
- SetSliceNumber( this->SliceMapper->GetSliceNumber( ) );
-
- this->SegmentationActor = vtkSmartPointer< vtkImageActor >::New( );
- this->SegmentationActor->SetMapper( this->SegmentationSliceMapper );
- this->SegmentationActor->Modified( );
-}
-
-// -------------------------------------------------------------------------
-void idms::VolumeActors::SliceActor::
-SetSliceNumber( const int& slice )
-{
- this->SliceMapper->SetSliceNumber( slice );
- this->SliceMapper->Update( );
- if( this->SegmentationSliceMapper.GetPointer( ) != NULL )
- {
- this->SegmentationSliceMapper->SetSliceNumber( slice );
- this->SegmentationSliceMapper->Update( );
-
- } // fi
-
- // Compute plane
- vtkAlgorithm* algo = this->SliceMapper->GetInputAlgorithm( );
- vtkInformation* info = algo->GetOutputInformation( 0 );
- int ext[ 6 ];
- double ori[ 3 ], spac[ 3 ], pos[ 3 ];
- info->Get( vtkStreamingDemandDrivenPipeline::WHOLE_EXTENT( ), ext );
- info->Get( vtkDataObject::ORIGIN( ), ori );
- info->Get( vtkDataObject::SPACING( ), spac );
- this->SliceMapper->GetSlicePlane( )->GetOrigin( pos );
-
- // Prevent obscuring voxels by offsetting the plane geometry
- double xbnds[ ] =
- {
- ori[ 0 ] + ( spac[ 0 ] * double( ext[ 0 ] ) ),
- ori[ 0 ] + ( spac[ 0 ] * double( ext[ 1 ] ) )
- };
- double ybnds[ ] =
- {
- ori[ 1 ] + ( spac[ 1 ] * double( ext[ 2 ] ) ),
- ori[ 1 ] + ( spac[ 1 ] * double( ext[ 3 ] ) )
- };
- double zbnds[ ] =
- {
- ori[ 2 ] + ( spac[ 2 ] * double( ext[ 4 ] ) ),
- ori[ 2 ] + ( spac[ 2 ] * double( ext[ 5 ] ) )
- };
-
- if( spac[ 0 ] < double( 0 ) )
- {
- double t = xbnds[ 0 ];
- xbnds[ 0 ] = xbnds[ 1 ];
- xbnds[ 1 ] = t;
-
- } // fi
- if( spac[ 1 ] < double( 0 ) )
- {
- double t = ybnds[ 0 ];
- ybnds[ 0 ] = ybnds[ 1 ];
- ybnds[ 1 ] = t;
-
- } // fi
- if( spac[ 2 ] < double( 0 ) )
- {
- double t = zbnds[ 0 ];
- zbnds[ 0 ] = zbnds[ 1 ];
- zbnds[ 1 ] = t;
-
- } // fi
-
- int axis = this->SliceMapper->GetOrientation( );
- this->PlaneActor->GetProperty( )->SetRepresentationToWireframe( );
- this->PlaneActor->GetProperty( )->SetLineWidth( 2 );
- if( axis == 0 ) // YZ, x-normal
- {
- this->PlaneSource->SetOrigin( pos[ 0 ], ybnds[ 0 ], zbnds[ 0 ]);
- this->PlaneSource->SetPoint1( pos[ 0 ], ybnds[ 1 ], zbnds[ 0 ] );
- this->PlaneSource->SetPoint2( pos[ 0 ], ybnds[ 0 ], zbnds[ 1 ] );
- this->PlaneActor->GetProperty( )->SetColor( 1, 0, 0 );
-
- this->RegionCutterPlane->SetOrigin( pos[ 0 ], ybnds[ 0 ], zbnds[ 0 ]);
- this->RegionCutterPlane->SetNormal( 1, 0, 0 );
- }
- else if( axis == 1 ) // ZX, y-normal
- {
- this->PlaneSource->SetOrigin( xbnds[ 0 ], pos[ 1 ], zbnds[ 0 ] );
- this->PlaneSource->SetPoint1( xbnds[ 0 ], pos[ 1 ], zbnds[ 1 ] );
- this->PlaneSource->SetPoint2( xbnds[ 1 ], pos[ 1 ], zbnds[ 0 ] );
- this->PlaneActor->GetProperty( )->SetColor( 0, 1, 0 );
-
- this->RegionCutterPlane->SetOrigin( xbnds[ 0 ], pos[ 1 ], zbnds[ 0 ] );
- this->RegionCutterPlane->SetNormal( 0, 1, 0 );
- }
- else // XY, z-normal
- {
- this->PlaneSource->SetOrigin( xbnds[ 0 ], ybnds[ 0 ], pos[ 2 ] );
- this->PlaneSource->SetPoint1( xbnds[ 1 ], ybnds[ 0 ], pos[ 2 ] );
- this->PlaneSource->SetPoint2( xbnds[ 0 ], ybnds[ 1 ], pos[ 2 ] );
- this->PlaneActor->GetProperty( )->SetColor( 0, 0, 1 );
-
- this->RegionCutterPlane->SetOrigin( xbnds[ 0 ], ybnds[ 0 ], pos[ 2 ] );
- this->RegionCutterPlane->SetNormal( 0, 0, 1 );
-
- } // fi
-
- this->RegionCutter->Modified( );
- this->RegionCutterMapper->Modified( );
- this->RegionCutterActor->Modified( );
-}
-
-// -------------------------------------------------------------------------
-void idms::VolumeActors::SliceActor::
-UpdateText( const double& w, const double& l )
-{
- char axis;
- if ( this->SliceMapper->GetOrientation( ) == 0 ) axis = 'X';
- else if( this->SliceMapper->GetOrientation( ) == 1 ) axis = 'Y';
- else if( this->SliceMapper->GetOrientation( ) == 2 ) axis = 'Z';
-
- std::sprintf(
- this->TextBuffer, "Axis: %c (%d)\nWin/Lev: %.2f/%.2f",
- axis, this->SliceMapper->GetSliceNumber( ), w, l
- );
- this->TextActor->SetInput( this->TextBuffer );
- this->TextActor->Modified( );
-}
-
-// -------------------------------------------------------------------------
-idms::VolumeActors* idms::VolumeActors::
-New( )
-{
- return( new Self( ) );
-}
-
-// -------------------------------------------------------------------------
-void idms::VolumeActors::
-Configure(
- vtkImageData* image,
- vtkRenderWindowInteractor* xi,
- vtkRenderWindowInteractor* yi,
- vtkRenderWindowInteractor* zi
- )
-{
- if( image == NULL || xi == NULL || yi == NULL || zi == NULL )
- vtkErrorMacro( "At least one object is \"NULL\"" );
-
- this->Image = image;
- this->Interactors[ 0 ] = xi;
- this->Interactors[ 1 ] = yi;
- this->Interactors[ 2 ] = zi;
-
- this->ImageToWindowLevel->SetInputData( this->Image );
- this->ResetWindowLevel( );
- this->ImageToWindowLevel->Update( );
-
- // Create 3D outline
- this->ImageOutlineSource =
- vtkSmartPointer< vtkOutlineSource >::New( );
- vtkSmartPointer< vtkPolyDataMapper > img_ol_mapper =
- vtkSmartPointer< vtkPolyDataMapper >::New( );
- this->ImageOutlineSource->SetBounds( this->Image->GetBounds( ) );
- img_ol_mapper->SetInputConnection(
- this->ImageOutlineSource->GetOutputPort( )
- );
- this->ImageOutlineIndex = this->GetNumberOfItems( );
- vtkSmartPointer< vtkActor > img_ol_actor =
- vtkSmartPointer< vtkActor >::New( );
- img_ol_actor->SetMapper( img_ol_mapper );
- img_ol_actor->GetProperty( )->SetColor( 1, 1, 1 );
- img_ol_actor->GetProperty( )->SetLineWidth( 1 );
- this->AddItem( img_ol_actor );
-
- // Cursor radius
- double spac[ 3 ];
- image->GetSpacing( spac );
- double radius = spac[ 0 ];
- radius = ( spac[ 1 ] < radius )? spac[ 1 ]: radius;
- radius = ( spac[ 2 ] < radius )? spac[ 2 ]: radius;
- radius *= double( 6 );
- this->Cursor->SetRadius( radius );
- this->CursorMapper->Modified( );
- this->CursorActor->Modified( );
-
- // Plane actors
- for( int a = 0; a < 3; ++a )
- {
- // Configure actors
- this->Planes[ a ].Configure( this->ImageToWindowLevel->GetOutputPort( ), a );
- this->Planes[ a ].ConfigureRegion( this->Region->GetOutputPort( ) );
- this->Planes[ a ].UpdateText( this->GetWindow( ), this->GetLevel( ) );
-
- // Add them to renderer
- vtkRenderer* ren = this->Interactors[ a ]->GetRenderWindow( )->
- GetRenderers( )->GetFirstRenderer( );
- if( ren == NULL )
- vtkErrorMacro( "At least one interactor doesn't have a valid renderer" );
- ren->AddActor( this->Planes[ a ].ImageActor );
- ren->AddActor( this->Planes[ a ].TextActor );
-
- for( int i = 0; i < 3; ++i )
- this->Interactors[ a ]->GetRenderWindow( )->
- GetRenderers( )->GetFirstRenderer( )->
- AddActor( this->Planes[ i ].PlaneActor );
-
- } // rof
-
- // Keep track into collection
-/*
- this->XPlaneIndex = this->GetNumberOfItems( );
- this->AddItem( this->Planes[ 0 ].ImageActor.GetPointer( ) );
- this->XTextIndex = this->GetNumberOfItems( );
- this->AddItem( this->Planes[ 0 ].TextActor.GetPointer( ) );
- this->XBoundsIndex = this->GetNumberOfItems( );
- this->AddItem( this->Planes[ 0 ].PlaneActor.GetPointer( ) );
-
- this->YPlaneIndex = this->GetNumberOfItems( );
- this->AddItem( this->Planes[ 1 ].ImageActor.GetPointer( ) );
- this->YTextIndex = this->GetNumberOfItems( );
- this->AddItem( this->Planes[ 1 ].TextActor.GetPointer( ) );
- this->YBoundsIndex = this->GetNumberOfItems( );
- this->AddItem( this->Planes[ 1 ].PlaneActor.GetPointer( ) );
-
- this->ZPlaneIndex = this->GetNumberOfItems( );
- this->AddItem( this->Planes[ 2 ].ImageActor.GetPointer( ) );
- this->ZTextIndex = this->GetNumberOfItems( );
- this->AddItem( this->Planes[ 2 ].TextActor.GetPointer( ) );
- this->ZBoundsIndex = this->GetNumberOfItems( );
- this->AddItem( this->Planes[ 2 ].PlaneActor.GetPointer( ) );
-*/
- // Initialize slice visualization
- this->ResetSlices( );
-
- /*
- #error CONTOUR_WIDGET <- ACA VOY
- static vtkSmartPointer<vtkOrientedGlyphContourRepresentation> contourRep =
- vtkSmartPointer<vtkOrientedGlyphContourRepresentation>::New();
- static vtkSmartPointer<vtkContourWidget> contourWidget =
- vtkSmartPointer<vtkContourWidget>::New();
- contourWidget->SetInteractor( zi );
- contourWidget->SetRepresentation( contourRep );
- contourWidget->On( );
- */
-
-
-
-
-
-
-
-
-
-}
-
-// -------------------------------------------------------------------------
-void idms::VolumeActors::
-SetSegmentation( vtkImageData* segmentation )
-{
- double range[ 2 ];
- this->Segmentation = segmentation;
- this->Segmentation->GetScalarRange( range );
-
- vtkSmartPointer< vtkLookupTable > lut =
- vtkSmartPointer< vtkLookupTable >::New( );
- lut->SetNumberOfTableValues( 2 );
- lut->SetTableRange( range );
- lut->SetTableValue( 0, 0, 0, 0, 0 );
- lut->SetTableValue( 1, 1, 0, 0, 0.4 );
-
- this->SegmentationToColors->SetInputData( this->Segmentation );
- this->SegmentationToColors->SetLookupTable( lut );
- this->SegmentationToColors->Update( );
-
- for( unsigned int a = 0; a < 3; ++a )
- {
- this->Planes[ a ].SetSegmentation(
- this->SegmentationToColors->GetOutputPort( )
- );
- vtkRenderer* ren = this->Interactors[ a ]->GetRenderWindow( )->
- GetRenderers( )->GetFirstRenderer( );
- ren->AddActor( this->Planes[ a ].SegmentationActor );
-
- } // rof
- this->Render( );
-}
-
-// -------------------------------------------------------------------------
-void idms::VolumeActors::
-AddAuxiliaryInteractor( vtkRenderWindowInteractor* i )
-{
- if( i != NULL )
- {
- this->AuxiliaryInteractors.insert( i );
- this->Modified( );
-
- } // fi
-}
-
-// -------------------------------------------------------------------------
-double idms::VolumeActors::
-GetMinWindow( ) const
-{
- return( double( 0.01 ) );
-}
-
-// -------------------------------------------------------------------------
-double idms::VolumeActors::
-GetMaxWindow( ) const
-{
- if( this->Image == NULL )
- return( double( 0 ) );
-
- double range[ 2 ];
- this->Image->GetScalarRange( range );
- return( range[ 1 ] - range[ 0 ] );
-}
-
-// -------------------------------------------------------------------------
-double idms::VolumeActors::
-GetMinLevel( ) const
-{
- if( this->Image == NULL )
- return( double( 0 ) );
-
- double range[ 2 ];
- this->Image->GetScalarRange( range );
- return( range[ 0 ] );
-}
-
-// -------------------------------------------------------------------------
-double idms::VolumeActors::
-GetMaxLevel( ) const
-{
- if( this->Image == NULL )
- return( double( 0 ) );
-
- double range[ 2 ];
- this->Image->GetScalarRange( range );
- return( range[ 1 ] );
-}
-
-// -------------------------------------------------------------------------
-double idms::VolumeActors::
-GetWindow( ) const
-{
- return( this->ImageToWindowLevel->GetWindow( ) );
-}
-
-// -------------------------------------------------------------------------
-double idms::VolumeActors::
-GetLevel( ) const
-{
- return( this->ImageToWindowLevel->GetLevel( ) );
-}
-
-// -------------------------------------------------------------------------
-void idms::VolumeActors::
-SetWindow( const double& w )
-{
- this->ImageToWindowLevel->SetWindow( w );
-}
-
-// -------------------------------------------------------------------------
-void idms::VolumeActors::
-SetLevel( const double& l )
-{
- this->ImageToWindowLevel->SetLevel( l );
-}
-
-// -------------------------------------------------------------------------
-void idms::VolumeActors::
-SetWindowLevel( const double& w, const double& l )
-{
- this->ImageToWindowLevel->SetWindow( w );
- this->ImageToWindowLevel->SetLevel( l );
- for( int a = 0; a < 3; ++a )
- this->Planes[ a ].UpdateText( w, l );
-}
-
-// -------------------------------------------------------------------------
-void idms::VolumeActors::
-ResetWindowLevel( )
-{
- double range[ 2 ];
- this->Image->GetScalarRange( range );
- this->SetWindowLevel(
- range[ 1 ] - range[ 0 ],
- ( ( range[ 1 ] + range[ 0 ] ) / double( 2 ) ) + range[ 0 ]
- );
-}
-
-// -------------------------------------------------------------------------
-vtkPlane* idms::VolumeActors::
-GetSlicePlane( const int& axis ) const
-{
- return( this->Planes[ axis ].SliceMapper->GetSlicePlane( ) );
-}
-
-// -------------------------------------------------------------------------
-int idms::VolumeActors::
-GetSliceNumberMinValue( const int& axis ) const
-{
- return( this->Planes[ axis ].SliceMapper->GetSliceNumberMinValue( ) );
-}
-
-// -------------------------------------------------------------------------
-int idms::VolumeActors::
-GetSliceNumberMaxValue( const int& axis ) const
-{
- return( this->Planes[ axis ].SliceMapper->GetSliceNumberMaxValue( ) );
-}
-
-// -------------------------------------------------------------------------
-int idms::VolumeActors::
-GetSlice( const int& axis ) const
-{
- return( this->Planes[ axis ].SliceMapper->GetSliceNumber( ) );
-}
-
-// -------------------------------------------------------------------------
-void idms::VolumeActors::
-SetSlice( const int& axis, const int& slice )
-{
- this->Planes[ axis ].SetSliceNumber( slice );
- this->Planes[ axis ].UpdateText( this->GetWindow( ), this->GetLevel( ) );
- this->RenderAuxiliaryInteractors( );
-}
-
-// -------------------------------------------------------------------------
-void idms::VolumeActors::
-SetSlice( const int& axis, const double& slice )
-{
- vtkAlgorithm* algo =
- this->Planes[ axis ].SliceMapper->GetInputAlgorithm( );
- vtkInformation* info = algo->GetOutputInformation( 0 );
- int ext[ 6 ];
- double ori[ 3 ], spac[ 3 ];
- info->Get( vtkStreamingDemandDrivenPipeline::WHOLE_EXTENT( ), ext );
- info->Get( vtkDataObject::ORIGIN( ), ori );
- info->Get( vtkDataObject::SPACING( ), spac );
- this->SetSlice(
- axis,
- int( ( slice - ori[ axis ] ) / spac[ axis ] ) + ext[ axis << 1 ]
- );
-}
-
-// -------------------------------------------------------------------------
-void idms::VolumeActors::
-ResetSlices( )
-{
- for( int a = 0; a < 3; ++a )
- this->SetSlice( a, this->GetSliceNumberMinValue( a ) );
- this->Render( );
-}
-
-// -------------------------------------------------------------------------
-void idms::VolumeActors::
-AddSeed( int idx[ 3 ] )
-{
- this->Seeds.push_back( std::vector< int >( idx, idx + 3 ) );
- this->Modified( );
-}
-
-// -------------------------------------------------------------------------
-void idms::VolumeActors::
-AddSeed( double pos[ 3 ] )
-{
- /* TODO
- this->Seeds.push_back( std::vector< double >( pos, pos + 3 ) );
- this->Modified( );
- */
-}
-
-// -------------------------------------------------------------------------
-unsigned int idms::VolumeActors::
-GetNumberOfSeeds( ) const
-{
- return( this->Seeds.size( ) );
-}
-
-// -------------------------------------------------------------------------
-void idms::VolumeActors::
-GetSeed( unsigned int i, int idx[ 3 ] ) const
-{
- if( i < this->Seeds.size( ) )
- {
- idx[ 0 ] = this->Seeds[ i ][ 0 ];
- idx[ 1 ] = this->Seeds[ i ][ 1 ];
- idx[ 2 ] = this->Seeds[ i ][ 2 ];
-
- } // fi
-}
-
-// -------------------------------------------------------------------------
-void idms::VolumeActors::
-SetCursorPosition( double pos[ 3 ] )
-{
- this->Cursor->SetCenter( pos );
-}
-
-// -------------------------------------------------------------------------
-void idms::VolumeActors::
-ShowRegion( int a )
-{
- vtkRenderer* ren = this->Interactors[ a ]->GetRenderWindow( )->
- GetRenderers( )->GetFirstRenderer( );
- ren->AddActor( this->Planes[ a ].RegionCutterActor );
-}
-
-// -------------------------------------------------------------------------
-void idms::VolumeActors::
-HideRegion( int a )
-{
- vtkRenderer* ren = this->Interactors[ a ]->GetRenderWindow( )->
- GetRenderers( )->GetFirstRenderer( );
- ren->RemoveActor( this->Planes[ a ].RegionCutterActor );
-}
-
-// -------------------------------------------------------------------------
-void idms::VolumeActors::
-SetRegionPosition( double pos[ 3 ] )
-{
- this->Region->SetCenter( pos );
-}
-
-// -------------------------------------------------------------------------
-void idms::VolumeActors::
-SetRegionRadius( double pos[ 3 ] )
-{
- double rpos[ 3 ];
-
- this->Region->GetCenter( rpos );
- double x = pos[ 0 ] - rpos[ 0 ];
- double y = pos[ 1 ] - rpos[ 1 ];
- double z = pos[ 2 ] - rpos[ 2 ];
- double d = ( x * x ) + ( y * y ) + ( z * z );
- if( double( 0 ) < d )
- d = std::sqrt( d );
- else
- d = double( 0 );
- this->Region->SetRadius( d );
- this->Planes[ 0 ].RegionCutter->Modified( );
- this->Planes[ 1 ].RegionCutter->Modified( );
- this->Planes[ 2 ].RegionCutter->Modified( );
- this->Planes[ 0 ].RegionCutterMapper->Modified( );
- this->Planes[ 1 ].RegionCutterMapper->Modified( );
- this->Planes[ 2 ].RegionCutterMapper->Modified( );
- this->Planes[ 0 ].RegionCutterActor->Modified( );
- this->Planes[ 1 ].RegionCutterActor->Modified( );
- this->Planes[ 2 ].RegionCutterActor->Modified( );
- this->Render( );
-}
-
-// -------------------------------------------------------------------------
-void idms::VolumeActors::
-GetImageBounds( double bounds[ 6 ] ) const
-{
- if( this->Image != NULL )
- this->Image->GetBounds( bounds );
-}
-
-// -------------------------------------------------------------------------
-void idms::VolumeActors::
-Render( )
-{
- for( int a = 0; a < 3; ++a )
- if( this->Interactors[ a ] != NULL )
- this->Interactors[ a ]->Render( );
-}
-
-// -------------------------------------------------------------------------
-void idms::VolumeActors::
-RenderAuxiliaryInteractors( )
-{
- for(
- TInteractors::iterator iIt = this->AuxiliaryInteractors.begin( );
- iIt != this->AuxiliaryInteractors.end( );
- ++iIt
- )
- ( *iIt )->Render( );
-}
-
-// -------------------------------------------------------------------------
-void idms::VolumeActors::
-ResetCameras( )
-{
- double b[ 6 ];
- this->GetImageBounds( b );
- for( int a = 0; a < 3; ++a )
- {
- if( this->Interactors[ a ] == NULL )
- continue;
- vtkRenderer* ren = this->Interactors[ a ]->GetRenderWindow( )->
- GetRenderers( )->GetFirstRenderer( );
- if( ren != NULL ) ren->ResetCamera( b );
-
- } // rof
-}
-
-// -------------------------------------------------------------------------
-idms::VolumeActors::
-VolumeActors( )
- : Superclass( ),
- Image( NULL ),
- Segmentation( NULL )
-{
- for( int a = 0; a < 3; ++a )
- this->Interactors[ a ] = NULL;
-
- this->ImageToWindowLevel =
- vtkSmartPointer< vtkImageMapToWindowLevelColors >::New( );
- this->ImageToWindowLevel->SetOutputFormatToLuminance( );
- this->SegmentationToColors =
- vtkSmartPointer< vtkImageMapToColors >::New( );
-
- this->Cursor = vtkSmartPointer< vtkSphereSource >::New( );
- this->CursorMapper = vtkSmartPointer< vtkPolyDataMapper >::New( );
- this->CursorActor = vtkSmartPointer< vtkActor >::New( );
-
- this->Cursor->SetPhiResolution( 36 );
- this->Cursor->SetThetaResolution( 36 );
- this->CursorMapper->SetInputConnection( this->Cursor->GetOutputPort( ) );
- this->CursorActor->SetMapper( this->CursorMapper );
- this->CursorActor->GetProperty( )->SetColor( 1, 1, 0 );
- this->CursorIndex = this->GetNumberOfItems( );
- this->AddItem( this->CursorActor );
-
- this->Region = vtkSmartPointer< vtkSphereSource >::New( );
- this->RegionMapper = vtkSmartPointer< vtkPolyDataMapper >::New( );
- this->RegionActor = vtkSmartPointer< vtkActor >::New( );
-
- this->Region->SetPhiResolution( 36 );
- this->Region->SetThetaResolution( 36 );
- this->RegionMapper->SetInputConnection( this->Region->GetOutputPort( ) );
- this->RegionActor->SetMapper( this->RegionMapper );
- this->RegionActor->GetProperty( )->SetColor( 0, 0, 1 );
- this->RegionActor->GetProperty( )->SetOpacity( 0 );
- this->RegionIndex = this->GetNumberOfItems( );
- this->AddItem( this->RegionActor );
-
- this->XPlaneIndex = this->GetNumberOfItems( );
- this->AddItem( this->Planes[ 0 ].ImageActor.GetPointer( ) );
- this->XTextIndex = this->GetNumberOfItems( );
- this->AddItem( this->Planes[ 0 ].TextActor.GetPointer( ) );
- this->XBoundsIndex = this->GetNumberOfItems( );
- this->AddItem( this->Planes[ 0 ].PlaneActor.GetPointer( ) );
-
- this->YPlaneIndex = this->GetNumberOfItems( );
- this->AddItem( this->Planes[ 1 ].ImageActor.GetPointer( ) );
- this->YTextIndex = this->GetNumberOfItems( );
- this->AddItem( this->Planes[ 1 ].TextActor.GetPointer( ) );
- this->YBoundsIndex = this->GetNumberOfItems( );
- this->AddItem( this->Planes[ 1 ].PlaneActor.GetPointer( ) );
-
- this->ZPlaneIndex = this->GetNumberOfItems( );
- this->AddItem( this->Planes[ 2 ].ImageActor.GetPointer( ) );
- this->ZTextIndex = this->GetNumberOfItems( );
- this->AddItem( this->Planes[ 2 ].TextActor.GetPointer( ) );
- this->ZBoundsIndex = this->GetNumberOfItems( );
- this->AddItem( this->Planes[ 2 ].PlaneActor.GetPointer( ) );
-}
-
-// -------------------------------------------------------------------------
-idms::VolumeActors::
-~VolumeActors( )
-{
-}
-
-// eof - $RCSfile$