From: Leonardo Florez-Valencia Date: Thu, 21 Apr 2016 15:57:42 +0000 (-0500) Subject: ... X-Git-Tag: v0.1~181 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=00d030e4e10fea579b427297027e3ac37ff960b6;p=cpPlugins.git ... --- diff --git a/appli/PipelineEditor/PipelineEditor.cxx b/appli/PipelineEditor/PipelineEditor.cxx index 7c06aac..0f2d3fd 100644 --- a/appli/PipelineEditor/PipelineEditor.cxx +++ b/appli/PipelineEditor/PipelineEditor.cxx @@ -1,9 +1,13 @@ #include "PipelineEditor.h" #include "ui_PipelineEditor.h" +#include + #include #include -#include + +#include +#include #include // ------------------------------------------------------------------------- @@ -76,8 +80,6 @@ _ShowFilterOutput( const std::string& filter_name, const std::string& output_name ) { - typedef cpPlugins::DataObject _TDataObject; - // Update filter, if needed this->_ExecFilter( filter_name ); @@ -85,47 +87,34 @@ _ShowFilterOutput( auto filter = this->m_Workspace.GetFilter( filter_name ); if( filter != NULL ) { - auto output = filter->GetOutputData( output_name ); - if( output != NULL ) + auto id = filter->GetOutputData< vtkImageData >( output_name ); + auto md = filter->GetOutputData< vtkPolyData >( output_name ); + if( id != NULL ) { - std::string data_name = output_name + "@" + filter_name; - auto idata = output->GetVTK< vtkImageData >( ); - auto mdata = output->GetVTK< vtkPolyData >( ); - if( idata != NULL ) - { - if( this->m_UI->Viewer->AddData( idata, data_name, "" ) ) - { - if( this->m_UI->Viewer->GetNumberOfData( ) > 1 ) - this->m_UI->Viewer->SetDataColor( data_name, 1, 0, 0 ); - else - this->m_UI->Viewer->SetMainImage( data_name ); - this->_Block( ); - this->m_UI->Viewer->ShowData( data_name ); - this->_UnBlock( ); - - } // fi - } - else if( mdata != NULL ) - { - if( this->m_UI->Viewer->AddData( mdata, data_name ) ) - { - this->m_UI->Viewer->SetDataColor( data_name, 1, 0, 0 ); - this->_Block( ); - this->m_UI->Viewer->ShowData( data_name ); - this->_UnBlock( ); - - } // fi - } - else - QMessageBox::critical( - this, - QMessageBox::tr( "Error showing data" ), - QMessageBox::tr( "No known VTK conversion!" ) - ); - - } // fi - - } // fi + this->_Block( ); + this->m_UI->Viewer->Clear( ); + this->m_UI->Viewer->SetMainImage( id ); + this->_UnBlock( ); + } + else if( md != NULL ) + { + this->_Block( ); + this->m_UI->Viewer->AddMesh( md ); + this->_UnBlock( ); + } + else + QMessageBox::critical( + this, + QMessageBox::tr( "Error showing data" ), + QMessageBox::tr( "No known VTK conversion!" ) + ); + } + else + QMessageBox::critical( + this, + QMessageBox::tr( "Error showing data" ), + QMessageBox::tr( "Unknown filter." ) + ); } // ------------------------------------------------------------------------- @@ -134,6 +123,7 @@ _HideFilterOutput( const std::string& filter_name, const std::string& output_name ) { + /* // Get output auto filter = this->m_Workspace.GetFilter( filter_name ); if( filter != NULL ) @@ -147,6 +137,7 @@ _HideFilterOutput( } // fi } // fi + */ } // ------------------------------------------------------------------------- @@ -155,6 +146,7 @@ _PropertiesFilterOutput( const std::string& filter_name, const std::string& output_name ) { + /* // Get output auto filter = this->m_Workspace.GetFilter( filter_name ); if( filter != NULL ) @@ -179,6 +171,7 @@ _PropertiesFilterOutput( ); } // fi + */ } // eof - $RCSfile$ diff --git a/appli/examples/extensions/example_ImageSlice.cxx b/appli/examples/extensions/example_ImageSlice.cxx index 86dc891..b45588a 100644 --- a/appli/examples/extensions/example_ImageSlice.cxx +++ b/appli/examples/extensions/example_ImageSlice.cxx @@ -24,7 +24,7 @@ int main( int argc, char* argv[] ) // Prepate slice objects vtkSmartPointer< cpExtensions::Visualization::ImageSliceActors > actors = vtkSmartPointer< cpExtensions::Visualization::ImageSliceActors >::New( ); - actors->SetInputConnection( reader->GetOutputPort( ) ); + actors->SetInputConnection( reader->GetOutputPort( ), 2 ); // Prepare scene vtkSmartPointer< vtkRenderer > ren = diff --git a/appli/examples/plugins/QT/example_MPRViewer/example_MPRViewer.cxx b/appli/examples/plugins/QT/example_MPRViewer/example_MPRViewer.cxx index 698b082..eb6daff 100644 --- a/appli/examples/plugins/QT/example_MPRViewer/example_MPRViewer.cxx +++ b/appli/examples/plugins/QT/example_MPRViewer/example_MPRViewer.cxx @@ -66,7 +66,7 @@ example_MPRViewer( int argc, char* argv[], QWidget* parent ) } // yrt this->m_UI->Viewer->SetMainImage( - this->m_Reader->GetOutputData( "Output" )->GetVTK< vtkImageData >( ) + this->m_Reader->GetOutputData< vtkImageData >( "Output" ) ); } diff --git a/appli/examples/plugins/example_ReadWriteImage.cxx b/appli/examples/plugins/example_ReadWriteImage.cxx index 5532068..7da797c 100644 --- a/appli/examples/plugins/example_ReadWriteImage.cxx +++ b/appli/examples/plugins/example_ReadWriteImage.cxx @@ -61,7 +61,7 @@ int main( int argc, char* argv[] ) writer_params->SetSaveFileName( "FileName", argv[ argc - 1 ] ); // Connect filters - writer->SetInput( "Input", reader->GetOutput( "Output" ) ); + writer->SetInputPort( "Input", reader->GetOutputPort( "Output" ) ); // Execute filters try diff --git a/appli/examples/plugins/example_ShowImage.cxx b/appli/examples/plugins/example_ShowImage.cxx index d08cc14..7a74ff1 100644 --- a/appli/examples/plugins/example_ShowImage.cxx +++ b/appli/examples/plugins/example_ShowImage.cxx @@ -59,9 +59,7 @@ int main( int argc, char* argv[] ) // Prepate slice objects vtkSmartPointer< cpExtensions::Visualization::ImageSliceActors > actors = vtkSmartPointer< cpExtensions::Visualization::ImageSliceActors >::New( ); - actors->SetInputData( - reader->GetOutputData( "Output" )->GetVTK< vtkImageData >( ), 1 - ); + actors->SetInputData( reader->GetOutputData< vtkImageData >( "Output" ), 2 ); // Prepare scene vtkSmartPointer< vtkRenderer > ren = diff --git a/lib/cpExtensions/QT/SimpleMPRWidget.cxx b/lib/cpExtensions/QT/SimpleMPRWidget.cxx index f3f1eb3..d335f53 100644 --- a/lib/cpExtensions/QT/SimpleMPRWidget.cxx +++ b/lib/cpExtensions/QT/SimpleMPRWidget.cxx @@ -75,6 +75,23 @@ cpExtensions::QT::SimpleMPRWidget:: delete this->m_UI; } +// ------------------------------------------------------------------------- +void cpExtensions::QT::SimpleMPRWidget:: +Clear( ) +{ + for( unsigned int i = 0; i < 4; ++i ) + this->m_Renderers[ i ]->RemoveAllViewProps( ); + for( unsigned int i = 0; i < 3; ++i ) + { + if( this->m_2DSlices[ i ].GetPointer( ) != NULL ) + this->m_2DSlices[ i ]->Clear( ); + if( this->m_3DSlices[ i ].GetPointer( ) != NULL ) + this->m_3DSlices[ i ]->Clear( ); + + } // rof + this->m_PolyDatas.clear( ); +} + // ------------------------------------------------------------------------- void cpExtensions::QT::SimpleMPRWidget:: SetMainImage( vtkImageData* image ) @@ -122,6 +139,36 @@ SetMainImage( vtkImageData* image ) this->m_VTK[ 3 ]->GetRenderWindow( )->Render( ); } +// ------------------------------------------------------------------------- +void cpExtensions::QT::SimpleMPRWidget:: +AddMesh( vtkPolyData* mesh ) +{ + PolyDataActor a; + a.Configure( mesh ); + this->m_PolyDatas[ mesh ] = a; + this->m_Renderers[ 3 ]->AddViewProp( a.Actor ); + + bool has_main_image = false; + for( unsigned int i = 0; i < 3; ++i ) + { + if( this->m_2DSlices[ i ].GetPointer( ) != NULL ) + { + if( this->m_2DSlices[ i ]->GetInputData( ) != NULL ) + { + has_main_image = true; + this->m_2DSlices[ i ]->AddMesh( mesh ); + this->m_2DSlices[ i ]->Render( ); + + } // fi + + } // fi + + } // rof + if( !has_main_image ) + this->m_Renderers[ 3 ]->ResetCamera( ); + this->m_VTK[ 3 ]->GetRenderWindow( )->Render( ); +} + // ------------------------------------------------------------------------- void cpExtensions::QT::SimpleMPRWidget:: _SyncBottom( int a, int b ) diff --git a/lib/cpExtensions/QT/SimpleMPRWidget.h b/lib/cpExtensions/QT/SimpleMPRWidget.h index 3dd2309..42a09f6 100644 --- a/lib/cpExtensions/QT/SimpleMPRWidget.h +++ b/lib/cpExtensions/QT/SimpleMPRWidget.h @@ -5,14 +5,16 @@ #ifdef cpExtensions_QT4 +#include #include - -#include +#include +#include #include +#include #include +#include /* - #include #include #include #include @@ -64,12 +66,50 @@ namespace cpExtensions typedef TMPRObjects::TLeaveCommand TLeaveCommand; */ + struct PolyDataActor + { + vtkSmartPointer< vtkPolyData > Data; + vtkSmartPointer< vtkPolyDataNormals > Normals; + vtkSmartPointer< vtkStripper > Stripper; + vtkSmartPointer< vtkPolyDataMapper > Mapper; + vtkSmartPointer< vtkQuadricLODActor > Actor; + + void Configure( vtkPolyData* data ) + { + this->Data = data; + double r[ 2 ]; + this->Data->GetScalarRange( r ); + + this->Normals = vtkSmartPointer< vtkPolyDataNormals >::New( ); + this->Stripper = vtkSmartPointer< vtkStripper >::New( ); + this->Mapper = vtkSmartPointer< vtkPolyDataMapper >::New( ); + this->Actor = vtkSmartPointer< vtkQuadricLODActor >::New( ); + + this->Normals->SetInputData( this->Data ); + this->Normals->SetFeatureAngle( 60.0 ); + this->Stripper->SetInputConnection( + this->Normals->GetOutputPort( ) + ); + this->Mapper->SetInputConnection( + this->Stripper->GetOutputPort( ) + ); + this->Mapper->UseLookupTableScalarRangeOff( ); + this->Mapper->SetScalarRange( + r[ 0 ], ( ( r[ 1 ] - r[ 0 ] ) * 0.75 ) + r[ 0 ] + ); + this->Actor->SetMapper( this->Mapper ); + this->Actor->DeferLODConstructionOff( ); + } + }; + public: explicit SimpleMPRWidget( QWidget* parent = 0 ); virtual ~SimpleMPRWidget( ); // Data management + void Clear( ); void SetMainImage( vtkImageData* image ); + void AddMesh( vtkPolyData* mesh ); /* TODO unsigned int GetNumberOfData( ) const; @@ -115,6 +155,8 @@ namespace cpExtensions vtkSmartPointer< TActors > m_2DSlices[ 3 ]; vtkSmartPointer< TActors > m_3DSlices[ 3 ]; + std::map< vtkPolyData*, PolyDataActor > m_PolyDatas; + /* TODO static double cm_Colors[ 8 ][ 3 ]; vtkSmartPointer< TMPRObjects > m_MPRObjects; diff --git a/lib/cpExtensions/Visualization/ImageSliceActors.cxx b/lib/cpExtensions/Visualization/ImageSliceActors.cxx index be7efe3..3fae553 100644 --- a/lib/cpExtensions/Visualization/ImageSliceActors.cxx +++ b/lib/cpExtensions/Visualization/ImageSliceActors.cxx @@ -4,6 +4,7 @@ #include #include #include +#include #include #include #include @@ -81,6 +82,37 @@ SetInputData( vtkImageData* data, int orientation ) this->_ConfigureInput( orientation ); } +// ------------------------------------------------------------------------- +vtkImageData* cpExtensions::Visualization::ImageSliceActors:: +GetInputData( ) +{ + if( this->m_Mapper.GetPointer( ) != NULL ) + return( this->m_Mapper->GetInput( ) ); + else + return( NULL ); +} + +// ------------------------------------------------------------------------- +void cpExtensions::Visualization::ImageSliceActors:: +AddMesh( vtkPolyData* mesh ) +{ + SourceActor< vtkCutter > a; + a.Create( ); + a.Source->SetInputData( mesh ); + a.Source->SetCutFunction( this->m_Mapper->GetSlicePlane( ) ); + a.Source->SetValue( 0, 0 ); + a.Source->GenerateTrianglesOff( ); + a.Source->Update( ); + a.Modified( ); + this->m_Meshes[ mesh ] = a; + this->AddItem( a.Actor ); + + auto ren = this->m_Style->GetCurrentRenderer( ); + if( ren != NULL ) + if( ren->HasViewProp( this->m_Actor ) ) + ren->AddViewProp( a.Actor ); +} + // ------------------------------------------------------------------------- void cpExtensions::Visualization::ImageSliceActors:: AssociateSlice( Self* slice ) diff --git a/lib/cpExtensions/Visualization/ImageSliceActors.h b/lib/cpExtensions/Visualization/ImageSliceActors.h index 4e29dc5..7ff8838 100644 --- a/lib/cpExtensions/Visualization/ImageSliceActors.h +++ b/lib/cpExtensions/Visualization/ImageSliceActors.h @@ -4,8 +4,10 @@ #include #include +#include #include #include +#include #include #include #include @@ -67,7 +69,6 @@ namespace cpExtensions this->Actor->Modified( ); } }; - public: vtkTypeMacro( ImageSliceActors, vtkPropCollection ); @@ -82,6 +83,9 @@ namespace cpExtensions void Clear( ); void SetInputConnection( vtkAlgorithmOutput* aout, int orientation ); void SetInputData( vtkImageData* data, int orientation ); + vtkImageData* GetInputData( ); + + void AddMesh( vtkPolyData* mesh ); void AssociateSlice( Self* slice ); void CleanAssociatedSlices( ); @@ -150,6 +154,9 @@ namespace cpExtensions // Secondary slices std::vector< vtkSmartPointer< Self > > m_AssociatedSlices; + // Associated meshes + std::map< vtkPolyData*, SourceActor< vtkCutter > > m_Meshes; + // Cursor SourceActor< vtkCursor3D > m_Cursor; diff --git a/lib/cpPlugins/ProcessObject.cxx b/lib/cpPlugins/ProcessObject.cxx index 050a257..29e14f8 100644 --- a/lib/cpPlugins/ProcessObject.cxx +++ b/lib/cpPlugins/ProcessObject.cxx @@ -68,7 +68,7 @@ GetNumberOfOutputs( ) const // ------------------------------------------------------------------------- cpPlugins:: OutputPort& cpPlugins::ProcessObject:: -GetOutput( const std::string& id ) +GetOutputPort( const std::string& id ) { static OutputPort null_port; auto i = this->m_Outputs.find( id ); @@ -84,7 +84,7 @@ GetOutput( const std::string& id ) // ------------------------------------------------------------------------- const cpPlugins:: OutputPort& cpPlugins::ProcessObject:: -GetOutput( const std::string& id ) const +GetOutputPort( const std::string& id ) const { static const OutputPort null_port; auto i = this->m_Outputs.find( id ); @@ -97,7 +97,7 @@ GetOutput( const std::string& id ) const // ------------------------------------------------------------------------- cpPlugins:: DataObject* cpPlugins::ProcessObject:: -GetInputData( const std::string& id ) +GetInput( const std::string& id ) { auto i = this->m_Inputs.find( id ); if( i != this->m_Inputs.end( ) ) @@ -109,7 +109,7 @@ GetInputData( const std::string& id ) // ------------------------------------------------------------------------- const cpPlugins:: DataObject* cpPlugins::ProcessObject:: -GetInputData( const std::string& id ) const +GetInput( const std::string& id ) const { auto i = this->m_Inputs.find( id ); if( i != this->m_Inputs.end( ) ) @@ -121,7 +121,7 @@ GetInputData( const std::string& id ) const // ------------------------------------------------------------------------- cpPlugins:: DataObject* cpPlugins::ProcessObject:: -GetOutputData( const std::string& id ) +GetOutput( const std::string& id ) { auto i = this->m_Outputs.find( id ); if( i != this->m_Outputs.end( ) ) @@ -133,7 +133,7 @@ GetOutputData( const std::string& id ) // ------------------------------------------------------------------------- const cpPlugins:: DataObject* cpPlugins::ProcessObject:: -GetOutputData( const std::string& id ) const +GetOutput( const std::string& id ) const { auto i = this->m_Outputs.find( id ); if( i != this->m_Outputs.end( ) ) @@ -144,7 +144,7 @@ GetOutputData( const std::string& id ) const // ------------------------------------------------------------------------- bool cpPlugins::ProcessObject:: -SetInput( const std::string& id, const OutputPort& port ) +SetInputPort( const std::string& id, const OutputPort& port ) { auto i = this->m_Inputs.find( id ); if( i != this->m_Inputs.end( ) ) diff --git a/lib/cpPlugins/ProcessObject.h b/lib/cpPlugins/ProcessObject.h index 908fd92..1f888a9 100644 --- a/lib/cpPlugins/ProcessObject.h +++ b/lib/cpPlugins/ProcessObject.h @@ -43,15 +43,21 @@ namespace cpPlugins unsigned int GetNumberOfInputs( ) const; unsigned int GetNumberOfOutputs( ) const; - OutputPort& GetOutput( const std::string& id ); - const OutputPort& GetOutput( const std::string& id ) const; + OutputPort& GetOutputPort( const std::string& id ); + const OutputPort& GetOutputPort( const std::string& id ) const; - DataObject* GetInputData( const std::string& id ); - const DataObject* GetInputData( const std::string& id ) const; - DataObject* GetOutputData( const std::string& id ); - const DataObject* GetOutputData( const std::string& id ) const; + DataObject* GetInput( const std::string& id ); + const DataObject* GetInput( const std::string& id ) const; + DataObject* GetOutput( const std::string& id ); + const DataObject* GetOutput( const std::string& id ) const; - bool SetInput( const std::string& id, const OutputPort& port ); + template< class _TType > + _TType* GetInputData( const std::string& name ); + + template< class _TType > + _TType* GetOutputData( const std::string& name ); + + bool SetInputPort( const std::string& id, const OutputPort& port ); void DisconnectInputs( ); void DisconnectOutputs( ); diff --git a/lib/cpPlugins/ProcessObject.hxx b/lib/cpPlugins/ProcessObject.hxx index 73e8743..f0f2cd0 100644 --- a/lib/cpPlugins/ProcessObject.hxx +++ b/lib/cpPlugins/ProcessObject.hxx @@ -1,6 +1,42 @@ #ifndef __CPPLUGINS__PROCESSOBJECT__HXX__ #define __CPPLUGINS__PROCESSOBJECT__HXX__ +// ------------------------------------------------------------------------- +template< class _TType > +_TType* cpPlugins::ProcessObject:: +GetInputData( const std::string& name ) +{ + auto in = this->GetInput( name ); + if( in != NULL ) + { + auto i = in->GetITK< _TType >( ); + auto v = in->GetVTK< _TType >( ); + if ( i != NULL ) return( i ); + else if( v != NULL ) return( v ); + else return( NULL ); + } + else + return( NULL ); +} + +// ------------------------------------------------------------------------- +template< class _TType > +_TType* cpPlugins::ProcessObject:: +GetOutputData( const std::string& name ) +{ + auto out = this->GetOutput( name ); + if( out != NULL ) + { + auto i = out->GetITK< _TType >( ); + auto v = out->GetVTK< _TType >( ); + if ( i != NULL ) return( i ); + else if( v != NULL ) return( v ); + else return( NULL ); + } + else + return( NULL ); +} + // ------------------------------------------------------------------------- template< class O > void cpPlugins::ProcessObject:: diff --git a/lib/cpPlugins/Workspace.cxx b/lib/cpPlugins/Workspace.cxx index b29309a..84188a7 100644 --- a/lib/cpPlugins/Workspace.cxx +++ b/lib/cpPlugins/Workspace.cxx @@ -251,7 +251,7 @@ Connect( return( false ); // Real connection - if( dest->SetInput( input_name, orig->GetOutput( output_name ) ) ) + if( dest->SetInputPort( input_name, orig->GetOutputPort( output_name ) ) ) { this->m_Graph->AddEdge( orig_filter, dest_filter, @@ -272,7 +272,7 @@ Connect( const OutputPort& port, const std::string& exposed_port ) { ProcessObject* filter = this->GetFilter( i->second.first ); if( filter != NULL ) - return( filter->SetInput( i->second.second, port ) ); + return( filter->SetInputPort( i->second.second, port ) ); else return( false ); } @@ -397,7 +397,7 @@ GetExposedOutput( const std::string& name ) { ProcessObject* filter = this->GetFilter( i->second.first ); if( filter != NULL ) - return( filter->GetOutput( i->second.second ) ); + return( filter->GetOutputPort( i->second.second ) ); } // fi return( null_port ); @@ -415,7 +415,7 @@ GetExposedOutput( const std::string& name ) const { const ProcessObject* filter = this->GetFilter( i->second.first ); if( filter != NULL ) - return( filter->GetOutput( i->second.second ) ); + return( filter->GetOutputPort( i->second.second ) ); } // fi return( null_port ); diff --git a/plugins/cpPluginsGenericFilters/JoinBoundingBoxes.cxx b/plugins/cpPluginsGenericFilters/JoinBoundingBoxes.cxx index 3fcd009..d53c71b 100644 --- a/plugins/cpPluginsGenericFilters/JoinBoundingBoxes.cxx +++ b/plugins/cpPluginsGenericFilters/JoinBoundingBoxes.cxx @@ -30,13 +30,13 @@ _GenerateData( ) typedef cpPlugins::BoundingBox _TBB; _TDO* dobjs[ 5 ]; - auto do0 = dynamic_cast< _TDO* >( this->GetInputData( "Input0" ) ); - dobjs[ 0 ] = dynamic_cast< _TDO* >( this->GetInputData( "Input1" ) ); - dobjs[ 1 ] = dynamic_cast< _TDO* >( this->GetInputData( "Input2" ) ); - dobjs[ 2 ] = dynamic_cast< _TDO* >( this->GetInputData( "Input3" ) ); - dobjs[ 3 ] = dynamic_cast< _TDO* >( this->GetInputData( "Input4" ) ); - dobjs[ 4 ] = dynamic_cast< _TDO* >( this->GetInputData( "Input5" ) ); - auto out = dynamic_cast< _TBB* >( this->GetOutputData( "Output" ) ); + auto do0 = dynamic_cast< _TDO* >( this->GetInput( "Input0" ) ); + dobjs[ 0 ] = dynamic_cast< _TDO* >( this->GetInput( "Input1" ) ); + dobjs[ 1 ] = dynamic_cast< _TDO* >( this->GetInput( "Input2" ) ); + dobjs[ 2 ] = dynamic_cast< _TDO* >( this->GetInput( "Input3" ) ); + dobjs[ 3 ] = dynamic_cast< _TDO* >( this->GetInput( "Input4" ) ); + dobjs[ 4 ] = dynamic_cast< _TDO* >( this->GetInput( "Input5" ) ); + auto out = dynamic_cast< _TBB* >( this->GetOutput( "Output" ) ); out->SetDataObject( do0 ); for( unsigned int d = 0; d < 5; ++d ) diff --git a/plugins/cpPluginsIO/ImageWriter.cxx b/plugins/cpPluginsIO/ImageWriter.cxx index 1855f2e..c1239b0 100644 --- a/plugins/cpPluginsIO/ImageWriter.cxx +++ b/plugins/cpPluginsIO/ImageWriter.cxx @@ -26,7 +26,7 @@ cpPluginsIO::ImageWriter:: void cpPluginsIO::ImageWriter:: _GenerateData( ) { - auto image = this->GetInputData( "Input" )->GetITK< itk::DataObject >( ); + auto image = this->GetInputData< itk::DataObject >( "Input" ); cpPlugins_Image_Demangle_Dim ( _GD0, image, 2 ); else cpPlugins_Image_Demangle_Dim( _GD0, image, 3 ); else this->_Error( "No valid input image dimension" ); diff --git a/plugins/cpPluginsIO/MeshReader.cxx b/plugins/cpPluginsIO/MeshReader.cxx index 6eb04da..3a40e42 100644 --- a/plugins/cpPluginsIO/MeshReader.cxx +++ b/plugins/cpPluginsIO/MeshReader.cxx @@ -79,7 +79,7 @@ _GD1( ) stlr->SetFileName( fname.c_str( ) ); stlr->Update( ); - this->GetOutputData( "Output" )->SetVTK( stlr->GetOutput( ) ); + this->GetOutput( "Output" )->SetVTK( stlr->GetOutput( ) ); } else if( ext == "obj" ) { @@ -87,7 +87,7 @@ _GD1( ) objr->SetFileName( fname.c_str( ) ); objr->Update( ); - this->GetOutputData( "Output" )->SetVTK( objr->GetOutput( ) ); + this->GetOutput( "Output" )->SetVTK( objr->GetOutput( ) ); } else if( ext == "vtk" ) { @@ -95,7 +95,7 @@ _GD1( ) pdr->SetFileName( fname.c_str( ) ); pdr->Update( ); - this->GetOutputData( "Output" )->SetVTK( pdr->GetOutput( ) ); + this->GetOutput( "Output" )->SetVTK( pdr->GetOutput( ) ); } else this->_Error( "Input file format not recognized." ); diff --git a/plugins/cpPluginsIO/MeshWriter.cxx b/plugins/cpPluginsIO/MeshWriter.cxx index 7cddc75..e69fc41 100644 --- a/plugins/cpPluginsIO/MeshWriter.cxx +++ b/plugins/cpPluginsIO/MeshWriter.cxx @@ -31,7 +31,7 @@ cpPluginsIO::MeshWriter:: void cpPluginsIO::MeshWriter:: _GenerateData( ) { - auto mesh = this->GetInputData( "Input" )->GetVTK< vtkPolyData >( ); + auto mesh = this->GetInputData< vtkPolyData >( "Input" ); if( mesh == NULL ) this->_Error( "No suitable input." ); diff --git a/plugins/cpPluginsImageFilters/AndImageFilter.cxx b/plugins/cpPluginsImageFilters/AndImageFilter.cxx index ecb6a37..4744f9d 100644 --- a/plugins/cpPluginsImageFilters/AndImageFilter.cxx +++ b/plugins/cpPluginsImageFilters/AndImageFilter.cxx @@ -22,7 +22,7 @@ cpPluginsImageFilters::AndImageFilter:: void cpPluginsImageFilters::AndImageFilter:: _GenerateData( ) { - auto image = this->GetInputData( "Input0" )->GetITK< itk::DataObject >( ); + auto image = this->GetInputData< itk::DataObject >( "Input0" ); cpPlugins_Image_Demangle_Pixel_AllInts ( _GD0, image, 1 ); else cpPlugins_Image_Demangle_Pixel_AllInts ( _GD0, image, 2 ); else cpPlugins_Image_Demangle_Pixel_AllInts ( _GD0, image, 3 ); @@ -42,7 +42,7 @@ _GD0( _TImage* image0 ) typedef itk::AndImageFilter< _TImage, _TImage > _TFilter; if( image0 != NULL ) { - auto image1 = this->GetInputData( "Input1" )->GetITK< _TImage >( ); + auto image1 = this->GetInputData< _TImage >( "Input1" ); if( image1 != NULL ) { // Configure filter @@ -52,7 +52,7 @@ _GD0( _TImage* image0 ) filter->Update( ); // Connect output - this->GetOutputData( "Output" )->SetITK( filter->GetOutput( ) ); + this->GetOutput( "Output" )->SetITK( filter->GetOutput( ) ); } else this->_Error( "No valid second input image." ); diff --git a/plugins/cpPluginsImageFilters/BinaryContourImageFilter.cxx b/plugins/cpPluginsImageFilters/BinaryContourImageFilter.cxx index 2d45cd4..5d3bcad 100644 --- a/plugins/cpPluginsImageFilters/BinaryContourImageFilter.cxx +++ b/plugins/cpPluginsImageFilters/BinaryContourImageFilter.cxx @@ -34,7 +34,7 @@ cpPluginsImageFilters::BinaryContourImageFilter:: void cpPluginsImageFilters::BinaryContourImageFilter:: _GenerateData( ) { - auto image = this->GetInputData( "Input" )->GetITK< itk::DataObject >( ); + auto image = this->GetInputData< itk::DataObject >( "Input" ); cpPlugins_Image_Demangle_Pixel_AllScalars ( _GD0, image, 2 ); else cpPlugins_Image_Demangle_Pixel_AllScalars( _GD0, image, 3 ); else this->_Error( "No valid input image." ); @@ -80,7 +80,7 @@ _GD1( _TImage* image ) filter->Update( ); // Connect output - this->GetOutputData( "Output" )->SetITK( filter->GetOutput( ) ); + this->GetOutput( "Output" )->SetITK( filter->GetOutput( ) ); } // eof - $RCSfile$ diff --git a/plugins/cpPluginsImageFilters/BinaryThresholdImageFilter.cxx b/plugins/cpPluginsImageFilters/BinaryThresholdImageFilter.cxx index 9fcbc43..b14cca9 100644 --- a/plugins/cpPluginsImageFilters/BinaryThresholdImageFilter.cxx +++ b/plugins/cpPluginsImageFilters/BinaryThresholdImageFilter.cxx @@ -32,7 +32,7 @@ cpPluginsImageFilters::BinaryThresholdImageFilter:: void cpPluginsImageFilters::BinaryThresholdImageFilter:: _GenerateData( ) { - auto image = this->GetInputData( "Input" )->GetITK< itk::DataObject >( ); + auto image = this->GetInputData< itk::DataObject >( "Input" ); cpPlugins_Image_Demangle_Pixel_AllScalars ( _GD0, image, 2 ); else cpPlugins_Image_Demangle_Pixel_AllScalars( _GD0, image, 3 ); else this->_Error( "No valid input image." ); @@ -74,7 +74,7 @@ _GD1( _TImage* image ) filter->Update( ); // Connect output - this->GetOutputData( "Output" )->SetITK( filter->GetOutput( ) ); + this->GetOutput( "Output" )->SetITK( filter->GetOutput( ) ); } // eof - $RCSfile$ diff --git a/plugins/cpPluginsImageFilters/CastImageFilter.cxx b/plugins/cpPluginsImageFilters/CastImageFilter.cxx index 0743b2a..87f9671 100644 --- a/plugins/cpPluginsImageFilters/CastImageFilter.cxx +++ b/plugins/cpPluginsImageFilters/CastImageFilter.cxx @@ -35,7 +35,7 @@ cpPluginsImageFilters::CastImageFilter:: void cpPluginsImageFilters::CastImageFilter:: _GenerateData( ) { - auto image = this->GetInputData( "Input" )->GetITK< itk::DataObject >( ); + auto image = this->GetInputData< itk::DataObject >( "Input" ); cpPlugins_Image_Demangle_Pixel_AllScalars ( _GD0, image, 1 ); else cpPlugins_Image_Demangle_Pixel_AllScalars( _GD0, image, 2 ); else cpPlugins_Image_Demangle_Pixel_AllScalars( _GD0, image, 3 ); @@ -87,7 +87,7 @@ _GD1( _TInputImage* image ) filter->Update( ); // Connect output - this->GetOutputData( "Output" )->SetITK( filter->GetOutput( ) ); + this->GetOutput( "Output" )->SetITK( filter->GetOutput( ) ); } // eof - $RCSfile$ diff --git a/plugins/cpPluginsImageFilters/MultiScaleGaussianImageFilter.cxx b/plugins/cpPluginsImageFilters/MultiScaleGaussianImageFilter.cxx index f528e8e..bbdaa98 100644 --- a/plugins/cpPluginsImageFilters/MultiScaleGaussianImageFilter.cxx +++ b/plugins/cpPluginsImageFilters/MultiScaleGaussianImageFilter.cxx @@ -29,7 +29,7 @@ cpPluginsImageFilters::MultiScaleGaussianImageFilter:: void cpPluginsImageFilters::MultiScaleGaussianImageFilter:: _GenerateData( ) { - auto image = this->GetInputData( "Input" )->GetITK< itk::DataObject >( ); + auto image = this->GetInputData< itk::DataObject >( "Input" ); cpPlugins_Image_Demangle_Pixel_AllScalars ( _GD0, image, 2 ); else cpPlugins_Image_Demangle_Pixel_AllScalars( _GD0, image, 3 ); else this->_Error( "No valid input image." ); @@ -74,7 +74,7 @@ _GD1( _TImage* image ) filter->Update( ); // Connect output - this->GetOutputData( "Output" )->SetITK( filter->GetOutput( ) ); + this->GetOutput( "Output" )->SetITK( filter->GetOutput( ) ); } // eof - $RCSfile$ diff --git a/plugins/cpPluginsImageFilters/OrImageFilter.cxx b/plugins/cpPluginsImageFilters/OrImageFilter.cxx index 5eb50ad..f45774c 100644 --- a/plugins/cpPluginsImageFilters/OrImageFilter.cxx +++ b/plugins/cpPluginsImageFilters/OrImageFilter.cxx @@ -22,7 +22,7 @@ cpPluginsImageFilters::OrImageFilter:: void cpPluginsImageFilters::OrImageFilter:: _GenerateData( ) { - auto image = this->GetInputData( "Input0" )->GetITK< itk::DataObject >( ); + auto image = this->GetInputData< itk::DataObject >( "Input0" ); cpPlugins_Image_Demangle_Pixel_AllInts ( _GD0, image, 1 ); else cpPlugins_Image_Demangle_Pixel_AllInts ( _GD0, image, 2 ); else cpPlugins_Image_Demangle_Pixel_AllInts ( _GD0, image, 3 ); @@ -42,7 +42,7 @@ _GD0( _TImage* image0 ) typedef itk::OrImageFilter< _TImage, _TImage > _TFilter; if( image0 != NULL ) { - auto image1 = this->GetInputData( "Input1" )->GetITK< _TImage >( ); + auto image1 = this->GetInputData< _TImage >( "Input1" ); if( image1 != NULL ) { // Configure filter @@ -52,7 +52,7 @@ _GD0( _TImage* image0 ) filter->Update( ); // Connect output - this->GetOutputData( "Output" )->SetITK( filter->GetOutput( ) ); + this->GetOutput( "Output" )->SetITK( filter->GetOutput( ) ); } else this->_Error( "No valid second input image." ); diff --git a/plugins/cpPluginsImageFilters/ResampleImageFilter.cxx b/plugins/cpPluginsImageFilters/ResampleImageFilter.cxx index 8508189..ea45ac4 100644 --- a/plugins/cpPluginsImageFilters/ResampleImageFilter.cxx +++ b/plugins/cpPluginsImageFilters/ResampleImageFilter.cxx @@ -26,7 +26,7 @@ cpPluginsImageFilters::ResampleImageFilter:: void cpPluginsImageFilters::ResampleImageFilter:: _GenerateData( ) { - auto image = this->GetInputData( "Input" )->GetITK< itk::DataObject >( ); + auto image = this->GetInputData< itk::DataObject >( "Input" ); cpPlugins_Image_Demangle_Pixel_AllScalars ( _GD0, image, 2 ); else cpPlugins_Image_Demangle_Pixel_AllScalars( _GD0, image, 3 ); else this->_Error( "No valid input image." ); @@ -67,7 +67,7 @@ _GD1( _TImage* image ) filter->SetInput( image ); // Connect output - this->GetOutputData( "Output" )->SetITK( filter->GetOutput( ) ); + this->GetOutput( "Output" )->SetITK( filter->GetOutput( ) ); } // eof - $RCSfile$ diff --git a/plugins/cpPluginsImageFilters/SignedMaurerDistanceMapImageFilter.cxx b/plugins/cpPluginsImageFilters/SignedMaurerDistanceMapImageFilter.cxx index 05b9620..cabe80d 100644 --- a/plugins/cpPluginsImageFilters/SignedMaurerDistanceMapImageFilter.cxx +++ b/plugins/cpPluginsImageFilters/SignedMaurerDistanceMapImageFilter.cxx @@ -37,7 +37,7 @@ cpPluginsImageFilters::SignedMaurerDistanceMapImageFilter:: void cpPluginsImageFilters::SignedMaurerDistanceMapImageFilter:: _GenerateData( ) { - auto image = this->GetInputData( "Input" )->GetITK< itk::DataObject >( ); + auto image = this->GetInputData< itk::DataObject >( "Input" ); cpPlugins_Image_Demangle_Pixel_AllScalars ( _GD0, image, 2 ); else cpPlugins_Image_Demangle_Pixel_AllScalars( _GD0, image, 3 ); else this->_Error( "No valid input image." ); @@ -87,7 +87,7 @@ _GD1( _TImage* image ) filter->Update( ); // Connect output - this->GetOutputData( "Output" )->SetITK( filter->GetOutput( ) ); + this->GetOutput( "Output" )->SetITK( filter->GetOutput( ) ); } // eof - $RCSfile$ diff --git a/plugins/cpPluginsImageMeshFilters/MarchingCubes.cxx b/plugins/cpPluginsImageMeshFilters/MarchingCubes.cxx index 365cf49..5dc5826 100644 --- a/plugins/cpPluginsImageMeshFilters/MarchingCubes.cxx +++ b/plugins/cpPluginsImageMeshFilters/MarchingCubes.cxx @@ -27,7 +27,7 @@ void cpPluginsImageMeshFilters::MarchingCubes:: _GenerateData( ) { // Get input - auto image = this->GetInputData( "Input" ); + auto image = this->GetInput( "Input" ); vtkImageData* vtk_image = image->GetVTK< vtkImageData >( ); if( vtk_image == NULL ) this->_Error( "Input does not have a valid VTK conversion." ); @@ -58,7 +58,7 @@ _GenerateData( ) this->_Error( "Input data does not have a valid dimension." ); // Connect output - this->GetOutputData( "Output" )->SetVTK( pd ); + this->GetOutput( "Output" )->SetVTK( pd ); } // eof - $RCSfile$ diff --git a/plugins/cpPluginsImageMeshFilters/TriangleMeshToBinaryImageFilter.cxx b/plugins/cpPluginsImageMeshFilters/TriangleMeshToBinaryImageFilter.cxx index 4ee256f..c2442a6 100644 --- a/plugins/cpPluginsImageMeshFilters/TriangleMeshToBinaryImageFilter.cxx +++ b/plugins/cpPluginsImageMeshFilters/TriangleMeshToBinaryImageFilter.cxx @@ -36,8 +36,8 @@ _GenerateData( ) typedef itk::Mesh< float, 3 > _3F; typedef itk::Mesh< double, 3 > _3D; - auto _3f = this->GetInputData( "Input" )->GetITK< _3F >( ); - auto _3d = this->GetInputData( "Input" )->GetITK< _3D >( ); + auto _3f = this->GetInputData< _3F >( "Input" ); + auto _3d = this->GetInputData< _3D >( "Input" ); if ( _3f != NULL ) this->_GD0( _3f ); else if( _3d != NULL ) this->_GD0( _3d ); else this->_Error( "No valid input mesh." ); @@ -65,7 +65,7 @@ _GD1( _TMesh* mesh ) _TFilter* filter = this->_CreateITK< _TFilter >( ); - auto in_bb = dynamic_cast< _TBB* >( this->GetInputData( "BoundingBox" ) ); + auto in_bb = dynamic_cast< _TBB* >( this->GetInput( "BoundingBox" ) ); _TPoint minBB, maxBB; if( in_bb == NULL ) { @@ -127,8 +127,7 @@ _GD1( _TMesh* mesh ) filter->Update( ); // Connect output - auto out = this->GetOutputData( "Output" ); - out->SetITK( filter->GetOutput( ) ); + this->GetOutput( "Output" )->SetITK( filter->GetOutput( ) ); } // eof - $RCSfile$ diff --git a/plugins/cpPluginsMeshFilters/AppendMeshesFilter.cxx b/plugins/cpPluginsMeshFilters/AppendMeshesFilter.cxx index f963274..b3fd5a6 100644 --- a/plugins/cpPluginsMeshFilters/AppendMeshesFilter.cxx +++ b/plugins/cpPluginsMeshFilters/AppendMeshesFilter.cxx @@ -27,12 +27,12 @@ cpPluginsMeshFilters::AppendMeshesFilter:: void cpPluginsMeshFilters::AppendMeshesFilter:: _GenerateData( ) { - auto m0 = this->GetInputData( "Input0" )->GetVTK< vtkPolyData >( ); - auto m1 = this->GetInputData( "Input1" )->GetVTK< vtkPolyData >( ); - auto m2 = this->GetInputData( "Input2" ); - auto m3 = this->GetInputData( "Input3" ); - auto m4 = this->GetInputData( "Input4" ); - auto m5 = this->GetInputData( "Input5" ); + auto m0 = this->GetInputData< vtkPolyData >( "Input0" ); + auto m1 = this->GetInputData< vtkPolyData >( "Input1" ); + auto m2 = this->GetInput( "Input2" ); + auto m3 = this->GetInput( "Input3" ); + auto m4 = this->GetInput( "Input4" ); + auto m5 = this->GetInput( "Input5" ); if( m0 == NULL || m1 == NULL ) this->_Error( "Invalid inputs." ); @@ -46,7 +46,7 @@ _GenerateData( ) if( m5 != NULL ) filter->AddInputData( m5->GetVTK< vtkPolyData >( ) ); filter->Update( ); - this->GetOutputData( "Output" )->SetVTK( filter->GetOutput( ) ); + this->GetOutput( "Output" )->SetVTK( filter->GetOutput( ) ); } // eof - $RCSfile$ diff --git a/plugins/cpPluginsWidgets/NoInteractiveSeedWidget.cxx b/plugins/cpPluginsWidgets/NoInteractiveSeedWidget.cxx index 85ff059..5f2bd3b 100644 --- a/plugins/cpPluginsWidgets/NoInteractiveSeedWidget.cxx +++ b/plugins/cpPluginsWidgets/NoInteractiveSeedWidget.cxx @@ -26,7 +26,7 @@ cpPluginsWidgets::NoInteractiveSeedWidget:: void cpPluginsWidgets::NoInteractiveSeedWidget:: _GenerateData( ) { - auto image = this->GetInputData( "ReferenceImage" )->GetITK< itk::DataObject >( ); + auto image = this->GetInputData< itk::DataObject >( "ReferenceImage" ); cpPlugins_Image_Demangle_Dim ( _GD0, image, 2 ); else cpPlugins_Image_Demangle_Dim( _GD0, image, 3 ); else this->_Error( "No valid input image." ); @@ -57,7 +57,7 @@ _GD0( _TImage* image ) if( image->TransformPhysicalPointToIndex( seed, idx ) ) container->Get( ).push_back( idx ); container->SetReferenceImage( image ); - this->GetOutputData( "Output" )->SetITK( container ); + this->GetOutput( "Output" )->SetITK( container ); } else this->_Error( "Input image dimension not supported." ); diff --git a/plugins/cpPluginsWidgets/SeedWidget.cxx b/plugins/cpPluginsWidgets/SeedWidget.cxx index da3109d..9e7a408 100644 --- a/plugins/cpPluginsWidgets/SeedWidget.cxx +++ b/plugins/cpPluginsWidgets/SeedWidget.cxx @@ -36,7 +36,7 @@ cpPluginsWidgets::SeedWidget:: void cpPluginsWidgets::SeedWidget:: _GenerateData( ) { - auto image = this->GetInputData( "ReferenceImage" )->GetITK< itk::DataObject >( ); + auto image = this->GetInputData< itk::DataObject >( "ReferenceImage" ); cpPlugins_Image_Demangle_Dim ( _GD0, image, 2 ); else cpPlugins_Image_Demangle_Dim( _GD0, image, 3 ); else this->_Error( "No valid input image." ); @@ -47,13 +47,15 @@ template< class _TImage > void cpPluginsWidgets::SeedWidget:: _GD0( _TImage* image ) { - typedef + + /* + typedef cpExtensions::DataStructures::ImageIndexesContainer< _TImage::ImageDimension > _TContainer; - typedef cpExtensions::Interaction::ImageInteractorStyle _S; + typedef cpExtensions::Interaction::ImageInteractorStyle _S; - if( image != NULL ) - { + if( image != NULL ) + { auto container = this->_CreateITK< _TContainer >( ); double aux_pnt[ 3 ]; unsigned int dim = ( _TImage::ImageDimension < 3 )? _TImage::ImageDimension: 3; @@ -62,34 +64,34 @@ _GD0( _TImage* image ) // MPR if( this->m_MPRViewer != NULL ) { - for( unsigned int i = 0; i < 4; ++i ) - { - _S* s = - dynamic_cast< _S* >( - this->m_MPRViewer->GetInteractor( i )->GetInteractorStyle( ) - ); - if( s != NULL ) - { - if( this->m_Configured ) - { - for( unsigned int i = 0; i < s->GetNumberOfSeeds( ); ++i ) - { - s->GetSeedAsPoint( i, aux_pnt ); - typename _TImage::PointType seed; - for( unsigned int d = 0; d < dim; ++d ) - seed[ d ] = aux_pnt[ d ]; - typename _TImage::IndexType idx; - if( image->TransformPhysicalPointToIndex( seed, idx ) ) - container->Get( ).push_back( idx ); - - } // rof - } - else - s->SeedWidgetOn( ); - - } // fi - - } // rof + for( unsigned int i = 0; i < 4; ++i ) + { + _S* s = + dynamic_cast< _S* >( + this->m_MPRViewer->GetInteractor( i )->GetInteractorStyle( ) + ); + if( s != NULL ) + { + if( this->m_Configured ) + { + for( unsigned int i = 0; i < s->GetNumberOfSeeds( ); ++i ) + { + s->GetSeedAsPoint( i, aux_pnt ); + typename _TImage::PointType seed; + for( unsigned int d = 0; d < dim; ++d ) + seed[ d ] = aux_pnt[ d ]; + typename _TImage::IndexType idx; + if( image->TransformPhysicalPointToIndex( seed, idx ) ) + container->Get( ).push_back( idx ); + + } // rof + } + else + s->SeedWidgetOn( ); + + } // fi + + } // rof } // fi @@ -97,30 +99,31 @@ _GD0( _TImage* image ) _S* s = dynamic_cast< _S* >( this->m_SingleInteractor ); if( s != NULL ) { - if( this->m_Configured ) - { - for( unsigned int i = 0; i < s->GetNumberOfSeeds( ); ++i ) - { - s->GetSeedAsPoint( i, aux_pnt ); - typename _TImage::PointType seed; - for( unsigned int d = 0; d < dim; ++d ) - seed[ d ] = aux_pnt[ d ]; - typename _TImage::IndexType idx; - if( image->TransformPhysicalPointToIndex( seed, idx ) ) - container->Get( ).push_back( idx ); - - } // rof - } - else - s->SeedWidgetOn( ); + if( this->m_Configured ) + { + for( unsigned int i = 0; i < s->GetNumberOfSeeds( ); ++i ) + { + s->GetSeedAsPoint( i, aux_pnt ); + typename _TImage::PointType seed; + for( unsigned int d = 0; d < dim; ++d ) + seed[ d ] = aux_pnt[ d ]; + typename _TImage::IndexType idx; + if( image->TransformPhysicalPointToIndex( seed, idx ) ) + container->Get( ).push_back( idx ); + + } // rof + } + else + s->SeedWidgetOn( ); } // fi this->m_Configured = true; container->SetReferenceImage( image ); this->GetOutputData( "Output" )->SetITK( container ); - } - else + } + else this->_Error( "Input image dimension not supported." ); + */ } // eof - $RCSfile$