#include <QMessageBox>
#ifdef _WIN32
+# define PLUGIN_PREFIX ""
# define PLUGIN_EXT "dll"
# define PLUGIN_REGEX "Plugins file (*.dll);;All files (*)"
#else
+# define PLUGIN_PREFIX "lib"
# define PLUGIN_EXT "so"
# define PLUGIN_REGEX "Plugins file (*.so);;All files (*)"
#endif // _WIN32
);
// Start: load all disponible plugins
- this->_triggered_actionOpenPlugins( );
+ this->_LoadPlugins(
+ std::string( PLUGIN_PREFIX ) +
+ std::string( "cpPlugins." ) +
+ std::string( PLUGIN_EXT )
+ );
}
// -------------------------------------------------------------------------
delete this->m_MPR;
}
+// -------------------------------------------------------------------------
+bool ImageMPR::
+_LoadPlugins( const std::string& filename )
+{
+ this->m_Plugins.UnloadAll( );
+ if( !( this->m_Plugins.Load( filename ) ) )
+ {
+ this->m_Plugins.UnloadAll( );
+ return( false );
+
+ } // fi
+ this->m_BaseClasses[ "ImageReader" ] = "cpPlugins::ImageReader";
+ this->m_BaseClasses[ "MeshReader" ] = "cpPlugins::MeshReader";
+ return( true );
+}
+
// -------------------------------------------------------------------------
void ImageMPR::
_triggered_actionOpenPlugins( )
return;
std::string fname = dialog.selectedFiles( ).at( 0 ).toStdString( );
- this->m_Plugins.UnloadAll( );
- if( !( this->m_Plugins.Load( fname ) ) )
- {
+ if( !( _LoadPlugins( fname ) ) )
QMessageBox::critical(
this,
tr( "Ignoring plugin" ),
tr( fname.c_str( ) )
);
- this->m_Plugins.UnloadAll( );
- return;
-
- } // fi
-
- this->m_BaseClasses[ "ImageReader" ] =
- "cpPlugins::Plugins::ImageReader";
- this->m_BaseClasses[ "PolyDataReader" ] =
- "cpPlugins::Plugins::PolyDataReader";
}
// -------------------------------------------------------------------------
this->m_InputImage = NULL;
// Get a reader from plugins
- TPlugin::Pointer reader =
+ TPluginFilter::Pointer reader =
this->m_Plugins.CreateProcessObject(
this->m_BaseClasses[ "ImageReader" ]
);
QStringList::const_iterator qIt = q_fnames.begin( );
for( ; qIt != q_fnames.end( ); ++qIt )
reader_params.AddValueToStringList( "FileNames", qIt->toStdString( ) );
-
- // Other parameters
- reader_params.SetValueAsString( "PixelType", "short" );
- reader_params.SetValueAsUint( "ImageDimension", 3 );
- reader_params.SetValueAsUint( "IsColorImage", 0 );
reader->SetParameters( reader_params );
// Execute and get error message, if any
std::string fname = dialog.selectedFiles( ).at( 0 ).toStdString( );
- this->m_InputPolyData = NULL;
+ this->m_InputMesh = NULL;
// Get a reader from plugins
- TPlugin::Pointer reader =
+ TPluginFilter::Pointer reader =
this->m_Plugins.CreateProcessObject(
- this->m_BaseClasses[ "PolyDataReader" ]
+ this->m_BaseClasses[ "MeshReader" ]
);
// Configure plugin
// Assign fresh image, if any
if( err == "" )
{
- this->m_InputPolyData =
- dynamic_cast< TPluginPolyData* >( reader->GetOutput( 0 ) );
+ this->m_InputMesh =
+ dynamic_cast< TPluginMesh* >( reader->GetOutput( 0 ) );
reader->DisconnectOutputs( );
- if( this->m_InputPolyData.IsNotNull( ) )
+ if( this->m_InputMesh.IsNotNull( ) )
{
- this->m_InputPolyData->GetActor( )->GetProperty( )->SetColor( 1, 0, 1 );
- this->m_MPR->Add3DActor( this->m_InputPolyData->GetActor( ) );
+ this->m_InputMeshMapper = vtkSmartPointer< vtkPolyDataMapper >::New( );
+ this->m_InputMeshMapper->SetInputData( this->m_InputMesh->GetVTKPolyData( ) );
+ this->m_InputMeshActor = vtkSmartPointer< vtkActor >::New( );
+ this->m_InputMeshActor->SetMapper( this->m_InputMeshMapper );
+ this->m_MPR->Add3DActor( this->m_InputMeshActor );
} // fi
}
#include <cpPlugins/Interface/Interface.h>
#include <cpPlugins/Interface/ProcessObject.h>
#include <cpPlugins/Interface/Image.h>
-#include <cpPlugins/Interface/PolyData.h>
-#include <cpPlugins/Interface/DataObject.h>
+#include <cpPlugins/Interface/Mesh.h>
#include <cpPlugins/Extensions/Visualization/MPRWithDifferentWindows.h>
// -------------------------------------------------------------------------
typedef cpPlugins::Interface::Object TPluginObject;
typedef cpPlugins::Interface::DataObject TPluginData;
typedef cpPlugins::Interface::Image TPluginImage;
- typedef cpPlugins::Interface::PolyData TPluginPolyData;
- typedef cpPlugins::Interface::ProcessObject TPlugin;
+ typedef cpPlugins::Interface::Mesh TPluginMesh;
+ typedef cpPlugins::Interface::ProcessObject TPluginFilter;
typedef cpPlugins::Interface::Parameters TParameters;
typedef std::map< std::string, std::string > TStringMap;
explicit ImageMPR( QWidget* parent = 0 );
virtual ~ImageMPR( );
+protected:
+ bool _LoadPlugins( const std::string& filename );
+
private slots:
void _triggered_actionOpenPlugins( );
void _triggered_actionOpenInputImage( );
TStringMap m_BaseClasses;
// Real data
- TPluginImage::Pointer m_InputImage;
- TPluginPolyData::Pointer m_InputPolyData;
+ TPluginImage::Pointer m_InputImage;
+ TPluginMesh::Pointer m_InputMesh;
// Visualization stuff
TMPR* m_MPR;
+ vtkSmartPointer< vtkPolyDataMapper > m_InputMeshMapper;
+ vtkSmartPointer< vtkActor > m_InputMeshActor;
/* TODO
vtkSmartPointer< vtkOrientationMarkerWidget > m_3DOrientationWidget;
SET(
EXAMPLES_PROGRAMS
- example_TestParameters
- example_LoadPlugins
+ ## example_TestParameters
+ ## example_LoadPlugins
example_ReadWriteImage
- example_ReadImageSeriesWriteImage
- example_ReadQuadEdgeMesh
- example_RenderQuadEdgeMesh
- example_RGBImageToHSVChannels
- example_RGBImageToYPbPrChannels
- example_MPR
+ ## example_ReadImageSeriesWriteImage
+ ## example_ReadQuadEdgeMesh
+ ## example_RenderQuadEdgeMesh
+ ## example_RGBImageToHSVChannels
+ ## example_RGBImageToYPbPrChannels
+ ## example_MPR
+ example_MarchingCubes
)
FOREACH(prog ${EXAMPLES_PROGRAMS})
SET(
NOPLUGINS_EXAMPLES_PROGRAMS
- example_ExtractDICOMSeries
- example_ImageGaussianModelEstimator
- example_ReadQuadEdgeMeshWithoutPlugins
- example_RenderQuadEdgeMeshWithoutPlugins
- example_ParallelImageMean
- example_LightCompensation
- example_1DImageGradient
- example_2DImageGradient
- example_3DImageGradient
- example_2DGulsunTekMedialness
- example_3DGulsunTekMedialness
+ ## example_ExtractDICOMSeries
+ ## example_ImageGaussianModelEstimator
+ ## example_ReadQuadEdgeMeshWithoutPlugins
+ ## example_RenderQuadEdgeMeshWithoutPlugins
+ ## example_ParallelImageMean
+ ## example_LightCompensation
+ ## example_1DImageGradient
+ ## example_2DImageGradient
+ ## example_3DImageGradient
+ ## example_2DGulsunTekMedialness
+ ## example_3DGulsunTekMedialness
## example_KalmanVelocity
)
FOREACH(prog ${NOPLUGINS_EXAMPLES_PROGRAMS})
--- /dev/null
+#include <cstdlib>
+#include <iostream>
+#include <string>
+
+#include <cpPlugins/Interface/Interface.h>
+#include <cpPlugins/Interface/ProcessObject.h>
+
+int main( int argc, char* argv[] )
+{
+ if( argc < 5 )
+ {
+ std::cerr
+ << "Usage: " << argv[ 0 ]
+ << " plugins_file"
+ << " input_image value output_mesh" << std::endl;
+ return( 1 );
+
+ } // fi
+
+ // Create interface
+ typedef cpPlugins::Interface::Interface TInterface;
+ typedef TInterface::TClasses TClasses;
+ TInterface plugins;
+ if( !plugins.Load( argv[ 1 ] ) )
+ {
+ std::cerr << "Failed to load plugins." << std::endl;
+ return( 1 );
+
+ } // fi
+
+ // Create objects
+ typedef cpPlugins::Interface::ProcessObject TProcessObject;
+ typedef cpPlugins::Interface::Parameters TParameters;
+ cpPlugins::Interface::ProcessObject::Pointer reader, writer, mc;
+ reader = plugins.CreateProcessObject( "cpPlugins::ImageReader" );
+ writer = plugins.CreateProcessObject( "cpPlugins::MeshWriter" );
+ mc = plugins.CreateProcessObject( "cpPlugins::MarchingCubes" );
+ if( reader.IsNull( ) || writer.IsNull( ) || mc.IsNull( ) )
+ {
+ std::cerr << "No suitable objects found in plugins." << std::endl;
+ return( 1 );
+
+ } // fi
+
+ // Configure reader
+ TParameters reader_params = reader->GetDefaultParameters( );
+ for( int i = 2; i < argc - 2; ++i )
+ reader_params.AddValueToStringList( "FileNames", argv[ i ] );
+ reader->SetParameters( reader_params );
+
+ // Configure marching cubes
+ TParameters mc_params = mc->GetDefaultParameters( );
+ mc_params.AddValueToRealList( "Thresholds", std::atof( argv[ argc - 2 ] ) );
+ mc->SetParameters( mc_params );
+
+ // Configure writer
+ TParameters writer_params = writer->GetDefaultParameters( );
+ writer_params.SetValueAsString( "FileName", argv[ argc - 1 ] );
+ writer->SetParameters( writer_params );
+
+ // Connect pipeline
+ mc->SetInput( 0, reader->GetOutput( 0 ) );
+ writer->SetInput( 0, mc->GetOutput( 0 ) );
+
+ // Execute pipeline
+ std::string err = writer->Update( );
+ if( err != "" )
+ {
+ std::cerr << "ERROR: " << err << std::endl;
+ return( 1 );
+
+ } // fi
+ return( 0 );
+}
+
+// eof - $RCSfile$
int main( int argc, char* argv[] )
{
- if( argc < 7 )
+ if( argc < 4 )
{
std::cerr
<< "Usage: " << argv[ 0 ]
<< " plugins_file"
- << " input_image output_image"
- << " dimensions pixel_type is_color" << std::endl;
+ << " input_image output_image" << std::endl;
return( 1 );
} // fi
- std::string plugins_file = argv[ 1 ];
- std::string input_image_file = argv[ 2 ];
- std::string output_image_file = argv[ 3 ];
- unsigned int dimensions = std::atoi( argv[ 4 ] );
- std::string pixel_type = argv[ 5 ];
- bool is_color = ( std::atoi( argv[ 6 ] ) == 1 );
// Create interface
typedef cpPlugins::Interface::Interface TInterface;
typedef TInterface::TClasses TClasses;
-
TInterface plugins;
- plugins.Load( plugins_file );
+ if( !plugins.Load( argv[ 1 ] ) )
+ {
+ std::cerr << "Failed to load plugins." << std::endl;
+ return( 1 );
+
+ } // fi
// Create objects
typedef cpPlugins::Interface::ProcessObject TProcessObject;
typedef cpPlugins::Interface::Parameters TParameters;
- cpPlugins::Interface::ProcessObject::Pointer reader;
- cpPlugins::Interface::ProcessObject::Pointer writer;
-
- reader = plugins.CreateProcessObject( "cpPlugins::Plugins::ImageReader" );
+ cpPlugins::Interface::ProcessObject::Pointer reader, writer;
+ reader = plugins.CreateProcessObject( "cpPlugins::ImageReader" );
if( reader.IsNull( ) )
{
std::cerr << "No suitable reader found in plugins." << std::endl;
return( 1 );
} // fi
- writer = plugins.CreateProcessObject( "cpPlugins::Plugins::ImageWriter" );
+ writer = plugins.CreateProcessObject( "cpPlugins::ImageWriter" );
if( writer.IsNull( ) )
{
std::cerr << "No suitable writer found in plugins." << std::endl;
// Configure reader
TParameters reader_params = reader->GetDefaultParameters( );
- reader_params.AddValueToStringList( "FileNames", input_image_file );
- reader_params.SetValueAsString( "PixelType", pixel_type );
- reader_params.SetValueAsUint( "ImageDimension", dimensions );
- reader_params.SetValueAsUint( "IsColorImage", ( is_color? 1: 0 ) );
+ for( int i = 2; i < argc - 1; ++i )
+ reader_params.AddValueToStringList( "FileNames", argv[ i ] );
reader->SetParameters( reader_params );
- // Configure reader
+ // Configure writer
TParameters writer_params = writer->GetDefaultParameters( );
- writer_params.SetValueAsString( "FileName", output_image_file );
+ writer_params.SetValueAsString( "FileName", argv[ argc - 1 ] );
writer->SetParameters( writer_params );
// Connect pipeline
writer->SetInput( 0, reader->GetOutput( 0 ) );
- std::string msg = writer->Update( );
-
- if( msg != "" )
- std::cerr << "ERROR: " << msg << std::endl;
+ // Execute pipeline
+ std::string err = writer->Update( );
+ if( err != "" )
+ {
+ std::cerr << "ERROR: " << err << std::endl;
+ return( 1 );
+ } // fi
return( 0 );
}
#include <cpPlugins/Interface/DataObject.h>
+#include <vtkImageData.h>
+#include <vtkPolyData.h>
// -------------------------------------------------------------------------
-std::string cpPlugins::Interface::DataObject::
-GetClassName( ) const
+itk::DataObject* cpPlugins::Interface::DataObject::
+GetITKDataObject( )
{
- return( "cpPlugins::Interface::DataObject" );
+ return( this->m_ITKObject.GetPointer( ) );
}
// -------------------------------------------------------------------------
-std::string cpPlugins::Interface::DataObject::
-GetClassType( ) const
+const itk::DataObject* cpPlugins::Interface::DataObject::
+GetITKDataObject( ) const
{
- return( "DataObject" );
+ return( this->m_ITKObject.GetPointer( ) );
}
// -------------------------------------------------------------------------
-itk::DataObject* cpPlugins::Interface::DataObject::
-GetRealDataObject( ) const
+vtkDataObject* cpPlugins::Interface::DataObject::
+GetVTKDataObject( )
{
- return( this->m_RealDataObject );
+ return( this->m_VTKObject.GetPointer( ) );
}
// -------------------------------------------------------------------------
-void cpPlugins::Interface::DataObject::
-SetRealDataObject( itk::DataObject* dobj )
+const vtkDataObject* cpPlugins::Interface::DataObject::
+GetVTKDataObject( ) const
{
- this->m_RealDataObject = dobj;
+ return( this->m_VTKObject.GetPointer( ) );
}
// -------------------------------------------------------------------------
void cpPlugins::Interface::DataObject::
SetSource( cpPlugins::Interface::Object* src )
{
- this->m_Source = src;
+ if( this->m_Source.GetPointer( ) != src )
+ {
+ this->m_Source = src;
+ this->Modified( );
+
+ } // fi
}
// -------------------------------------------------------------------------
void cpPlugins::Interface::DataObject::
DisconnectPipeline( )
{
- if( this->m_RealDataObject.IsNotNull( ) )
+ if( this->m_ITKObject.IsNotNull( ) )
{
- this->m_RealDataObject->DisconnectPipeline( );
+ // Disconnect input pipelines
+ this->m_ITKObject->DisconnectPipeline( );
+ vtkImageData* vtk_image =
+ dynamic_cast< vtkImageData* >( this->m_VTKObject.GetPointer( ) );
+ vtkPolyData* vtk_pd =
+ dynamic_cast< vtkPolyData* >( this->m_VTKObject.GetPointer( ) );
+ if( vtk_image != NULL )
+ {
+ vtkSmartPointer< vtkImageData > d =
+ vtkSmartPointer< vtkImageData >::New( );
+ d->ShallowCopy( vtk_image );
+ this->m_VTKObject = d;
+ }
+ else if( vtk_pd != NULL )
+ {
+ vtkSmartPointer< vtkPolyData > d =
+ vtkSmartPointer< vtkPolyData >::New( );
+ d->ShallowCopy( vtk_pd );
+ this->m_VTKObject = d;
+
+ } // fi
+
+ // Unbind source
if( this->m_Source.IsNotNull( ) )
this->m_Source->Delete( );
this->Register( );
DataObject( )
: Superclass( )
{
+ this->m_ClassName = "cpPlugins::Interface::DataObject";
+ this->m_ClassCategory = "BasicObject";
}
// -------------------------------------------------------------------------
#include <map>
#include <string>
-#include <itkDataObject.h>
+#include <vtkDataObject.h>
+#include <vtkSmartPointer.h>
#include <cpPlugins/Interface/cpPlugins_Interface_Export.h>
#include <cpPlugins/Interface/Object.h>
+#define ITK_MANUAL_INSTANTIATION
+#include <itkDataObject.h>
+
namespace cpPlugins
{
namespace Interface
typedef itk::SmartPointer< const Self > ConstPointer;
public:
- itkNewMacro( Self );
itkTypeMacro( DataObject, Object );
public:
- virtual std::string GetClassName( ) const;
- virtual std::string GetClassType( ) const;
+ virtual itk::DataObject* GetITKDataObject( );
+ virtual const itk::DataObject* GetITKDataObject( ) const;
+ virtual void SetITKDataObject( itk::DataObject* o ) = 0;
- itk::DataObject* GetRealDataObject( ) const;
- virtual void SetRealDataObject( itk::DataObject* dobj );
+ virtual vtkDataObject* GetVTKDataObject( );
+ virtual const vtkDataObject* GetVTKDataObject( ) const;
+ virtual void SetVTKDataObject( vtkDataObject* o ) = 0;
Object* GetSource( );
const Object* GetSource( ) const;
Self& operator=( const Self& );
protected:
- itk::DataObject::Pointer m_RealDataObject;
- Object::Pointer m_Source;
+ itk::DataObject::Pointer m_ITKObject;
+ vtkSmartPointer< vtkDataObject > m_VTKObject;
+ Object::Pointer m_Source;
};
} // ecapseman
#include <cpPlugins/Interface/FilterObject.h>
-// -------------------------------------------------------------------------
-std::string cpPlugins::Interface::FilterObject::
-GetClassName( ) const
-{
- return( "cpPlugins::Interface::FilterObject" );
-}
-
-// -------------------------------------------------------------------------
-std::string cpPlugins::Interface::FilterObject::
-GetClassType( ) const
-{
- return( "FilterObject" );
-}
-
// -------------------------------------------------------------------------
cpPlugins::Interface::FilterObject::
FilterObject( )
: Superclass( )
{
+ this->m_ClassName = "cpPlugins::Interface::FilterObject";
+ this->m_ClassCategory = "BasicObject";
}
// -------------------------------------------------------------------------
public:
itkTypeMacro( FilterObject, ProcessObject );
- public:
- virtual std::string GetClassName( ) const;
- virtual std::string GetClassType( ) const;
-
protected:
FilterObject( );
virtual ~FilterObject( );
#include <cpPlugins/Interface/Image.h>
-#define ITK_MANUAL_INSTANTIATION
+#undef ITK_MANUAL_INSTANTIATION
#include <itkImage.h>
+#include <itkCovariantVector.h>
#include <itkRGBPixel.h>
+#include <itkRGBAPixel.h>
+#include <itkVector.h>
+#include <itkSymmetricSecondRankTensor.h>
+#include <itkDiffusionTensor3D.h>
#include <itkImageToVTKImageFilter.h>
+#include <itkVTKImageToImageFilter.h>
// -------------------------------------------------------------------------
-#define cpPlugins_Image_Dimension( d, o, f ) \
- if( dynamic_cast< itk::ImageBase< d >* >( o ) != NULL ) \
- this->f< d >( )
+#define cpPlugins_Image_Pixel( p, d, o ) \
+ if( dynamic_cast< itk::Image< p, d >* >( o ) != NULL ) \
+ this->_ITK_2_VTK_1< p, d >( o )
// -------------------------------------------------------------------------
-#define cpPlugins_Image_Pixel( p, d, o, f ) \
- if( dynamic_cast< itk::Image< p, d >* >( o ) != NULL ) \
- this->f< p, d >( )
+#define cpPlugins_Image_Vector( p, d, o ) \
+ if( \
+ dynamic_cast< itk::Image< itk::Vector< p, d >, d >* >( o ) != NULL \
+ ) \
+ this->_ITK_2_VTK_1< itk::Vector< p, d >, d >( o )
// -------------------------------------------------------------------------
-#define cpPlugins_Image_RGB( p, d, o, f ) \
+#define cpPlugins_Image_CovVector( p, d, o ) \
if( \
- dynamic_cast< itk::Image< itk::RGBPixel< p >, d >* >( o ) != NULL \
+ dynamic_cast< itk::Image< itk::CovariantVector< p, d >, d >* >( o ) \
+ != \
+ NULL \
) \
- this->f< itk::RGBPixel< p >, d >( )
+ this->_ITK_2_VTK_1< itk::CovariantVector< p, d >, d >( o )
// -------------------------------------------------------------------------
-std::string cpPlugins::Interface::Image::
-GetClassName( ) const
+#define cpPlugins_Image_SymTensor( p, d, o ) \
+ if( \
+ dynamic_cast< itk::Image< itk::SymmetricSecondRankTensor< p, d >, d >* >( o ) \
+ != \
+ NULL \
+ ) \
+ this->_ITK_2_VTK_1< itk::SymmetricSecondRankTensor< p, d >, d >( o )
+
+// -------------------------------------------------------------------------
+#define cpPlugins_Image_RGB( p, d, o ) \
+ cpPlugins_Image_Pixel( itk::RGBPixel< p >, d, o )
+
+// -------------------------------------------------------------------------
+#define cpPlugins_Image_RGBA( p, d, o ) \
+ cpPlugins_Image_Pixel( itk::RGBAPixel< p >, d, o )
+
+// -------------------------------------------------------------------------
+#define cpPlugins_Image_DiffTensor( p, d, o ) \
+ cpPlugins_Image_Pixel( itk::DiffusionTensor3D< p >, d, o )
+
+// -------------------------------------------------------------------------
+void cpPlugins::Interface::Image::
+SetITKDataObject( itk::DataObject* o )
{
- return( "cpPlugins::Interface::Image" );
+ if( dynamic_cast< itk::ImageBase< 1 >* >( o ) != NULL )
+ this->_ITK_2_VTK_0< 1 >( o );
+ else if( dynamic_cast< itk::ImageBase< 2 >* >( o ) != NULL )
+ this->_ITK_2_VTK_0< 2 >( o );
+ else if( dynamic_cast< itk::ImageBase< 3 >* >( o ) != NULL )
+ this->_ITK_2_VTK_0< 3 >( o );
+ else
+ this->m_ITKObject = NULL;
}
// -------------------------------------------------------------------------
void cpPlugins::Interface::Image::
-SetRealDataObject( itk::DataObject* dobj )
+SetVTKDataObject( vtkDataObject* o )
{
- this->Superclass::SetRealDataObject( dobj );
-
- // NOTE: Only 2 and 3 dimensions at this moment to connect with VTK
- cpPlugins_Image_Dimension( 2, dobj, _VTK_0 );
- else cpPlugins_Image_Dimension( 3, dobj, _VTK_0 );
+ // this->m_VTKObject = o;
+ std::cerr << "Image: TODO this!!!!" << std::endl;
+ std::exit( 1 );
}
// -------------------------------------------------------------------------
vtkImageData* cpPlugins::Interface::Image::
-GetVTKImageData( ) const
+GetVTKImageData( )
{
- return( this->m_VTKImageData );
+ return( dynamic_cast< vtkImageData* >( this->GetVTKDataObject( ) ) );
}
// -------------------------------------------------------------------------
-void cpPlugins::Interface::Image::
-UpdateVTKImageData( )
+const vtkImageData* cpPlugins::Interface::Image::
+GetVTKImageData( ) const
{
- this->m_Image2VTKImageData->Modified( );
- this->m_Image2VTKImageData->Update( );
- this->m_VTKImageData->Modified( );
+ return( dynamic_cast< const vtkImageData* >( this->GetVTKDataObject( ) ) );
}
// -------------------------------------------------------------------------
cpPlugins::Interface::Image::
Image( )
- : Superclass( ),
- m_VTKImageData( NULL )
+ : Superclass( )
{
+ this->m_ClassName = "cpPlugins::Interface::Image";
+ this->m_ClassCategory = "BasicObject";
}
// -------------------------------------------------------------------------
// -------------------------------------------------------------------------
template< unsigned int D >
void cpPlugins::Interface::Image::
-_VTK_0( )
+_ITK_2_VTK_0( itk::DataObject* o )
{
- itk::DataObject* dobj = this->Superclass::GetRealDataObject( );
-
- cpPlugins_Image_Pixel( char, D, dobj, _VTK_1 );
- else cpPlugins_Image_Pixel( short, D, dobj, _VTK_1 );
- else cpPlugins_Image_Pixel( int, D, dobj, _VTK_1 );
- else cpPlugins_Image_Pixel( long, D, dobj, _VTK_1 );
- else cpPlugins_Image_Pixel( unsigned char, D, dobj, _VTK_1 );
- else cpPlugins_Image_Pixel( unsigned short, D, dobj, _VTK_1 );
- else cpPlugins_Image_Pixel( unsigned int, D, dobj, _VTK_1 );
- else cpPlugins_Image_Pixel( unsigned long, D, dobj, _VTK_1 );
- else cpPlugins_Image_Pixel( float, D, dobj, _VTK_1 );
- else cpPlugins_Image_Pixel( double, D, dobj, _VTK_1 );
- else cpPlugins_Image_RGB( char, D, dobj, _VTK_1 );
- else cpPlugins_Image_RGB( short, D, dobj, _VTK_1 );
- else cpPlugins_Image_RGB( int, D, dobj, _VTK_1 );
- else cpPlugins_Image_RGB( long, D, dobj, _VTK_1 );
- else cpPlugins_Image_RGB( unsigned char, D, dobj, _VTK_1 );
- else cpPlugins_Image_RGB( unsigned short, D, dobj, _VTK_1 );
- else cpPlugins_Image_RGB( unsigned int, D, dobj, _VTK_1 );
- else cpPlugins_Image_RGB( unsigned long, D, dobj, _VTK_1 );
- else cpPlugins_Image_RGB( float, D, dobj, _VTK_1 );
- else cpPlugins_Image_RGB( double, D, dobj, _VTK_1 );
+ cpPlugins_Image_Pixel( char, D, o );
+ else cpPlugins_Image_Pixel( short, D, o );
+ else cpPlugins_Image_Pixel( int, D, o );
+ else cpPlugins_Image_Pixel( long, D, o );
+ else cpPlugins_Image_Pixel( float, D, o );
+ else cpPlugins_Image_Pixel( double, D, o );
+ else cpPlugins_Image_Pixel( unsigned char, D, o );
+ else cpPlugins_Image_Pixel( unsigned short, D, o );
+ else cpPlugins_Image_Pixel( unsigned int, D, o );
+ else cpPlugins_Image_Pixel( unsigned long, D, o );
+ else cpPlugins_Image_RGB( char, D, o );
+ else cpPlugins_Image_RGB( short, D, o );
+ else cpPlugins_Image_RGB( int, D, o );
+ else cpPlugins_Image_RGB( long, D, o );
+ else cpPlugins_Image_RGB( float, D, o );
+ else cpPlugins_Image_RGB( double, D, o );
+ else cpPlugins_Image_RGB( unsigned char, D, o );
+ else cpPlugins_Image_RGB( unsigned short, D, o );
+ else cpPlugins_Image_RGB( unsigned int, D, o );
+ else cpPlugins_Image_RGB( unsigned long, D, o );
+ else cpPlugins_Image_RGBA( char, D, o );
+ else cpPlugins_Image_RGBA( short, D, o );
+ else cpPlugins_Image_RGBA( int, D, o );
+ else cpPlugins_Image_RGBA( long, D, o );
+ else cpPlugins_Image_RGBA( float, D, o );
+ else cpPlugins_Image_RGBA( double, D, o );
+ else cpPlugins_Image_RGBA( unsigned char, D, o );
+ else cpPlugins_Image_RGBA( unsigned short, D, o );
+ else cpPlugins_Image_RGBA( unsigned int, D, o );
+ else cpPlugins_Image_RGBA( unsigned long, D, o );
+ else cpPlugins_Image_Vector( char, D, o );
+ else cpPlugins_Image_Vector( short, D, o );
+ else cpPlugins_Image_Vector( int, D, o );
+ else cpPlugins_Image_Vector( long, D, o );
+ else cpPlugins_Image_Vector( float, D, o );
+ else cpPlugins_Image_Vector( double, D, o );
+ else cpPlugins_Image_Vector( unsigned char, D, o );
+ else cpPlugins_Image_Vector( unsigned short, D, o );
+ else cpPlugins_Image_Vector( unsigned int, D, o );
+ else cpPlugins_Image_Vector( unsigned long, D, o );
+ else cpPlugins_Image_CovVector( char, D, o );
+ else cpPlugins_Image_CovVector( short, D, o );
+ else cpPlugins_Image_CovVector( int, D, o );
+ else cpPlugins_Image_CovVector( long, D, o );
+ else cpPlugins_Image_CovVector( float, D, o );
+ else cpPlugins_Image_CovVector( double, D, o );
+ else cpPlugins_Image_CovVector( unsigned char, D, o );
+ else cpPlugins_Image_CovVector( unsigned short, D, o );
+ else cpPlugins_Image_CovVector( unsigned int, D, o );
+ else cpPlugins_Image_CovVector( unsigned long, D, o );
+ else cpPlugins_Image_SymTensor( char, D, o );
+ else cpPlugins_Image_SymTensor( short, D, o );
+ else cpPlugins_Image_SymTensor( int, D, o );
+ else cpPlugins_Image_SymTensor( long, D, o );
+ else cpPlugins_Image_SymTensor( float, D, o );
+ else cpPlugins_Image_SymTensor( double, D, o );
+ else cpPlugins_Image_SymTensor( unsigned char, D, o );
+ else cpPlugins_Image_SymTensor( unsigned short, D, o );
+ else cpPlugins_Image_SymTensor( unsigned int, D, o );
+ else cpPlugins_Image_SymTensor( unsigned long, D, o );
+ else cpPlugins_Image_DiffTensor( char, D, o );
+ else cpPlugins_Image_DiffTensor( short, D, o );
+ else cpPlugins_Image_DiffTensor( int, D, o );
+ else cpPlugins_Image_DiffTensor( long, D, o );
+ else cpPlugins_Image_DiffTensor( float, D, o );
+ else cpPlugins_Image_DiffTensor( double, D, o );
+ else cpPlugins_Image_DiffTensor( unsigned char, D, o );
+ else cpPlugins_Image_DiffTensor( unsigned short, D, o );
+ else cpPlugins_Image_DiffTensor( unsigned int, D, o );
+ else cpPlugins_Image_DiffTensor( unsigned long, D, o );
}
// -------------------------------------------------------------------------
template< class P, unsigned int D >
void cpPlugins::Interface::Image::
-_VTK_1( )
+_ITK_2_VTK_1( itk::DataObject* o )
{
- typedef itk::Image< P, D > _TImage;
- typedef itk::ImageToVTKImageFilter< _TImage > _TFilter;
-
- _TImage* img =
- dynamic_cast< _TImage* >( this->Superclass::GetRealDataObject( ) );
- typename _TFilter::Pointer filter = _TFilter::New( );
- filter->SetInput( img );
- filter->Update( );
- this->m_VTKImageData = filter->GetOutput( );
- this->m_Image2VTKImageData = filter;
+ typedef itk::Image< P, D > _I;
+ typedef itk::ImageToVTKImageFilter< _I > _F;
+
+ typename _F::Pointer f = _F::New( );
+ f->SetInput( dynamic_cast< _I* >( o ) );
+ f->Update( );
+
+ this->m_ITKObject = o;
+ this->m_VTKObject = f->GetOutput( );
+ this->m_ITKvVTKConnection = f;
}
// eof - $RCSfile$
#include <map>
#include <string>
-#include <itkProcessObject.h>
#include <cpPlugins/Interface/cpPlugins_Interface_Export.h>
#include <cpPlugins/Interface/DataObject.h>
+#define ITK_MANUAL_INSTANTIATION
+#include <itkProcessObject.h>
+
class vtkImageData;
namespace cpPlugins
itkTypeMacro( Image, DataObject );
public:
- virtual std::string GetClassName( ) const;
- virtual void SetRealDataObject( itk::DataObject* dobj );
+ virtual void SetITKDataObject( itk::DataObject* o );
+ virtual void SetVTKDataObject( vtkDataObject* o );
- vtkImageData* GetVTKImageData( ) const;
- void UpdateVTKImageData( );
+ virtual vtkImageData* GetVTKImageData( );
+ virtual const vtkImageData* GetVTKImageData( ) const;
protected:
Image( );
virtual ~Image( );
template< unsigned int D >
- void _VTK_0( );
+ void _ITK_2_VTK_0( itk::DataObject* o );
template< class P, unsigned int D >
- void _VTK_1( );
+ void _ITK_2_VTK_1( itk::DataObject* o );
private:
// Purposely not implemented
Self& operator=( const Self& );
protected:
- itk::ProcessObject::Pointer m_Image2VTKImageData;
- vtkImageData* m_VTKImageData;
+ itk::ProcessObject::Pointer m_ITKvVTKConnection;
};
} // ecapseman
#include <cpPlugins/Interface/ImageSink.h>
-// -------------------------------------------------------------------------
-std::string cpPlugins::Interface::ImageSink::
-GetClassName( ) const
-{
- return( "cpPlugins::Interface::ImageSink" );
-}
-
-// -------------------------------------------------------------------------
-std::string cpPlugins::Interface::ImageSink::
-GetClassType( ) const
-{
- return( "ImageSink" );
-}
-
// -------------------------------------------------------------------------
cpPlugins::Interface::ImageSink::
ImageSink( )
: Superclass( )
{
+ this->m_ClassName = "cpPlugins::Interface::ImageSink";
+ this->m_ClassCategory = "ImageSink";
}
// -------------------------------------------------------------------------
public:
itkTypeMacro( ImageSink, SinkObject );
- public:
- virtual std::string GetClassName( ) const;
- virtual std::string GetClassType( ) const;
-
protected:
ImageSink( );
virtual ~ImageSink( );
#include <cpPlugins/Interface/ImageSource.h>
-// -------------------------------------------------------------------------
-std::string cpPlugins::Interface::ImageSource::
-GetClassName( ) const
-{
- return( "cpPlugins::Interface::ImageSource" );
-}
-
-// -------------------------------------------------------------------------
-std::string cpPlugins::Interface::ImageSource::
-GetClassType( ) const
-{
- return( "ImageSource" );
-}
-
// -------------------------------------------------------------------------
cpPlugins::Interface::ImageSource::
ImageSource( )
: Superclass( )
{
+ this->m_ClassName = "cpPlugins::Interface::ImageSource";
+ this->m_ClassCategory = "ImageSource";
}
// -------------------------------------------------------------------------
public:
itkTypeMacro( ImageSource, SourceObject );
- public:
- virtual std::string GetClassName( ) const;
- virtual std::string GetClassType( ) const;
-
protected:
ImageSource( );
virtual ~ImageSource( );
#include <cpPlugins/Interface/ImageToImageFilter.h>
-// -------------------------------------------------------------------------
-std::string cpPlugins::Interface::ImageToImageFilter::
-GetClassName( ) const
-{
- return( "cpPlugins::Interface::ImageToImageFilter" );
-}
-
-// -------------------------------------------------------------------------
-std::string cpPlugins::Interface::ImageToImageFilter::
-GetClassType( ) const
-{
- return( "ImageToImageFilter" );
-}
-
// -------------------------------------------------------------------------
cpPlugins::Interface::ImageToImageFilter::
ImageToImageFilter( )
: Superclass( )
{
+ this->m_ClassName = "cpPlugins::Interface::ImageToImageFilter";
+ this->m_ClassCategory = "ImageToImageFilter";
}
// -------------------------------------------------------------------------
public:
itkTypeMacro( ImageToImageFilter, FilterObject );
- public:
- virtual std::string GetClassName( ) const;
- virtual std::string GetClassType( ) const;
-
protected:
ImageToImageFilter( );
virtual ~ImageToImageFilter( );
#include <cpPlugins/Interface/ImageToMeshFilter.h>
-// -------------------------------------------------------------------------
-std::string cpPlugins::Interface::ImageToMeshFilter::
-GetClassName( ) const
-{
- return( "cpPlugins::Interface::ImageToMeshFilter" );
-}
-
-// -------------------------------------------------------------------------
-std::string cpPlugins::Interface::ImageToMeshFilter::
-GetClassType( ) const
-{
- return( "ImageToMeshFilter" );
-}
-
// -------------------------------------------------------------------------
cpPlugins::Interface::ImageToMeshFilter::
ImageToMeshFilter( )
: Superclass( )
{
+ this->m_ClassName = "cpPlugins::Interface::ImageToMeshFilter";
+ this->m_ClassCategory = "ImageToMeshFilter";
}
// -------------------------------------------------------------------------
public:
itkTypeMacro( ImageToMeshFilter, FilterObject );
- public:
- virtual std::string GetClassName( ) const;
- virtual std::string GetClassType( ) const;
-
protected:
ImageToMeshFilter( );
virtual ~ImageToMeshFilter( );
+++ /dev/null
-#include <cpPlugins/Interface/ImageToPolyLineParametricPathFilter.h>
-
-// -------------------------------------------------------------------------
-std::string cpPlugins::Interface::ImageToPolyLineParametricPathFilter::
-GetClassName( ) const
-{
- return( "cpPlugins::Interface::ImageToPolyLineParametricPathFilter" );
-}
-
-// -------------------------------------------------------------------------
-std::string cpPlugins::Interface::ImageToPolyLineParametricPathFilter::
-GetClassType( ) const
-{
- return( "ImageToPolyLineParametricPathFilter" );
-}
-
-// -------------------------------------------------------------------------
-cpPlugins::Interface::ImageToPolyLineParametricPathFilter::
-ImageToPolyLineParametricPathFilter( )
- : Superclass( )
-{
-}
-
-// -------------------------------------------------------------------------
-cpPlugins::Interface::ImageToPolyLineParametricPathFilter::
-~ImageToPolyLineParametricPathFilter( )
-{
-}
-
-// eof - $RCSfile$
+++ /dev/null
-#ifndef __CPPLUGINS__INTERFACE__IMAGETOPOLYLINEPARAMETRICPATHFILTER__H__
-#define __CPPLUGINS__INTERFACE__IMAGETOPOLYLINEPARAMETRICPATHFILTER__H__
-
-#include <cpPlugins/Interface/cpPlugins_Interface_Export.h>
-#include <cpPlugins/Interface/FilterObject.h>
-
-namespace cpPlugins
-{
- namespace Interface
- {
- /**
- */
- class cpPlugins_Interface_EXPORT ImageToPolyLineParametricPathFilter
- : public FilterObject
- {
- public:
- typedef ImageToPolyLineParametricPathFilter Self;
- typedef FilterObject Superclass;
- typedef itk::SmartPointer< Self > Pointer;
- typedef itk::SmartPointer< const Self > ConstPointer;
-
- public:
- itkTypeMacro( ImageToPolyLineParametricPathFilter, FilterObject );
-
- public:
- virtual std::string GetClassName( ) const;
- virtual std::string GetClassType( ) const;
-
- protected:
- ImageToPolyLineParametricPathFilter( );
- virtual ~ImageToPolyLineParametricPathFilter( );
-
- private:
- // Purposely not implemented
- ImageToPolyLineParametricPathFilter( const Self& );
- Self& operator=( const Self& );
- };
-
- } // ecapseman
-
-} // ecapseman
-
-#endif // __CPPLUGINS__INTERFACE__IMAGETOPOLYLINEPARAMETRICPATHFILTER__H__
-
-// eof - $RCSfile$
+#undef ITK_MANUAL_INSTANTIATION
#include <itkImage.h>
+#include <itkCovariantVector.h>
#include <itkRGBPixel.h>
+#include <itkRGBAPixel.h>
+#include <itkVector.h>
+#include <itkSymmetricSecondRankTensor.h>
+#include <itkDiffusionTensor3D.h>
#include <itkImageToVTKImageFilter.h>
// -------------------------------------------------------------------------
-#define cpPlugins_Instance_itkImage( t, d ) \
- template class itk::Image< t, d >; \
- template class itk::Image< itk::RGBPixel< t >, d >
+#define cpPlugins_Instance_itkImage_Pixel( p, d ) \
+ template class itk::Image< p, d >; \
+ template class itk::ImageToVTKImageFilter< itk::Image< p, d > >
// -------------------------------------------------------------------------
-#define cpPlugins_Instance_itkImage2vtkImage( t, d ) \
- template class itk::ImageToVTKImageFilter< itk::Image< t, d > >; \
+#define cpPlugins_Instance_itkImage_RGB( p, d ) \
+ cpPlugins_Instance_itkImage_Pixel( itk::RGBPixel< p >, d )
+
+// -------------------------------------------------------------------------
+#define cpPlugins_Instance_itkImage_RGBA( p, d ) \
+ cpPlugins_Instance_itkImage_Pixel( itk::RGBAPixel< p >, d )
+
+// -------------------------------------------------------------------------
+#define cpPlugins_Instance_itkImage_Vector( p, d ) \
+ template class itk::Image< itk::Vector< p, d >, d >; \
template class \
- itk::ImageToVTKImageFilter< itk::Image< itk::RGBPixel< t >, d > >
+ itk::ImageToVTKImageFilter< itk::Image< itk::Vector< p, d >, d > >
// -------------------------------------------------------------------------
-#define cpPlugins_Instance_All_itkImage( t, d ) \
- cpPlugins_Instance_itkImage( t, d ); \
- cpPlugins_Instance_itkImage2vtkImage( t, d )
+#define cpPlugins_Instance_itkImage_CovVector( p, d ) \
+ template class itk::Image< itk::CovariantVector< p, d >, d >; \
+ template class \
+ itk::ImageToVTKImageFilter< itk::Image< itk::CovariantVector< p, d >, d > >
// -------------------------------------------------------------------------
-// Images without vtk conversion
-cpPlugins_Instance_itkImage( char, 1 );
-cpPlugins_Instance_itkImage( short, 1 );
-cpPlugins_Instance_itkImage( int, 1 );
-cpPlugins_Instance_itkImage( long, 1 );
-cpPlugins_Instance_itkImage( unsigned char, 1 );
-cpPlugins_Instance_itkImage( unsigned short, 1 );
-cpPlugins_Instance_itkImage( unsigned int, 1 );
-cpPlugins_Instance_itkImage( unsigned long, 1 );
-cpPlugins_Instance_itkImage( float, 1 );
-cpPlugins_Instance_itkImage( double, 1 );
+#define cpPlugins_Instance_itkImage_SymTensor( p, d ) \
+ template class itk::Image< itk::SymmetricSecondRankTensor< p, d >, d >; \
+ template class \
+ itk::ImageToVTKImageFilter< itk::Image< itk::SymmetricSecondRankTensor< p, d >, d > >
-cpPlugins_Instance_itkImage( char, 4 );
-cpPlugins_Instance_itkImage( short, 4 );
-cpPlugins_Instance_itkImage( int, 4 );
-cpPlugins_Instance_itkImage( long, 4 );
-cpPlugins_Instance_itkImage( unsigned char, 4 );
-cpPlugins_Instance_itkImage( unsigned short, 4 );
-cpPlugins_Instance_itkImage( unsigned int, 4 );
-cpPlugins_Instance_itkImage( unsigned long, 4 );
-cpPlugins_Instance_itkImage( float, 4 );
-cpPlugins_Instance_itkImage( double, 4 );
+// -------------------------------------------------------------------------
+#define cpPlugins_Instance_itkImage_DiffTensor( p, d ) \
+ cpPlugins_Instance_itkImage_Pixel( itk::DiffusionTensor3D< p >, d )
// -------------------------------------------------------------------------
-// Images with vtk conversion
-cpPlugins_Instance_All_itkImage( char, 2 );
-cpPlugins_Instance_All_itkImage( short, 2 );
-cpPlugins_Instance_All_itkImage( int, 2 );
-cpPlugins_Instance_All_itkImage( long, 2 );
-cpPlugins_Instance_All_itkImage( unsigned char, 2 );
-cpPlugins_Instance_All_itkImage( unsigned short, 2 );
-cpPlugins_Instance_All_itkImage( unsigned int, 2 );
-cpPlugins_Instance_All_itkImage( unsigned long, 2 );
-cpPlugins_Instance_All_itkImage( float, 2 );
-cpPlugins_Instance_All_itkImage( double, 2 );
+#define cpPlugins_Instance_itkImage_DIM( d ) \
+ cpPlugins_Instance_itkImage_Pixel( char, d ); \
+ cpPlugins_Instance_itkImage_Pixel( short, d ); \
+ cpPlugins_Instance_itkImage_Pixel( int, d ); \
+ cpPlugins_Instance_itkImage_Pixel( long, d ); \
+ cpPlugins_Instance_itkImage_Pixel( float, d ); \
+ cpPlugins_Instance_itkImage_Pixel( double, d ); \
+ cpPlugins_Instance_itkImage_Pixel( unsigned char, d ); \
+ cpPlugins_Instance_itkImage_Pixel( unsigned short, d ); \
+ cpPlugins_Instance_itkImage_Pixel( unsigned int, d ); \
+ cpPlugins_Instance_itkImage_Pixel( unsigned long, d ); \
+ cpPlugins_Instance_itkImage_RGB( char, d ); \
+ cpPlugins_Instance_itkImage_RGB( short, d ); \
+ cpPlugins_Instance_itkImage_RGB( int, d ); \
+ cpPlugins_Instance_itkImage_RGB( long, d ); \
+ cpPlugins_Instance_itkImage_RGB( float, d ); \
+ cpPlugins_Instance_itkImage_RGB( double, d ); \
+ cpPlugins_Instance_itkImage_RGB( unsigned char, d ); \
+ cpPlugins_Instance_itkImage_RGB( unsigned short, d ); \
+ cpPlugins_Instance_itkImage_RGB( unsigned int, d ); \
+ cpPlugins_Instance_itkImage_RGB( unsigned long, d ); \
+ cpPlugins_Instance_itkImage_RGBA( char, d ); \
+ cpPlugins_Instance_itkImage_RGBA( short, d ); \
+ cpPlugins_Instance_itkImage_RGBA( int, d ); \
+ cpPlugins_Instance_itkImage_RGBA( long, d ); \
+ cpPlugins_Instance_itkImage_RGBA( float, d ); \
+ cpPlugins_Instance_itkImage_RGBA( double, d ); \
+ cpPlugins_Instance_itkImage_RGBA( unsigned char, d ); \
+ cpPlugins_Instance_itkImage_RGBA( unsigned short, d ); \
+ cpPlugins_Instance_itkImage_RGBA( unsigned int, d ); \
+ cpPlugins_Instance_itkImage_RGBA( unsigned long, d ); \
+ cpPlugins_Instance_itkImage_Vector( char, d ); \
+ cpPlugins_Instance_itkImage_Vector( short, d ); \
+ cpPlugins_Instance_itkImage_Vector( int, d ); \
+ cpPlugins_Instance_itkImage_Vector( long, d ); \
+ cpPlugins_Instance_itkImage_Vector( float, d ); \
+ cpPlugins_Instance_itkImage_Vector( double, d ); \
+ cpPlugins_Instance_itkImage_Vector( unsigned char, d ); \
+ cpPlugins_Instance_itkImage_Vector( unsigned short, d ); \
+ cpPlugins_Instance_itkImage_Vector( unsigned int, d ); \
+ cpPlugins_Instance_itkImage_Vector( unsigned long, d ); \
+ cpPlugins_Instance_itkImage_CovVector( char, d ); \
+ cpPlugins_Instance_itkImage_CovVector( short, d ); \
+ cpPlugins_Instance_itkImage_CovVector( int, d ); \
+ cpPlugins_Instance_itkImage_CovVector( long, d ); \
+ cpPlugins_Instance_itkImage_CovVector( float, d ); \
+ cpPlugins_Instance_itkImage_CovVector( double, d ); \
+ cpPlugins_Instance_itkImage_CovVector( unsigned char, d ); \
+ cpPlugins_Instance_itkImage_CovVector( unsigned short, d ); \
+ cpPlugins_Instance_itkImage_CovVector( unsigned int, d ); \
+ cpPlugins_Instance_itkImage_CovVector( unsigned long, d ); \
+ cpPlugins_Instance_itkImage_SymTensor( char, d ); \
+ cpPlugins_Instance_itkImage_SymTensor( short, d ); \
+ cpPlugins_Instance_itkImage_SymTensor( int, d ); \
+ cpPlugins_Instance_itkImage_SymTensor( long, d ); \
+ cpPlugins_Instance_itkImage_SymTensor( float, d ); \
+ cpPlugins_Instance_itkImage_SymTensor( double, d ); \
+ cpPlugins_Instance_itkImage_SymTensor( unsigned char, d ); \
+ cpPlugins_Instance_itkImage_SymTensor( unsigned short, d ); \
+ cpPlugins_Instance_itkImage_SymTensor( unsigned int, d ); \
+ cpPlugins_Instance_itkImage_SymTensor( unsigned long, d ); \
+ cpPlugins_Instance_itkImage_DiffTensor( char, d ); \
+ cpPlugins_Instance_itkImage_DiffTensor( short, d ); \
+ cpPlugins_Instance_itkImage_DiffTensor( int, d ); \
+ cpPlugins_Instance_itkImage_DiffTensor( long, d ); \
+ cpPlugins_Instance_itkImage_DiffTensor( float, d ); \
+ cpPlugins_Instance_itkImage_DiffTensor( double, d ); \
+ cpPlugins_Instance_itkImage_DiffTensor( unsigned char, d ); \
+ cpPlugins_Instance_itkImage_DiffTensor( unsigned short, d ); \
+ cpPlugins_Instance_itkImage_DiffTensor( unsigned int, d ); \
+ cpPlugins_Instance_itkImage_DiffTensor( unsigned long, d );
-cpPlugins_Instance_All_itkImage( char, 3 );
-cpPlugins_Instance_All_itkImage( short, 3 );
-cpPlugins_Instance_All_itkImage( int, 3 );
-cpPlugins_Instance_All_itkImage( long, 3 );
-cpPlugins_Instance_All_itkImage( unsigned char, 3 );
-cpPlugins_Instance_All_itkImage( unsigned short, 3 );
-cpPlugins_Instance_All_itkImage( unsigned int, 3 );
-cpPlugins_Instance_All_itkImage( unsigned long, 3 );
-cpPlugins_Instance_All_itkImage( float, 3 );
-cpPlugins_Instance_All_itkImage( double, 3 );
+// -------------------------------------------------------------------------
+cpPlugins_Instance_itkImage_DIM( 1 );
+cpPlugins_Instance_itkImage_DIM( 2 );
+cpPlugins_Instance_itkImage_DIM( 3 );
// eof - $RCSfile$
-/* TODO
- #include <itkMesh.h>
+#undef ITK_MANUAL_INSTANTIATION
+#include <itkMesh.h>
+#include <itkQuadEdgeMesh.h>
- template class itk::Mesh< float, 2 >;
- template class itk::Mesh< double, 2 >;
- template class itk::Mesh< float, 3 >;
- template class itk::Mesh< double, 3 >;
-*/
+template class itk::Mesh< float, 2 >;
+template class itk::Mesh< float, 3 >;
+template class itk::Mesh< double, 2 >;
+template class itk::Mesh< double, 3 >;
+template class itk::QuadEdgeMesh< float, 2 >;
+template class itk::QuadEdgeMesh< float, 3 >;
+template class itk::QuadEdgeMesh< double, 2 >;
+template class itk::QuadEdgeMesh< double, 3 >;
// eof - $RCSfile$
+++ /dev/null
-#include <itkPolyLineParametricPath.h>
-#include <itkVectorContainer.h>
-#include <itkContinuousIndex.h>
-
-template class itk::PolyLineParametricPath< 1 >;
-template class itk::PolyLineParametricPath< 2 >;
-template class itk::PolyLineParametricPath< 3 >;
-template class itk::PolyLineParametricPath< 4 >;
-
-template class
-itk::VectorContainer< unsigned int, itk::ContinuousIndex< double, 1 > >;
-template class
-itk::VectorContainer< unsigned int, itk::ContinuousIndex< double, 2 > >;
-template class
-itk::VectorContainer< unsigned int, itk::ContinuousIndex< double, 3 > >;
-template class
-itk::VectorContainer< unsigned int, itk::ContinuousIndex< double, 4 > >;
-
-// eof - $RCSfile$
Interface( );
virtual ~Interface( );
- /// Plugin access
+ // Plugin access
TClasses& GetClasses( );
const TClasses& GetClasses( ) const;
Object::Pointer CreateObject( const std::string& name ) const;
const std::string& name
) const;
- /// Interface to PLUMA
+ // Interface to PLUMA
bool Load( const std::string& path );
bool Load( const std::string& folder, const std::string& name );
int LoadFromFolder( const std::string& folder, bool r = false );
#include <cpPlugins/Interface/Mesh.h>
-#include <vtkMapper.h>
-
-#include <cpPlugins/Extensions/DataStructures/QuadEdgeMesh.h>
-#include <cpPlugins/Extensions/Visualization/OpenGLMeshMapper.h>
+#include <vtkPolyData.h>
// -------------------------------------------------------------------------
-std::string cpPlugins::Interface::Mesh::
-GetClassName( ) const
+void cpPlugins::Interface::Mesh::
+SetITKDataObject( itk::DataObject* o )
{
- return( "cpPlugins::Interface::Mesh" );
+ // TODO: conversion!!!
+ std::cout << "Mesh: SetITKDataObject " << std::endl;
+ std::exit( 1 );
}
// -------------------------------------------------------------------------
void cpPlugins::Interface::Mesh::
-SetRealDataObject( itk::DataObject* dobj )
+SetVTKDataObject( vtkDataObject* o )
{
- this->Superclass::SetRealDataObject( dobj );
+ if( dynamic_cast< vtkPolyData* >( o ) != NULL )
+ {
+ this->m_VTKObject = o;
- // NOTE: Only 2 and 3 dimensions at this moment
- using namespace cpPlugins::Extensions;
- typedef DataStructures::QuadEdgeMesh< float, 2 > _TF2;
- typedef DataStructures::QuadEdgeMesh< double, 2 > _TD2;
- typedef DataStructures::QuadEdgeMesh< float, 3 > _TF3;
- typedef DataStructures::QuadEdgeMesh< double, 3 > _TD3;
+ // TODO: conversion!!!
+ }
+ else
+ this->m_VTKObject = NULL;
+}
- if ( dynamic_cast< _TF2* >( dobj ) ) this->_Map< _TF2 >( );
- else if( dynamic_cast< _TD2* >( dobj ) ) this->_Map< _TD2 >( );
- else if( dynamic_cast< _TF3* >( dobj ) ) this->_Map< _TF3 >( );
- else if( dynamic_cast< _TD3* >( dobj ) ) this->_Map< _TD3 >( );
+// -------------------------------------------------------------------------
+vtkPolyData* cpPlugins::Interface::Mesh::
+GetVTKPolyData( )
+{
+ return( dynamic_cast< vtkPolyData* >( this->m_VTKObject.GetPointer( ) ) );
}
// -------------------------------------------------------------------------
-vtkMapper* cpPlugins::Interface::Mesh::
-GetVTKMapper( ) const
+const vtkPolyData* cpPlugins::Interface::Mesh::
+GetVTKPolyData( ) const
{
- return( this->m_Mapper );
+ return(
+ dynamic_cast< const vtkPolyData* >( this->m_VTKObject.GetPointer( ) )
+ );
}
// -------------------------------------------------------------------------
cpPlugins::Interface::Mesh::
Mesh( )
- : Superclass( ),
- m_Mapper( NULL )
+ : Superclass( )
{
+ this->m_ClassName = "cpPlugins::Interface::Mesh";
+ this->m_ClassCategory = "BasicObject";
}
// -------------------------------------------------------------------------
cpPlugins::Interface::Mesh::
~Mesh( )
{
- if( this->m_Mapper != NULL ) this->m_Mapper->Delete( );
}
// -------------------------------------------------------------------------
-template< class M >
+template< unsigned int D >
void cpPlugins::Interface::Mesh::
-_Map( )
+_ITK_2_VTK_0( itk::DataObject* o )
{
- typedef
- cpPlugins::Extensions::Visualization::OpenGLMeshMapper< M >
- _TMapper;
+}
- if( this->m_Mapper != NULL ) this->m_Mapper->Delete( );
- M* mesh = dynamic_cast< M* >( this->Superclass::GetRealDataObject( ) );
- _TMapper* mapper = _TMapper::New( );
- mapper->SetInputData( mesh );
- this->m_Mapper = mapper;
+// -------------------------------------------------------------------------
+template< class P, unsigned int D >
+void cpPlugins::Interface::Mesh::
+_ITK_2_VTK_1( itk::DataObject* o )
+{
+}
+
+// -------------------------------------------------------------------------
+template< unsigned int D >
+void cpPlugins::Interface::Mesh::
+_VTK_2_ITK_0( itk::DataObject* o )
+{
+}
+
+// -------------------------------------------------------------------------
+template< class P, unsigned int D >
+void cpPlugins::Interface::Mesh::
+_VTK_2_ITK_1( itk::DataObject* o )
+{
}
// eof - $RCSfile$
#ifndef __CPPLUGINS__INTERFACE__MESH__H__
#define __CPPLUGINS__INTERFACE__MESH__H__
-#include <map>
-#include <string>
-#include <itkProcessObject.h>
#include <cpPlugins/Interface/cpPlugins_Interface_Export.h>
#include <cpPlugins/Interface/DataObject.h>
-class vtkMapper;
+class vtkPolyData;
namespace cpPlugins
{
itkTypeMacro( Mesh, DataObject );
public:
- virtual std::string GetClassName( ) const;
- virtual void SetRealDataObject( itk::DataObject* dobj );
+ virtual void SetITKDataObject( itk::DataObject* o );
+ virtual void SetVTKDataObject( vtkDataObject* o );
- vtkMapper* GetVTKMapper( ) const;
+ vtkPolyData* GetVTKPolyData( );
+ const vtkPolyData* GetVTKPolyData( ) const;
protected:
Mesh( );
virtual ~Mesh( );
- template< class M >
- void _Map( );
+ template< unsigned int D >
+ void _ITK_2_VTK_0( itk::DataObject* o );
+
+ template< class P, unsigned int D >
+ void _ITK_2_VTK_1( itk::DataObject* o );
+
+ template< unsigned int D >
+ void _VTK_2_ITK_0( itk::DataObject* o );
+
+ template< class P, unsigned int D >
+ void _VTK_2_ITK_1( itk::DataObject* o );
private:
// Purposely not implemented
Mesh( const Self& );
Self& operator=( const Self& );
-
- protected:
- vtkMapper* m_Mapper;
};
} // ecapseman
#include <cpPlugins/Interface/MeshSink.h>
-// -------------------------------------------------------------------------
-std::string cpPlugins::Interface::MeshSink::
-GetClassName( ) const
-{
- return( "cpPlugins::Interface::MeshSink" );
-}
-
-// -------------------------------------------------------------------------
-std::string cpPlugins::Interface::MeshSink::
-GetClassType( ) const
-{
- return( "MeshSink" );
-}
-
// -------------------------------------------------------------------------
cpPlugins::Interface::MeshSink::
MeshSink( )
: Superclass( )
{
+ this->m_ClassName = "cpPlugins::Interface::MeshSink";
+ this->m_ClassCategory = "MeshSink";
}
// -------------------------------------------------------------------------
public:
itkTypeMacro( MeshSink, SinkObject );
- public:
- virtual std::string GetClassName( ) const;
- virtual std::string GetClassType( ) const;
-
protected:
MeshSink( );
virtual ~MeshSink( );
#include <cpPlugins/Interface/MeshSource.h>
-// -------------------------------------------------------------------------
-std::string cpPlugins::Interface::MeshSource::
-GetClassName( ) const
-{
- return( "cpPlugins::Interface::MeshSource" );
-}
-
-// -------------------------------------------------------------------------
-std::string cpPlugins::Interface::MeshSource::
-GetClassType( ) const
-{
- return( "MeshSource" );
-}
-
// -------------------------------------------------------------------------
cpPlugins::Interface::MeshSource::
MeshSource( )
: Superclass( )
{
+ this->m_ClassName = "cpPlugins::Interface::MeshSource";
+ this->m_ClassCategory = "MeshSource";
}
// -------------------------------------------------------------------------
public:
itkTypeMacro( MeshSource, SourceObject );
- public:
- virtual std::string GetClassName( ) const;
- virtual std::string GetClassType( ) const;
-
protected:
MeshSource( );
virtual ~MeshSource( );
#include <cpPlugins/Interface/MeshToImageFilter.h>
-// -------------------------------------------------------------------------
-std::string cpPlugins::Interface::MeshToImageFilter::
-GetClassName( ) const
-{
- return( "cpPlugins::Interface::MeshToImageFilter" );
-}
-
-// -------------------------------------------------------------------------
-std::string cpPlugins::Interface::MeshToImageFilter::
-GetClassType( ) const
-{
- return( "MeshToImageFilter" );
-}
-
// -------------------------------------------------------------------------
cpPlugins::Interface::MeshToImageFilter::
MeshToImageFilter( )
: Superclass( )
{
+ this->m_ClassName = "cpPlugins::Interface::MeshToImageFilter";
+ this->m_ClassCategory = "MeshToImageFilter";
}
// -------------------------------------------------------------------------
public:
itkTypeMacro( MeshToImageFilter, FilterObject );
- public:
- virtual std::string GetClassName( ) const;
- virtual std::string GetClassType( ) const;
-
protected:
MeshToImageFilter( );
virtual ~MeshToImageFilter( );
#include <cpPlugins/Interface/MeshToMeshFilter.h>
-// -------------------------------------------------------------------------
-std::string cpPlugins::Interface::MeshToMeshFilter::
-GetClassName( ) const
-{
- return( "cpPlugins::Interface::MeshToMeshFilter" );
-}
-
-// -------------------------------------------------------------------------
-std::string cpPlugins::Interface::MeshToMeshFilter::
-GetClassType( ) const
-{
- return( "MeshToMeshFilter" );
-}
-
// -------------------------------------------------------------------------
cpPlugins::Interface::MeshToMeshFilter::
MeshToMeshFilter( )
: Superclass( )
{
+ this->m_ClassName = "cpPlugins::Interface::MeshToMeshFilter";
+ this->m_ClassCategory = "MeshToMeshFilter";
}
// -------------------------------------------------------------------------
public:
itkTypeMacro( MeshToMeshFilter, FilterObject );
- public:
- virtual std::string GetClassName( ) const;
- virtual std::string GetClassType( ) const;
-
protected:
MeshToMeshFilter( );
virtual ~MeshToMeshFilter( );
#include <cpPlugins/Interface/Object.h>
-// -------------------------------------------------------------------------
-std::string cpPlugins::Interface::Object::
-GetClassName( ) const
-{
- return( "cpPlugins::Interface::Object" );
-}
-
-// -------------------------------------------------------------------------
-std::string cpPlugins::Interface::Object::
-GetClassType( ) const
-{
- return( "Object" );
-}
-
// -------------------------------------------------------------------------
cpPlugins::Interface::Object::
Object( )
: Superclass( )
{
+ this->m_ClassName = "cpPlugins::Interface::Object";
+ this->m_ClassCategory = "BasicObject";
}
// -------------------------------------------------------------------------
#include <string>
#include <Pluma/Pluma.hpp>
+#include <cpPlugins/Interface/cpPlugins_Interface_Export.h>
+
+#define ITK_MANUAL_INSTANTIATION
#include <itkObject.h>
#include <itkObjectFactory.h>
-#include <cpPlugins/Interface/cpPlugins_Interface_Export.h>
// -------------------------------------------------------------------------
#define CPPLUGINS_PROVIDER_HEADER_BEGIN( TYPE ) \
itkTypeMacro( Object, itkObject );
public:
- virtual std::string GetClassName( ) const;
- virtual std::string GetClassType( ) const;
+ itkGetConstMacro( ClassName, std::string );
+ itkGetConstMacro( ClassCategory, std::string );
protected:
Object( );
// Purposely not implemented
Object( const Self& );
Self& operator=( const Self& );
+
+ protected:
+ std::string m_ClassName;
+ std::string m_ClassCategory;
};
/**
+++ /dev/null
-
-#include <cpPlugins/Interface/PolyData.h>
-
-// -------------------------------------------------------------------------
-std::string cpPlugins::Interface::PolyData::
-GetClassName( ) const
-{
- return( "cpPlugins::Interface::PolyData" );
-}
-
-// -------------------------------------------------------------------------
-void cpPlugins::Interface::PolyData::
-SetRealDataObject( itk::DataObject* dobj )
-{
- // Nothing to be done here
-}
-
-// -------------------------------------------------------------------------
-void cpPlugins::Interface::PolyData::
-SetRealDataObject( vtkDataObject* dobj )
-{
- this->m_Data = dynamic_cast< vtkPolyData* >( dobj );
- if( this->m_Data == NULL )
- return;
- this->m_Mapper->SetInputData( this->m_Data );
- this->m_Actor->SetMapper( this->m_Mapper );
-}
-
-// -------------------------------------------------------------------------
-vtkPolyData* cpPlugins::Interface::PolyData::
-GetData( ) const
-{
- return( this->m_Data );
-}
-
-// -------------------------------------------------------------------------
-vtkPolyDataMapper* cpPlugins::Interface::PolyData::
-GetMapper( ) const
-{
- return( this->m_Mapper );
-}
-
-// -------------------------------------------------------------------------
-vtkActor* cpPlugins::Interface::PolyData::
-GetActor( ) const
-{
- return( this->m_Actor );
-}
-
-// -------------------------------------------------------------------------
-cpPlugins::Interface::PolyData::
-PolyData( )
- : Superclass( )
-{
- this->m_Mapper = vtkSmartPointer< vtkPolyDataMapper >::New( );
- this->m_Actor = vtkSmartPointer< vtkActor >::New( );
-}
-
-// -------------------------------------------------------------------------
-cpPlugins::Interface::PolyData::
-~PolyData( )
-{
-}
-
-// eof - $RCSfile$
+++ /dev/null
-#ifndef __CPPLUGINS__INTERFACE__POLYDATA__H__
-#define __CPPLUGINS__INTERFACE__POLYDATA__H__
-
-#include <cpPlugins/Interface/cpPlugins_Interface_Export.h>
-#include <cpPlugins/Interface/DataObject.h>
-
-#include <vtkActor.h>
-#include <vtkPolyData.h>
-#include <vtkPolyDataMapper.h>
-#include <vtkSmartPointer.h>
-
-namespace cpPlugins
-{
- namespace Interface
- {
- /**
- */
- class cpPlugins_Interface_EXPORT PolyData
- : public DataObject
- {
- public:
- typedef PolyData Self;
- typedef DataObject Superclass;
- typedef itk::SmartPointer< Self > Pointer;
- typedef itk::SmartPointer< const Self > ConstPointer;
-
- public:
- itkNewMacro( Self );
- itkTypeMacro( PolyData, DataObject );
-
- public:
- virtual std::string GetClassName( ) const;
- virtual void SetRealDataObject( itk::DataObject* dobj );
- virtual void SetRealDataObject( vtkDataObject* dobj );
-
- vtkPolyData* GetData( ) const;
- vtkPolyDataMapper* GetMapper( ) const;
- vtkActor* GetActor( ) const;
-
- protected:
- PolyData( );
- virtual ~PolyData( );
-
- private:
- // Purposely not implemented
- PolyData( const Self& );
- Self& operator=( const Self& );
-
- protected:
- vtkSmartPointer< vtkPolyData > m_Data;
- vtkSmartPointer< vtkPolyDataMapper > m_Mapper;
- vtkSmartPointer< vtkActor > m_Actor;
- };
-
- } // ecapseman
-
-} // ecapseman
-
-#endif // __CPPLUGINS__INTERFACE__POLYDATA__H__
-
-// eof - $RCSfile$
+++ /dev/null
-#include <cpPlugins/Interface/PolyDataSource.h>
-
-// -------------------------------------------------------------------------
-std::string cpPlugins::Interface::PolyDataSource::
-GetClassName( ) const
-{
- return( "cpPlugins::Interface::PolyDataSource" );
-}
-
-// -------------------------------------------------------------------------
-std::string cpPlugins::Interface::PolyDataSource::
-GetClassType( ) const
-{
- return( "PolyDataSource" );
-}
-
-// -------------------------------------------------------------------------
-cpPlugins::Interface::PolyDataSource::
-PolyDataSource( )
- : Superclass( )
-{
-}
-
-// -------------------------------------------------------------------------
-cpPlugins::Interface::PolyDataSource::
-~PolyDataSource( )
-{
-}
-
-// eof - $RCSfile$
+++ /dev/null
-#ifndef __CPPLUGINS__INTERFACE__POLYDATASOURCE__H__
-#define __CPPLUGINS__INTERFACE__POLYDATASOURCE__H__
-
-#include <cpPlugins/Interface/cpPlugins_Interface_Export.h>
-#include <cpPlugins/Interface/SourceObject.h>
-
-namespace cpPlugins
-{
- namespace Interface
- {
- /**
- */
- class cpPlugins_Interface_EXPORT PolyDataSource
- : public SourceObject
- {
- public:
- typedef PolyDataSource Self;
- typedef SourceObject Superclass;
- typedef itk::SmartPointer< Self > Pointer;
- typedef itk::SmartPointer< const Self > ConstPointer;
-
- public:
- itkTypeMacro( PolyDataSource, SourceObject );
-
- public:
- virtual std::string GetClassName( ) const;
- virtual std::string GetClassType( ) const;
-
- protected:
- PolyDataSource( );
- virtual ~PolyDataSource( );
-
- private:
- // Purposely not implemented
- PolyDataSource( const Self& );
- Self& operator=( const Self& );
- };
-
- } // ecapseman
-
-} // ecapseman
-
-#endif // __CPPLUGINS__INTERFACE__POLYDATASOURCE__H__
-
-// eof - $RCSfile$
+++ /dev/null
-#include <cpPlugins/Interface/PolyLineParametricPath.h>
-
-#include <vtkCellArray.h>
-#include <vtkPoints.h>
-
-#define ITK_MANUAL_INSTANTIATION
-#include <itkPolyLineParametricPath.h>
-#include <itkImageBase.h>
-
-// -------------------------------------------------------------------------
-std::string cpPlugins::Interface::PolyLineParametricPath::
-GetClassName( ) const
-{
- return( "cpPlugins::Interface::PolyLineParametricPath" );
-}
-
-// -------------------------------------------------------------------------
-void cpPlugins::Interface::PolyLineParametricPath::
-SetRealDataObject( itk::DataObject* dobj, itk::DataObject* ref_image )
-{
- typedef itk::PolyLineParametricPath< 2 > _T2;
- typedef itk::PolyLineParametricPath< 3 > _T3;
-
- this->Superclass::SetRealDataObject( dobj );
-
- if( ref_image != NULL )
- {
- if( dynamic_cast< _T2* >( dobj ) != NULL )
- this->_VTK< 2 >( ref_image );
- else if( dynamic_cast< _T3* >( dobj ) != NULL )
- this->_VTK< 3 >( ref_image );
-
- } // fi
-}
-
-// -------------------------------------------------------------------------
-cpPlugins::Interface::PolyLineParametricPath::
-PolyLineParametricPath( )
- : Superclass( )
-{
- this->m_PolyData = vtkSmartPointer< vtkPolyData >::New( );
-}
-
-// -------------------------------------------------------------------------
-cpPlugins::Interface::PolyLineParametricPath::
-~PolyLineParametricPath( )
-{
-}
-
-// -------------------------------------------------------------------------
-template< unsigned int D >
-void cpPlugins::Interface::PolyLineParametricPath::
-_VTK( itk::DataObject* ref_image )
-{
- typedef itk::PolyLineParametricPath< D > _TPath;
- typedef typename _TPath::VertexListType _TVertices;
- typedef typename _TPath::ContinuousIndexType _TIndex;
- typedef itk::ImageBase< D > _TImage;
- typedef typename _TImage::PointType _TPoint;
-
- _TPath* path =
- dynamic_cast< _TPath* >( this->m_RealDataObject.GetPointer( ) );
- if( path == NULL )
- return;
- const _TVertices* vertices = path->GetVertexList( );
- if( vertices == NULL )
- return;
- const _TImage* image = dynamic_cast< const _TImage* >( ref_image );
-
- vtkSmartPointer< vtkPoints > points =
- vtkSmartPointer< vtkPoints >::New( );
- vtkSmartPointer< vtkCellArray > lines =
- vtkSmartPointer< vtkCellArray >::New( );
- double x, y, z;
- for( unsigned int i = 0; i < vertices->Size( ); ++i )
- {
- _TIndex idx = vertices->GetElement( i );
- if( image != NULL )
- {
- _TPoint pnt;
- image->TransformContinuousIndexToPhysicalPoint( idx, pnt );
- x = double( pnt[ 0 ] );
- y = double( pnt[ 1 ] );
- z = ( D >= 3 )? double( pnt[ 2 ] ): double( 0 );
- }
- else
- {
- x = double( idx[ 0 ] );
- y = double( idx[ 1 ] );
- z = ( D >= 3 )? double( idx[ 2 ] ): double( 0 );
-
- } // fi
- points->InsertNextPoint( x, y, z );
- if( i > 0 )
- {
- lines->InsertNextCell( 2 );
- lines->InsertCellPoint( i - 1 );
- lines->InsertCellPoint( i );
-
- } // fi
-
- } // rof
- this->m_PolyData->SetPoints( points );
- this->m_PolyData->SetLines( lines );
-}
-
-// eof - $RCSfile$
+++ /dev/null
-#ifndef __CPPLUGINS__INTERFACE__POLYLINEPARAMETRICPATH__H__
-#define __CPPLUGINS__INTERFACE__POLYLINEPARAMETRICPATH__H__
-
-#include <map>
-#include <string>
-#include <itkProcessObject.h>
-#include <cpPlugins/Interface/cpPlugins_Interface_Export.h>
-#include <cpPlugins/Interface/DataObject.h>
-
-#include <vtkPolyData.h>
-#include <vtkSmartPointer.h>
-
-namespace cpPlugins
-{
- namespace Interface
- {
- /**
- */
- class cpPlugins_Interface_EXPORT PolyLineParametricPath
- : public DataObject
- {
- public:
- typedef PolyLineParametricPath Self;
- typedef DataObject Superclass;
- typedef itk::SmartPointer< Self > Pointer;
- typedef itk::SmartPointer< const Self > ConstPointer;
-
- public:
- itkNewMacro( Self );
- itkTypeMacro( PolyLineParametricPath, DataObject );
-
- public:
- virtual std::string GetClassName( ) const;
- virtual void SetRealDataObject(
- itk::DataObject* dobj,
- itk::DataObject* ref_image = NULL
- );
-
- protected:
- PolyLineParametricPath( );
- virtual ~PolyLineParametricPath( );
-
- template< unsigned int D >
- void _VTK( itk::DataObject* ref_image );
-
- private:
- // Purposely not implemented
- PolyLineParametricPath( const Self& );
- Self& operator=( const Self& );
-
- protected:
- vtkSmartPointer< vtkPolyData > m_PolyData;
- };
-
- } // ecapseman
-
-} // ecapseman
-
-#endif // __CPPLUGINS__INTERFACE__POLYLINEPARAMETRICPATH__H__
-
-// eof - $RCSfile$
+++ /dev/null
-#include <cpPlugins/Interface/PolyLineParametricPathSource.h>
-
-// -------------------------------------------------------------------------
-std::string cpPlugins::Interface::PolyLineParametricPathSource::
-GetClassName( ) const
-{
- return( "cpPlugins::Interface::PolyLineParametricPathSource" );
-}
-
-// -------------------------------------------------------------------------
-std::string cpPlugins::Interface::PolyLineParametricPathSource::
-GetClassType( ) const
-{
- return( "PolyLineParametricPathSource" );
-}
-
-// -------------------------------------------------------------------------
-cpPlugins::Interface::PolyLineParametricPathSource::
-PolyLineParametricPathSource( )
- : Superclass( )
-{
-}
-
-// -------------------------------------------------------------------------
-cpPlugins::Interface::PolyLineParametricPathSource::
-~PolyLineParametricPathSource( )
-{
-}
-
-// eof - $RCSfile$
+++ /dev/null
-#ifndef __CPPLUGINS__INTERFACE__POLYLINEPARAMETRICPATHSOURCE__H__
-#define __CPPLUGINS__INTERFACE__POLYLINEPARAMETRICPATHSOURCE__H__
-
-#include <cpPlugins/Interface/cpPlugins_Interface_Export.h>
-#include <cpPlugins/Interface/SourceObject.h>
-
-namespace cpPlugins
-{
- namespace Interface
- {
- /**
- */
- class cpPlugins_Interface_EXPORT PolyLineParametricPathSource
- : public SourceObject
- {
- public:
- typedef PolyLineParametricPathSource Self;
- typedef SourceObject Superclass;
- typedef itk::SmartPointer< Self > Pointer;
- typedef itk::SmartPointer< const Self > ConstPointer;
-
- public:
- itkTypeMacro( PolyLineParametricPathSource, SourceObject );
-
- public:
- virtual std::string GetClassName( ) const;
- virtual std::string GetClassType( ) const;
-
- protected:
- PolyLineParametricPathSource( );
- virtual ~PolyLineParametricPathSource( );
-
- private:
- // Purposely not implemented
- PolyLineParametricPathSource( const Self& );
- Self& operator=( const Self& );
- };
-
- } // ecapseman
-
-} // ecapseman
-
-#endif // __CPPLUGINS__INTERFACE__POLYLINEPARAMETRICPATHSOURCE__H__
-
-// eof - $RCSfile$
#include <cpPlugins/Interface/ProcessObject.h>
-// -------------------------------------------------------------------------
-std::string cpPlugins::Interface::ProcessObject::
-GetClassName( ) const
-{
- return( "cpPlugins::Interface::ProcessObject" );
-}
-
-// -------------------------------------------------------------------------
-std::string cpPlugins::Interface::ProcessObject::
-GetClassType( ) const
-{
- return( "ProcessObject" );
-}
-
// -------------------------------------------------------------------------
const cpPlugins::Interface::Parameters&
cpPlugins::Interface::ProcessObject::
ProcessObject( )
: Superclass( )
{
+ this->m_ClassName = "cpPlugins::Interface::ProcessObject";
+ this->m_ClassCategory = "BasicObject";
}
// -------------------------------------------------------------------------
}
// -------------------------------------------------------------------------
-itk::DataObject* cpPlugins::Interface::ProcessObject::
-_GetInput( unsigned int idx )
-{
- if( idx < this->m_Inputs.size( ) )
- return( this->m_Inputs[ idx ]->GetRealDataObject( ) );
- else
- return( NULL );
-}
+/* TODO
+ itk::DataObject* cpPlugins::Interface::ProcessObject::
+ _GetInput( unsigned int idx )
+ {
+ if( idx < this->m_Inputs.size( ) )
+ return( this->m_Inputs[ idx ]->GetRealDataObject( ) );
+ else
+ return( NULL );
+ }
-// -------------------------------------------------------------------------
-void cpPlugins::Interface::ProcessObject::
-_SetOutput( unsigned int idx, itk::DataObject* dobj )
-{
- if( idx < this->m_Outputs.size( ) )
- if( this->m_Outputs[ idx ].IsNotNull( ) )
- this->m_Outputs[ idx ]->SetRealDataObject( dobj );
-}
+ // -------------------------------------------------------------------------
+ void cpPlugins::Interface::ProcessObject::
+ _SetOutput( unsigned int idx, itk::DataObject* dobj )
+ {
+ if( idx < this->m_Outputs.size( ) )
+ if( this->m_Outputs[ idx ].IsNotNull( ) )
+ this->m_Outputs[ idx ]->SetRealDataObject( dobj );
+ }
+*/
// eof - $RCSfile$
#ifndef __CPPLUGINS__INTERFACE__PROCESSOBJECT__H__
#define __CPPLUGINS__INTERFACE__PROCESSOBJECT__H__
-#include <itkProcessObject.h>
#include <cpPlugins/Interface/cpPlugins_Interface_Export.h>
#include <cpPlugins/Interface/Object.h>
#include <cpPlugins/Interface/DataObject.h>
#include <cpPlugins/Interface/Parameters.h>
+#define ITK_MANUAL_INSTANTIATION
+#include <itkProcessObject.h>
+
namespace cpPlugins
{
namespace Interface
itkTypeMacro( ProcessObject, Object );
public:
- virtual std::string GetClassName( ) const;
- virtual std::string GetClassType( ) const;
virtual const Parameters& GetDefaultParameters( ) const;
virtual void SetParameters( const Parameters& params );
ProcessObject( );
virtual ~ProcessObject( );
- virtual itk::DataObject* _GetInput( unsigned int idx );
- virtual void _SetOutput( unsigned int idx, itk::DataObject* dobj );
+ /* TODO
+ virtual itk::DataObject* _GetInput( unsigned int idx );
+ virtual void _SetOutput( unsigned int idx, itk::DataObject* dobj );
+ */
template< class O >
- void _MakeOutput( unsigned int idx )
- {
- if( idx >= this->m_Outputs.size( ) )
- return;
- this->m_Outputs[ idx ] = O::New( );
- this->m_Outputs[ idx ]->SetSource( this );
- }
+ void _MakeOutput( unsigned int idx )
+ {
+ if( idx >= this->m_Outputs.size( ) )
+ return;
+ this->m_Outputs[ idx ] = O::New( );
+ this->m_Outputs[ idx ]->SetSource( this );
+ }
virtual std::string _GenerateData( ) = 0;
#include <cpPlugins/Interface/SinkObject.h>
-// -------------------------------------------------------------------------
-std::string cpPlugins::Interface::SinkObject::
-GetClassName( ) const
-{
- return( "cpPlugins::Interface::SinkObject" );
-}
-
-// -------------------------------------------------------------------------
-std::string cpPlugins::Interface::SinkObject::
-GetClassType( ) const
-{
- return( "SinkObject" );
-}
-
// -------------------------------------------------------------------------
cpPlugins::Interface::SinkObject::
SinkObject( )
: Superclass( )
{
+ this->m_ClassName = "cpPlugins::Interface::SinkObject";
+ this->m_ClassCategory = "BasicObject";
this->SetNumberOfOutputs( 0 );
}
public:
itkTypeMacro( SinkObject, ProcessObject );
- public:
- virtual std::string GetClassName( ) const;
- virtual std::string GetClassType( ) const;
-
protected:
SinkObject( );
virtual ~SinkObject( );
#include <cpPlugins/Interface/SourceObject.h>
-// -------------------------------------------------------------------------
-std::string cpPlugins::Interface::SourceObject::
-GetClassName( ) const
-{
- return( "cpPlugins::Interface::SourceObject" );
-}
-
-// -------------------------------------------------------------------------
-std::string cpPlugins::Interface::SourceObject::
-GetClassType( ) const
-{
- return( "SourceObject" );
-}
-
// -------------------------------------------------------------------------
cpPlugins::Interface::SourceObject::
SourceObject( )
: Superclass( )
{
+ this->m_ClassName = "cpPlugins::Interface::SourceObject";
+ this->m_ClassCategory = "BasicObject";
this->SetNumberOfInputs( 0 );
}
public:
itkTypeMacro( SourceObject, ProcessObject );
- public:
- virtual std::string GetClassName( ) const;
- virtual std::string GetClassType( ) const;
-
protected:
SourceObject( );
virtual ~SourceObject( );
## = Source code =
## ===============
-FILE(GLOB LIB_HEADERS_H "*.h")
-FILE(GLOB LIB_HEADERS_HPP "*.hpp")
-FILE(GLOB LIB_HEADERS_HXX "*.hxx")
-FILE(GLOB LIB_SOURCES_C "*.c")
-FILE(GLOB LIB_SOURCES_CPP "*.cpp")
-FILE(GLOB LIB_SOURCES_CXX "*.cxx")
+
+#FILE(GLOB LIB_HEADERS_H "*.h")
+#FILE(GLOB LIB_HEADERS_HPP "*.hpp")
+#FILE(GLOB LIB_HEADERS_HXX "*.hxx")
+#FILE(GLOB LIB_SOURCES_C "*.c")
+#FILE(GLOB LIB_SOURCES_CPP "*.cpp")
+#FILE(GLOB LIB_SOURCES_CXX "*.cxx")
+
+SET(
+ LIB_HEADERS_H
+ ImageReader.h
+ ImageWriter.h
+ MeshReader.h
+ MeshWriter.h
+ MarchingCubes.h
+ )
+SET(
+ LIB_SOURCES_CXX
+ Host.cxx
+ ImageReader.cxx
+ ImageWriter.cxx
+ MeshReader.cxx
+ MeshWriter.cxx
+ MarchingCubes.cxx
+ )
## =====================
## = Compilation rules =
#include <Pluma/Connector.hpp>
#include <cpPlugins/Plugins/ImageReader.h>
-#include <cpPlugins/Plugins/ImageSeriesReader.h>
#include <cpPlugins/Plugins/ImageWriter.h>
-#include <cpPlugins/Plugins/MarchingCubes.h>
#include <cpPlugins/Plugins/MeshReader.h>
-#include <cpPlugins/Plugins/PolyDataReader.h>
-#include <cpPlugins/Plugins/RGBImageToHSVChannelsFilter.h>
-#include <cpPlugins/Plugins/RGBImageToYPbPrChannelsFilter.h>
+#include <cpPlugins/Plugins/MeshWriter.h>
+#include <cpPlugins/Plugins/MarchingCubes.h>
+/*
+ #include <cpPlugins/Plugins/ImageSeriesReader.h>
+ #include <cpPlugins/Plugins/MeshReader.h>
+ #include <cpPlugins/Plugins/PolyDataReader.h>
+ #include <cpPlugins/Plugins/RGBImageToHSVChannelsFilter.h>
+ #include <cpPlugins/Plugins/RGBImageToYPbPrChannelsFilter.h>
+*/
/// TODO: doc
+
PLUMA_CONNECTOR
bool connect( pluma::Host& host )
{
using namespace cpPlugins::Plugins;
host.add( new ImageReaderProvider( ) );
- host.add( new ImageSeriesReaderProvider( ) );
host.add( new ImageWriterProvider( ) );
+ host.add( new MeshReaderProvider( ) );
+ host.add( new MeshWriterProvider( ) );
host.add( new MarchingCubesProvider( ) );
+/*
+ host.add( new ImageSeriesReaderProvider( ) );
host.add( new MeshReaderProvider( ) );
host.add( new PolyDataReaderProvider( ) );
host.add( new RGBImageToHSVChannelsFilterProvider( ) );
host.add( new RGBImageToYPbPrChannelsFilterProvider( ) );
+*/
return( true );
}
#include <cpPlugins/Plugins/ImageReader.h>
#include <cpPlugins/Interface/Image.h>
-#include <itkImageFileReader.h>
-#include <itkImageSeriesReader.h>
+#include <set>
-#define ITK_MANUAL_INSTANTIATION
+#undef ITK_MANUAL_INSTANTIATION
#include <itkImage.h>
#include <itkRGBPixel.h>
-
-// -------------------------------------------------------------------------
-std::string cpPlugins::Plugins::ImageReader::
-GetClassName( ) const
-{
- return( "cpPlugins::Plugins::ImageReader" );
-}
+#include <itkImageFileReader.h>
+#include <itkImageSeriesReader.h>
// -------------------------------------------------------------------------
cpPlugins::Plugins::ImageReader::
ImageReader( )
: Superclass( )
{
+ this->m_ClassName = "cpPlugins::ImageReader";
+ this->m_ClassCategory = "ImageReader";
+
this->SetNumberOfOutputs( 1 );
this->_MakeOutput< cpPlugins::Interface::Image >( 0 );
using namespace cpPlugins::Interface;
this->m_DefaultParameters.Configure( Parameters::StringList, "FileNames" );
- this->m_DefaultParameters.Configure( Parameters::String, "PixelType" );
- this->m_DefaultParameters.Configure( Parameters::Uint, "Dimension" );
- this->m_DefaultParameters.Configure( Parameters::Uint, "IsColorImage" );
- this->m_DefaultParameters.SetValueAsString( "PixelType", "uchar" );
- this->m_DefaultParameters.SetValueAsUint( "Dimension", 3 );
- this->m_DefaultParameters.SetValueAsUint( "IsColorImage", 0 );
this->m_Parameters = this->m_DefaultParameters;
}
std::string cpPlugins::Plugins::ImageReader::
_GenerateData( )
{
- using namespace cpPlugins::Interface;
- Parameters::TUint dim = this->m_Parameters.GetValueAsUint( "Dimension" );
- std::string r = "cpPlugins::Plugins::ImageReader: itk::Image dimension not supported.";
- if ( dim == 1 ) r = this->_GD0< 1 >( );
- else if( dim == 2 ) r = this->_GD0< 2 >( );
- else if( dim == 3 ) r = this->_GD0< 3 >( );
- else if( dim == 4 ) r = this->_GD0< 4 >( );
+ // Get filenames
+ TStringList names;
+ this->m_Parameters.GetValueAsStringList( names, "FileNames" );
+ std::string r = "";
+ if( names.size( ) >= 1 )
+ {
+ // Guess image properties
+ itk::ImageIOBase::Pointer io =
+ itk::ImageIOFactory::CreateImageIO(
+ names[ 0 ].c_str( ),
+ itk::ImageIOFactory::ReadMode
+ );
+ if( io.IsNotNull( ) )
+ {
+ io->SetFileName( names[ 0 ] );
+ io->ReadImageInformation( );
+ if( names.size( ) == 1 )
+ {
+ switch( io->GetNumberOfDimensions( ) )
+ {
+ case 1: r = this->_GD0< 1 >( io, names ); break;
+ case 2: r = this->_GD0< 2 >( io, names ); break;
+ case 3: r = this->_GD0< 3 >( io, names ); break;
+ default:
+ r = "ImageReader: Image dimension not supported.";
+ break;
+ } // hctiws
+ }
+ else if( names.size( ) > 1 )
+ {
+ switch( io->GetNumberOfDimensions( ) )
+ {
+ case 1: r = this->_GD0< 2 >( io, names ); break;
+ case 2: r = this->_GD0< 3 >( io, names ); break;
+ default:
+ r = "ImageReader: Image dimension not supported.";
+ break;
+ } // hctiws
+
+ } // fi
+ }
+ else
+ r = "ImageReader: Could not CreateImageIO for \"" + names[ 0 ] + "\"";
+ }
+ else
+ r = "No image files given";
return( r );
}
// -------------------------------------------------------------------------
template< unsigned int D >
std::string cpPlugins::Plugins::ImageReader::
-_GD0( )
+_GD0( itk::ImageIOBase* io, const TStringList& names )
{
- using namespace cpPlugins::Interface;
- Parameters::TString pt = this->m_Parameters.GetValueAsString( "PixelType" );
- Parameters::TUint ci = this->m_Parameters.GetValueAsUint( "IsColorImage" );
-
- std::string r = "cpPlugins::Plugins::ImageReader: itk::Image pixel type not supported";
- if( ci == 0 )
- {
- if( pt == "char" )
- r = this->_GD1< char, D >( );
- else if( pt == "short" )
- r = this->_GD1< short, D >( );
- else if( pt == "int" )
- r = this->_GD1< int, D >( );
- else if( pt == "long" )
- r = this->_GD1< long, D >( );
- else if( pt == "uchar" )
- r = this->_GD1< unsigned char, D >( );
- else if( pt == "ushort" )
- r = this->_GD1< unsigned short, D >( );
- else if( pt == "uint" )
- r = this->_GD1< unsigned int, D >( );
- else if( pt == "ulong" )
- r = this->_GD1< unsigned long, D >( );
- else if( pt == "float" )
- r = this->_GD1< float, D >( );
- else if( pt == "double" )
- r = this->_GD1< double, D >( );
- }
- else
+ std::string r = "";
+ switch( io->GetComponentType( ) )
{
- if( pt == "char" )
- r = this->_GD1< itk::RGBPixel< char >, D >( );
- else if( pt == "short" )
- r = this->_GD1< itk::RGBPixel< short >, D >( );
- else if( pt == "int" )
- r = this->_GD1< itk::RGBPixel< int >, D >( );
- else if( pt == "long" )
- r = this->_GD1< itk::RGBPixel< long >, D >( );
- else if( pt == "uchar" )
- r = this->_GD1< itk::RGBPixel< unsigned char >, D >( );
- else if( pt == "ushort" )
- r = this->_GD1< itk::RGBPixel< unsigned short >, D >( );
- else if( pt == "uint" )
- r = this->_GD1< itk::RGBPixel< unsigned int >, D >( );
- else if( pt == "ulong" )
- r = this->_GD1< itk::RGBPixel< unsigned long >, D >( );
- else if( pt == "float" )
- r = this->_GD1< itk::RGBPixel< float >, D >( );
- else if( pt == "double" )
- r = this->_GD1< itk::RGBPixel< double >, D >( );
- } // fi
+ case itk::ImageIOBase::UCHAR:
+ r = this->_GD1< unsigned char, D >( io, names );
+ break;
+ case itk::ImageIOBase::CHAR:
+ r = this->_GD1< char, D >( io, names );
+ break;
+ case itk::ImageIOBase::USHORT:
+ r = this->_GD1< unsigned short, D >( io, names );
+ break;
+ case itk::ImageIOBase::SHORT:
+ r = this->_GD1< short, D >( io, names );
+ break;
+ case itk::ImageIOBase::UINT:
+ r = this->_GD1< unsigned int, D >( io, names );
+ break;
+ case itk::ImageIOBase::INT:
+ r = this->_GD1< int, D >( io, names );
+ break;
+ case itk::ImageIOBase::ULONG:
+ r = this->_GD1< unsigned long, D >( io, names );
+ break;
+ case itk::ImageIOBase::LONG:
+ r = this->_GD1< long, D >( io, names );
+ break;
+ case itk::ImageIOBase::FLOAT:
+ r = this->_GD1< float, D >( io, names );
+ break;
+ case itk::ImageIOBase::DOUBLE:
+ r = this->_GD1< double, D >( io, names );
+ break;
+ default:
+ r = "ImageReader: Atomic pixel type not supported.";
+ break;
+ } // hctiws
return( r );
}
// -------------------------------------------------------------------------
template< class P, unsigned int D >
std::string cpPlugins::Plugins::ImageReader::
-_GD1( )
+_GD1( itk::ImageIOBase* io, const TStringList& names )
{
- typedef itk::Image< P, D > _TImage;
+ std::string r = "";
+ switch( io->GetPixelType( ) )
+ {
+ case itk::ImageIOBase::SCALAR:
+ r = this->_GD2< P, D >( names );
+ break;
+ case itk::ImageIOBase::RGB:
+ r = this->_GD2< itk::RGBPixel< P >, D >( names );
+ break;
+ case itk::ImageIOBase::RGBA:
+ r = this->_GD2< itk::RGBAPixel< P >, D >( names );
+ break;
+ /* TODO
+ case itk::ImageIOBase::OFFSET:
+ r = this->_GD2< itk::Offset< P >, D >( names );
+ break;
+ case itk::ImageIOBase::VECTOR:
+ r = this->_GD2< P, D >( names );
+ break;
+ case itk::ImageIOBase::POINT:
+ r = this->_GD2< P, D >( names );
+ break;
+ case itk::ImageIOBase::COVARIANTVECTOR:
+ r = this->_GD2< P, D >( names );
+ break;
+ case itk::ImageIOBase::SYMMETRICSECONDRANKTENSOR:
+ r = this->_GD2< P, D >( names );
+ break;
+ case itk::ImageIOBase::DIFFUSIONTENSOR3D:
+ r = this->_GD2< P, D >( names );
+ break;
+ */
+ /* TODO
+ case itk::ImageIOBase::COMPLEX:
+ r = this->_GD2< std::complex< P >, D >( names );
+ break;
+ case itk::ImageIOBase::FIXEDARRAY:
+ r = this->_GD2< P, D >( names );
+ break;
+ case itk::ImageIOBase::MATRIX:
+ r = this->_GD2< P, D >( names );
+ break;
+ */
+ default:
+ r = "ImageReader: Pixel type not supported.";
+ break;
+ } // hctiws
+ return( r );
+}
- // Get filenames
- using namespace cpPlugins::Interface;
- std::vector< Parameters::TString > unordered_names;
- this->m_Parameters.GetValueAsStringList( unordered_names, "FileNames" );
+// -------------------------------------------------------------------------
+template< class P, unsigned int D >
+std::string cpPlugins::Plugins::ImageReader::
+_GD2( const TStringList& names )
+{
+ typedef itk::Image< P, D > _I;
- if( unordered_names.size( ) == 1 )
+ std::string r = "";
+ if( names.size( ) == 1 )
{
// Read single image
- typedef itk::ImageFileReader< _TImage > _TSingleReader;
-
- _TSingleReader* singleReader =
- dynamic_cast< _TSingleReader* >(
- this->m_RealProcessObject.GetPointer( )
- );
- if( singleReader == NULL )
+ typedef itk::ImageFileReader< _I > _SR;
+ _SR* reader =
+ dynamic_cast< _SR* >( this->m_RealProcessObject.GetPointer( ) );
+ if( reader == NULL )
{
- this->m_RealProcessObject = _TSingleReader::New( );
- singleReader =
- dynamic_cast< _TSingleReader* >(
- this->m_RealProcessObject.GetPointer( )
- );
+ this->m_RealProcessObject = _SR::New( );
+ reader =
+ dynamic_cast< _SR* >( this->m_RealProcessObject.GetPointer( ) );
} // fi
- singleReader->SetFileName( unordered_names.front( ) );
+ reader->SetFileName( names[ 0 ] );
try
{
- singleReader->Update( );
+ reader->Update( );
+ this->m_Outputs[ 0 ]->SetITKDataObject( reader->GetOutput( ) );
}
catch( itk::ExceptionObject& err )
{
- return( err.GetDescription( ) );
+ r = "ImageReader: " + std::string( err.GetDescription( ) );
+ this->m_Outputs[ 0 ]->SetITKDataObject( NULL );
} // yrt
- this->_SetOutput( 0, singleReader->GetOutput( ) );
- return( "" );
}
- else if( unordered_names.size( ) > 1 )
+ else if( names.size( ) > 1 )
{
// Read image series
std::set< std::string > ordered_names;
- for( unsigned int i = 0; i < unordered_names.size( ); ++i )
- ordered_names.insert( unordered_names[ i ] );
+ for( unsigned int i = 0; i < names.size( ); ++i )
+ ordered_names.insert( names[ i ] );
- typedef itk::ImageSeriesReader< _TImage > _TMultiReader;
- _TMultiReader* multiReader =
- dynamic_cast< _TMultiReader* >(
- this->m_RealProcessObject.GetPointer( )
- );
- if( multiReader == NULL )
+ typedef itk::ImageSeriesReader< _I > _MR;
+ _MR* reader =
+ dynamic_cast< _MR* >( this->m_RealProcessObject.GetPointer( ) );
+ if( reader == NULL )
{
- this->m_RealProcessObject = _TMultiReader::New( );
- multiReader =
- dynamic_cast< _TMultiReader* >(
- this->m_RealProcessObject.GetPointer( )
- );
+ this->m_RealProcessObject = _MR::New( );
+ reader =
+ dynamic_cast< _MR* >( this->m_RealProcessObject.GetPointer( ) );
} // fi
std::set< std::string >::const_iterator fnIt = ordered_names.begin( );
for( ; fnIt != ordered_names.end( ); ++fnIt )
- multiReader->AddFileName( *fnIt );
+ reader->AddFileName( *fnIt );
try
{
- multiReader->Update( );
+ reader->Update( );
+ this->m_Outputs[ 0 ]->SetITKDataObject( reader->GetOutput( ) );
}
catch( itk::ExceptionObject& err )
{
- return( err.GetDescription( ) );
+ r = "ImageReader: " + std::string( err.GetDescription( ) );
+ this->m_Outputs[ 0 ]->SetITKDataObject( NULL );
} // yrt
- this->_SetOutput( 0, multiReader->GetOutput( ) );
- return( "" );
}
else
- return( "No image filename(s) given." );
+ r = "ImageReader: No image files given";
+ return( r );
}
// eof - $RCSfile$
#ifndef __CPPLUGINS__PLUGINS__IMAGEREADER__H__
#define __CPPLUGINS__PLUGINS__IMAGEREADER__H__
+#include <vector>
+
#include <cpPlugins/Plugins/cpPlugins_Export.h>
#include <cpPlugins/Interface/ImageSource.h>
-#include <itkProcessObject.h>
+
+#define ITK_MANUAL_INSTANTIATION
+#include <itkImageIOBase.h>
namespace cpPlugins
{
typedef itk::SmartPointer< Self > Pointer;
typedef itk::SmartPointer< const Self > ConstPointer;
+ typedef
+ std::vector< cpPlugins::Interface::Parameters::TString >
+ TStringList;
+
public:
itkNewMacro( Self );
itkTypeMacro( ImageReader, cpPluginsInterfaceImageSource );
- public:
- virtual std::string GetClassName( ) const;
-
protected:
ImageReader( );
virtual ~ImageReader( );
virtual std::string _GenerateData( );
template< unsigned int D >
- std::string _GD0( );
+ std::string _GD0( itk::ImageIOBase* io, const TStringList& names );
+
+ template< class P, unsigned int D >
+ std::string _GD1( itk::ImageIOBase* io, const TStringList& names );
template< class P, unsigned int D >
- std::string _GD1( );
+ std::string _GD2( const TStringList& names );
private:
// Purposely not implemented
+++ /dev/null
-#include <cpPlugins/Plugins/ImageSeriesReader.h>
-#include <cpPlugins/Interface/Image.h>
-
-#include <set>
-#include <sstream>
-
-#include <itkImageSeriesReader.h>
-
-#define ITK_MANUAL_INSTANTIATION
-#include <itkImage.h>
-#include <itkRGBPixel.h>
-
-// -------------------------------------------------------------------------
-std::string cpPlugins::Plugins::ImageSeriesReader::
-GetClassName( ) const
-{
- return( "cpPlugins::Plugins::ImageSeriesReader" );
-}
-
-// -------------------------------------------------------------------------
-cpPlugins::Plugins::ImageSeriesReader::
-ImageSeriesReader( )
- : Superclass( )
-{
- this->SetNumberOfOutputs( 1 );
- this->_MakeOutput< cpPlugins::Interface::Image >( 0 );
-
- using namespace cpPlugins::Interface;
- this->m_DefaultParameters.Configure( Parameters::StringList, "FileNames" );
- this->m_DefaultParameters.Configure( Parameters::String, "PixelType" );
- this->m_DefaultParameters.Configure( Parameters::Uint, "Dimension" );
- this->m_DefaultParameters.Configure( Parameters::Uint, "IsColorImage" );
- this->m_DefaultParameters.SetValueAsString( "PixelType", "uchar" );
- this->m_DefaultParameters.SetValueAsUint( "Dimension", 3 );
- this->m_DefaultParameters.SetValueAsUint( "IsColorImage", 0 );
- this->m_Parameters = this->m_DefaultParameters;
-}
-
-// -------------------------------------------------------------------------
-cpPlugins::Plugins::ImageSeriesReader::
-~ImageSeriesReader( )
-{
-}
-
-// -------------------------------------------------------------------------
-std::string cpPlugins::Plugins::ImageSeriesReader::
-_GenerateData( )
-{
- using namespace cpPlugins::Interface;
- Parameters::TUint dim = this->m_Parameters.GetValueAsUint( "Dimension" );
-
- std::string r = "cpPlugins::Plugins::ImageSeriesReader: itk::Image dimension not supported.";
- if ( dim == 2 ) r = this->_GD0< 2 >( );
- else if( dim == 3 ) r = this->_GD0< 3 >( );
- else if( dim == 4 ) r = this->_GD0< 4 >( );
-
- return( r );
-}
-
-// -------------------------------------------------------------------------
-template< unsigned int D >
-std::string cpPlugins::Plugins::ImageSeriesReader::
-_GD0( )
-{
- using namespace cpPlugins::Interface;
- Parameters::TString pt = this->m_Parameters.GetValueAsString( "PixelType" );
- Parameters::TUint ci = this->m_Parameters.GetValueAsUint( "IsColorImage" );
-
- std::string r = "cpPlugins::Plugins::ImageSeriesReader: itk::Image pixel type not supported";
- if( ci == 0 )
- {
- if( pt == "char" )
- r = this->_GD1< char, D >( );
- else if( pt == "short" )
- r = this->_GD1< short, D >( );
- else if( pt == "int" )
- r = this->_GD1< int, D >( );
- else if( pt == "long" )
- r = this->_GD1< long, D >( );
- else if( pt == "uchar" )
- r = this->_GD1< unsigned char, D >( );
- else if( pt == "ushort" )
- r = this->_GD1< unsigned short, D >( );
- else if( pt == "uint" )
- r = this->_GD1< unsigned int, D >( );
- else if( pt == "ulong" )
- r = this->_GD1< unsigned long, D >( );
- else if( pt == "float" )
- r = this->_GD1< float, D >( );
- else if( pt == "double" )
- r = this->_GD1< double, D >( );
- }
- else if( ci == 1 )
- {
- if( pt == "char" )
- r = this->_GD1< itk::RGBPixel< char >, D >( );
- else if( pt == "short" )
- r = this->_GD1< itk::RGBPixel< short >, D >( );
- else if( pt == "int" )
- r = this->_GD1< itk::RGBPixel< int >, D >( );
- else if( pt == "long" )
- r = this->_GD1< itk::RGBPixel< long >, D >( );
- else if( pt == "uchar" )
- r = this->_GD1< itk::RGBPixel< unsigned char >, D >( );
- else if( pt == "ushort" )
- r = this->_GD1< itk::RGBPixel< unsigned short >, D >( );
- else if( pt == "uint" )
- r = this->_GD1< itk::RGBPixel< unsigned int >, D >( );
- else if( pt == "ulong" )
- r = this->_GD1< itk::RGBPixel< unsigned long >, D >( );
- else if( pt == "float" )
- r = this->_GD1< itk::RGBPixel< float >, D >( );
- else if( pt == "double" )
- r = this->_GD1< itk::RGBPixel< double >, D >( );
- } // fi
- return( r );
-}
-
-// -------------------------------------------------------------------------
-template< class P, unsigned int D >
-std::string cpPlugins::Plugins::ImageSeriesReader::
-_GD1( )
-{
- using namespace cpPlugins::Interface;
- std::vector< Parameters::TString > unordered_names;
- this->m_Parameters.GetValueAsStringList( unordered_names, "FileNames" );
- std::set< std::string > ordered_names;
- for( unsigned int i = 0; i < unordered_names.size( ); ++i )
- ordered_names.insert( unordered_names[ i ] );
-
- // Reader
- typedef itk::Image< P, D > _TImage;
- typedef itk::ImageSeriesReader< _TImage > _TReader;
-
- _TReader* reader =
- dynamic_cast< _TReader* >( this->m_RealProcessObject.GetPointer( ) );
- if( reader == NULL )
- {
- this->m_RealProcessObject = _TReader::New( );
- reader =
- dynamic_cast< _TReader* >( this->m_RealProcessObject.GetPointer( ) );
-
- } // fi
- std::set< std::string >::const_iterator fnIt = ordered_names.begin( );
- for( ; fnIt != ordered_names.end( ); ++fnIt )
- reader->AddFileName( *fnIt );
- try
- {
- reader->Update( );
- }
- catch( itk::ExceptionObject& err )
- {
- return( err.GetDescription( ) );
-
- } // yrt
- this->_SetOutput( 0, reader->GetOutput( ) );
- return( "" );
-}
-
-// eof - $RCSfile$
+++ /dev/null
-#ifndef __CPPLUGINS__PLUGINS__IMAGESERIESREADER__H__
-#define __CPPLUGINS__PLUGINS__IMAGESERIESREADER__H__
-
-#include <cpPlugins/Plugins/cpPlugins_Export.h>
-#include <cpPlugins/Interface/ImageSource.h>
-#include <itkProcessObject.h>
-
-namespace cpPlugins
-{
- namespace Plugins
- {
- /**
- */
- class cpPlugins_EXPORT ImageSeriesReader
- : public cpPlugins::Interface::ImageSource
- {
- public:
- typedef ImageSeriesReader Self;
- typedef cpPlugins::Interface::ImageSource Superclass;
- typedef itk::SmartPointer< Self > Pointer;
- typedef itk::SmartPointer< const Self > ConstPointer;
-
- public:
- itkNewMacro( Self );
- itkTypeMacro( ImageSeriesReader, cpPluginsInterfaceImageSource );
-
- public:
- virtual std::string GetClassName( ) const;
-
- protected:
- ImageSeriesReader( );
- virtual ~ImageSeriesReader( );
-
- virtual std::string _GenerateData( );
-
- template< unsigned int D >
- std::string _GD0( );
-
- template< class P, unsigned int D >
- std::string _GD1( );
-
- private:
- // Purposely not implemented
- ImageSeriesReader( const Self& );
- Self& operator=( const Self& );
- };
-
- // ---------------------------------------------------------------------
- CPPLUGINS_INHERIT_PROVIDER( ImageSeriesReader );
-
- } // ecapseman
-
-} // ecapseman
-
-#endif // __CPPLUGINS__PLUGINS__IMAGESERIESREADER__H__
-
-// eof - $RCSfile$
#include <cpPlugins/Plugins/ImageWriter.h>
-#include <itkImageFileWriter.h>
-
-#define ITK_MANUAL_INSTANTIATION
+#undef ITK_MANUAL_INSTANTIATION
#include <itkImage.h>
#include <itkRGBPixel.h>
+#include <itkImageFileWriter.h>
// -------------------------------------------------------------------------
-#define cpPlugins_ImageWriter_Dimension( r, d, o, f ) \
- if( dynamic_cast< itk::ImageBase< d >* >( o ) != NULL ) \
- r = this->f< d >( )
+#define cpPlugins_ImageWriter_Dimension( r, d, i, f ) \
+ if( dynamic_cast< itk::ImageBase< d >* >( i ) != NULL ) \
+ r = this->f< d >( i )
// -------------------------------------------------------------------------
-#define cpPlugins_ImageWriter_Pixel( r, p, d, o, f ) \
- if( dynamic_cast< itk::Image< p, d >* >( o ) != NULL ) \
- r = this->f< p, d >( )
+#define cpPlugins_ImageWriter_Pixel( r, p, d, i, f ) \
+ if( dynamic_cast< itk::Image< p, d >* >( i ) != NULL ) \
+ r = this->f< p, d >( i )
// -------------------------------------------------------------------------
-#define cpPlugins_ImageWriter_RGB( r, p, d, o, f ) \
+#define cpPlugins_ImageWriter_RGB( r, p, d, i, f ) \
if( \
- dynamic_cast< itk::Image< itk::RGBPixel< p >, d >* >( o ) != NULL \
+ dynamic_cast< itk::Image< itk::RGBPixel< p >, d >* >( i ) != NULL \
) \
- r = this->f< itk::RGBPixel< p >, d >( )
-
-// -------------------------------------------------------------------------
-std::string cpPlugins::Plugins::ImageWriter::
-GetClassName( ) const
-{
- return( "cpPlugins::Plugins::ImageWriter" );
-}
+ r = this->f< itk::RGBPixel< p >, d >( i )
// -------------------------------------------------------------------------
cpPlugins::Plugins::ImageWriter::
ImageWriter( )
: Superclass( )
{
+ this->m_ClassName = "cpPlugins::ImageWriter";
+ this->m_ClassCategory = "ImageWriter";
this->SetNumberOfInputs( 1 );
using namespace cpPlugins::Interface;
std::string cpPlugins::Plugins::ImageWriter::
_GenerateData( )
{
- itk::DataObject* o = this->_GetInput( 0 );
+ itk::DataObject* i = this->m_Inputs[ 0 ]->GetITKDataObject( );
- std::string r = "cpPlugins::Plugins::ImageWriter: itk::Image dimension not supported.";
- cpPlugins_ImageWriter_Dimension( r, 1, o, _GD0 );
- else cpPlugins_ImageWriter_Dimension( r, 2, o, _GD0 );
- else cpPlugins_ImageWriter_Dimension( r, 3, o, _GD0 );
- else cpPlugins_ImageWriter_Dimension( r, 4, o, _GD0 );
+ std::string r = "ImageWriter: Image dimension not supported.";
+ cpPlugins_ImageWriter_Dimension ( r, 1, i, _GD0 );
+ else cpPlugins_ImageWriter_Dimension( r, 2, i, _GD0 );
+ else cpPlugins_ImageWriter_Dimension( r, 3, i, _GD0 );
return( r );
}
// -------------------------------------------------------------------------
template< unsigned int D >
std::string cpPlugins::Plugins::ImageWriter::
-_GD0( )
+_GD0( itk::DataObject* i )
{
- itk::ImageBase< D >* i =
- dynamic_cast< itk::ImageBase< D >* >( this->_GetInput( 0 ) );
-
- std::string r = "cpPlugins::Plugins::ImageWriter: itk::Image pixel type not supported";
- cpPlugins_ImageWriter_Pixel( r, char, D, i, _GD1 );
- else cpPlugins_ImageWriter_Pixel( r, short, D, i, _GD1 );
- else cpPlugins_ImageWriter_Pixel( r, int, D, i, _GD1 );
- else cpPlugins_ImageWriter_Pixel( r, long, D, i, _GD1 );
- else cpPlugins_ImageWriter_Pixel( r, unsigned char, D, i, _GD1 );
+ std::string r = "ImageWriter: Image pixel type not supported";
+ cpPlugins_ImageWriter_Pixel ( r, char , D, i, _GD1 );
+ else cpPlugins_ImageWriter_Pixel( r, short , D, i, _GD1 );
+ else cpPlugins_ImageWriter_Pixel( r, int , D, i, _GD1 );
+ else cpPlugins_ImageWriter_Pixel( r, long , D, i, _GD1 );
+ else cpPlugins_ImageWriter_Pixel( r, unsigned char , D, i, _GD1 );
else cpPlugins_ImageWriter_Pixel( r, unsigned short, D, i, _GD1 );
- else cpPlugins_ImageWriter_Pixel( r, unsigned int, D, i, _GD1 );
- else cpPlugins_ImageWriter_Pixel( r, unsigned long, D, i, _GD1 );
- else cpPlugins_ImageWriter_Pixel( r, float, D, i, _GD1 );
- else cpPlugins_ImageWriter_Pixel( r, double, D, i, _GD1 );
- else cpPlugins_ImageWriter_RGB( r, char, D, i, _GD1 );
- else cpPlugins_ImageWriter_RGB( r, short, D, i, _GD1 );
- else cpPlugins_ImageWriter_RGB( r, int, D, i, _GD1 );
- else cpPlugins_ImageWriter_RGB( r, long, D, i, _GD1 );
- else cpPlugins_ImageWriter_RGB( r, unsigned char, D, i, _GD1 );
- else cpPlugins_ImageWriter_RGB( r, unsigned short, D, i, _GD1 );
- else cpPlugins_ImageWriter_RGB( r, unsigned int, D, i, _GD1 );
- else cpPlugins_ImageWriter_RGB( r, unsigned long, D, i, _GD1 );
- else cpPlugins_ImageWriter_RGB( r, float, D, i, _GD1 );
- else cpPlugins_ImageWriter_RGB( r, double, D, i, _GD1 );
+ else cpPlugins_ImageWriter_Pixel( r, unsigned int , D, i, _GD1 );
+ else cpPlugins_ImageWriter_Pixel( r, unsigned long , D, i, _GD1 );
+ else cpPlugins_ImageWriter_Pixel( r, float , D, i, _GD1 );
+ else cpPlugins_ImageWriter_Pixel( r, double , D, i, _GD1 );
+ else cpPlugins_ImageWriter_RGB ( r, char , D, i, _GD1 );
+ else cpPlugins_ImageWriter_RGB ( r, short , D, i, _GD1 );
+ else cpPlugins_ImageWriter_RGB ( r, int , D, i, _GD1 );
+ else cpPlugins_ImageWriter_RGB ( r, long , D, i, _GD1 );
+ else cpPlugins_ImageWriter_RGB ( r, unsigned char , D, i, _GD1 );
+ else cpPlugins_ImageWriter_RGB ( r, unsigned short, D, i, _GD1 );
+ else cpPlugins_ImageWriter_RGB ( r, unsigned int , D, i, _GD1 );
+ else cpPlugins_ImageWriter_RGB ( r, unsigned long , D, i, _GD1 );
+ else cpPlugins_ImageWriter_RGB ( r, float , D, i, _GD1 );
+ else cpPlugins_ImageWriter_RGB ( r, double , D, i, _GD1 );
return( r );
}
// -------------------------------------------------------------------------
template< class P, unsigned int D >
std::string cpPlugins::Plugins::ImageWriter::
-_GD1( )
+_GD1( itk::DataObject* i )
{
- typedef itk::Image< P, D > _TImage;
- typedef itk::ImageFileWriter< _TImage > _TWriter;
+ typedef itk::Image< P, D > _I;
+ typedef itk::ImageFileWriter< _I > _W;
// Get filename
using namespace cpPlugins::Interface;
Parameters::TString fname =
this->m_Parameters.GetValueAsString( "FileName" );
- _TWriter* writer =
- dynamic_cast< _TWriter* >( this->m_RealProcessObject.GetPointer( ) );
+ _W* writer = dynamic_cast< _W* >( this->m_RealProcessObject.GetPointer( ) );
if( writer == NULL )
{
- this->m_RealProcessObject = _TWriter::New( );
- writer =
- dynamic_cast< _TWriter* >( this->m_RealProcessObject.GetPointer( ) );
+ this->m_RealProcessObject = _W::New( );
+ writer = dynamic_cast< _W* >( this->m_RealProcessObject.GetPointer( ) );
} // fi
writer->SetFileName( fname );
- writer->SetInput( dynamic_cast< _TImage* >( this->_GetInput( 0 ) ) );
+ writer->SetInput( dynamic_cast< _I* >( i ) );
try
{
writer->Update( );
}
catch( itk::ExceptionObject& err )
{
- return( err.GetDescription( ) );
+ return( "ImageWriter: " + std::string( err.GetDescription( ) ) );
} // yrt
return( "" );
#include <cpPlugins/Plugins/cpPlugins_Export.h>
#include <cpPlugins/Interface/ImageSink.h>
-#include <itkProcessObject.h>
namespace cpPlugins
{
itkNewMacro( Self );
itkTypeMacro( ImageWriter, cpPluginsInterfaceImageSink );
- public:
- virtual std::string GetClassName( ) const;
-
protected:
ImageWriter( );
virtual ~ImageWriter( );
virtual std::string _GenerateData( );
template< unsigned int D >
- std::string _GD0( );
+ std::string _GD0( itk::DataObject* i );
template< class P, unsigned int D >
- std::string _GD1( );
+ std::string _GD1( itk::DataObject* i );
private:
// Purposely not implemented
#include <cpPlugins/Interface/Image.h>
#include <cpPlugins/Interface/Mesh.h>
-#include <itkImageFileReader.h>
-
-#define ITK_MANUAL_INSTANTIATION
-#include <itkImage.h>
-#include <itkRGBPixel.h>
-
-// -------------------------------------------------------------------------
-std::string cpPlugins::Plugins::MarchingCubes::
-GetClassName( ) const
-{
- return( "cpPlugins::Plugins::MarchingCubes" );
-}
+#include <vtkImageData.h>
+#include <vtkMarchingCubes.h>
+#include <vtkMarchingSquares.h>
// -------------------------------------------------------------------------
cpPlugins::Plugins::MarchingCubes::
MarchingCubes( )
- : Superclass( )
+ : Superclass( ),
+ m_Algorithm( NULL )
{
+ this->m_ClassName = "cpPlugins::MarchingCubes";
+
this->SetNumberOfInputs( 1 );
this->SetNumberOfOutputs( 1 );
this->_MakeOutput< cpPlugins::Interface::Mesh >( 0 );
- /* TODO
- this->m_DefaultParameters[ "FileName" ] =
- TParameter( "string", "no_file_name" );
- this->m_DefaultParameters[ "PixelType" ] = TParameter( "type", "uchar" );
- this->m_DefaultParameters[ "ImageDimension" ] = TParameter( "int", "2" );
- this->m_DefaultParameters[ "IsColorImage" ] = TParameter( "bool", "0" );
- */
+ using namespace cpPlugins::Interface;
+ this->m_DefaultParameters.Configure( Parameters::RealList, "Thresholds" );
+ this->m_Parameters = this->m_DefaultParameters;
}
// -------------------------------------------------------------------------
cpPlugins::Plugins::MarchingCubes::
~MarchingCubes( )
{
+ if( this->m_Algorithm != NULL )
+ this->m_Algorithm->Delete( );
}
// -------------------------------------------------------------------------
std::string cpPlugins::Plugins::MarchingCubes::
_GenerateData( )
{
- return( "" );
- /* TODO
- TParameters::const_iterator dIt;
-
- // Get image dimension
- dIt = this->m_Parameters.find( "ImageDimension" );
- if( dIt == this->m_Parameters.end( ) )
- dIt = this->m_DefaultParameters.find( "ImageDimension" );
-
- std::string r = "cpPlugins::Plugins::MarchingCubes: itk::Image dimension not supported.";
- if ( dIt->second.second == "1" ) r = this->_GD0< 1 >( );
- else if( dIt->second.second == "2" ) r = this->_GD0< 2 >( );
- else if( dIt->second.second == "3" ) r = this->_GD0< 3 >( );
- else if( dIt->second.second == "4" ) r = this->_GD0< 4 >( );
-
- return( r );
- */
-}
-
-// -------------------------------------------------------------------------
-template< unsigned int D >
-std::string cpPlugins::Plugins::MarchingCubes::
-_GD0( )
-{
- return( "" );
- /* TODO
- TParameters::const_iterator tIt, cIt;
-
- // Get image pixel type
- tIt = this->m_Parameters.find( "PixelType" );
- if( tIt == this->m_Parameters.end( ) )
- tIt = this->m_DefaultParameters.find( "PixelType" );
- cIt = this->m_Parameters.find( "IsColorImage" );
- if( cIt == this->m_Parameters.end( ) )
- cIt = this->m_DefaultParameters.find( "IsColorImage" );
-
- std::string r = "cpPlugins::Plugins::MarchingCubes: itk::Image pixel type not supported";
- if( cIt->second.second == "0" )
+ // Get input
+ cpPlugins::Interface::Image* input =
+ dynamic_cast< cpPlugins::Interface::Image* >(
+ this->m_Inputs[ 0 ].GetPointer( )
+ );
+ if( input == NULL )
+ return( "MarchingCubes: Input data is not a valid image." );
+ vtkImageData* vtk_input =
+ dynamic_cast< vtkImageData* >( input->GetVTKDataObject( ) );
+ if( vtk_input == NULL )
+ return( "MarchingCubes: Input does not have a valid conversion to VTK." );
+
+ if( this->m_Algorithm != NULL )
+ this->m_Algorithm->Delete( );
+
+ std::vector< double > values;
+ this->m_Parameters.GetValueAsRealList( values, "Thresholds" );
+ if( vtk_input->GetDataDimension( ) == 2 )
{
- if( tIt->second.second == "char" )
- r = this->_GD1< char, D >( );
- else if( tIt->second.second == "short" )
- r = this->_GD1< short, D >( );
- else if( tIt->second.second == "int" )
- r = this->_GD1< int, D >( );
- else if( tIt->second.second == "long" )
- r = this->_GD1< long, D >( );
- else if( tIt->second.second == "uchar" )
- r = this->_GD1< unsigned char, D >( );
- else if( tIt->second.second == "ushort" )
- r = this->_GD1< unsigned short, D >( );
- else if( tIt->second.second == "uint" )
- r = this->_GD1< unsigned int, D >( );
- else if( tIt->second.second == "ulong" )
- r = this->_GD1< unsigned long, D >( );
- else if( tIt->second.second == "float" )
- r = this->_GD1< float, D >( );
- else if( tIt->second.second == "double" )
- r = this->_GD1< double, D >( );
+ vtkMarchingSquares* ms = vtkMarchingSquares::New( );
+ ms->SetInputData( vtk_input );
+ for( unsigned int i = 0; i < values.size( ); ++i )
+ ms->SetValue( i, values[ i ] );
+ this->m_Algorithm = ms;
}
- else if( cIt->second.second == "1" )
- {
- if( tIt->second.second == "char" )
- r = this->_GD1< itk::RGBPixel< char >, D >( );
- else if( tIt->second.second == "short" )
- r = this->_GD1< itk::RGBPixel< short >, D >( );
- else if( tIt->second.second == "int" )
- r = this->_GD1< itk::RGBPixel< int >, D >( );
- else if( tIt->second.second == "long" )
- r = this->_GD1< itk::RGBPixel< long >, D >( );
- else if( tIt->second.second == "uchar" )
- r = this->_GD1< itk::RGBPixel< unsigned char >, D >( );
- else if( tIt->second.second == "ushort" )
- r = this->_GD1< itk::RGBPixel< unsigned short >, D >( );
- else if( tIt->second.second == "uint" )
- r = this->_GD1< itk::RGBPixel< unsigned int >, D >( );
- else if( tIt->second.second == "ulong" )
- r = this->_GD1< itk::RGBPixel< unsigned long >, D >( );
- else if( tIt->second.second == "float" )
- r = this->_GD1< itk::RGBPixel< float >, D >( );
- else if( tIt->second.second == "double" )
- r = this->_GD1< itk::RGBPixel< double >, D >( );
- } // fi
- return( r );
-*/
-}
-
-// -------------------------------------------------------------------------
-template< class P, unsigned int D >
-std::string cpPlugins::Plugins::MarchingCubes::
-_GD1( )
-{
- return( "" );
- /* TODO
- TParameters::const_iterator fIt;
-
- // Get filename
- fIt = this->m_Parameters.find( "FileName" );
- if( fIt == this->m_Parameters.end( ) )
- fIt = this->m_DefaultParameters.find( "FileName" );
-
- typedef itk::Image< P, D > _TImage;
- typedef itk::ImageFileReader< _TImage > _TReader;
-
- _TReader* reader =
- dynamic_cast< _TReader* >( this->m_Reader.GetPointer( ) );
- if( reader == NULL )
- {
- this->m_Reader = _TReader::New( );
- reader = dynamic_cast< _TReader* >( this->m_Reader.GetPointer( ) );
-
- } // fi
- reader->SetFileName( fIt->second.second );
- try
+ else if( vtk_input->GetDataDimension( ) == 3 )
{
- reader->Update( );
+ vtkMarchingCubes* mc = vtkMarchingCubes::New( );
+ mc->SetInputData( vtk_input );
+ for( unsigned int i = 0; i < values.size( ); ++i )
+ mc->SetValue( i, values[ i ] );
+ this->m_Algorithm = mc;
}
- catch( itk::ExceptionObject& err )
- {
- return( err.GetDescription( ) );
+ else
+ return( "MarchingCubes: Input data does not have a valid dimension." );
- } // yrt
- this->_SetOutput( 0, reader->GetOutput( ) );
+ // Execute filter
+ this->m_Algorithm->Update( );
+ this->m_Outputs[ 0 ]->SetVTKDataObject( this->m_Algorithm->GetOutput( ) );
return( "" );
-*/
}
// eof - $RCSfile$
#include <cpPlugins/Plugins/cpPlugins_Export.h>
#include <cpPlugins/Interface/ImageToMeshFilter.h>
-#include <itkProcessObject.h>
+
+class vtkPolyDataAlgorithm;
namespace cpPlugins
{
itkNewMacro( Self );
itkTypeMacro( MarchingCubes, cpPluginsInterfaceImageToMeshFilter );
- public:
- virtual std::string GetClassName( ) const;
-
protected:
MarchingCubes( );
virtual ~MarchingCubes( );
virtual std::string _GenerateData( );
- template< unsigned int D >
- std::string _GD0( );
-
- template< class P, unsigned int D >
- std::string _GD1( );
-
private:
// Purposely not implemented
MarchingCubes( const Self& );
Self& operator=( const Self& );
+
+ protected:
+ vtkPolyDataAlgorithm* m_Algorithm;
};
// ---------------------------------------------------------------------
#include <cpPlugins/Plugins/MeshReader.h>
#include <cpPlugins/Interface/Mesh.h>
-#include <cpPlugins/Extensions/DataStructures/QuadEdgeMesh.h>
-#include <cpPlugins/Extensions/IO/MeshReader.h>
-
-// -------------------------------------------------------------------------
-std::string cpPlugins::Plugins::MeshReader::
-GetClassName( ) const
-{
- return( "cpPlugins::Plugins::MeshReader" );
-}
+#include <vtkPolyData.h>
+#include <vtkPolyDataReader.h>
// -------------------------------------------------------------------------
cpPlugins::Plugins::MeshReader::
MeshReader( )
: Superclass( )
{
+ this->m_ClassName = "cpPlugins::MeshReader";
+ this->m_ClassCategory = "MeshReader";
+
this->SetNumberOfOutputs( 1 );
this->_MakeOutput< cpPlugins::Interface::Mesh >( 0 );
{
using namespace cpPlugins::Interface;
Parameters::TUint dim = this->m_Parameters.GetValueAsUint( "Dimension" );
- std::string r = "cpPlugins::Plugins::MeshReader: itk::Mesh dimension not supported.";
+ std::string r = "MeshReader: Mesh dimension not supported.";
if( dim == 3 )
r = this->_GD0< 3 >( );
return( r );
{
using namespace cpPlugins::Interface;
Parameters::TString pt = this->m_Parameters.GetValueAsString( "PixelType" );
- std::string r = "cpPlugins::Plugins::MeshReader: itk::Mesh pixel type not supported";
+ std::string r = "MeshReader: Mesh pixel type not supported";
if( pt == "float" ) r = this->_GD1< float, D >( );
else if( pt == "double" ) r = this->_GD1< double, D >( );
return( r );
Parameters::TString fname =
this->m_Parameters.GetValueAsString( "FileName" );
- using namespace cpPlugins::Extensions;
- typedef DataStructures::QuadEdgeMesh< P, D > _TMesh;
- typedef IO::MeshReader< _TMesh > _TReader;
-
- _TReader* reader =
- dynamic_cast< _TReader* >( this->m_RealProcessObject.GetPointer( ) );
- if( reader == NULL )
- {
- this->m_RealProcessObject = _TReader::New( );
- reader =
- dynamic_cast< _TReader* >( this->m_RealProcessObject.GetPointer( ) );
-
- } // fi
- reader->SetFileName( fname );
- try
- {
- reader->Update( );
- }
- catch( itk::ExceptionObject& err )
- {
- return( err.GetDescription( ) );
-
- } // yrt
- this->_SetOutput( 0, reader->GetOutput( ) );
+ if( this->m_Reader != NULL )
+ this->m_Reader->Delete( );
+ vtkPolyDataReader* pdr = vtkPolyDataReader::New( );
+ this->m_Reader = pdr;
+ pdr->SetFileName( fname.c_str( ) );
+ pdr->Update( );
+ this->m_Outputs[ 0 ]->SetVTKDataObject( pdr->GetOutput( ) );
return( "" );
}
#include <cpPlugins/Plugins/cpPlugins_Export.h>
#include <cpPlugins/Interface/MeshSource.h>
-#include <itkProcessObject.h>
+
+class vtkDataReader;
namespace cpPlugins
{
itkNewMacro( Self );
itkTypeMacro( MeshReader, cpPluginsInterfaceMeshSource );
- public:
- virtual std::string GetClassName( ) const;
-
protected:
MeshReader( );
virtual ~MeshReader( );
// Purposely not implemented
MeshReader( const Self& );
Self& operator=( const Self& );
+
+ protected:
+ vtkDataReader* m_Reader;
};
// ---------------------------------------------------------------------
--- /dev/null
+#include <cpPlugins/Plugins/MeshWriter.h>
+
+#include <vtkSmartPointer.h>
+#include <vtkPolyData.h>
+#include <vtkPolyDataWriter.h>
+
+// -------------------------------------------------------------------------
+cpPlugins::Plugins::MeshWriter::
+MeshWriter( )
+ : Superclass( ),
+ m_Writer( NULL )
+{
+ this->m_ClassName = "cpPlugins::MeshWriter";
+ this->m_ClassCategory = "MeshWriter";
+ this->SetNumberOfInputs( 1 );
+
+ using namespace cpPlugins::Interface;
+ this->m_DefaultParameters.Configure( Parameters::String, "FileName" );
+ this->m_Parameters = this->m_DefaultParameters;
+}
+
+// -------------------------------------------------------------------------
+cpPlugins::Plugins::MeshWriter::
+~MeshWriter( )
+{
+ if( this->m_Writer != NULL )
+ this->m_Writer->Delete( );
+}
+
+// -------------------------------------------------------------------------
+std::string cpPlugins::Plugins::MeshWriter::
+_GenerateData( )
+{
+ vtkPolyData* i =
+ dynamic_cast< vtkPolyData* >(
+ this->m_Inputs[ 0 ]->GetVTKDataObject( )
+ );
+ if( i == NULL )
+ return( "MeshWriter: No suitable input." );
+ std::string fname = this->m_Parameters.GetValueAsString( "FileName" );
+
+ if( this->m_Writer != NULL )
+ this->m_Writer->Delete( );
+
+ vtkPolyDataWriter* pdw = vtkPolyDataWriter::New( );
+ this->m_Writer = pdw;
+ pdw->SetInputData( i );
+ pdw->SetFileName( fname.c_str( ) );
+ pdw->Update( );
+ if( pdw->GetErrorCode( ) != 0 )
+ return( "MeshWriter: someting wrong happened." );
+ return( "" );
+}
+
+// eof - $RCSfile$
--- /dev/null
+#ifndef __CPPLUGINS__PLUGINS__MESHWRITER__H__
+#define __CPPLUGINS__PLUGINS__MESHWRITER__H__
+
+#include <cpPlugins/Plugins/cpPlugins_Export.h>
+#include <cpPlugins/Interface/MeshSink.h>
+
+class vtkDataWriter;
+
+namespace cpPlugins
+{
+ namespace Plugins
+ {
+ /**
+ */
+ class cpPlugins_EXPORT MeshWriter
+ : public cpPlugins::Interface::MeshSink
+ {
+ public:
+ typedef MeshWriter Self;
+ typedef cpPlugins::Interface::MeshSink Superclass;
+ typedef itk::SmartPointer< Self > Pointer;
+ typedef itk::SmartPointer< const Self > ConstPointer;
+
+ public:
+ itkNewMacro( Self );
+ itkTypeMacro( MeshWriter, cpPluginsInterfaceMeshSink );
+
+ protected:
+ MeshWriter( );
+ virtual ~MeshWriter( );
+
+ virtual std::string _GenerateData( );
+
+ private:
+ // Purposely not implemented
+ MeshWriter( const Self& );
+ Self& operator=( const Self& );
+
+ protected:
+ vtkDataWriter* m_Writer;
+ };
+
+ // ---------------------------------------------------------------------
+ CPPLUGINS_INHERIT_PROVIDER( MeshWriter );
+
+ } // ecapseman
+
+} // ecapseman
+
+#endif // __CPPLUGINS__PLUGINS__MESHWRITER__H__
+
+// eof - $RCSfile$