this->m_UI->setupUi( this );
// Create and associate renderers
- this->m_MPRActors = vtkSmartPointer< TMPRActors >::New( );
-
- for( unsigned int i = 0; i < 4; ++i )
- {
- this->m_Renderers[ i ] = vtkSmartPointer< vtkRenderer >::New( );
- this->m_Renderers[ i ]->SetBackground( 0.1, 0.3, 0.8 );
-
- } // rof
- this->m_UI->m_XPlaneVTK->GetRenderWindow( )->AddRenderer( this->m_Renderers[ 0 ] );
- this->m_UI->m_YPlaneVTK->GetRenderWindow( )->AddRenderer( this->m_Renderers[ 1 ] );
- this->m_UI->m_ZPlaneVTK->GetRenderWindow( )->AddRenderer( this->m_Renderers[ 2 ] );
- this->m_UI->m_3DVTK->GetRenderWindow( )->AddRenderer( this->m_Renderers[ 3 ] );
+ this->m_MPRObjects = vtkSmartPointer< TMPRObjects >::New( );
+ this->m_MPRObjects->SetRenderWindows(
+ this->m_UI->m_XPlaneVTK->GetRenderWindow( ),
+ this->m_UI->m_YPlaneVTK->GetRenderWindow( ),
+ this->m_UI->m_ZPlaneVTK->GetRenderWindow( ),
+ this->m_UI->m_3DVTK->GetRenderWindow( )
+ );
// signals <-> slots
QObject::connect(
bool ImageMPR::
_LoadPlugins( const std::string& filename )
{
+ QApplication::setOverrideCursor( Qt::WaitCursor );
+ this->setEnabled( false );
+
this->m_ImageReaderClass = "";
this->m_ImageWriterClass = "";
this->m_MeshReaderClass = "";
} // fi
} // rof
+ QApplication::restoreOverrideCursor( );
+ this->setEnabled( true );
+
return( true );
}
dialog.setFileMode( QFileDialog::ExistingFiles );
dialog.setDirectory( tr( "." ) );
dialog.setNameFilter(
- tr( "Medical image files (*.mhd *.bin *.dcm *.nrri);;All files (*)" )
+ tr( "Medical image files (*.mhd *.bin *.dcm);;All files (*)" )
);
dialog.setDefaultSuffix( tr( "mhd" ) );
if( !( dialog.exec( ) ) )
reader->SetParameters( reader_params );
// Execute and get error message, if any
+ QApplication::setOverrideCursor( Qt::WaitCursor );
+ this->setEnabled( false );
std::string err = reader->Update( );
+ QApplication::restoreOverrideCursor( );
+ this->setEnabled( true );
// Assign fresh image, if any
if( err == "" )
{
- this->m_InputImage =
- dynamic_cast< TPluginImage* >( reader->GetOutput( 0 ) );
+ this->m_InputImage = reader->GetOutput< TPluginImage >( 0 );
reader->DisconnectOutputs( );
if( this->m_InputImage.IsNotNull( ) )
{
- this->m_MPRActors->SetInputData( this->m_InputImage->GetVTKImageData( ) );
- this->m_MPRActors->PushDataInto(
- this->m_Renderers[ 0 ],
- this->m_Renderers[ 1 ],
- this->m_Renderers[ 2 ],
- this->m_Renderers[ 3 ]
- );
-
- /*
- this->m_MPR.AssociatePlaneInteractor( 0, this->m_UI->m_XPlaneVTK->GetRenderWindow( )->GetInteractor( ) );
- this->m_MPR.AssociatePlaneInteractor( 1, this->m_UI->m_YPlaneVTK->GetRenderWindow( )->GetInteractor( ) );
- this->m_MPR.AssociatePlaneInteractor( 2, this->m_UI->m_ZPlaneVTK->GetRenderWindow( )->GetInteractor( ) );
- */
+ vtkImageData* vtk_id = this->m_InputImage->GetVTKImageData( );
+ if( vtk_id != NULL )
+ {
+ this->m_MPRObjects->SetImage( vtk_id );
+ this->m_MPRObjects->ResetCameras( );
+ this->m_MPRObjects->RenderAll( );
+ }
+ else
+ QMessageBox::critical(
+ this,
+ tr( "Error message" ),
+ tr( "Read image does not have a valid VTK converter." )
+ );
} // fi
- this->m_Renderers[ 0 ]->ResetCamera( );
- this->m_Renderers[ 1 ]->ResetCamera( );
- this->m_Renderers[ 2 ]->ResetCamera( );
- this->m_Renderers[ 3 ]->ResetCamera( );
-
- this->m_UI->m_XPlaneVTK->GetRenderWindow( )->Render( );
- this->m_UI->m_YPlaneVTK->GetRenderWindow( )->Render( );
- this->m_UI->m_ZPlaneVTK->GetRenderWindow( )->Render( );
- this->m_UI->m_3DVTK->GetRenderWindow( )->Render( );
}
else
QMessageBox::critical(
void ImageMPR::
_triggered_actionOpenInputPolyData( )
{
- /*
// Show dialog and check if it was accepted
QFileDialog dialog( this );
dialog.setFileMode( QFileDialog::ExistingFile );
- dialog.setDirectory( "." );
- dialog.setNameFilter( tr( "VTK file (*.vtk);;All files (*)" ) );
+ dialog.setDirectory( tr( "." ) );
+ dialog.setNameFilter(
+ tr( "Mesh files (*.vtk *.obj);;All files (*)" )
+ );
dialog.setDefaultSuffix( tr( "vtk" ) );
if( !( dialog.exec( ) ) )
return;
- std::string fname = dialog.selectedFiles( ).at( 0 ).toStdString( );
-
this->m_InputMesh = NULL;
// Get a reader from plugins
TPluginFilter::Pointer reader =
- this->m_Plugins.CreateProcessObject(
- this->m_BaseClasses[ "MeshReader" ]
- );
+ this->m_Plugins.CreateProcessObject( this->m_MeshReaderClass );
- // Configure plugin
+ // Configure reader
TParameters reader_params = reader->GetDefaultParameters( );
- reader_params.SetValueAsString( "FileName", fname );
+ QStringList q_fnames = dialog.selectedFiles( );
+ QStringList::const_iterator qIt = q_fnames.begin( );
+ for( ; qIt != q_fnames.end( ); ++qIt )
+ reader_params.SetValueAsString( "FileName", qIt->toStdString( ) );
reader->SetParameters( reader_params );
// Execute and get error message, if any
+ QApplication::setOverrideCursor( Qt::WaitCursor );
+ this->setEnabled( false );
std::string err = reader->Update( );
+ QApplication::restoreOverrideCursor( );
+ this->setEnabled( true );
+
// Assign fresh image, if any
if( err == "" )
{
- this->m_InputMesh =
- dynamic_cast< TPluginMesh* >( reader->GetOutput( 0 ) );
+ this->m_InputMesh = reader->GetOutput< TPluginMesh >( 0 );
reader->DisconnectOutputs( );
if( this->m_InputMesh.IsNotNull( ) )
{
- this->m_InputMeshMapper = vtkSmartPointer< vtkPolyDataMapper >::New( );
- this->m_InputMeshMapper->SetInputData( this->m_InputMesh->GetVTKPolyData( ) );
- this->m_InputMeshActor = vtkSmartPointer< vtkActor >::New( );
- this->m_InputMeshActor->SetMapper( this->m_InputMeshMapper );
- this->m_MPR->Add3DActor( this->m_InputMeshActor );
+ vtkActor* vtk_actor = this->m_InputMesh->GetVTKActor( );
+ if( vtk_actor != NULL )
+ {
+ this->m_MPRObjects->Get3DRenderer( )->AddActor( vtk_actor );
+ this->m_MPRObjects->Render( 4 );
+ }
+ else
+ QMessageBox::critical(
+ this,
+ tr( "Error message" ),
+ tr( "Read mesh does not have a valid vtkActor." )
+ );
} // fi
}
else
QMessageBox::critical(
this,
- tr( "Error reading polydata" ),
+ tr( "Error reading mesh" ),
tr( err.c_str( ) )
);
- */
}
// -------------------------------------------------------------------------
void ImageMPR::
_triggered_actionImageToImage( )
{
- /* TODO
if( this->m_InputImage.IsNull( ) )
return;
return;
// Execute filter
+ QApplication::setOverrideCursor( Qt::WaitCursor );
+ this->setEnabled( false );
filter->SetParameters( parameters );
filter->SetInput( 0, this->m_InputImage );
std::string err = filter->Update( );
+ QApplication::restoreOverrideCursor( );
+ this->setEnabled( true );
// Update image
if( err == "" )
{
- TPluginImage* result =
- dynamic_cast< TPluginImage* >( filter->GetOutput( 0 ) );
+ TPluginImage* result = filter->GetOutput< TPluginImage >( 0 );
result->DisconnectPipeline( );
this->m_InputImage = result;
if( this->m_InputImage.IsNotNull( ) )
- this->m_MPR->SetImage( this->m_InputImage->GetVTKImageData( ) );
+ this->m_MPRObjects->SetImage( this->m_InputImage->GetVTKImageData( ) );
}
else
QMessageBox::critical(
tr( "Error executing filter" ),
tr( err.c_str( ) )
);
- */
}
// -------------------------------------------------------------------------
return;
// Execute filter
+ QApplication::setOverrideCursor( Qt::WaitCursor );
+ this->setEnabled( false );
filter->SetParameters( parameters );
filter->SetInput( 0, this->m_InputImage );
std::string err = filter->Update( );
+ QApplication::restoreOverrideCursor( );
+ this->setEnabled( true );
// Update image
if( err == "" )
{
- /* TODO
- TPluginImage* result =
- dynamic_cast< TPluginImage* >( filter->GetOutput( 0 ) );
- result->DisconnectPipeline( );
- this->m_InputImage = result;
- if( this->m_InputImage.IsNotNull( ) )
- this->m_MPR->SetImage( this->m_InputImage->GetVTKImageData( ) );
- */
+ TPluginMesh* result = filter->GetOutput< TPluginMesh >( 0 );
+ result->DisconnectPipeline( );
+ this->m_InputMesh = result;
+ if( this->m_InputMesh.IsNotNull( ) )
+ this->m_MPRObjects->Get3DRenderer( )->AddActor(
+ this->m_InputMesh->GetVTKActor( )
+ );
}
else
QMessageBox::critical(
#include <QMainWindow>
// vtk stuff
-#include <vtkRenderer.h>
#include <vtkSmartPointer.h>
-#include <cpExtensions/Visualization/MPRActors.h>
+#include <cpExtensions/Visualization/MPRObjects.h>
// Plugins interface
#include <cpPlugins/Interface/Interface.h>
typedef cpPlugins::Interface::Parameters TParameters;
typedef std::set< std::string > TStringContainer;
- typedef cpExtensions::Visualization::MPRActors TMPRActors;
+ typedef cpExtensions::Visualization::MPRObjects TMPRObjects;
public:
explicit ImageMPR( QWidget* parent = 0 );
TPluginMesh::Pointer m_InputMesh;
// Visualization stuff
- vtkSmartPointer< TMPRActors > m_MPRActors;
- vtkSmartPointer< vtkRenderer > m_Renderers[ 4 ];
- vtkSmartPointer< vtkPolyDataMapper > m_InputMeshMapper;
- vtkSmartPointer< vtkActor > m_InputMeshActor;
+ vtkSmartPointer< TMPRObjects > m_MPRObjects;
/* TODO
vtkSmartPointer< vtkOrientationMarkerWidget > m_3DOrientationWidget;
)
TARGET_LINK_LIBRARIES(
${prog}
+ cpExtensions
cpPlugins_Interface
)
ENDFOREACH(prog)
#include <cpPlugins/Interface/Interface.h>
#include <cpPlugins/Interface/ProcessObject.h>
#include <cpPlugins/Interface/Image.h>
-#include <cpExtensions/Visualization/MPRObjects.h>
+#include <vtkSmartPointer.h>
+#include <vtkCommand.h>
#include <vtkRenderer.h>
#include <vtkRenderWindow.h>
#include <vtkRenderWindowInteractor.h>
+#include <vtkSliderRepresentation2D.h>
+#include <vtkSliderWidget.h>
+#include <cpExtensions/Visualization/MPRActors.h>
+
+// -------------------------------------------------------------------------
+typedef cpPlugins::Interface::Interface TInterface;
+typedef cpPlugins::Interface::ProcessObject TFilter;
+typedef cpPlugins::Interface::Parameters TParameters;
+typedef cpPlugins::Interface::Image TImage;
+
+typedef cpExtensions::Visualization::MPRActors TMPRActors;
+
+// -------------------------------------------------------------------------
+class SliderCallback
+ : public vtkCommand
+{
+public:
+ static SliderCallback* New( )
+ {
+ return new SliderCallback;
+ }
+ virtual void Execute( vtkObject* caller, unsigned long eId , void* data )
+ {
+ vtkSliderWidget* wdg =
+ reinterpret_cast< vtkSliderWidget* >( caller );
+ if( wdg == NULL )
+ return;
+ vtkSliderRepresentation* rep =
+ static_cast< vtkSliderRepresentation* >(
+ wdg->GetRepresentation( )
+ );
+ if( rep == NULL )
+ return;
+ std::string title = rep->GetTitleText( );
+ if( title == "X" )
+ this->Actors->SetSlice( 0, int( rep->GetValue( ) ) );
+ else if( title == "Y" )
+ this->Actors->SetSlice( 1, int( rep->GetValue( ) ) );
+ else if( title == "Z" )
+ this->Actors->SetSlice( 2, int( rep->GetValue( ) ) );
+ else if( title == "Window" )
+ this->Actors->SetWindow( rep->GetValue( ) );
+ else if( title == "Level" )
+ this->Actors->SetLevel( rep->GetValue( ) );
+ }
+ SliderCallback( )
+ : vtkCommand( )
+ {
+ }
+
+public:
+ TMPRActors* Actors;
+};
+
+// -------------------------------------------------------------------------
+struct Slider
+{
+ vtkSmartPointer< vtkSliderRepresentation2D > Representation;
+ vtkSmartPointer< vtkSliderWidget > Widget;
+
+ Slider(
+ double min_value,
+ double max_value,
+ double value,
+ const std::string& title,
+ vtkRenderWindowInteractor* iren,
+ double p1x, double p1y, double p2x, double p2y,
+ SliderCallback* callback = NULL
+ )
+ {
+ this->Representation =
+ vtkSmartPointer< vtkSliderRepresentation2D >::New( );
+ this->Representation->SetMinimumValue( min_value );
+ this->Representation->SetMaximumValue( max_value );
+ this->Representation->SetValue( value );
+ this->Representation->SetTitleText( title.c_str( ) );
+ this->Representation->GetPoint1Coordinate( )->
+ SetCoordinateSystemToNormalizedDisplay();
+ this->Representation->GetPoint1Coordinate( )->
+ SetValue( p1x, p1y );
+ this->Representation->GetPoint2Coordinate( )->
+ SetCoordinateSystemToNormalizedDisplay();
+ this->Representation->GetPoint2Coordinate( )->SetValue( p2x, p2y );
+
+ this->Widget = vtkSmartPointer< vtkSliderWidget >::New( );
+ this->Widget->SetInteractor( iren );
+ this->Widget->SetRepresentation( this->Representation );
+ this->Widget->SetAnimationModeToAnimate( );
+ this->Widget->EnabledOn( );
+ if( callback != NULL )
+ this->Widget->AddObserver( vtkCommand::InteractionEvent, callback );
+ }
+};
+
+// -------------------------------------------------------------------------
int main( int argc, char* argv[] )
{
if( argc < 3 )
std::string plugins_file = argv[ 1 ];
// Create interface
- typedef cpPlugins::Interface::Interface TInterface;
- typedef TInterface::TClasses TClasses;
-
TInterface plugins;
plugins.Load( plugins_file );
- // Create objects
- typedef cpPlugins::Interface::ProcessObject TProcessObject;
- typedef cpPlugins::Interface::Parameters TParameters;
- cpPlugins::Interface::ProcessObject::Pointer reader;
- reader = plugins.CreateProcessObject( "cpPlugins::ImageReader" );
+ // Create reader
+ TFilter::Pointer reader =
+ plugins.CreateProcessObject( "cpPlugins::ImageReader" );
if( reader.IsNull( ) )
{
- std::cerr << "No suitable reader found in plugins." << std::endl;
+ std::cerr << "No suitable image reader found in plugins." << std::endl;
return( 1 );
} // fi
return( 1 );
} // fi
- cpPlugins::Interface::Image* image =
- dynamic_cast< cpPlugins::Interface::Image* >( reader->GetOutput( 0 ) );
- vtkImageData* vtk_image = image->GetVTKImageData( );
- if( vtk_image == NULL )
+
+ // Get input image's vtk representation
+ vtkImageData* image = reader->GetOutput< TImage >( 0 )->GetVTKImageData( );
+ if( image == NULL )
{
std::cerr
<< "ERROR: read image does not have a valid VTK conversion."
interactor->SetRenderWindow( window );
// Actors
- cpExtensions::Visualization::MPRObjects mpr;
- mpr.SetImage( vtk_image );
- /*
- mpr.AssociatePlaneInteractor( 0, interactor );
- mpr.AssociatePlaneInteractor( 1, interactor );
- mpr.AssociatePlaneInteractor( 2, interactor );
- */
+ vtkSmartPointer< TMPRActors > mpr_actors =
+ vtkSmartPointer< TMPRActors >::New( );
+ mpr_actors->SetInputData( image );
+ mpr_actors->PushDataInto( NULL, NULL, NULL, renderer );
+
+ // Callbacks
+ vtkSmartPointer< SliderCallback > cb =
+ vtkSmartPointer< SliderCallback >::New( );
+ cb->Actors = mpr_actors;
+
+ Slider x_slider(
+ mpr_actors->GetSliceNumberMinValue( 0 ),
+ mpr_actors->GetSliceNumberMaxValue( 0 ),
+ mpr_actors->GetSliceNumberMinValue( 0 ),
+ "X", interactor,
+ 0.100, 0.15, 0.290, 0.15, cb
+ );
+ Slider y_slider(
+ mpr_actors->GetSliceNumberMinValue( 1 ),
+ mpr_actors->GetSliceNumberMaxValue( 1 ),
+ mpr_actors->GetSliceNumberMinValue( 1 ),
+ "Y", interactor,
+ 0.300, 0.15, 0.490, 0.15, cb
+ );
+ Slider z_slider(
+ mpr_actors->GetSliceNumberMinValue( 2 ),
+ mpr_actors->GetSliceNumberMaxValue( 2 ),
+ mpr_actors->GetSliceNumberMinValue( 2 ),
+ "Z", interactor,
+ 0.500, 0.15, 0.690, 0.15, cb
+ );
+ Slider w_slider(
+ mpr_actors->GetMinWindow( ),
+ mpr_actors->GetMaxWindow( ),
+ mpr_actors->GetWindow( ),
+ "Window", interactor,
+ 0.100, 0.05, 0.290, 0.05, cb
+ );
+ Slider l_slider(
+ mpr_actors->GetMinWindow( ),
+ mpr_actors->GetMaxWindow( ),
+ mpr_actors->GetWindow( ),
+ "Level", interactor,
+ 0.300, 0.05, 0.490, 0.05, cb
+ );
// Begin interaction
renderer->ResetCamera( );
// Create objects
typedef cpPlugins::Interface::ProcessObject TProcessObject;
+ typedef cpPlugins::Interface::DataObject TDataObject;
typedef cpPlugins::Interface::Parameters TParameters;
cpPlugins::Interface::ProcessObject::Pointer reader, writer, mc;
reader = plugins.CreateProcessObject( "cpPlugins::ImageReader" );
writer->SetParameters( writer_params );
// Connect pipeline
- mc->SetInput( 0, reader->GetOutput( 0 ) );
- writer->SetInput( 0, mc->GetOutput( 0 ) );
+ mc->SetInput( 0, reader->GetOutput< TDataObject >( 0 ) );
+ writer->SetInput( 0, mc->GetOutput< TDataObject >( 0 ) );
// Execute pipeline
std::string err = writer->Update( );
// Create objects
typedef cpPlugins::Interface::ProcessObject TProcessObject;
+ typedef cpPlugins::Interface::DataObject TDataObject;
typedef cpPlugins::Interface::Parameters TParameters;
cpPlugins::Interface::ProcessObject::Pointer reader, writer, otsu;
reader = plugins.CreateProcessObject( "cpPlugins::ImageReader" );
writer->SetParameters( writer_params );
// Connect pipeline
- otsu->SetInput( 0, reader->GetOutput( 0 ) );
- writer->SetInput( 0, otsu->GetOutput( 0 ) );
+ otsu->SetInput( 0, reader->GetOutput< TDataObject >( 0 ) );
+ writer->SetInput( 0, otsu->GetOutput< TDataObject >( 0 ) );
// Execute pipeline
std::string err = writer->Update( );
// Create objects
typedef cpPlugins::Interface::ProcessObject TProcessObject;
+ typedef cpPlugins::Interface::DataObject TDataObject;
typedef cpPlugins::Interface::Parameters TParameters;
cpPlugins::Interface::ProcessObject::Pointer reader, writer, filter;
reader = plugins.CreateProcessObject( "cpPlugins::ImageReader" );
writer->SetParameters( writer_params );
// Connect pipeline
- filter->SetInput( 0, reader->GetOutput( 0 ) );
- writer->SetInput( 0, filter->GetOutput( 0 ) );
+ filter->SetInput( 0, reader->GetOutput< TDataObject >( 0 ) );
+ writer->SetInput( 0, filter->GetOutput< TDataObject >( 0 ) );
// Execute pipeline
std::string err = writer->Update( );
// Create objects
typedef cpPlugins::Interface::ProcessObject TProcessObject;
+ typedef cpPlugins::Interface::DataObject TDataObject;
typedef cpPlugins::Interface::Parameters TParameters;
cpPlugins::Interface::ProcessObject::Pointer reader, writer, filter;
reader = plugins.CreateProcessObject( "cpPlugins::ImageReader" );
writer->SetParameters( writer_params );
// Connect pipeline
- filter->SetInput( 0, reader->GetOutput( 0 ) );
- writer->SetInput( 0, filter->GetOutput( 0 ) );
+ filter->SetInput( 0, reader->GetOutput< TDataObject >( 0 ) );
+ writer->SetInput( 0, filter->GetOutput< TDataObject >( 0 ) );
// Execute pipeline
std::string err = writer->Update( );
// Create objects
typedef cpPlugins::Interface::ProcessObject TProcessObject;
+ typedef cpPlugins::Interface::DataObject TDataObject;
typedef cpPlugins::Interface::Parameters TParameters;
cpPlugins::Interface::ProcessObject::Pointer reader, writer;
reader = plugins.CreateProcessObject( "cpPlugins::ImageReader" );
writer->SetParameters( writer_params );
// Connect pipeline
- writer->SetInput( 0, reader->GetOutput( 0 ) );
+ writer->SetInput( 0, reader->GetOutput< TDataObject >( 0 ) );
// Execute pipeline
std::string err = writer->Update( );
} // fi
- dynamic_cast< cpPlugins::Interface::Image* >( reader->GetOutput( 0 ) )->GetVTKImageData( )->Print( std::cout );
-
return( 0 );
}
int s = this->m_SliceActors->GetSliceNumber( ) + off;
int maxs = this->m_SliceActors->GetSliceNumberMaxValue( );
this->m_SliceActors->SetSliceNumber( ( s < maxs )? s: maxs );
+ this->m_MPRActors->SetSlice(
+ this->m_SliceActors->GetAxis( ),
+ this->m_SliceActors->GetSliceNumber( )
+ );
this->Interactor->Render( );
this->_RenderAssociateInteractors( );
}
int s = this->m_SliceActors->GetSliceNumber( ) - off;
int mins = this->m_SliceActors->GetSliceNumberMinValue( );
this->m_SliceActors->SetSliceNumber( ( mins < s )? s: mins );
+ this->m_MPRActors->SetSlice(
+ this->m_SliceActors->GetAxis( ),
+ this->m_SliceActors->GetSliceNumber( )
+ );
this->Interactor->Render( );
this->_RenderAssociateInteractors( );
}
GetSliceActors( const int& i ) const
{
if( i < 3 )
- return( this->Slices[ i ] );
+ return( this->Slices[ 0 ][ i ] );
else
return( NULL );
}
// -------------------------------------------------------------------------
void cpExtensions::Visualization::MPRActors::
-PushDataInto( vtkRenderer* x, vtkRenderer* y, vtkRenderer* z, vtkRenderer* w )
+PushDataInto(
+ vtkRenderer* x, vtkRenderer* y, vtkRenderer* z, vtkRenderer* w
+ )
{
vtkRenderer* rends[] = { x, y, z };
for( int i = 0; i < 3; ++i )
{
if( rends[ i ] != NULL )
{
- rends[ i ]->AddActor( this->Slices[ i ]->GetImageActor( ) );
- rends[ i ]->AddActor( this->Slices[ i ]->GetTextActor( ) );
+ rends[ i ]->AddActor( this->Slices[ 0 ][ i ]->GetImageActor( ) );
+ rends[ i ]->AddActor( this->Slices[ 0 ][ i ]->GetTextActor( ) );
for( int j = 0; j < 3; ++j )
- rends[ i ]->AddActor( this->Slices[ j ]->GetPlaneActor( ) );
- if( w != NULL )
- {
- w->AddActor( this->Slices[ i ]->GetImageActor( ) );
- w->AddActor( this->Slices[ i ]->GetPlaneActor( ) );
+ rends[ i ]->AddActor( this->Slices[ 0 ][ j ]->GetPlaneActor( ) );
- } // fi
+ } // fi
+ if( w != NULL )
+ {
+ w->AddActor( this->Slices[ 1 ][ i ]->GetImageActor( ) );
+ w->AddActor( this->Slices[ 1 ][ i ]->GetPlaneActor( ) );
} // fi
} // rof
-
if( w != NULL )
w->AddActor( this->ImageOutlineActor );
}
{
if( rends[ i ] != NULL )
{
- rends[ i ]->RemoveActor( this->Slices[ i ]->GetImageActor( ) );
- rends[ i ]->RemoveActor( this->Slices[ i ]->GetTextActor( ) );
+ rends[ i ]->RemoveActor( this->Slices[ 0 ][ i ]->GetImageActor( ) );
+ rends[ i ]->RemoveActor( this->Slices[ 0 ][ i ]->GetTextActor( ) );
for( int j = 0; j < 3; ++j )
- rends[ i ]->RemoveActor( this->Slices[ j ]->GetPlaneActor( ) );
+ rends[ i ]->RemoveActor( this->Slices[ 0 ][ j ]->GetPlaneActor( ) );
if( w != NULL )
{
- w->RemoveActor( this->Slices[ i ]->GetImageActor( ) );
- w->RemoveActor( this->Slices[ i ]->GetPlaneActor( ) );
+ w->RemoveActor( this->Slices[ 1 ][ i ]->GetImageActor( ) );
+ w->RemoveActor( this->Slices[ 1 ][ i ]->GetPlaneActor( ) );
} // fi
} // rof
if( w != NULL )
- {
w->RemoveActor( this->ImageOutlineActor );
-
- } // fi
}
// -------------------------------------------------------------------------
int cpExtensions::Visualization::MPRActors::
GetSliceNumberMinValue( const int& axis ) const
{
- return( this->Slices[ axis ]->GetSliceNumberMinValue( ) );
+ return( this->Slices[ 0 ][ axis ]->GetSliceNumberMinValue( ) );
}
// -------------------------------------------------------------------------
int cpExtensions::Visualization::MPRActors::
GetSliceNumberMaxValue( const int& axis ) const
{
- return( this->Slices[ axis ]->GetSliceNumberMaxValue( ) );
+ return( this->Slices[ 0 ][ axis ]->GetSliceNumberMaxValue( ) );
}
// -------------------------------------------------------------------------
int cpExtensions::Visualization::MPRActors::
GetSlice( const int& axis ) const
{
- return( this->Slices[ axis ]->GetSliceNumber( ) );
+ return( this->Slices[ 0 ][ axis ]->GetSliceNumber( ) );
}
// -------------------------------------------------------------------------
real = ext[ ( axis << 1 ) + 1 ];
// Change slice
- this->Slices[ axis ]->SetSliceNumber( real );
+ this->Slices[ 0 ][ axis ]->SetSliceNumber( real );
+ this->Slices[ 1 ][ axis ]->SetSliceNumber( real );
this->Modified( );
}
{
this->ImageMapToColors = vtkSmartPointer< vtkImageMapToColors >::New( );
this->ImageOutlineActor = vtkSmartPointer< vtkActor >::New( );
- this->Slices[ 0 ] = vtkSmartPointer< _TSlice >::New( );
- this->Slices[ 1 ] = vtkSmartPointer< _TSlice >::New( );
- this->Slices[ 2 ] = vtkSmartPointer< _TSlice >::New( );
+ this->Slices[ 0 ][ 0 ] = vtkSmartPointer< _TSlice >::New( );
+ this->Slices[ 0 ][ 1 ] = vtkSmartPointer< _TSlice >::New( );
+ this->Slices[ 0 ][ 2 ] = vtkSmartPointer< _TSlice >::New( );
+ this->Slices[ 1 ][ 0 ] = vtkSmartPointer< _TSlice >::New( );
+ this->Slices[ 1 ][ 1 ] = vtkSmartPointer< _TSlice >::New( );
+ this->Slices[ 1 ][ 2 ] = vtkSmartPointer< _TSlice >::New( );
}
// -------------------------------------------------------------------------
return;
this->ImageMapToColors->Update( );
- for( int i = 0; i < 3; ++i )
+ for( int j = 0; j < 2; ++j )
{
- this->Slices[ i ]->SetInputConnection(
- this->ImageMapToColors->GetOutputPort( ), i
- );
- this->Slices[ i ]->UpdateText( );
+ for( int i = 0; i < 3; ++i )
+ {
+ this->Slices[ j ][ i ]->SetInputConnection(
+ this->ImageMapToColors->GetOutputPort( ), i
+ );
+ this->Slices[ j ][ i ]->UpdateText( );
+
+ } // rof
} // rof
typedef
cpExtensions::Visualization::ImageSliceActors
_TSlice;
- vtkSmartPointer< _TSlice > Slices[ 3 ];
+ vtkSmartPointer< _TSlice > Slices[ 2 ][ 3 ];
unsigned int ImageOutlineActorIndex;
};
-#include <cpExtensions/Visualization/MPRWithDifferentWindows.h>
-#include <vtkCamera.h>
+#include <cpExtensions/Visualization/MPRObjects.h>
// -------------------------------------------------------------------------
-cpExtensions::Visualization::MPRWithDifferentWindows::
-MPRWithDifferentWindows(
- vtkRenderWindow* xWin,
- vtkRenderWindow* yWin,
- vtkRenderWindow* zWin,
- vtkRenderWindow* auxWin
- )
+cpExtensions::Visualization::MPRObjects*
+cpExtensions::Visualization::MPRObjects::
+New( )
{
- this->m_Windows[ 0 ] = xWin;
- this->m_Windows[ 1 ] = yWin;
- this->m_Windows[ 2 ] = zWin;
- this->m_Windows[ 3 ] = auxWin;
+ return( new Self( ) );
+}
- // Prepare actors
- this->m_MPRActors = vtkSmartPointer< TMPRActors >::New( );
+// -------------------------------------------------------------------------
+void cpExtensions::Visualization::MPRObjects::
+SetRenderWindows(
+ vtkRenderWindow* wx, vtkRenderWindow* wy,
+ vtkRenderWindow* wz, vtkRenderWindow* w3D
+ )
+{
+ this->m_Windows[ 0 ] = wx;
+ this->m_Windows[ 1 ] = wy;
+ this->m_Windows[ 2 ] = wz;
+ this->m_Windows[ 3 ] = w3D;
// Prepare renderers
for( int i = 0; i < 4; ++i )
}
// -------------------------------------------------------------------------
-cpExtensions::Visualization::MPRWithDifferentWindows::
-~MPRWithDifferentWindows( )
-{
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::Visualization::MPRWithDifferentWindows::
+void cpExtensions::Visualization::MPRObjects::
SetImage( vtkImageData* image )
{
this->m_MPRActors->SetInputData( image );
}
// -------------------------------------------------------------------------
-void cpExtensions::Visualization::MPRWithDifferentWindows::
-SetModeToNavigation( )
-{
- for( unsigned int i = 0; i < 3; ++i )
- {
- if( this->m_Styles[ i ].GetPointer( ) != NULL )
- this->m_Styles[ i ]->SetModeToNavigation( );
-
- } // rof
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::Visualization::MPRWithDifferentWindows::
-SetModeToDeformation( )
-{
- for( unsigned int i = 0; i < 3; ++i )
- {
- if( this->m_Styles[ i ].GetPointer( ) != NULL )
- this->m_Styles[ i ]->SetModeToDeformation( );
-
- } // rof
-}
-
-// -------------------------------------------------------------------------
-void cpExtensions::Visualization::MPRWithDifferentWindows::
+void cpExtensions::Visualization::MPRObjects::
ResetCamera( const int& id )
{
if( id < 4 )
}
// -------------------------------------------------------------------------
-void cpExtensions::Visualization::MPRWithDifferentWindows::
+void cpExtensions::Visualization::MPRObjects::
ResetCameras( )
{
for( int i = 0; i < 4; ++i )
}
// -------------------------------------------------------------------------
-void cpExtensions::Visualization::MPRWithDifferentWindows::
+void cpExtensions::Visualization::MPRObjects::
Render( const int& id )
{
if( id < 4 )
}
// -------------------------------------------------------------------------
-void cpExtensions::Visualization::MPRWithDifferentWindows::
+void cpExtensions::Visualization::MPRObjects::
RenderAll( )
{
for( int i = 0; i < 4; ++i )
}
// -------------------------------------------------------------------------
-vtkRenderer* cpExtensions::Visualization::MPRWithDifferentWindows::
-GetRenderer( const int& id ) const
+vtkRenderer* cpExtensions::Visualization::MPRObjects::
+GetXRenderer( )
{
- if( id < 4 )
- return( this->m_Renderers[ id ] );
- else
- return( NULL );
+ return( this->m_Renderers[ 0 ] );
}
// -------------------------------------------------------------------------
-void cpExtensions::Visualization::MPRWithDifferentWindows::
-Add3DActor( vtkProp3D* prop )
+vtkRenderer* cpExtensions::Visualization::MPRObjects::
+GetYRenderer( )
{
- if( this->m_Renderers[ 3 ] != NULL )
- {
- this->m_Renderers[ 3 ]->AddActor( prop );
- this->ResetCamera( 3 );
- this->Render( 3 );
+ return( this->m_Renderers[ 1 ] );
+}
- } // fi
+// -------------------------------------------------------------------------
+vtkRenderer* cpExtensions::Visualization::MPRObjects::
+GetZRenderer( )
+{
+ return( this->m_Renderers[ 2 ] );
+}
+
+// -------------------------------------------------------------------------
+vtkRenderer* cpExtensions::Visualization::MPRObjects::
+Get3DRenderer( )
+{
+ return( this->m_Renderers[ 3 ] );
+}
+
+// -------------------------------------------------------------------------
+const vtkRenderer* cpExtensions::Visualization::MPRObjects::
+GetXRenderer( ) const
+{
+ return( this->m_Renderers[ 0 ] );
+}
+
+// -------------------------------------------------------------------------
+const vtkRenderer* cpExtensions::Visualization::MPRObjects::
+GetYRenderer( ) const
+{
+ return( this->m_Renderers[ 1 ] );
+}
+
+// -------------------------------------------------------------------------
+const vtkRenderer* cpExtensions::Visualization::MPRObjects::
+GetZRenderer( ) const
+{
+ return( this->m_Renderers[ 2 ] );
+}
+
+// -------------------------------------------------------------------------
+const vtkRenderer* cpExtensions::Visualization::MPRObjects::
+Get3DRenderer( ) const
+{
+ return( this->m_Renderers[ 3 ] );
+}
+
+// -------------------------------------------------------------------------
+cpExtensions::Visualization::MPRObjects::
+MPRObjects( )
+ : vtkObject( )
+{
+ // Prepare actors
+ this->m_MPRActors = vtkSmartPointer< TMPRActors >::New( );
+}
+
+// -------------------------------------------------------------------------
+cpExtensions::Visualization::MPRObjects::
+~MPRObjects( )
+{
}
// eof - $RCSfile$
--- /dev/null
+#ifndef __CPEXTENSIONS__VISUALIZATION__MPROBJECTS__H__
+#define __CPEXTENSIONS__VISUALIZATION__MPROBJECTS__H__
+
+#include <cpExtensions/cpExtensions_Export.h>
+#include <cpExtensions/Visualization/MPRActors.h>
+#include <cpExtensions/Visualization/ImageInteractorStyle.h>
+
+#include <vtkObject.h>
+#include <vtkRenderer.h>
+#include <vtkRenderWindow.h>
+
+namespace cpExtensions
+{
+ namespace Visualization
+ {
+ /**
+ */
+ class cpExtensions_EXPORT MPRObjects
+ : public vtkObject
+ {
+ public:
+ typedef MPRObjects Self;
+ typedef cpExtensions::Visualization::MPRActors TMPRActors;
+ typedef cpExtensions::Visualization::ImageInteractorStyle TStyle;
+
+ public:
+ vtkTypeMacro( MPRObjects, vtkObject );
+
+ public:
+ // Creation
+ static MPRObjects* New( );
+
+ void SetRenderWindows(
+ vtkRenderWindow* wx, vtkRenderWindow* wy,
+ vtkRenderWindow* wz, vtkRenderWindow* w3D
+ );
+
+ void SetImage( vtkImageData* image );
+ void ResetCamera( const int& id );
+ void ResetCameras( );
+ void Render( const int& id );
+ void RenderAll( );
+ vtkRenderer* GetXRenderer( );
+ vtkRenderer* GetYRenderer( );
+ vtkRenderer* GetZRenderer( );
+ vtkRenderer* Get3DRenderer( );
+ const vtkRenderer* GetXRenderer( ) const;
+ const vtkRenderer* GetYRenderer( ) const;
+ const vtkRenderer* GetZRenderer( ) const;
+ const vtkRenderer* Get3DRenderer( ) const;
+
+ protected:
+ MPRObjects( );
+ virtual ~MPRObjects( );
+
+ private:
+ // Purposely not implemented
+ MPRObjects( const Self& );
+ Self& operator=( const Self& );
+
+ protected:
+ // Inputs
+ vtkSmartPointer< vtkRenderWindow > m_Windows[ 4 ];
+
+ // Internal pipelines
+ vtkSmartPointer< TMPRActors > m_MPRActors;
+ vtkSmartPointer< vtkRenderer > m_Renderers[ 4 ];
+ vtkSmartPointer< TStyle > m_Styles[ 3 ];
+ };
+
+ } // ecapseman
+
+} // ecapseman
+
+#endif // __CPEXTENSIONS__VISUALIZATION__MPROBJECTS__H__
+
+// eof - $RCSfile$
+++ /dev/null
-#ifndef __CPEXTENSIONS__VISUALIZATION__MPRWITHDIFFERENTWINDOWS__H__
-#define __CPEXTENSIONS__VISUALIZATION__MPRWITHDIFFERENTWINDOWS__H__
-
-#include <cpExtensions/Visualization/MPRActors.h>
-#include <cpExtensions/Visualization/ImageInteractorStyle.h>
-#include <cpExtensions/cpExtensions_Export.h>
-
-#include <vtkImageData.h>
-#include <vtkRenderer.h>
-#include <vtkRenderWindow.h>
-#include <vtkSmartPointer.h>
-
-// -------------------------------------------------------------------------
-#define cpPlugins_MPRWithDifferentWindows_ObserverMacro( e ) \
- inline void Add##e##Observer( vtkCommand* observer ) \
- { \
- for( int i = 0; i < 3; ++i ) \
- if( this->m_Styles[ i ].GetPointer( ) != NULL ) \
- this->m_Styles[ i ]->Add##e##Observer( observer ); \
- } \
- inline void Remove##e##Observer( vtkCommand* observer ) \
- { \
- for( int i = 0; i < 3; ++i ) \
- if( this->m_Styles[ i ].GetPointer( ) != NULL ) \
- this->m_Styles[ i ]->Remove##e##Observer( observer ); \
- } \
- inline void Remove##e##Observers( ) \
- { \
- for( int i = 0; i < 3; ++i ) \
- if( this->m_Styles[ i ].GetPointer( ) != NULL ) \
- this->m_Styles[ i ]->Remove##e##Observers( ); \
- }
-
-namespace cpExtensions
-{
- namespace Visualization
- {
- /**
- */
- class cpExtensions_EXPORT MPRWithDifferentWindows
- {
- public:
- typedef cpExtensions::Visualization::
- MPRActors TMPRActors;
- typedef cpExtensions::Visualization::
- ImageInteractorStyle TStyle;
-
- public:
- cpPlugins_MPRWithDifferentWindows_ObserverMacro( DoubleClick );
- cpPlugins_MPRWithDifferentWindows_ObserverMacro( Cursor );
- cpPlugins_MPRWithDifferentWindows_ObserverMacro( Radius );
-
- public:
- MPRWithDifferentWindows(
- vtkRenderWindow* xWin = NULL,
- vtkRenderWindow* yWin = NULL,
- vtkRenderWindow* zWin = NULL,
- vtkRenderWindow* auxWin = NULL
- );
- virtual ~MPRWithDifferentWindows( );
-
- void SetImage( vtkImageData* image );
- void SetModeToNavigation( );
- void SetModeToDeformation( );
-
- void ResetCamera( const int& id );
- void ResetCameras( );
- void Render( const int& id );
- void RenderAll( );
-
- vtkRenderer* GetRenderer( const int& id ) const;
-
- void Add3DActor( vtkProp3D* prop );
-
- protected:
- // Inputs
- vtkRenderWindow* m_Windows[ 4 ];
-
- // Internal pipelines
- vtkSmartPointer< TMPRActors > m_MPRActors;
- vtkSmartPointer< vtkRenderer > m_Renderers[ 4 ];
- vtkSmartPointer< TStyle > m_Styles[ 3 ];
- };
-
- } // ecapseman
-
-} // ecapseman
-
-#endif // __CPEXTENSIONS__VISUALIZATION__MPRWITHDIFFERENTWINDOWS__H__
-
-
-// eof - $RCSfile$
SetVTKMesh( vtkPolyData* mesh )
{
this->m_VTKObject = mesh;
+
+ this->m_Mapper = vtkSmartPointer< vtkPolyDataMapper >::New( );
+ this->m_Actor = vtkSmartPointer< vtkActor >::New( );
+
+ this->m_Mapper->SetInputData( mesh );
+ this->m_Actor->SetMapper( this->m_Mapper );
+
this->Modified( );
}
);
}
+// -------------------------------------------------------------------------
+vtkActor* cpPlugins::Interface::Mesh::
+GetVTKActor( )
+{
+ return( this->m_Actor );
+}
+
+// -------------------------------------------------------------------------
+const vtkActor* cpPlugins::Interface::Mesh::
+GetVTKActor( ) const
+{
+ return( this->m_Actor );
+}
+
// -------------------------------------------------------------------------
cpPlugins::Interface::Mesh::
Mesh( )
#include <cpPlugins/Interface/cpPlugins_Interface_Export.h>
#include <cpPlugins/Interface/DataObject.h>
-class vtkPolyData;
+#include <vtkSmartPointer.h>
+#include <vtkActor.h>
+#include <vtkPolyData.h>
+#include <vtkPolyDataMapper.h>
namespace cpPlugins
{
virtual void SetVTKMesh( vtkPolyData* mesh );
virtual vtkPolyData* GetVTKMesh( );
virtual const vtkPolyData* GetVTKMesh( ) const;
+ virtual vtkActor* GetVTKActor( );
+ virtual const vtkActor* GetVTKActor( ) const;
protected:
Mesh( );
// Purposely not implemented
Mesh( const Self& );
Self& operator=( const Self& );
+
+ protected:
+ vtkSmartPointer< vtkActor > m_Actor;
+ vtkSmartPointer< vtkPolyDataMapper > m_Mapper;
};
} // ecapseman
#include <QHBoxLayout>
#include <QLabel>
#include <QLineEdit>
+#include <QTableWidget>
#include <QWidget>
// -------------------------------------------------------------------------
BoolList,
IntList,
UintList,
- RealList,
IndexList,
PointList,
NoType
v_double->setMaximum( std::numeric_limits< double >::max( ) );
v_double->setValue( parameters.GetValueAsReal( *nIt ) );
w_input = v_double;
+ }
+ else if( pt == Parameters::RealList )
+ {
+ QStringList header;
+ header << nIt->c_str( );
+
+ QTableWidget* l_double = new QTableWidget( dlg );
+ l_double->setColumnCount( 1 );
+ l_double->setRowCount( 1 );
+ l_double->setHorizontalHeaderLabels( header );
+ l_double->setShowGrid( true );
+ l_double->setSelectionBehavior( QAbstractItemView::SelectRows );
+ l_double->setSelectionMode( QAbstractItemView::SingleSelection );
+
+ QObject::connect(
+ l_double, SIGNAL( cellDoubleClicked( int, int ) ),
+ l_double, SLOT( insertRow( int ) )
+ );
+
+ w_input = l_double;
} // fi
dlg->findChild< QDoubleSpinBox* >( nIt->c_str( ) );
if( v_double != NULL )
parameters.SetValueAsReal( *nIt, v_double->value( ) );
+ }
+ else if( pt == Parameters::RealList )
+ {
+ QTableWidget* l_double =
+ dlg->findChild< QTableWidget* >( nIt->c_str( ) );
+ if( l_double != NULL )
+ {
+ for( int r = 0; r < l_double->rowCount( ); ++r )
+ {
+ double v =
+ std::atof(
+ l_double->item( r, 0 )->text( ).toStdString( ).c_str( )
+ );
+ parameters.AddValueToRealList( *nIt, v );
+
+ } // rof
+
+ } // fi
} // fi
} // fi
}
-// -------------------------------------------------------------------------
-cpPlugins::Interface::DataObject* cpPlugins::Interface::ProcessObject::
-GetOutput( unsigned int idx )
-{
- if( idx < this->m_Outputs.size( ) )
- return( this->m_Outputs[ idx ] );
- else
- return( NULL );
-}
-
// -------------------------------------------------------------------------
std::string cpPlugins::Interface::ProcessObject::
Update( )
virtual void SetNumberOfOutputs( unsigned int n );
virtual void SetInput( unsigned int idx, DataObject* dobj );
- virtual DataObject* GetOutput( unsigned int idx );
virtual std::string Update( );
virtual void DisconnectOutputs( );
- protected:
- ProcessObject( );
- virtual ~ProcessObject( );
-
- template< class O >
- inline void _MakeOutput( unsigned int idx );
-
template< class T >
- inline T* _Input( unsigned int idx );
+ inline T* GetInput( unsigned int idx );
template< class T >
- inline const T* _Input( unsigned int idx ) const;
+ inline const T* GetInput( unsigned int idx ) const;
template< class T >
- inline T* _Output( unsigned int idx );
+ inline T* GetOutput( unsigned int idx );
template< class T >
- inline const T* _Output( unsigned int idx ) const;
+ inline const T* GetOutput( unsigned int idx ) const;
+
+ protected:
+ ProcessObject( );
+ virtual ~ProcessObject( );
+
+ template< class O >
+ inline void _MakeOutput( unsigned int idx );
virtual std::string _GenerateData( ) = 0;
#ifndef __CPPLUGINS__INTERFACE__PROCESSOBJECT__HXX__
#define __CPPLUGINS__INTERFACE__PROCESSOBJECT__HXX__
-// -------------------------------------------------------------------------
-template< class O >
-void cpPlugins::Interface::ProcessObject::
-_MakeOutput( unsigned int idx )
-{
- if( idx >= this->m_Outputs.size( ) )
- return;
- this->m_Outputs[ idx ] = O::New( );
- this->m_Outputs[ idx ]->SetSource( this );
-}
-
// -------------------------------------------------------------------------
template< class T >
T* cpPlugins::Interface::ProcessObject::
-_Input( unsigned int idx )
+GetInput( unsigned int idx )
{
if( idx < this->m_Inputs.size( ) )
return( dynamic_cast< T* >( this->m_Inputs[ idx ].GetPointer( ) ) );
// -------------------------------------------------------------------------
template< class T >
const T* cpPlugins::Interface::ProcessObject::
-_Input( unsigned int idx ) const
+GetInput( unsigned int idx ) const
{
if( idx < this->m_Inputs.size( ) )
return(
// -------------------------------------------------------------------------
template< class T >
T* cpPlugins::Interface::ProcessObject::
-_Output( unsigned int idx )
+GetOutput( unsigned int idx )
{
if( idx < this->m_Outputs.size( ) )
return( dynamic_cast< T* >( this->m_Outputs[ idx ].GetPointer( ) ) );
// -------------------------------------------------------------------------
template< class T >
const T* cpPlugins::Interface::ProcessObject::
-_Output( unsigned int idx ) const
+GetOutput( unsigned int idx ) const
{
if( idx < this->m_Outputs.size( ) )
return(
return( NULL );
}
+// -------------------------------------------------------------------------
+template< class O >
+void cpPlugins::Interface::ProcessObject::
+_MakeOutput( unsigned int idx )
+{
+ if( idx >= this->m_Outputs.size( ) )
+ return;
+ this->m_Outputs[ idx ] = O::New( );
+ this->m_Outputs[ idx ]->SetSource( this );
+}
+
#endif // __CPPLUGINS__INTERFACE__PROCESSOBJECT__HXX__
// eof - $RCSfile$
{
io->SetFileName( names[ 0 ] );
io->ReadImageInformation( );
- if( names.size( ) == 1 )
+ if( names.size( ) >= 1 )
{
switch( io->GetNumberOfDimensions( ) )
{
case 3: r = this->_GD0< 3 >( io, names ); break;
case 4: r = this->_GD0< 4 >( io, names ); break;
default:
- r = "ImageReader: Single image dimension not supported.";
- break;
- } // hctiws
- }
- else if( names.size( ) > 1 )
- {
- switch( io->GetNumberOfDimensions( ) )
- {
- case 1: r = this->_GD0< 2 >( io, names ); break;
- case 2: r = this->_GD0< 3 >( io, names ); break;
- case 3: r = this->_GD0< 4 >( io, names ); break;
- default:
- r = "ImageReader: Multiple images dimension not supported.";
+ r = "ImageReader: Image dimension not supported.";
break;
} // hctiws
case itk::ImageIOBase::SHORT:
r = this->_RealGD< itk::RGBPixel< short >, 2 >( names );
break;
+ case itk::ImageIOBase::UINT:
+ r = this->_RealGD< itk::RGBPixel< unsigned int >, 2 >( names );
+ break;
+ case itk::ImageIOBase::INT:
+ r = this->_RealGD< itk::RGBPixel< int >, 2 >( names );
+ break;
+ case itk::ImageIOBase::ULONG:
+ r = this->_RealGD< itk::RGBPixel< unsigned long >, 2 >( names );
+ break;
+ case itk::ImageIOBase::LONG:
+ r = this->_RealGD< itk::RGBPixel< long >, 2 >( names );
+ break;
+ case itk::ImageIOBase::FLOAT:
+ r = this->_RealGD< itk::RGBPixel< float >, 2 >( names );
+ break;
+ case itk::ImageIOBase::DOUBLE:
+ r = this->_RealGD< itk::RGBPixel< double >, 2 >( names );
+ break;
default:
- r = "ImageReader: Scalar pixel type not supported.";
+ r = "ImageReader: RGB pixel type not supported.";
break;
} // hctiws
}
case itk::ImageIOBase::SHORT:
r = this->_RealGD< itk::RGBPixel< short >, 3 >( names );
break;
+ case itk::ImageIOBase::UINT:
+ r = this->_RealGD< itk::RGBPixel< unsigned int >, 3 >( names );
+ break;
+ case itk::ImageIOBase::INT:
+ r = this->_RealGD< itk::RGBPixel< int >, 3 >( names );
+ break;
+ case itk::ImageIOBase::ULONG:
+ r = this->_RealGD< itk::RGBPixel< unsigned long >, 3 >( names );
+ break;
+ case itk::ImageIOBase::LONG:
+ r = this->_RealGD< itk::RGBPixel< long >, 3 >( names );
+ break;
+ case itk::ImageIOBase::FLOAT:
+ r = this->_RealGD< itk::RGBPixel< float >, 3 >( names );
+ break;
+ case itk::ImageIOBase::DOUBLE:
+ r = this->_RealGD< itk::RGBPixel< double >, 3 >( names );
+ break;
default:
- r = "ImageReader: Scalar pixel type not supported.";
+ r = "ImageReader: RGB pixel type not supported.";
break;
} // hctiws
}
case itk::ImageIOBase::SHORT:
r = this->_RealGD< itk::RGBPixel< short >, 4 >( names );
break;
+ case itk::ImageIOBase::UINT:
+ r = this->_RealGD< itk::RGBPixel< unsigned int >, 4 >( names );
+ break;
+ case itk::ImageIOBase::INT:
+ r = this->_RealGD< itk::RGBPixel< int >, 4 >( names );
+ break;
+ case itk::ImageIOBase::ULONG:
+ r = this->_RealGD< itk::RGBPixel< unsigned long >, 4 >( names );
+ break;
+ case itk::ImageIOBase::LONG:
+ r = this->_RealGD< itk::RGBPixel< long >, 4 >( names );
+ break;
+ case itk::ImageIOBase::FLOAT:
+ r = this->_RealGD< itk::RGBPixel< float >, 4 >( names );
+ break;
+ case itk::ImageIOBase::DOUBLE:
+ r = this->_RealGD< itk::RGBPixel< double >, 4 >( names );
+ break;
default:
- r = "ImageReader: Scalar pixel type not supported.";
+ r = "ImageReader: RGB pixel type not supported.";
break;
} // hctiws
case itk::ImageIOBase::SHORT:
r = this->_RealGD< itk::RGBAPixel< short >, 2 >( names );
break;
+ case itk::ImageIOBase::UINT:
+ r = this->_RealGD< itk::RGBAPixel< unsigned int >, 2 >( names );
+ break;
+ case itk::ImageIOBase::INT:
+ r = this->_RealGD< itk::RGBAPixel< int >, 2 >( names );
+ break;
+ case itk::ImageIOBase::ULONG:
+ r = this->_RealGD< itk::RGBAPixel< unsigned long >, 2 >( names );
+ break;
+ case itk::ImageIOBase::LONG:
+ r = this->_RealGD< itk::RGBAPixel< long >, 2 >( names );
+ break;
+ case itk::ImageIOBase::FLOAT:
+ r = this->_RealGD< itk::RGBAPixel< float >, 2 >( names );
+ break;
+ case itk::ImageIOBase::DOUBLE:
+ r = this->_RealGD< itk::RGBAPixel< double >, 2 >( names );
+ break;
default:
- r = "ImageReader: Scalar pixel type not supported.";
+ r = "ImageReader: RGBA pixel type not supported.";
break;
} // hctiws
}
case itk::ImageIOBase::SHORT:
r = this->_RealGD< itk::RGBAPixel< short >, 3 >( names );
break;
+ case itk::ImageIOBase::UINT:
+ r = this->_RealGD< itk::RGBAPixel< unsigned int >, 3 >( names );
+ break;
+ case itk::ImageIOBase::INT:
+ r = this->_RealGD< itk::RGBAPixel< int >, 3 >( names );
+ break;
+ case itk::ImageIOBase::ULONG:
+ r = this->_RealGD< itk::RGBAPixel< unsigned long >, 3 >( names );
+ break;
+ case itk::ImageIOBase::LONG:
+ r = this->_RealGD< itk::RGBAPixel< long >, 3 >( names );
+ break;
+ case itk::ImageIOBase::FLOAT:
+ r = this->_RealGD< itk::RGBAPixel< float >, 3 >( names );
+ break;
+ case itk::ImageIOBase::DOUBLE:
+ r = this->_RealGD< itk::RGBAPixel< double >, 3 >( names );
+ break;
default:
- r = "ImageReader: Scalar pixel type not supported.";
+ r = "ImageReader: RGBA pixel type not supported.";
break;
} // hctiws
}
case itk::ImageIOBase::SHORT:
r = this->_RealGD< itk::RGBAPixel< short >, 4 >( names );
break;
+ case itk::ImageIOBase::UINT:
+ r = this->_RealGD< itk::RGBAPixel< unsigned int >, 4 >( names );
+ break;
+ case itk::ImageIOBase::INT:
+ r = this->_RealGD< itk::RGBAPixel< int >, 4 >( names );
+ break;
+ case itk::ImageIOBase::ULONG:
+ r = this->_RealGD< itk::RGBAPixel< unsigned long >, 4 >( names );
+ break;
+ case itk::ImageIOBase::LONG:
+ r = this->_RealGD< itk::RGBAPixel< long >, 4 >( names );
+ break;
+ case itk::ImageIOBase::FLOAT:
+ r = this->_RealGD< itk::RGBAPixel< float >, 4 >( names );
+ break;
+ case itk::ImageIOBase::DOUBLE:
+ r = this->_RealGD< itk::RGBAPixel< double >, 4 >( names );
+ break;
default:
- r = "ImageReader: Scalar pixel type not supported.";
+ r = "ImageReader: RGBA pixel type not supported.";
break;
} // hctiws
r = this->_RealGD< itk::CovariantVector< double, D >, D >( names );
break;
default:
- r = "ImageReader: Vector type not supported.";
+ r = "ImageReader: CovariantVector type not supported.";
break;
} // hctiws
}
{
typedef itk::Image< P, D > _I;
+ cpPlugins::Interface::Image* out =
+ this->GetOutput< cpPlugins::Interface::Image >( 0 );
+ if( out == NULL )
+ return( "ImageReader: No output object properly created." );
+
std::string r = "";
if( names.size( ) == 1 )
{
try
{
reader->Update( );
- cpPlugins::Interface::Image* out =
- this->_Output< cpPlugins::Interface::Image >( 0 );
- if( out != NULL )
- out->SetITKImage< _I >( reader->GetOutput( ) );
- else
- r = "ImageReader: output not correctly created.";
+ out->SetITKImage< _I >( reader->GetOutput( ) );
}
catch( itk::ExceptionObject& err )
{
r = "ImageReader: " + std::string( err.GetDescription( ) );
- cpPlugins::Interface::Image* out =
- this->_Output< cpPlugins::Interface::Image >( 0 );
- if( out != NULL )
- out->SetITKImage< _I >( NULL );
- else
- r = "ImageReader: output not correctly created.";
+ out->SetITKImage< _I >( NULL );
} // yrt
}
} // fi
std::set< std::string >::const_iterator fnIt = ordered_names.begin( );
for( ; fnIt != ordered_names.end( ); ++fnIt )
+ {
reader->AddFileName( *fnIt );
+ }
try
{
reader->Update( );
- cpPlugins::Interface::Image* out =
- this->_Output< cpPlugins::Interface::Image >( 0 );
- if( out != NULL )
- out->SetITKImage< _I >( reader->GetOutput( ) );
- else
- r = "ImageReader: output not correctly created.";
+ out->SetITKImage< _I >( reader->GetOutput( ) );
}
catch( itk::ExceptionObject& err )
{
r = "ImageReader: " + std::string( err.GetDescription( ) );
- cpPlugins::Interface::Image* out =
- this->_Output< cpPlugins::Interface::Image >( 0 );
- if( out != NULL )
- out->SetITKImage< _I >( NULL );
- else
- r = "ImageReader: output not correctly created.";
+ out->SetITKImage< _I >( NULL );
} // yrt
}
_GenerateData( )
{
cpPlugins::Interface::Image* image =
- this->_Input< cpPlugins::Interface::Image >( 0 );
+ this->GetInput< cpPlugins::Interface::Image >( 0 );
if( image == NULL )
return( "ImageWriter: No input image." );
{
// Get input
cpPlugins::Interface::Image* image =
- this->_Input< cpPlugins::Interface::Image >( 0 );
+ this->GetInput< cpPlugins::Interface::Image >( 0 );
if( image == NULL )
return( "MarchingCubes: Input data is not a valid image." );
vtkImageData* vtk_image = image->GetVTKImageData( );
// Execute filter
this->m_Algorithm->Update( );
cpPlugins::Interface::Mesh* out =
- this->_Output< cpPlugins::Interface::Mesh >( 0 );
+ this->GetOutput< cpPlugins::Interface::Mesh >( 0 );
out->SetVTKMesh( this->m_Algorithm->GetOutput( ) );
return( "" );
}
pdr->Update( );
cpPlugins::Interface::Mesh* out =
- this->_Output< cpPlugins::Interface::Mesh >( 0 );
+ this->GetOutput< cpPlugins::Interface::Mesh >( 0 );
if( out != NULL )
out->SetVTKMesh( pdr->GetOutput( ) );
else
_GenerateData( )
{
cpPlugins::Interface::Mesh* mesh =
- this->_Input< cpPlugins::Interface::Mesh >( 0 );
+ this->GetInput< cpPlugins::Interface::Mesh >( 0 );
if( mesh == NULL )
return( "MeshWriter: No input mesh." );
vtkPolyData* i = mesh->GetVTKMesh( );
_GenerateData( )
{
cpPlugins::Interface::Image* image =
- this->_Input< cpPlugins::Interface::Image >( 0 );
+ this->GetInput< cpPlugins::Interface::Image >( 0 );
if( image == NULL )
return( "OtsuThresholdImageFilter: No input image." );
// Connect output
cpPlugins::Interface::Image* out =
- this->_Output< cpPlugins::Interface::Image >( 0 );
+ this->GetOutput< cpPlugins::Interface::Image >( 0 );
if( out != NULL )
{
out->SetITKImage< O >( filter->GetOutput( ) );
_GenerateData( )
{
cpPlugins::Interface::Image* image =
- this->_Input< cpPlugins::Interface::Image >( 0 );
+ this->GetInput< cpPlugins::Interface::Image >( 0 );
if( image == NULL )
return( "RGBImageToOtherChannelsFilter: No input image." );
// Connect output
cpPlugins::Interface::Image* out =
- this->_Output< cpPlugins::Interface::Image >( 0 );
+ this->GetOutput< cpPlugins::Interface::Image >( 0 );
if( out != NULL )
{
out->SetITKImage< _O >( filter->GetOutput( ) );
{
// Get input
cpPlugins::Interface::Image* image =
- this->_Input< cpPlugins::Interface::Image >( 0 );
+ this->GetInput< cpPlugins::Interface::Image >( 0 );
if( image == NULL )
return( "SecondRankDiffusionTensorToPolyData: Input data is not a valid image." );
// Connect output
cpPlugins::Interface::Mesh* out =
- this->_Output< cpPlugins::Interface::Mesh >( 0 );
+ this->GetOutput< cpPlugins::Interface::Mesh >( 0 );
if( out != NULL )
{
out->SetVTKMesh( this->m_Algorithm->GetOutput( ) );