ImageMPR( QWidget* parent )
: QMainWindow( parent ),
m_UI( new Ui::ImageMPR ),
- m_ImageLoaded( false )
+ m_ImageLoaded( "" ),
+ m_Flooding( false )
{
this->m_UI->setupUi( this );
+ // Associate callbacks
+ this->m_UI->MPR->AddCursorCommand( Self::_CursorCommand, this );
+
// Connect actions
ImageMPR_ConnectAction( OpenImage );
ImageMPR_ConnectAction( OpenSegmentation );
void ImageMPR::
_aOpenImage( )
{
- if( this->m_ImageLoaded )
+ if( this->m_ImageLoaded != "" )
this->m_UI->MPR->ClearAll( );
this->m_ImageLoaded = this->m_UI->MPR->LoadImage( );
}
void ImageMPR::
_aOpenSegmentation( )
{
- if( this->m_ImageLoaded )
+ if( this->m_ImageLoaded != "" )
this->m_ImageLoaded = this->m_UI->MPR->LoadImage( );
}
if( action == NULL )
return;
std::string name = action->text( ).toStdString( );
- this->m_UI->MPR->ExecuteFilter( name, 0 );
+
+ if( name == "cpPlugins::BasicFilters::FloodFillImageFilter" )
+ {
+ this->m_Flooding = true;
+ }
+ else
+ {
+ this->m_Flooding = false;
+ this->m_UI->MPR->ExecuteFilter(
+ name, this->m_ImageLoaded, "SegmentedImage"
+ );
+
+ } // fi
// Configure filter
/*
*/
}
+// -------------------------------------------------------------------------
+void ImageMPR::
+_CursorCommand( double* pos, int axis, void* data )
+{
+ Self* app = reinterpret_cast< Self* >( data );
+ if( app == NULL )
+ return;
+ if( !( app->m_Flooding ) )
+ return;
+
+ cpPlugins::Interface::ProcessObject::Pointer filter =
+ app->m_UI->MPR->CreateFilter(
+ "cpPlugins::BasicFilters::FloodFillImageFilter"
+ );
+ if( filter.IsNull( ) )
+ return;
+
+ cpPlugins::Interface::Parameters* params = filter->GetParameters( );
+ params->SetPoint( "Seed", 3, pos );
+ params->SetReal( "Window", app->m_UI->MPR->GetWindow( ) );
+ params->SetReal( "Level", app->m_UI->MPR->GetLevel( ) );
+ params->SetUint( "InsideValue", 1 );
+ params->SetUint( "OutsideValue", 0 );
+ filter->SetInput( "Input", app->m_UI->MPR->GetImage( app->m_ImageLoaded ) );
+ app->m_UI->MPR->Block( );
+ std::string err = filter->Update( );
+ cpPlugins::Interface::BaseMPRWindow::TImage::Pointer image = filter->GetOutput< cpPlugins::Interface::BaseMPRWindow::TImage >( "Output" );
+ filter->DisconnectOutputs( );
+ app->m_UI->MPR->AddImage( "Segmentation", image );
+ app->m_UI->MPR->Unblock( );
+
+
+
+ /* TODO
+ std::cout
+ << "CursorCommand ==> "
+ << pos[ 0 ] << " "
+ << pos[ 1 ] << " "
+ << pos[ 2 ] << " : "
+ << axis << " "
+ << data << std::endl;
+ */
+}
+
/*
#include "MementoState.h"
Q_OBJECT;
public:
+ typedef ImageMPR Self;
+ typedef QMainWindow Superclass;
+
+ typedef cpExtensions::Visualization::MPRObjects TMPRObjects;
+ typedef TMPRObjects::TCursorCommand TCursorCommand;
+ typedef TMPRObjects::TMouseCommand TMouseCommand;
+ typedef TMPRObjects::TMouseWheelCommand TMouseWheelCommand;
+ typedef TMPRObjects::TKeyCommand TKeyCommand;
+
// Plugins types
/*
typedef cpPlugins::Interface::Interface TPluginsInterface;
void _execPlugin( );
+protected:
+ // Callbacks
+ static void _CursorCommand( double* pos, int axis, void* data );
+
private:
Ui::ImageMPR* m_UI;
// Some state flags
- bool m_ImageLoaded;
+ std::string m_ImageLoaded;
+ bool m_Flooding;
// Plugins objects
/*
SET(
EXAMPLES_PROGRAMS_WITH_PLUGINS
- example_ReadWriteImage
- example_View2DImage
+ #example_ReadWriteImage
+ #example_MPR
+ #example_View2DImage
##example_MarchingCubes
##example_OtsuFilter
##example_RGBImageToHSVChannels
##example_MPR
)
-
-FOREACH(prog ${EXAMPLES_PROGRAMS})
+FOREACH(prog ${EXAMPLES_PROGRAMS_WITH_PLUGINS})
ADD_EXECUTABLE(
${prog}
${prog}.cxx
}
virtual void Execute( vtkObject* caller, unsigned long eId , void* data )
{
+ /*
vtkSliderWidget* wdg =
reinterpret_cast< vtkSliderWidget* >( caller );
if( wdg == NULL )
this->Actors->SetWindow( 0, rep->GetValue( ) );
else if( title == "Level" )
this->Actors->SetLevel( 0, rep->GetValue( ) );
+ */
}
SliderCallback( )
: vtkCommand( )
// Create reader
TFilter::Pointer reader =
- plugins.CreateProcessObject( "cpPlugins::ImageReader" );
+ plugins.CreateProcessObject( "cpPlugins::IO::ImageReader" );
if( reader.IsNull( ) )
{
- std::cerr << "No suitable image reader found in plugins." << std::endl;
+ std::cerr
+ << "ERROR: No suitable image reader found in plugins."
+ << std::endl;
return( 1 );
} // fi
// Configure reader
- TParameters reader_params = reader->GetDefaultParameters( );
+ TParameters* reader_params = reader->GetParameters( );
for( int i = 2; i < argc; ++i )
- reader_params.AddValueToStringList( "FileNames", argv[ i ] );
- reader->SetParameters( reader_params );
+ reader_params->AddToStringList( "FileNames", argv[ i ] );
// Execute reader
std::string msg = reader->Update( );
} // fi
// Get input image's vtk representation
- vtkImageData* image = reader->GetOutput< TImage >( 0 )->GetVTKImageData( );
+ vtkImageData* image =
+ reader->GetOutput< TImage >( "Output" )->GetVTK< vtkImageData >( );
if( image == NULL )
{
std::cerr
// Renderers
vtkSmartPointer< vtkRenderer > renderer =
vtkSmartPointer< vtkRenderer >::New( );
+ renderer->SetBackground( 0, 0, 1 );
window->AddRenderer( renderer );
// Interactor
vtkSmartPointer< TMPRActors > mpr_actors =
vtkSmartPointer< TMPRActors >::New( );
mpr_actors->AddInputData( image );
- mpr_actors->PushDataInto( NULL, NULL, NULL, renderer );
+ mpr_actors->PushActorsInto( NULL, NULL, NULL, window );
// Callbacks
vtkSmartPointer< SliderCallback > cb =
vtkSmartPointer< SliderCallback >::New( );
cb->Actors = mpr_actors;
+ /*
Slider x_slider(
mpr_actors->GetSliceNumberMinValue( 0 ),
mpr_actors->GetSliceNumberMaxValue( 0 ),
"Level", interactor,
0.300, 0.05, 0.490, 0.05, cb
);
+ */
// Begin interaction
renderer->ResetCamera( );
void cpExtensions::Visualization::ImageSliceActors::
PushActorsInto( vtkRenderWindow* window, bool force_style )
{
+ if( window == NULL )
+ return;
vtkRenderWindowInteractor* rwi = window->GetInteractor( );
vtkRenderer* renderer = window->GetRenderers( )->GetFirstRenderer( );
-
+ if( rwi == NULL || renderer == NULL )
+ return;
+
// Update style
- if( rwi != NULL && force_style )
- {
+ if( force_style )
if( rwi->GetInteractorStyle( ) != this->Style.GetPointer( ) )
- {
rwi->SetInteractorStyle( this->Style );
- } // fi
-
- } // fi
+ // Update actors
+ unsigned int N = this->GetNumberOfImageActors( );
+ for( unsigned int n = 0; n < N; ++n )
+ renderer->AddActor( this->GetImageActor( n ) );
+ renderer->AddActor( this->CursorActor );
+ renderer->AddActor( this->PlaneActor );
+ renderer->AddActor( this->TextActor );
+ renderer->Modified( );
+
+ // Configure camera
+ vtkCamera* camera = renderer->GetActiveCamera( );
+ if( camera == NULL )
+ return;
- if( renderer != NULL )
+ // Parallel projections are better when displaying 2D images
+ if( force_style )
{
- // Update actors
- unsigned int N = this->GetNumberOfImageActors( );
- for( unsigned int n = 0; n < N; ++n )
- renderer->AddActor( this->GetImageActor( n ) );
- renderer->AddActor( this->CursorActor );
- renderer->AddActor( this->PlaneActor );
- renderer->AddActor( this->TextActor );
- renderer->Modified( );
-
- // Configure camera
- vtkCamera* camera = renderer->GetActiveCamera( );
- if( camera == NULL )
- return;
-
- // Parallel projections are better when displaying 2D images
- if( force_style )
+ int axis = this->GetAxis( );
+ camera->ParallelProjectionOn( );
+ camera->SetFocalPoint( double( 0 ), double( 0 ), double( 0 ) );
+ if( axis == 0 )
{
- int axis = this->GetAxis( );
- camera->ParallelProjectionOn( );
- camera->SetFocalPoint( double( 0 ), double( 0 ), double( 0 ) );
- if( axis == 0 )
- {
- camera->SetPosition( double( 1 ), double( 0 ), double( 0 ) );
- camera->SetViewUp ( double( 0 ), double( 1 ), double( 0 ) );
- }
- else if( axis == 1 )
- {
- camera->SetPosition( double( 0 ), double( 1 ), double( 0 ) );
- camera->SetViewUp ( double( 0 ), double( 0 ), double( -1 ) );
- }
- else // if( axis == 2 )
- {
- camera->SetPosition( double( 0 ), double( 0 ), double( 1 ) );
- camera->SetViewUp ( double( 0 ), double( 1 ), double( 0 ) );
-
- } // fi
+ camera->SetPosition( double( 1 ), double( 0 ), double( 0 ) );
+ camera->SetViewUp ( double( 0 ), double( 1 ), double( 0 ) );
+ }
+ else if( axis == 1 )
+ {
+ camera->SetPosition( double( 0 ), double( 1 ), double( 0 ) );
+ camera->SetViewUp ( double( 0 ), double( 0 ), double( -1 ) );
+ }
+ else // if( axis == 2 )
+ {
+ camera->SetPosition( double( 0 ), double( 0 ), double( 1 ) );
+ camera->SetViewUp ( double( 0 ), double( 1 ), double( 0 ) );
} // fi
- renderer->ResetCamera( );
- rwi->Render( );
} // fi
+ renderer->ResetCamera( );
+ rwi->Render( );
}
// -------------------------------------------------------------------------
void cpExtensions::Visualization::ImageSliceActors::
UpdateText( double pos[ 3 ] )
{
+ /* TODO
if( this->SliceMappers.size( ) > 0 )
{
char axis;
this->TextActor->SetInput( this->TextBuffer );
this->TextActor->Modified( );
this->Modified( );
+ */
}
// -------------------------------------------------------------------------
if( !alt && !ctr && !sft )
actors->SetCursor( pos );
else if( !alt && ctr && !sft && actors->SlicesCommand != NULL )
+ {
actors->SlicesCommand( pos, actors->GetAxis( ), actors->SlicesData );
+ for( unsigned int i = 0; i < actors->CursorCommands.size( ); ++i )
+ actors->CursorCommands[ i ].first(
+ pos,
+ actors->GetAxis( ),
+ actors->CursorCommands[ i ].second
+ );
+
+ } // fi
}
else if( btn == ImageInteractorStyle::ButtonID_Middle )
{
typedef ImageSliceActors Self;
typedef void ( *TCursorCommand )( double*, int, void* );
+ typedef ImageInteractorStyle::TMouseCommand TMouseCommand;
+ typedef ImageInteractorStyle::TMouseWheelCommand TMouseWheelCommand;
+ typedef ImageInteractorStyle::TKeyCommand TKeyCommand;
public:
vtkTypeMacro( ImageSliceActors, vtkPropCollection );
// Creation
static ImageSliceActors* New( );
+ void AddCursorCommand( TCursorCommand command, void* data )
+ {
+ this->CursorCommands.push_back(
+ std::pair< TCursorCommand, void* >(
+ command, data
+ )
+ );
+ }
+
void AddInputConnection( vtkAlgorithmOutput* aout, int axis = 2 );
void AddInputData( vtkImageData* data, int axis = 2 );
void Clear( );
TCursorCommand SlicesCommand;
void* SlicesData;
+ // Associated commands
+ std::vector< std::pair< TCursorCommand, void* > > CursorCommands;
+ std::vector< TMouseCommand > MouseCommands;
+ std::vector< TMouseCommand > MouseClickCommands;
+ std::vector< TMouseCommand > MouseDoubleClickCommands;
+ std::vector< TMouseWheelCommand > MouseWheelCommands;
+ std::vector< TKeyCommand > KeyCommands;
+
// Other associated actors
typedef std::pair< vtkAlgorithm*, vtkActor* > TAssociatedActor;
typedef std::vector< TAssociatedActor > TAssociatedActors;
#include <vtkAlgorithmOutput.h>
#include <vtkImageData.h>
+#include <vtkOutlineSource.h>
+#include <vtkProperty.h>
#include <vtkRenderer.h>
#include <vtkRendererCollection.h>
#include <vtkRenderWindow.h>
this->Slices[ i ][ j ]->AddInputConnection(
( ( imap != NULL )? imap->GetOutputPort( ): aout ), j
);
+
+ // Create bounding box
+ vtkImageData* new_image = dynamic_cast< vtkImageData* >(
+ aout->GetProducer( )->GetOutputDataObject( aout->GetIndex( ) )
+ );
+
+ // Create 3D outline
+ double bb[ 6 ];
+ new_image->GetBounds( bb );
+
+ vtkSmartPointer< vtkOutlineSource > img_ol =
+ vtkSmartPointer< vtkOutlineSource >::New( );
+ img_ol->SetBounds( bb );
+
+ vtkSmartPointer< vtkPolyDataMapper > img_ol_mapper =
+ vtkSmartPointer< vtkPolyDataMapper >::New( );
+ img_ol_mapper->SetInputConnection( img_ol->GetOutputPort( ) );
+ this->ImageOutlineActor->SetMapper( img_ol_mapper );
+ this->ImageOutlineActor->GetProperty( )->SetColor( 1, 1, 1 );
+ this->ImageOutlineActor->GetProperty( )->SetLineWidth( 1 );
+
+ this->AddItem( this->ImageOutlineActor );
}
else
{
this->Slices[ i ][ j ]->AddInputData( new_image, j );
} // fi
+
+ // Create 3D outline
+ double bb[ 6 ];
+ new_image->GetBounds( bb );
+
+ vtkSmartPointer< vtkOutlineSource > img_ol =
+ vtkSmartPointer< vtkOutlineSource >::New( );
+ img_ol->SetBounds( bb );
+
+ vtkSmartPointer< vtkPolyDataMapper > img_ol_mapper =
+ vtkSmartPointer< vtkPolyDataMapper >::New( );
+ img_ol_mapper->SetInputConnection( img_ol->GetOutputPort( ) );
+ this->ImageOutlineActor->SetMapper( img_ol_mapper );
+ this->ImageOutlineActor->GetProperty( )->SetColor( 1, 1, 1 );
+ this->ImageOutlineActor->GetProperty( )->SetLineWidth( 1 );
+
+ this->AddItem( this->ImageOutlineActor );
}
else
{
public:
typedef MPRActors Self;
+ typedef ImageSliceActors::TCursorCommand TCursorCommand;
+ typedef ImageSliceActors::TMouseCommand TMouseCommand;
+ typedef ImageSliceActors::TMouseWheelCommand TMouseWheelCommand;
+ typedef ImageSliceActors::TKeyCommand TKeyCommand;
+
public:
vtkTypeMacro( MPRActors, vtkPropCollection );
// Creation
static MPRActors* New( );
+ void AddCursorCommand( TCursorCommand command, void* data )
+ {
+ this->Slices[ 0 ][ 0 ]->AddCursorCommand( command, data );
+ this->Slices[ 0 ][ 1 ]->AddCursorCommand( command, data );
+ this->Slices[ 0 ][ 2 ]->AddCursorCommand( command, data );
+ }
+
ImageSliceActors* GetSliceActors( const int& i ) const;
int AddInputConnection( vtkAlgorithmOutput* aout );
unsigned int i, double r, double g, double b
);
+ double GetWindow( )
+ {
+ return( this->Slices[ 0 ][ 0 ]->GetWindow( ) );
+ }
+ double GetLevel( )
+ {
+ return( this->Slices[ 0 ][ 0 ]->GetLevel( ) );
+ }
+
// Slice access
int GetSliceNumberMinValue( const int& axis ) const;
int GetSliceNumberMaxValue( const int& axis ) const;
protected:
vtkSmartPointer< vtkActor > ImageOutlineActor;
vtkSmartPointer< ImageSliceActors > Slices[ 2 ][ 3 ];
+
+ std::vector< TCursorCommand > CursorCommands;
+ std::vector< TMouseCommand > MouseCommands;
+ std::vector< TMouseCommand > MouseClickCommands;
+ std::vector< TMouseCommand > MouseDoubleClickCommands;
+ std::vector< TMouseWheelCommand > MouseWheelCommands;
+ std::vector< TKeyCommand > KeyCommands;
};
} // ecapseman
typedef MPRObjects Self;
typedef cpExtensions::Visualization::MPRActors TMPRActors;
+ typedef TMPRActors::TCursorCommand TCursorCommand;
+ typedef TMPRActors::TMouseCommand TMouseCommand;
+ typedef TMPRActors::TMouseWheelCommand TMouseWheelCommand;
+ typedef TMPRActors::TKeyCommand TKeyCommand;
+
public:
vtkTypeMacro( MPRObjects, vtkObject );
// Creation
static MPRObjects* New( );
+ void AddCursorCommand( TCursorCommand command, void* data )
+ {
+ this->m_MPRActors->AddCursorCommand( command, data );
+ }
+
void SetRenderWindows(
vtkRenderWindow* wx, vtkRenderWindow* wy,
vtkRenderWindow* wz, vtkRenderWindow* w3D
TMPRActors* GetMPRActors( );
const TMPRActors* GetMPRActors( ) const;
+ double GetWindow( ) const
+ {
+ return( this->m_MPRActors->GetWindow( ) );
+ }
+ double GetLevel( ) const
+ {
+ return( this->m_MPRActors->GetLevel( ) );
+ }
+
protected:
MPRObjects( );
virtual ~MPRObjects( );
// Internal pipelines
vtkSmartPointer< TMPRActors > m_MPRActors;
vtkSmartPointer< vtkRenderer > m_Renderers[ 4 ];
+
+ std::vector< TCursorCommand > CursorCommands;
+ std::vector< TMouseCommand > MouseCommands;
+ std::vector< TMouseCommand > MouseClickCommands;
+ std::vector< TMouseCommand > MouseDoubleClickCommands;
+ std::vector< TMouseWheelCommand > MouseWheelCommands;
+ std::vector< TKeyCommand > KeyCommands;
};
} // ecapseman
}
// -------------------------------------------------------------------------
-bool cpPlugins::Interface::BaseMPRWindow::
+std::string cpPlugins::Interface::BaseMPRWindow::
LoadImage( )
{
std::string msg = "";
- bool ret = true;
+ std::string ret = "";
if( this->m_ImageReader.IsNull( ) )
- {
msg = "No valid image reader. Please load a valid plugin file.";
- ret = false;
-
- } // fi
if( this->m_ImageReader->ExecConfigurationDialog( this ) )
{
msg = this->m_ImageReader->Update( );
if( msg == "" )
{
- this->m_Images.push_back(
- this->m_ImageReader->GetOutput< TImage >( 0 )
- );
+ TImage::Pointer image =
+ this->m_ImageReader->GetOutput< TImage >( "Output" );
+ if( this->m_Images.size( ) == 0 )
+ ret = image->GetName( );
+ else
+ ret = "Segmentation";
+ this->m_Images[ ret ] = image;
this->m_ImageReader->DisconnectOutputs( );
this->m_ImageReader->GetParameters( )->ClearStringList( "FileNames" );
- vtkImageData* vtk_id =
- this->m_Images.rbegin( )->GetPointer( )->GetVTK< vtkImageData >( );
+ vtkImageData* vtk_id = image->GetVTK< vtkImageData >( );
if( vtk_id != NULL )
{
this->m_MPRObjects->AddImage( vtk_id );
msg = "Read image does not have a valid VTK converter.";
}
else
- ret = false;
+ ret = "";
} // fi
}
// -------------------------------------------------------------------------
-bool cpPlugins::Interface::BaseMPRWindow::
+std::string cpPlugins::Interface::BaseMPRWindow::
LoadMesh( )
{
- return( false );
+ return( "" );
}
// -------------------------------------------------------------------------
void cpPlugins::Interface::BaseMPRWindow::
-ExecuteFilter( const std::string& name, int input_id, int output_id )
+ExecuteFilter(
+ const std::string& name,
+ const std::string& input_id,
+ const std::string& output_id
+ )
{
TProcessObject::Pointer filter =
this->m_Interface.CreateProcessObject( name );
std::string category = filter->GetClassCategory( );
if( category == "ImageToBinaryImageFilter" )
{
- if( input_id < this->m_Images.size( ) )
+ TImages::iterator iIt = this->m_Images.find( input_id );
+ if( iIt != this->m_Images.end( ) )
{
- filter->SetInput( 0, this->m_Images[ input_id ] );
+ filter->SetInput( "Input", this->m_Images[ input_id ] );
bool dlg_ok = filter->ExecConfigurationDialog( NULL );
if( !dlg_ok )
return;
+ std::string err = filter->Update( );
+ std::cout << "ERR: " << err << std::endl;
+ if( err == "" )
+ {
+ this->m_Images[ "Segmentation" ] =
+ filter->GetOutput< TImage >( "Output" );
+ filter->DisconnectOutputs( );
+
+ vtkImageData* vtk_id =
+ this->m_Images[ "Segmentation" ]->GetVTK< vtkImageData >( );
+ if( vtk_id != NULL )
+ this->m_MPRObjects->AddImage( vtk_id );
+ }
+ else
+ QMessageBox::critical(
+ this, tr( "Error with plugin" ), tr( err.c_str( ) )
+ );
+
} // fi
} // fi
}
+// -------------------------------------------------------------------------
+void cpPlugins::Interface::BaseMPRWindow::
+AddImage( const std::string& name, TImage* image )
+{
+ this->m_Images[ name ] = image;
+ vtkImageData* vtk_id =
+ this->m_Images[ name ]->GetVTK< vtkImageData >( );
+ if( vtk_id != NULL )
+ this->m_MPRObjects->AddImage( vtk_id );
+}
+
// -------------------------------------------------------------------------
void cpPlugins::Interface::BaseMPRWindow::
ClearAll( )
#ifdef cpPlugins_Interface_QT4
+#include <map>
#include <set>
#include <string>
-#include <vector>
#include <QApplication>
#include <QMenu>
typedef cpPlugins::Interface::Image TImage;
typedef cpPlugins::Interface::Mesh TMesh;
- typedef std::vector< TImage::Pointer > TImages;
- typedef std::vector< TMesh::Pointer > TMeshes;
- typedef std::set< std::string > TOrderedStringContainer;
+ typedef cpExtensions::Visualization::MPRObjects TMPRObjects;
+ typedef TMPRObjects::TCursorCommand TCursorCommand;
+ typedef TMPRObjects::TMouseCommand TMouseCommand;
+ typedef TMPRObjects::TMouseWheelCommand TMouseWheelCommand;
+ typedef TMPRObjects::TKeyCommand TKeyCommand;
+
+ typedef std::map< std::string, TImage::Pointer > TImages;
+ typedef std::map< std::string, TMesh::Pointer > TMeshes;
+ typedef std::set< std::string > TOrderedStringContainer;
typedef std::map< std::string, std::set< std::string > > TFilters;
public:
explicit BaseMPRWindow( QWidget* parent = 0 );
virtual ~BaseMPRWindow( );
+ void AddCursorCommand( TCursorCommand command, void* data )
+ {
+ this->m_MPRObjects->AddCursorCommand( command, data );
+ }
+
void DialogLoadPlugins( );
void AssociatePluginsToMenu(
QMenu* menu, QObject* obj, const char* slot
bool LoadPlugins( const std::string& fname );
void LoadPlugins( );
- bool LoadImage( );
- bool LoadMesh( );
+ std::string LoadImage( );
+ std::string LoadMesh( );
void ExecuteFilter(
const std::string& name,
- int input_id, int output_id = -1
+ const std::string& input_id,
+ const std::string& output_id
);
+ TProcessObject::Pointer CreateFilter( const std::string& name )
+ {
+ return( this->m_Interface.CreateProcessObject( name ) );
+ }
+
+ void AddImage( const std::string& name, TImage* image );
+ TImage* GetImage( std::string& name ) const
+ {
+ TImages::const_iterator i = this->m_Images.find( name );
+ if( i != this->m_Images.end( ) )
+ return( i->second );
+ else
+ return( NULL );
+ }
+
+ double GetWindow( ) const
+ {
+ return( this->m_MPRObjects->GetWindow( ) );
+ }
+ double GetLevel( ) const
+ {
+ return( this->m_MPRObjects->GetLevel( ) );
+ }
+
void ClearAll( );
protected:
void _UpdatePlugins( );
protected:
- typedef cpExtensions::Visualization::MPRObjects TMPRObjects;
vtkSmartPointer< TMPRObjects > m_MPRObjects;
QVTKWidget* m_XVTK;
#include <cpPlugins/Interface/Parameters.h>
+#include <cpPlugins/Interface/ProcessObject.h>
#include <sstream>
+// -------------------------------------------------------------------------
+const cpPlugins::Interface::
+ProcessObject* cpPlugins::Interface::Parameters::
+GetProcessObject( ) const
+{
+ return( this->m_Process );
+}
+
+// -------------------------------------------------------------------------
+void cpPlugins::Interface::Parameters::
+SetProcessObject( ProcessObject* v )
+{
+ this->m_Process = v;
+}
+
+// -------------------------------------------------------------------------
+void cpPlugins::Interface::Parameters::
+Modified( ) const
+{
+ this->Superclass::Modified( );
+ if( this->m_Process != NULL )
+ this->m_Process->Modified( );
+}
+
// -------------------------------------------------------------------------
void cpPlugins::Interface::Parameters::
Clear( )
// -------------------------------------------------------------------------
cpPlugins::Interface::Parameters::
Parameters( )
- : Superclass( )
+ : Superclass( ),
+ m_Process( NULL )
{
this->Clear( );
}
{
namespace Interface
{
+ // Some forward declarations
+ class ProcessObject;
+
/**
*/
class cpPlugins_Interface_EXPORT Parameters
itkTypeMacro( cpPlugins::Interface::Parameters, itk::Object );
public:
+ // To impact pipeline
+ virtual const ProcessObject* GetProcessObject( ) const;
+ virtual void SetProcessObject( ProcessObject* v );
+ virtual void Modified( ) const;
+
// Parameters container configuration
void Clear( );
protected:
TParameters m_Parameters;
+ const ProcessObject* m_Process;
};
} // ecapseman
#include <cpPlugins/Interface/ParametersQtDialog.h>
#endif // cpPlugins_Interface_QT4
+// -------------------------------------------------------------------------
+void cpPlugins::Interface::ProcessObject::
+Modified( ) const
+{
+ if( this->m_ITKObject.IsNotNull( ) )
+ this->m_ITKObject->Modified( );
+ if( this->m_VTKObject.GetPointer( ) != NULL )
+ this->m_VTKObject->Modified( );
+ this->Superclass::Modified( );
+}
+
// -------------------------------------------------------------------------
cpPlugins::Interface::ProcessObject::
TParameters* cpPlugins::Interface::ProcessObject::
// -------------------------------------------------------------------------
void cpPlugins::Interface::ProcessObject::
-SetNumberOfInputs( unsigned int n )
-{
- this->m_Inputs.clear( );
- this->m_Inputs.resize( n );
- this->Modified( );
-}
-
-// -------------------------------------------------------------------------
-void cpPlugins::Interface::ProcessObject::
-SetNumberOfOutputs( unsigned int n )
+SetInput( const std::string& id, cpPlugins::Interface::DataObject* dobj )
{
- this->m_Outputs.clear( );
- this->m_Outputs.resize( n );
- this->Modified( );
-}
-
-// -------------------------------------------------------------------------
-void cpPlugins::Interface::ProcessObject::
-SetInput( unsigned int idx, cpPlugins::Interface::DataObject* dobj )
-{
- if( idx < this->m_Inputs.size( ) )
+ _TDataContainer::iterator i = this->m_Inputs.find( id );
+ if( i != this->m_Inputs.end( ) )
{
- this->m_Inputs[ idx ] = dobj;
+ i->second = dobj;
this->Modified( );
} // fi
std::string r = "";
// Force upstream updates
- for( unsigned int i = 0; i < this->m_Inputs.size( ) && r == ""; ++i )
+ _TDataContainer::iterator i = this->m_Inputs.begin( );
+ for( ; i != this->m_Inputs.end( ) && r == ""; ++i )
{
- Self* src = dynamic_cast< Self* >( this->m_Inputs[ i ]->GetSource( ) );
+ Self* src = dynamic_cast< Self* >( i->second->GetSource( ) );
if( src != NULL )
r = src->Update( );
void cpPlugins::Interface::ProcessObject::
DisconnectOutputs( )
{
- for( unsigned int idx = 0; idx < this->m_Outputs.size( ); ++idx )
- if( this->m_Outputs[ idx ].IsNotNull( ) )
- this->m_Outputs[ idx ]->DisconnectPipeline( );
+ _TDataContainer::iterator i = this->m_Outputs.begin( );
+ for( ; i != this->m_Outputs.end( ); ++i )
+ if( i->second.IsNotNull( ) )
+ i->second->DisconnectPipeline( );
}
// -------------------------------------------------------------------------
{
}
+// -------------------------------------------------------------------------
+void cpPlugins::Interface::ProcessObject::
+_AddInput( const std::string& name )
+{
+ this->m_Inputs[ name ] = NULL;
+ this->Modified( );
+}
+
// eof - $RCSfile$
#define __CPPLUGINS__INTERFACE__PROCESSOBJECT__H__
#include <cpPlugins/Interface/cpPlugins_Interface_Export.h>
+
+#include <map>
+
#include <cpPlugins/Interface/Config.h>
#include <cpPlugins/Interface/Object.h>
#include <cpPlugins/Interface/DataObject.h>
);
public:
+ // To impact pipeline
+ virtual void Modified( ) const;
+
virtual TParameters* GetParameters( );
virtual const TParameters* GetParameters( ) const;
virtual unsigned int GetNumberOfInputs( ) const;
virtual unsigned int GetNumberOfOutputs( ) const;
- virtual void SetNumberOfInputs( unsigned int n );
- virtual void SetNumberOfOutputs( unsigned int n );
-
- virtual void SetInput( unsigned int idx, DataObject* dobj );
+ virtual void SetInput( const std::string& id, DataObject* dobj );
virtual std::string Update( );
virtual void DisconnectOutputs( );
inline const T* GetVTK( ) const;
template< class T >
- inline T* GetInput( unsigned int idx );
+ inline T* GetInput( const std::string& id );
template< class T >
- inline const T* GetInput( unsigned int idx ) const;
+ inline const T* GetInput( const std::string& id ) const;
template< class T >
- inline T* GetOutput( unsigned int idx );
+ inline T* GetOutput( const std::string& id );
template< class T >
- inline const T* GetOutput( unsigned int idx ) const;
+ inline const T* GetOutput( const std::string& id ) const;
protected:
ProcessObject( );
virtual ~ProcessObject( );
+ virtual void _AddInput( const std::string& name );
+
template< class F >
inline F* _CreateITK( );
inline F* _CreateVTK( );
template< class O >
- inline void _MakeOutput( unsigned int idx );
+ inline void _MakeOutput( const std::string& id );
virtual std::string _GenerateData( ) = 0;
Parameters::Pointer m_Parameters;
- std::vector< DataObject::Pointer > m_Inputs;
- std::vector< DataObject::Pointer > m_Outputs;
+ typedef std::map< std::string, DataObject::Pointer > _TDataContainer;
+ _TDataContainer m_Inputs;
+ _TDataContainer m_Outputs;
};
} // ecapseman
// -------------------------------------------------------------------------
template< class T >
T* cpPlugins::Interface::ProcessObject::
-GetInput( unsigned int idx )
+GetInput( const std::string& id )
{
- if( idx < this->m_Inputs.size( ) )
- return( dynamic_cast< T* >( this->m_Inputs[ idx ].GetPointer( ) ) );
+ _TDataContainer::iterator i = this->m_Inputs.find( id );
+ if( i != this->m_Inputs.end( ) )
+ return( dynamic_cast< T* >( i->second.GetPointer( ) ) );
else
return( NULL );
}
// -------------------------------------------------------------------------
template< class T >
const T* cpPlugins::Interface::ProcessObject::
-GetInput( unsigned int idx ) const
+GetInput( const std::string& id ) const
{
- if( idx < this->m_Inputs.size( ) )
- return(
- dynamic_cast< const T* >( this->m_Inputs[ idx ].GetPointer( ) )
- );
+ _TDataContainer::const_iterator i = this->m_Inputs.find( id );
+ if( i != this->m_Inputs.end( ) )
+ return( dynamic_cast< const T* >( i->second.GetPointer( ) ) );
else
return( NULL );
}
// -------------------------------------------------------------------------
template< class T >
T* cpPlugins::Interface::ProcessObject::
-GetOutput( unsigned int idx )
+GetOutput( const std::string& id )
{
- if( idx < this->m_Outputs.size( ) )
- return( dynamic_cast< T* >( this->m_Outputs[ idx ].GetPointer( ) ) );
+ _TDataContainer::iterator i = this->m_Outputs.find( id );
+ if( i != this->m_Outputs.end( ) )
+ return( dynamic_cast< T* >( i->second.GetPointer( ) ) );
else
return( NULL );
}
// -------------------------------------------------------------------------
template< class T >
const T* cpPlugins::Interface::ProcessObject::
-GetOutput( unsigned int idx ) const
+GetOutput( const std::string& id ) const
{
- if( idx < this->m_Outputs.size( ) )
- return(
- dynamic_cast< const T* >( this->m_Outputs[ idx ].GetPointer( ) )
- );
+ _TDataContainer::const_iterator i = this->m_Outputs.find( id );
+ if( i != this->m_Outputs.end( ) )
+ return( dynamic_cast< const T* >( i->second.GetPointer( ) ) );
else
return( NULL );
}
// -------------------------------------------------------------------------
template< class O >
void cpPlugins::Interface::ProcessObject::
-_MakeOutput( unsigned int idx )
+_MakeOutput( const std::string& id )
{
- if( idx >= this->m_Outputs.size( ) )
- return;
- this->m_Outputs[ idx ] = O::New( );
- this->m_Outputs[ idx ]->SetSource( this );
+ this->m_Outputs[ id ] = O::New( );
+ this->m_Outputs[ id ]->SetSource( this );
+ this->Modified( );
}
#endif // __CPPLUGINS__INTERFACE__PROCESSOBJECT__HXX__
BinaryErodeImageFilter( )
: Superclass( )
{
- //this->m_ClassName = "cpPlugins::BasicFilters::BinaryErodeImageFilter";
- //this->m_ClassCategory = "ImageToImageFilter";
- this->SetNumberOfInputs( 1 );
- this->SetNumberOfOutputs( 1 );
- this->_MakeOutput< cpPlugins::Interface::Image >( 0 );
+ this->_AddInput( "Input" );
+ this->_MakeOutput< cpPlugins::Interface::Image >( "Output" );
this->m_Parameters->ConfigureAsUint( "Radius", 2 );
}
_GenerateData( )
{
cpPlugins::Interface::Image* image =
- this->GetInput< cpPlugins::Interface::Image >( 0 );
+ this->GetInput< cpPlugins::Interface::Image >( "Input" );
if( image == NULL )
return( "BinaryErodeImageFilter: No input image." );
// Connect output
cpPlugins::Interface::Image* out =
- this->GetOutput< cpPlugins::Interface::Image >( 0 );
+ this->GetOutput< cpPlugins::Interface::Image >( "Output" );
if( out != NULL )
{
out->SetITK< O >( filter->GetOutput( ) );
BinaryThresholdImageFilter( )
: Superclass( )
{
- this->SetNumberOfInputs( 1 );
- this->SetNumberOfOutputs( 1 );
- this->_MakeOutput< cpPlugins::Interface::Image >( 0 );
+ this->_AddInput( "Input" );
+ this->_MakeOutput< cpPlugins::Interface::Image >( "Output" );
this->m_Parameters->ConfigureAsReal( "LowerThresholdValue", 0 );
- this->m_Parameters->ConfigureAsReal( "UpperThresholdValue", 0 );
- this->m_Parameters->ConfigureAsUint( "InsideValue", 255 );
- this->m_Parameters->ConfigureAsUint( "OutsideValue", 1 );
+ this->m_Parameters->ConfigureAsReal( "UpperThresholdValue", 10000 );
+ this->m_Parameters->ConfigureAsUint( "InsideValue", 1 );
+ this->m_Parameters->ConfigureAsUint( "OutsideValue", 0 );
}
// -------------------------------------------------------------------------
_GenerateData( )
{
cpPlugins::Interface::Image* image =
- this->GetInput< cpPlugins::Interface::Image >( 0 );
+ this->GetInput< cpPlugins::Interface::Image >( "Input" );
if( image == NULL )
return( "BinaryThresholdImageFilter: No input image." );
// Get parameters
//unsigned int bins =
// this->m_Parameters.GetValueAsUint( "NumberOfHistogramBins" );
- _IP lower_val = _IP( this->m_Parameters->GetReal( "LowerValue" ) );
- _IP upper_val = _IP( this->m_Parameters->GetReal( "UpperValue" ) );
+ _IP lower_val = _IP( this->m_Parameters->GetReal( "LowerThresholdValue" ) );
+ _IP upper_val = _IP( this->m_Parameters->GetReal( "UpperThresholdValue" ) );
_OP in_val = _OP( this->m_Parameters->GetUint( "InsideValue" ) );
_OP out_val = _OP( this->m_Parameters->GetUint( "OutsideValue" ) );
// Connect output
cpPlugins::Interface::Image* out =
- this->GetOutput< cpPlugins::Interface::Image >( 0 );
+ this->GetOutput< cpPlugins::Interface::Image >( "Output" );
if( out != NULL )
{
out->SetITK< O >( filter->GetOutput( ) );
Cutter( )
: Superclass( )
{
- this->SetNumberOfInputs( 2 );
- this->SetNumberOfOutputs( 1 );
- this->_MakeOutput< cpPlugins::Interface::Mesh >( 0 );
+ this->_AddInput( "InputMesh" );
+ this->_AddInput( "InputFunction" );
+ this->_MakeOutput< cpPlugins::Interface::Mesh >( "Output" );
}
// -------------------------------------------------------------------------
{
// Get inputs
cpPlugins::Interface::Mesh* mesh =
- this->GetInput< cpPlugins::Interface::Mesh >( 0 );
+ this->GetInput< cpPlugins::Interface::Mesh >( "InputMesh" );
cpPlugins::Interface::ImplicitFunction* function =
- this->GetInput< cpPlugins::Interface::ImplicitFunction >( 1 );
+ this->GetInput< cpPlugins::Interface::ImplicitFunction >(
+ "InputFunction"
+ );
if( function == NULL )
return( "Cutter: Input data 1 is not a valid implicit function." );
// Execute filter
cpPlugins::Interface::Mesh* out =
- this->GetOutput< cpPlugins::Interface::Mesh >( 0 );
+ this->GetOutput< cpPlugins::Interface::Mesh >( "Output" );
out->SetVTK( cutter->GetOutput( ) );
return( "" );
ExtractSliceImageFilter( )
: Superclass( )
{
- this->SetNumberOfInputs( 1 );
- this->SetNumberOfOutputs( 1 );
- this->_MakeOutput< cpPlugins::Interface::Image >( 0 );
+ this->_AddInput( "Input" );
+ this->_MakeOutput< cpPlugins::Interface::Image >( "Output" );
this->m_Parameters->ConfigureAsUint( "Axis", 0 );
this->m_Parameters->ConfigureAsInt( "Slice", 0 );
_GenerateData( )
{
cpPlugins::Interface::Image* image =
- this->GetInput< cpPlugins::Interface::Image >( 0 );
+ this->GetInput< cpPlugins::Interface::Image >( "Input" );
if( image == NULL )
return( "ExtractSliceImageFilter: No input image." );
// Connect output
cpPlugins::Interface::Image* out =
- this->GetOutput< cpPlugins::Interface::Image >( 0 );
+ this->GetOutput< cpPlugins::Interface::Image >( "Output" );
if( out != NULL )
{
out->SetITK< O >( filter->GetOutput( ) );
FloodFillImageFilter( )
: Superclass( )
{
- this->SetNumberOfInputs( 1 );
- this->SetNumberOfOutputs( 1 );
- this->_MakeOutput< cpPlugins::Interface::Image >( 0 );
+ this->_AddInput( "Input" );
+ this->_MakeOutput< cpPlugins::Interface::Image >( "Output" );
double seed[ 3 ] = { double( 0 ) };
this->m_Parameters->ConfigureAsPoint( "Seed", 3, seed );
+ this->m_Parameters->ConfigureAsReal( "Window", 0 );
+ this->m_Parameters->ConfigureAsReal( "Level", 0 );
this->m_Parameters->ConfigureAsUint( "InsideValue", 0 );
this->m_Parameters->ConfigureAsUint( "OutsideValue", 255 );
}
_GenerateData( )
{
cpPlugins::Interface::Image* image =
- this->GetInput< cpPlugins::Interface::Image >( 0 );
+ this->GetInput< cpPlugins::Interface::Image >( "Input" );
if( image == NULL )
return( "FloodFillImageFilter: No input image." );
itkImageFunction
);
+ itkSetMacro( Window, double );
+ itkSetMacro( Level, double );
+
public:
virtual bool Evaluate( const TPoint& point ) const
{
}
virtual bool EvaluateAtIndex( const TIndex& index ) const
{
- return( true );
+ if( !( this->IsInsideBuffer( index ) ) )
+ return( false );
+
+ const I* image = this->GetInputImage( );
+ double w2 = this->m_Window / double( 2 );
+ double min = this->m_Level - w2;
+ double max = this->m_Level + w2;
+ unsigned char val = double( 0 );
+ double x = double( image->GetPixel( index ) );
+ double m = double( 100 ) / this->m_Window;
+ double b = ( this->m_Window - ( double( 2 ) * this->m_Level ) );
+ b *= double( 50 ) / this->m_Window;
+ if( x > min && x < max )
+ val = ( unsigned char )( ( m * x ) + b );
+
+ if( this->m_Start )
+ {
+ this->m_StartValue = val;
+ this->m_Start = false;
+ return( true );
+ }
+ else
+ return( std::abs( this->m_StartValue - val ) <= 2 );
}
virtual bool EvaluateAtContinuousIndex( const TCIndex& index ) const
{
protected:
cpPlugins_BasicFilters_FloodFillImageFilter_Function( )
- : Superclass( )
+ : Superclass( ),
+ m_Window( double( 0 ) ),
+ m_Level( double( 0 ) ),
+ m_Start( true )
{
}
virtual ~cpPlugins_BasicFilters_FloodFillImageFilter_Function( )
// Purposely not implemented
cpPlugins_BasicFilters_FloodFillImageFilter_Function( const Self& other );
Self& operator=( const Self& other );
+
+protected:
+ double m_Window;
+ double m_Level;
+ mutable unsigned char m_StartValue;
+ mutable bool m_Start;
};
// -------------------------------------------------------------------------
pseed = this->m_Parameters->GetPoint< typename I::PointType >(
"Seed", I::ImageDimension
);
+ double window = this->m_Parameters->GetReal( "Window" );
+ double level = this->m_Parameters->GetReal( "Level" );
_OP in_val = _OP( this->m_Parameters->GetUint( "InsideValue" ) );
_OP out_val = _OP( this->m_Parameters->GetUint( "OutsideValue" ) );
out->FillBuffer( out_val );
typename _F::Pointer f = _F::New( );
+ f->SetInputImage( in );
+ f->SetWindow( window );
+ f->SetLevel( level );
_It i( in, f );
i.AddSeed( seed );
// Connect output
cpPlugins::Interface::Image* out_port =
- this->GetOutput< cpPlugins::Interface::Image >( 0 );
+ this->GetOutput< cpPlugins::Interface::Image >( "Output" );
if( out_port != NULL )
{
out_port->SetITK< O >( out );
);
cpPlugins_Id_Macro(
cpPlugins::BasicFilters::FloodFillImageFilter,
- "ImageToImageFilter"
+ "ImageToBinaryImageFilter"
);
protected:
MarchingCubes( )
: Superclass( )
{
- this->SetNumberOfInputs( 1 );
- this->SetNumberOfOutputs( 1 );
- this->_MakeOutput< cpPlugins::Interface::Mesh >( 0 );
+ this->_AddInput( "Input" );
+ this->_MakeOutput< cpPlugins::Interface::Mesh >( "Output" );
this->m_Parameters->ConfigureAsRealList( "Thresholds" );
}
{
// Get input
cpPlugins::Interface::Image* image =
- this->GetInput< cpPlugins::Interface::Image >( 0 );
+ this->GetInput< cpPlugins::Interface::Image >( "Input" );
if( image == NULL )
return( "MarchingCubes: Input data is not a valid image." );
vtkImageData* vtk_image = image->GetVTK< vtkImageData >( );
// Execute filter
cpPlugins::Interface::Mesh* out =
- this->GetOutput< cpPlugins::Interface::Mesh >( 0 );
+ this->GetOutput< cpPlugins::Interface::Mesh >( "Output" );
out->SetVTK( pd );
return( "" );
}
MedianImageFilter( )
: Superclass( )
{
- this->SetNumberOfInputs( 1 );
- this->SetNumberOfOutputs( 1 );
- this->_MakeOutput< cpPlugins::Interface::Image >( 0 );
+ this->_AddInput( "Input" );
+ this->_MakeOutput< cpPlugins::Interface::Image >( "Output" );
this->m_Parameters->ConfigureAsUint( "Radius", 3 );
}
_GenerateData( )
{
cpPlugins::Interface::Image* image =
- this->GetInput< cpPlugins::Interface::Image >( 0 );
+ this->GetInput< cpPlugins::Interface::Image >( "Input" );
if( image == NULL )
return( "MedianImageFilter: No input image." );
// Connect output
cpPlugins::Interface::Image* out =
- this->GetOutput< cpPlugins::Interface::Image >( 0 );
+ this->GetOutput< cpPlugins::Interface::Image >( "Output" );
if( out != NULL )
{
out->SetITK< O >( filter->GetOutput( ) );
OtsuThresholdImageFilter( )
: Superclass( )
{
- this->SetNumberOfInputs( 1 );
- this->SetNumberOfOutputs( 1 );
- this->_MakeOutput< cpPlugins::Interface::Image >( 0 );
+ this->_AddInput( "Input" );
+ this->_MakeOutput< cpPlugins::Interface::Image >( "Output" );
this->m_Parameters->ConfigureAsUint( "NumberOfHistogramBins", 100 );
this->m_Parameters->ConfigureAsUint( "InsideValue", 255 );
// Connect output
cpPlugins::Interface::Image* out =
- this->GetOutput< cpPlugins::Interface::Image >( 0 );
+ this->GetOutput< cpPlugins::Interface::Image >( "Output" );
if( out != NULL )
{
out->SetITK< O >( filter->GetOutput( ) );
{
typedef cpPlugins::Interface::Parameters TParameters;
- this->SetNumberOfInputs( 1 );
- this->SetNumberOfOutputs( 1 );
- this->_MakeOutput< cpPlugins::Interface::Image >( 0 );
+ this->_AddInput( "Input" );
+ this->_MakeOutput< cpPlugins::Interface::Image >( "Output" );
std::vector< std::string > choices;
choices.push_back( "HSV" );
_GenerateData( )
{
cpPlugins::Interface::Image* image =
- this->GetInput< cpPlugins::Interface::Image >( 0 );
+ this->GetInput< cpPlugins::Interface::Image >( "Input" );
if( image == NULL )
return( "RGBImageToOtherChannelsFilter: No input image." );
// Connect output
cpPlugins::Interface::Image* out =
- this->GetOutput< cpPlugins::Interface::Image >( 0 );
+ this->GetOutput< cpPlugins::Interface::Image >( "Output" );
if( out != NULL )
{
out->SetITK< _O >( filter->GetOutput( ) );
SphereMeshSource( )
: Superclass( )
{
- this->SetNumberOfInputs( 0 );
- this->SetNumberOfOutputs( 1 );
- this->_MakeOutput< cpPlugins::Interface::Mesh >( 0 );
+ this->_MakeOutput< cpPlugins::Interface::Mesh >( "Output" );
double point[ 3 ] = { double( 0 ) };
this->m_Parameters->ConfigureAsPoint( "Center", 3, point );
// Execute filter
cpPlugins::Interface::Mesh* out =
- this->GetOutput< cpPlugins::Interface::Mesh >( 0 );
+ this->GetOutput< cpPlugins::Interface::Mesh >( "Output" );
out->SetVTK( src->GetOutput( ) );
return( "" );
}
ImageReader( )
: Superclass( )
{
- this->SetNumberOfOutputs( 1 );
- this->_MakeOutput< cpPlugins::Interface::Image >( 0 );
+ this->_MakeOutput< cpPlugins::Interface::Image >( "Output" );
this->m_Parameters->ConfigureAsStringList( "FileNames" );
this->m_Parameters->ConfigureAsBool( "VectorType", false );
_RealGD( const TStringList& names )
{
cpPlugins::Interface::Image* out =
- this->GetOutput< cpPlugins::Interface::Image >( 0 );
+ this->GetOutput< cpPlugins::Interface::Image >( "Output" );
if( out == NULL )
return( "ImageReader: No output object properly created." );
ImageWriter( )
: Superclass( )
{
- this->SetNumberOfInputs( 1 );
+ this->_AddInput( "Input" );
this->m_Parameters->ConfigureAsString( "FileName", "" );
}
_GD0_Image( )
{
cpPlugins::Interface::Image* image =
- this->GetInput< cpPlugins::Interface::Image >( 0 );
+ this->GetInput< cpPlugins::Interface::Image >( "Input" );
if( image == NULL )
return( "ImageWriter: No input image." );
_GD0_VectorImage( )
{
cpPlugins::Interface::Image* image =
- this->GetInput< cpPlugins::Interface::Image >( 0 );
+ this->GetInput< cpPlugins::Interface::Image >( "Input" );
if( image == NULL )
return( "ImageWriter: No input image." );
MeshReader( )
: Superclass( )
{
- this->SetNumberOfOutputs( 1 );
- this->_MakeOutput< cpPlugins::Interface::Mesh >( 0 );
+ this->_MakeOutput< cpPlugins::Interface::Mesh >( "Output" );
std::vector< TParameters::TString > valid_types;
valid_types.push_back( "float" );
pdr->Update( );
cpPlugins::Interface::Mesh* out =
- this->GetOutput< cpPlugins::Interface::Mesh >( 0 );
+ this->GetOutput< cpPlugins::Interface::Mesh >( "Output" );
if( out != NULL )
out->SetVTK( pdr->GetOutput( ) );
else
MeshWriter( )
: Superclass( )
{
- this->SetNumberOfInputs( 1 );
+ this->_AddInput( "Input" );
this->m_Parameters->ConfigureAsString( "FileName", "" );
}
_GenerateData( )
{
cpPlugins::Interface::Mesh* mesh =
- this->GetInput< cpPlugins::Interface::Mesh >( 0 );
+ this->GetInput< cpPlugins::Interface::Mesh >( "Input" );
if( mesh == NULL )
return( "MeshWriter: No input mesh." );
vtkPolyData* i = mesh->GetVTK< vtkPolyData >( );