#include "PipelineEditor.h"
#include "ui_PipelineEditor.h"
+#include <QMessageBox>
+
#include <cpPipelineEditor/Editor.h>
#include <cpExtensions/QT/PropertyWidget.h>
-#include <QMessageBox>
+
+#include <vtkImageData.h>
+#include <vtkPolyData.h>
#include <vtkRenderWindowInteractor.h>
// -------------------------------------------------------------------------
const std::string& filter_name, const std::string& output_name
)
{
- typedef cpPlugins::DataObject _TDataObject;
-
// Update filter, if needed
this->_ExecFilter( filter_name );
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." )
+ );
}
// -------------------------------------------------------------------------
const std::string& filter_name, const std::string& output_name
)
{
+ /*
// Get output
auto filter = this->m_Workspace.GetFilter( filter_name );
if( filter != NULL )
} // fi
} // fi
+ */
}
// -------------------------------------------------------------------------
const std::string& filter_name, const std::string& output_name
)
{
+ /*
// Get output
auto filter = this->m_Workspace.GetFilter( filter_name );
if( filter != NULL )
);
} // fi
+ */
}
// eof - $RCSfile$
// 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 =
} // yrt
this->m_UI->Viewer->SetMainImage(
- this->m_Reader->GetOutputData( "Output" )->GetVTK< vtkImageData >( )
+ this->m_Reader->GetOutputData< vtkImageData >( "Output" )
);
}
writer_params->SetSaveFileName( "FileName", argv[ argc - 1 ] );
// Connect filters
- writer->SetInput( "Input", reader->GetOutput( "Output" ) );
+ writer->SetInputPort( "Input", reader->GetOutputPort( "Output" ) );
// Execute filters
try
// 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 =
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 )
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 )
#ifdef cpExtensions_QT4
+#include <map>
#include <QWidget>
-
-#include <cpExtensions/Visualization/ImageSliceActors.h>
+#include <vtkPolyDataNormals.h>
+#include <vtkQuadricLODActor.h>
#include <vtkRenderer.h>
+#include <vtkStripper.h>
#include <vtkSmartPointer.h>
+#include <cpExtensions/Visualization/ImageSliceActors.h>
/*
- #include <map>
#include <string>
#include <vtkSmartPointer.h>
#include <vtkImageData.h>
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;
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;
#include <vtkCamera.h>
#include <vtkImageData.h>
#include <vtkImageProperty.h>
+#include <vtkPlane.h>
#include <vtkProperty.h>
#include <vtkRenderer.h>
#include <vtkRenderWindow.h>
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 )
#include <cpExtensions/cpExtensions_Export.h>
#include <cpExtensions/Interaction/ImageInteractorStyle.h>
+#include <map>
#include <vtkActor.h>
#include <vtkCursor3D.h>
+#include <vtkCutter.h>
#include <vtkImageActor.h>
#include <vtkImageSliceMapper.h>
#include <vtkPolyDataMapper.h>
this->Actor->Modified( );
}
};
-
public:
vtkTypeMacro( ImageSliceActors, vtkPropCollection );
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( );
// Secondary slices
std::vector< vtkSmartPointer< Self > > m_AssociatedSlices;
+ // Associated meshes
+ std::map< vtkPolyData*, SourceActor< vtkCutter > > m_Meshes;
+
// Cursor
SourceActor< vtkCursor3D > m_Cursor;
// -------------------------------------------------------------------------
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 );
// -------------------------------------------------------------------------
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 );
// -------------------------------------------------------------------------
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( ) )
// -------------------------------------------------------------------------
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( ) )
// -------------------------------------------------------------------------
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( ) )
// -------------------------------------------------------------------------
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( ) )
// -------------------------------------------------------------------------
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( ) )
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( );
#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::
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,
{
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 );
}
{
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 );
{
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 );
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 )
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" );
stlr->SetFileName( fname.c_str( ) );
stlr->Update( );
- this->GetOutputData( "Output" )->SetVTK( stlr->GetOutput( ) );
+ this->GetOutput( "Output" )->SetVTK( stlr->GetOutput( ) );
}
else if( ext == "obj" )
{
objr->SetFileName( fname.c_str( ) );
objr->Update( );
- this->GetOutputData( "Output" )->SetVTK( objr->GetOutput( ) );
+ this->GetOutput( "Output" )->SetVTK( objr->GetOutput( ) );
}
else if( ext == "vtk" )
{
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." );
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." );
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 );
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
filter->Update( );
// Connect output
- this->GetOutputData( "Output" )->SetITK( filter->GetOutput( ) );
+ this->GetOutput( "Output" )->SetITK( filter->GetOutput( ) );
}
else
this->_Error( "No valid second input image." );
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." );
filter->Update( );
// Connect output
- this->GetOutputData( "Output" )->SetITK( filter->GetOutput( ) );
+ this->GetOutput( "Output" )->SetITK( filter->GetOutput( ) );
}
// eof - $RCSfile$
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." );
filter->Update( );
// Connect output
- this->GetOutputData( "Output" )->SetITK( filter->GetOutput( ) );
+ this->GetOutput( "Output" )->SetITK( filter->GetOutput( ) );
}
// eof - $RCSfile$
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 );
filter->Update( );
// Connect output
- this->GetOutputData( "Output" )->SetITK( filter->GetOutput( ) );
+ this->GetOutput( "Output" )->SetITK( filter->GetOutput( ) );
}
// eof - $RCSfile$
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." );
filter->Update( );
// Connect output
- this->GetOutputData( "Output" )->SetITK( filter->GetOutput( ) );
+ this->GetOutput( "Output" )->SetITK( filter->GetOutput( ) );
}
// eof - $RCSfile$
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 );
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
filter->Update( );
// Connect output
- this->GetOutputData( "Output" )->SetITK( filter->GetOutput( ) );
+ this->GetOutput( "Output" )->SetITK( filter->GetOutput( ) );
}
else
this->_Error( "No valid second input image." );
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." );
filter->SetInput( image );
// Connect output
- this->GetOutputData( "Output" )->SetITK( filter->GetOutput( ) );
+ this->GetOutput( "Output" )->SetITK( filter->GetOutput( ) );
}
// eof - $RCSfile$
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." );
filter->Update( );
// Connect output
- this->GetOutputData( "Output" )->SetITK( filter->GetOutput( ) );
+ this->GetOutput( "Output" )->SetITK( filter->GetOutput( ) );
}
// eof - $RCSfile$
_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." );
this->_Error( "Input data does not have a valid dimension." );
// Connect output
- this->GetOutputData( "Output" )->SetVTK( pd );
+ this->GetOutput( "Output" )->SetVTK( pd );
}
// eof - $RCSfile$
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." );
_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 )
{
filter->Update( );
// Connect output
- auto out = this->GetOutputData( "Output" );
- out->SetITK( filter->GetOutput( ) );
+ this->GetOutput( "Output" )->SetITK( filter->GetOutput( ) );
}
// eof - $RCSfile$
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." );
if( m5 != NULL ) filter->AddInputData( m5->GetVTK< vtkPolyData >( ) );
filter->Update( );
- this->GetOutputData( "Output" )->SetVTK( filter->GetOutput( ) );
+ this->GetOutput( "Output" )->SetVTK( filter->GetOutput( ) );
}
// eof - $RCSfile$
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." );
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." );
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." );
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;
// 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
_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$