// -------------------------------------------------------------------------
void cpPlugins::Interface::Image::
-SetVTK( vtkObject* image )
+SetITK( itk::LightObject* o )
{
- // this->m_VTKObject = image;
+ this->Superclass::SetITK( o );
+ this->_ITK_2_VTK_0< 2 >( o );
+ this->_ITK_2_VTK_0< 3 >( o );
+}
+
+// -------------------------------------------------------------------------
+void cpPlugins::Interface::Image::
+SetVTK( vtkObjectBase* o )
+{
+ this->Superclass::SetVTK( o );
std::cerr << "Image: TODO this!!!!" << std::endl;
std::exit( 1 );
}
#include <itkProcessObject.h>
-// Some forward declarations
-class vtkObject;
-
namespace cpPlugins
{
namespace Interface
cpPlugins_Id_Macro( Image, DataObject );
public:
- template< class I >
- inline void SetITK( itk::Object* object );
-
- virtual void SetVTK( vtkObject* image );
+ virtual void SetITK( itk::LightObject* o );
+ virtual void SetVTK( vtkObjectBase* o );
protected:
Image( );
virtual ~Image( );
+ template< unsigned int D >
+ inline void _ITK_2_VTK_0( itk::LightObject* o );
+
template< class P, unsigned int D >
- inline void _ITK_2_VTK( itk::Object* object );
+ inline void _ITK_2_VTK_1( itk::LightObject* o );
+
+ template< class I >
+ inline void _ITK_2_VTK_2( itk::LightObject* o );
private:
// Purposely not implemented
Self& operator=( const Self& );
protected:
- itk::ProcessObject::Pointer m_ITKvVTKConnection;
+ itk::ProcessObject::Pointer m_ITKvVTK;
};
} // ecapseman
#include <itkVector.h>
// -------------------------------------------------------------------------
-#define cpPlugins_VTKImage_Demangle( TI, T, D, o ) \
- if( typeid( TI ) == typeid( itk::Image< T, D > ) ) \
- this->_ITK_2_VTK< T, D >( o )
-
-// -------------------------------------------------------------------------
-#define cpPlugins_VTKImageArray_Demangle( TI, T, P, DP, DI, o ) \
- if( typeid( TI ) == typeid( itk::Image< T< P, DP >, DI > ) ) \
- this->_ITK_2_VTK< T< P, DP >, DI >( o )
-
-// -------------------------------------------------------------------------
-#define cpPlugins_VTKImage_Demangle_AllDims( TI, T, o ) \
- cpPlugins_VTKImage_Demangle( TI, T, 2, o ); \
- else cpPlugins_VTKImage_Demangle( TI, T, 3, o )
-
-// -------------------------------------------------------------------------
-#define cpPlugins_VTKImageArray_Demangle_AllDims( TI, T, P, o ) \
- cpPlugins_VTKImageArray_Demangle( TI, T, P, 2, 2, o ); \
- else cpPlugins_VTKImageArray_Demangle( TI, T, P, 3, 3, o )
-
-// -------------------------------------------------------------------------
-template< class I >
+template< unsigned int D >
void cpPlugins::Interface::Image::
-SetITK( itk::Object* object )
+_ITK_2_VTK_0( itk::LightObject* o )
{
- // Check if input object has the desired type
- I* image = dynamic_cast< I* >( object );
- if( image == NULL )
+ if( dynamic_cast< itk::ImageBase< D >* >( o ) != NULL )
+ {
+ this->_ITK_2_VTK_1< char, D >( o );
+ this->_ITK_2_VTK_1< short, D >( o );
+ this->_ITK_2_VTK_1< int, D >( o );
+ this->_ITK_2_VTK_1< long, D >( o );
+ this->_ITK_2_VTK_1< unsigned char, D >( o );
+ this->_ITK_2_VTK_1< unsigned short, D >( o );
+ this->_ITK_2_VTK_1< unsigned int, D >( o );
+ this->_ITK_2_VTK_1< unsigned long, D >( o );
+ this->_ITK_2_VTK_1< float, D >( o );
+ this->_ITK_2_VTK_1< double, D >( o );
+ this->_ITK_2_VTK_1< itk::RGBPixel< char >, D >( o );
+ this->_ITK_2_VTK_1< itk::RGBPixel< short >, D >( o );
+ this->_ITK_2_VTK_1< itk::RGBPixel< int >, D >( o );
+ this->_ITK_2_VTK_1< itk::RGBPixel< long >, D >( o );
+ this->_ITK_2_VTK_1< itk::RGBPixel< unsigned char >, D >( o );
+ this->_ITK_2_VTK_1< itk::RGBPixel< unsigned short >, D >( o );
+ this->_ITK_2_VTK_1< itk::RGBPixel< unsigned int >, D >( o );
+ this->_ITK_2_VTK_1< itk::RGBPixel< unsigned long >, D >( o );
+ this->_ITK_2_VTK_1< itk::RGBPixel< float >, D >( o );
+ this->_ITK_2_VTK_1< itk::RGBPixel< double >, D >( o );
+ this->_ITK_2_VTK_1< itk::RGBAPixel< char >, D >( o );
+ this->_ITK_2_VTK_1< itk::RGBAPixel< short >, D >( o );
+ this->_ITK_2_VTK_1< itk::RGBAPixel< int >, D >( o );
+ this->_ITK_2_VTK_1< itk::RGBAPixel< long >, D >( o );
+ this->_ITK_2_VTK_1< itk::RGBAPixel< unsigned char >, D >( o );
+ this->_ITK_2_VTK_1< itk::RGBAPixel< unsigned short >, D >( o );
+ this->_ITK_2_VTK_1< itk::RGBAPixel< unsigned int >, D >( o );
+ this->_ITK_2_VTK_1< itk::RGBAPixel< unsigned long >, D >( o );
+ this->_ITK_2_VTK_1< itk::RGBAPixel< float >, D >( o );
+ this->_ITK_2_VTK_1< itk::RGBAPixel< double >, D >( o );
+ this->_ITK_2_VTK_1< itk::DiffusionTensor3D< float >, D >( o );
+ this->_ITK_2_VTK_1< itk::DiffusionTensor3D< double >, D >( o );
+ this->_ITK_2_VTK_1< itk::Vector< float, D >, D >( o );
+ this->_ITK_2_VTK_1< itk::Vector< double, D >, D >( o );
+ this->_ITK_2_VTK_1< itk::CovariantVector< float, D >, D >( o );
+ this->_ITK_2_VTK_1< itk::CovariantVector< double, D >, D >( o );
+ this->_ITK_2_VTK_1< itk::Point< float, D >, D >( o );
+ this->_ITK_2_VTK_1< itk::Point< double, D >, D >( o );
+ this->_ITK_2_VTK_1< itk::SymmetricSecondRankTensor< float, D >, D >( o );
+ this->_ITK_2_VTK_1< itk::SymmetricSecondRankTensor< double, D >, D >( o );
+ }
+ else
{
- this->m_ITKObject = NULL;
this->m_VTKObject = NULL;
- this->m_ITKvVTKConnection = NULL;
+ this->m_ITKvVTK = NULL;
this->Modified( );
- return;
} // fi
+}
- // --------- TODO ---------------
- typename I::DirectionType norm_dir;
- norm_dir.SetIdentity( );
- image->SetDirection( norm_dir );
- // --------- TODO ---------------
-
- // Connect it to VTK
- cpPlugins_VTKImage_Demangle_AllDims( I, char, image );
- else cpPlugins_VTKImage_Demangle_AllDims( I, short, image );
- else cpPlugins_VTKImage_Demangle_AllDims( I, int, image );
- else cpPlugins_VTKImage_Demangle_AllDims( I, long, image );
- else cpPlugins_VTKImage_Demangle_AllDims( I, unsigned char, image );
- else cpPlugins_VTKImage_Demangle_AllDims( I, unsigned short, image );
- else cpPlugins_VTKImage_Demangle_AllDims( I, unsigned int, image );
- else cpPlugins_VTKImage_Demangle_AllDims( I, unsigned long, image );
- else cpPlugins_VTKImage_Demangle_AllDims( I, float, image );
- else cpPlugins_VTKImage_Demangle_AllDims( I, double, image );
- else cpPlugins_VTKImage_Demangle_AllDims( I, itk::RGBPixel< char >, image );
- else cpPlugins_VTKImage_Demangle_AllDims( I, itk::RGBPixel< short >, image );
- else cpPlugins_VTKImage_Demangle_AllDims( I, itk::RGBPixel< int >, image );
- else cpPlugins_VTKImage_Demangle_AllDims( I, itk::RGBPixel< long >, image );
- else cpPlugins_VTKImage_Demangle_AllDims( I, itk::RGBPixel< unsigned char >, image );
- else cpPlugins_VTKImage_Demangle_AllDims( I, itk::RGBPixel< unsigned short >, image );
- else cpPlugins_VTKImage_Demangle_AllDims( I, itk::RGBPixel< unsigned int >, image );
- else cpPlugins_VTKImage_Demangle_AllDims( I, itk::RGBPixel< unsigned long >, image );
- else cpPlugins_VTKImage_Demangle_AllDims( I, itk::RGBPixel< float >, image );
- else cpPlugins_VTKImage_Demangle_AllDims( I, itk::RGBPixel< double >, image );
- else cpPlugins_VTKImage_Demangle_AllDims( I, itk::RGBAPixel< char >, image );
- else cpPlugins_VTKImage_Demangle_AllDims( I, itk::RGBAPixel< short >, image );
- else cpPlugins_VTKImage_Demangle_AllDims( I, itk::RGBAPixel< int >, image );
- else cpPlugins_VTKImage_Demangle_AllDims( I, itk::RGBAPixel< long >, image );
- else cpPlugins_VTKImage_Demangle_AllDims( I, itk::RGBAPixel< unsigned char >, image );
- else cpPlugins_VTKImage_Demangle_AllDims( I, itk::RGBAPixel< unsigned short >, image );
- else cpPlugins_VTKImage_Demangle_AllDims( I, itk::RGBAPixel< unsigned int >, image );
- else cpPlugins_VTKImage_Demangle_AllDims( I, itk::RGBAPixel< unsigned long >, image );
- else cpPlugins_VTKImage_Demangle_AllDims( I, itk::RGBAPixel< float >, image );
- else cpPlugins_VTKImage_Demangle_AllDims( I, itk::RGBAPixel< double >, image );
- else cpPlugins_VTKImage_Demangle_AllDims( I, itk::DiffusionTensor3D< float >, image );
- else cpPlugins_VTKImage_Demangle_AllDims( I, itk::DiffusionTensor3D< double >, image );
- else cpPlugins_VTKImageArray_Demangle_AllDims( I, itk::Vector, float, image );
- else cpPlugins_VTKImageArray_Demangle_AllDims( I, itk::Vector, double, image );
- else cpPlugins_VTKImageArray_Demangle_AllDims( I, itk::CovariantVector, float, image );
- else cpPlugins_VTKImageArray_Demangle_AllDims( I, itk::CovariantVector, double, image );
- else cpPlugins_VTKImageArray_Demangle_AllDims( I, itk::Point, float, image );
- else cpPlugins_VTKImageArray_Demangle_AllDims( I, itk::Point, double, image );
- else cpPlugins_VTKImageArray_Demangle_AllDims( I, itk::SymmetricSecondRankTensor, float, image );
- else cpPlugins_VTKImageArray_Demangle_AllDims( I, itk::SymmetricSecondRankTensor, double, image );
- else
+// -------------------------------------------------------------------------
+template< class P, unsigned int D >
+void cpPlugins::Interface::Image::
+_ITK_2_VTK_1( itk::LightObject* o )
+{
+ if( dynamic_cast< itk::Image< P, D >* >( o ) == NULL )
{
this->m_VTKObject = NULL;
- this->m_ITKvVTKConnection = NULL;
-
- } // fi
-
- // Keep objects
- this->m_ITKObject = object;
- this->Modified( );
+ this->m_ITKvVTK = NULL;
+ this->Modified( );
+ }
+ else
+ this->_ITK_2_VTK_2< itk::Image< P, D > >( o );
}
// -------------------------------------------------------------------------
-template< class P, unsigned int D >
+template< class I >
void cpPlugins::Interface::Image::
-_ITK_2_VTK( itk::Object* object )
+_ITK_2_VTK_2( itk::LightObject* o )
{
- typedef itk::Image< P, D > _I;
- typedef itk::ImageToVTKImageFilter< _I > _I2Vtk;
-
- // Check (yes, again!!!) if input object has the desired type
- _I* image = dynamic_cast< _I* >( object );
- if( image == NULL )
- return;
-
- // Connect it to VTK
- _I2Vtk* f =
- dynamic_cast< _I2Vtk* >( this->m_ITKvVTKConnection.GetPointer( ) );
- if( f == NULL )
+ typedef itk::ImageToVTKImageFilter< I > _I2V;
+
+ I* image = dynamic_cast< I* >( o );
+ if( image != NULL )
+ {
+ _I2V* f = dynamic_cast< _I2V* >( this->m_ITKvVTK.GetPointer( ) );
+ if( f == NULL )
+ {
+ typename _I2V::Pointer nf = _I2V::New( );
+ this->m_ITKvVTK = nf;
+ f = nf.GetPointer( );
+
+ } // fi
+ f->SetInput( image );
+ f->Update( );
+
+ // Keep object track
+ this->m_ITKObject = o;
+ this->m_VTKObject = f->GetOutput( );
+ }
+ else
{
- typename _I2Vtk::Pointer nf = _I2Vtk::New( );
- this->m_ITKvVTKConnection = nf;
- f = nf.GetPointer( );
+ this->m_VTKObject = NULL;
+ this->m_ITKvVTK = NULL;
} // fi
- f->SetInput( image );
- f->Update( );
-
- // Keep object track
- this->m_VTKObject = f->GetOutput( );
+ this->Modified( );
}
#ifndef cpPlugins_Interface_EXPORTS
cpPlugins_Interface_ImplicitFunction_DEF( Sphere );
cpPlugins_Interface_ImplicitFunction_DEF( Superquadric );
-// -------------------------------------------------------------------------
-void cpPlugins::Interface::ImplicitFunction::
-SetFunction( vtkImplicitFunction* function )
-{
- this->m_VTKObject = function;
- this->Modified( );
-}
-
// -------------------------------------------------------------------------
cpPlugins::Interface::ImplicitFunction::
ImplicitFunction( )
itkTypeMacro( ImplicitFunction, DataObject );
public:
- void SetFunction( vtkImplicitFunction* function );
-
void SetFunctionToBox( );
void SetFunctionToCone( );
void SetFunctionToCylinder( );
// -------------------------------------------------------------------------
void cpPlugins::Interface::Mesh::
-SetVTK( vtkObject* object )
+SetITK( itk::LightObject* o )
+{
+ this->Superclass::SetITK( o );
+ this->_ITK_2_VTK< itk::Mesh< float, 2 > >( o );
+ this->_ITK_2_VTK< itk::Mesh< double, 2 > >( o );
+ this->_ITK_2_VTK< itk::Mesh< float, 3 > >( o );
+ this->_ITK_2_VTK< itk::Mesh< double, 3 > >( o );
+ this->_ITK_2_VTK< itk::QuadEdgeMesh< float, 2 > >( o );
+ this->_ITK_2_VTK< itk::QuadEdgeMesh< double, 2 > >( o );
+ this->_ITK_2_VTK< itk::QuadEdgeMesh< float, 3 > >( o );
+ this->_ITK_2_VTK< itk::QuadEdgeMesh< double, 3 > >( o );
+}
+
+// -------------------------------------------------------------------------
+void cpPlugins::Interface::Mesh::
+SetVTK( vtkObjectBase* o )
{
typedef itk::Mesh< double, 3 > _TMesh;
typedef _TMesh::CellType _TCell;
typedef itk::TriangleCell< _TCell > _TTriangle;
typedef itk::PolygonCell< _TCell > _TPolygon;
- vtkPolyData* mesh = dynamic_cast< vtkPolyData* >( object );
+ vtkPolyData* mesh = dynamic_cast< vtkPolyData* >( o );
if( mesh == NULL )
{
this->m_ITKObject = NULL;
cpPlugins_Id_Macro( Mesh, DataObject );
public:
- template< class M >
- inline void SetITK( M* mesh );
-
- virtual void SetVTK( vtkObject* object );
+ virtual void SetITK( itk::LightObject* o );
+ virtual void SetVTK( vtkObjectBase* o );
protected:
Mesh( );
virtual ~Mesh( );
+ template< class M >
+ inline void _ITK_2_VTK( itk::LightObject* o );
+
private:
// Purposely not implemented
Mesh( const Self& );
#include <vtkPoints.h>
#include <vtkPolyData.h>
-// -------------------------------------------------------------------------
-#define cpPlugins_Mesh_Import( N, T, D ) \
- cpPlugins_TEMPLATE_IMPORT( \
- 2(class cpPlugins_Interface_EXPORT itk::N< T, D >) \
- )
-
-// -------------------------------------------------------------------------
-
-#ifndef cpPlugins_Interface_EXPORTS
-
-cpPlugins_Mesh_Import( Mesh, float, 2 );
-cpPlugins_Mesh_Import( Mesh, double, 2 );
-cpPlugins_Mesh_Import( Mesh, float, 3 );
-cpPlugins_Mesh_Import( Mesh, double, 3 );
-cpPlugins_Mesh_Import( QuadEdgeMesh, float, 2 );
-cpPlugins_Mesh_Import( QuadEdgeMesh, double, 2 );
-cpPlugins_Mesh_Import( QuadEdgeMesh, float, 3 );
-cpPlugins_Mesh_Import( QuadEdgeMesh, double, 3 );
-
-#endif // cpPlugins_Interface_EXPORTS
-
// -------------------------------------------------------------------------
template< class M >
void cpPlugins::Interface::Mesh::
-SetITK( M* mesh )
+_ITK_2_VTK( itk::LightObject* o )
{
- if( this->m_ITKObject.GetPointer( ) == mesh )
+ M* mesh = dynamic_cast< M* >( o );
+ if( mesh == NULL )
return;
- this->m_ITKObject = mesh;
-
long numPoints = mesh->GetNumberOfPoints( );
if( numPoints == 0 )
return;
this->Modified( );
}
+// -------------------------------------------------------------------------
+#define cpPlugins_Mesh_Import( N, T, D ) \
+ cpPlugins_TEMPLATE_IMPORT( \
+ 2(class cpPlugins_Interface_EXPORT itk::N< T, D >) \
+ )
+
+// -------------------------------------------------------------------------
+
+#ifndef cpPlugins_Interface_EXPORTS
+
+cpPlugins_Mesh_Import( Mesh, float, 2 );
+cpPlugins_Mesh_Import( Mesh, double, 2 );
+cpPlugins_Mesh_Import( Mesh, float, 3 );
+cpPlugins_Mesh_Import( Mesh, double, 3 );
+cpPlugins_Mesh_Import( QuadEdgeMesh, float, 2 );
+cpPlugins_Mesh_Import( QuadEdgeMesh, double, 2 );
+cpPlugins_Mesh_Import( QuadEdgeMesh, float, 3 );
+cpPlugins_Mesh_Import( QuadEdgeMesh, double, 3 );
+
+#endif // cpPlugins_Interface_EXPORTS
+
#endif // __CPPLUGINS__INTERFACE__MESH__HXX__
// eof - $RCSfile$
#include <cpPlugins/Interface/PolyLineParametricPath.h>
-// -------------------------------------------------------------------------
-void cpPlugins::Interface::PolyLineParametricPath::
-SetVTK( vtkObject* path )
-{
-}
-
// -------------------------------------------------------------------------
cpPlugins::Interface::PolyLineParametricPath::
PolyLineParametricPath( )
#define __CPPLUGINS__INTERFACE__POLYLINEPARAMETRICPATH__H__
#include <cpPlugins/Interface/DataObject.h>
-
-// Some forward declarations
-class vtkObject;
+#include <itkPolyLineParametricPath.h>
namespace cpPlugins
{
itkTypeMacro( PolyLineParametricPath, DataObject );
cpPlugins_Id_Macro( PolyLineParametricPath, DataObject );
- public:
- template< class P >
- inline void SetITK( itk::Object* object );
-
- virtual void SetVTK( vtkObject* path );
-
protected:
PolyLineParametricPath( );
virtual ~PolyLineParametricPath( );
#ifndef __CPPLUGINS__INTERFACE__POLYLINEPARAMETRICPATH__HXX__
#define __CPPLUGINS__INTERFACE__POLYLINEPARAMETRICPATH__HXX__
-#include <itkPolyLineParametricPath.h>
-
-// -------------------------------------------------------------------------
-template< class P >
-void cpPlugins::Interface::PolyLineParametricPath::
-SetITK( itk::Object* object )
-{
- P* path = dynamic_cast< P* >( object );
- if( path != NULL )
- {
- this->m_ITKObject = path;
- this->m_VTKObject = NULL;
- this->Modified( );
-
- } // fi
-}
+// TODO: erase this file
#endif // __CPPLUGINS__INTERFACE__POLYLINEPARAMETRICPATH__HXX__
#include <cpPlugins/Interface/SimpleMPRWidget.h>
#endif // cpPlugins_Interface_QT4
+// -------------------------------------------------------------------------
+void cpPlugins::Interface::ProcessObject::
+SetITK( itk::LightObject* o )
+{
+ // Polymorphism: do nothing -> this is a filter!!!
+}
+
+// -------------------------------------------------------------------------
+void cpPlugins::Interface::ProcessObject::
+SetVTK( vtkObjectBase* o )
+{
+ // Polymorphism: do nothing -> this is a filter!!!
+}
+
// -------------------------------------------------------------------------
std::set< std::string > cpPlugins::Interface::ProcessObject::
GetInputsNames( ) const
bool need_to_update = false;
for( ; i != this->m_Inputs.end( ) && r == ""; ++i )
{
- if( i->second.IsValid( ) )
+ bool iv = i->second.IsValid( );
+ bool ir = i->second.IsRequired( );
+ if( iv || !ir )
{
Self* src = dynamic_cast< Self* >( i->second->GetSource( ) );
if( src != NULL )
r = src->Update( );
} // fi
-
- } // fi
+ }
+ else
+ r =
+ "ProcessObject: Required input \"" +
+ i->first + "@" + this->GetClassName( ) +
+ "\" is not valid (=NULL).";
} // rof
itkSetObjectMacro( MPRViewer, SimpleMPRWidget );
public:
+ virtual void SetITK( itk::LightObject* o );
+ virtual void SetVTK( vtkObjectBase* o );
+
// IO management
std::set< std::string > GetInputsNames( ) const;
std::set< std::string > GetOutputsNames( ) const;
ProcessObject( );
virtual ~ProcessObject( );
- void _AddInput( const std::string& name, bool required );
+ void _AddInput( const std::string& name, bool required = true );
template< class O >
inline void _AddOutput( const std::string& name );
template< class F >
AppendMeshesFilter( )
: Superclass( )
{
- this->_AddInput( "Input0", true );
- this->_AddInput( "Input1", true );
+ this->_AddInput( "Input0" );
+ this->_AddInput( "Input1" );
this->_AddOutput< cpPlugins::Interface::Mesh >( "Output" );
}
{
auto m0 = this->GetInputData< cpPlugins::Interface::Mesh >( "Input0" );
auto m1 = this->GetInputData< cpPlugins::Interface::Mesh >( "Input1" );
- if( m0 == NULL || m1 == NULL )
- return( "AppendMeshesFilter: No input meshes." );
auto filter = this->_CreateVTK< vtkAppendPolyData >( );
filter->AddInputData( m0->GetVTK< vtkPolyData >( ) );
BinaryErodeImageFilter( )
: Superclass( )
{
- this->_AddInput( "Input", true );
+ this->_AddInput( "Input" );
this->_AddOutput< cpPlugins::Interface::Image >( "Output" );
this->m_Parameters->ConfigureAsUint( "Radius" );
_GenerateData( )
{
auto image = this->GetInputData< cpPlugins::Interface::Image >( "Input" );
- if( image == NULL )
- return( "BinaryErodeImageFilter: No input image." );
-
itk::DataObject* itk_image = NULL;
std::string r = "";
cpPlugins_Image_Demangle_AllScalarTypes( 2, image, itk_image, r, _GD0 );
class cpPlugins_IO_DicomSeriesReader_ParametersQtDialog
: public cpPlugins::Interface::ParametersQtDialog
{
- // Q_OBJECT;
-
public:
cpPlugins_IO_DicomSeriesReader_ParametersQtDialog(
QWidget* parent = 0, Qt::WindowFlags f = 0
QDialog* tree_dialog = new QDialog( parent );
QTreeWidget* tree_widget = new QTreeWidget( tree_dialog );
QList< QTreeWidgetItem* > tree_items;
- std::map< std::string, std::map< std::string, std::vector< std::string > > >
- found_files;
+ std::map<
+ std::string,
+ std::map< std::string, std::vector< std::string > >
+ > found_files;
std::string main_dir_name =
dialog.selectedFiles( ).begin( )->toStdString( );
_RealGD( const TStringList& names )
{
auto out = this->GetOutputData< cpPlugins::Interface::Image >( "Output" );
- if( out == NULL )
- return( "ImageReader: No output object properly created." );
-
std::string r = "";
if( names.size( ) == 1 )
{
try
{
reader->Update( );
- out->SetITK< I >( reader->GetOutput( ) );
+ out->SetITK( reader->GetOutput( ) );
}
catch( itk::ExceptionObject& err )
{
r = "ImageReader: " + std::string( err.GetDescription( ) );
- out->SetITK< I >( NULL );
+ out->SetITK( NULL );
} // yrt
}
try
{
reader->Update( );
- out->SetITK< I >( reader->GetOutput( ) );
+ out->SetITK( reader->GetOutput( ) );
}
catch( itk::ExceptionObject& err )
{
r = "ImageReader: " + std::string( err.GetDescription( ) );
- out->SetITK< I >( NULL );
+ out->SetITK( NULL );
} // yrt
}
ImageWriter( )
: Superclass( )
{
- this->_AddInput( "Input", true );
+ this->_AddInput( "Input" );
this->m_Parameters->ConfigureAsSaveFileName( "FileName" );
this->m_Parameters->SetAcceptedFileExtensions(
"FileName",
_GD0_Image( )
{
auto image = this->GetInputData< cpPlugins::Interface::Image >( "Input" );
- if( image == NULL )
- return( "ImageWriter: No input image." );
-
itk::DataObject* itk_image = NULL;
std::string r = "";
cpPlugins_Image_Demangle_AllTypes( D, image, itk_image, r, _RealGD );
else r = "ImageWriter: Input image type not supported.";
-
return( r );
}
_GD0_VectorImage( )
{
auto image = this->GetInputData< cpPlugins::Interface::Image >( "Input" );
- if( image == NULL )
- return( "ImageWriter: No input image." );
-
itk::DataObject* itk_image = NULL;
std::string r = "";
cpPlugins_VectorImage_Demangle_AllTypes( D, image, itk_image, r, _RealGD );
else r = "ImageWriter: Input image type not supported.";
-
return( r );
}
std::string cpPlugins::IO::ImageWriter::
_RealGD( itk::DataObject* image )
{
- // Get filename
- std::string fname = this->m_Parameters->GetSaveFileName( "FileName" );
-
typedef itk::ImageFileWriter< I > _W;
_W* writer = this->_CreateITK< _W >( );
- writer->SetFileName( fname );
+ writer->SetFileName( this->m_Parameters->GetSaveFileName( "FileName" ) );
writer->SetInput( dynamic_cast< I* >( image ) );
try
{
return( "MeshReader: output not correctly created." );
return( "" );
}
+ else if( ext == "obj" )
+ {
+ // TODO
+ }
else if( ext == "vtk" )
{
vtkPolyDataReader* pdr = this->_CreateVTK< vtkPolyDataReader >( );
MeshWriter( )
: Superclass( )
{
- this->_AddInput( "Input", true );
+ this->_AddInput( "Input" );
this->m_Parameters->ConfigureAsSaveFileName( "FileName" );
this->m_Parameters->SetAcceptedFileExtensions(
"FileName",
_GenerateData( )
{
auto mesh = this->GetInputData< cpPlugins::Interface::Mesh >( "Input" );
- if( mesh == NULL )
- return( "MeshWriter: No input mesh." );
vtkPolyData* i = mesh->GetVTK< vtkPolyData >( );
if( i == NULL )
return( "MeshWriter: No suitable input." );
: Superclass( ),
m_Configured( false )
{
- this->_AddInput( "ReferenceImage", true );
+ this->_AddInput( "ReferenceImage" );
this->_AddOutput< cpPlugins::Interface::PointList >( "Output" );
this->m_Parameters->ConfigureAsBool( "SeedsAreInRealSpace" );
auto image =
this->GetInputData< cpPlugins::Interface::Image >( "ReferenceImage" );
- if( image == NULL )
- return( "SeedWidget: No input image." );
-
itk::DataObject* itk_image = image->GetITK< _2DImage >( );
if( itk_image != NULL )
return( this->_GD0< _2DImage >( itk_image ) );
return( this->_GD0< _3DImage >( itk_image ) );
} // fi
-
return( "SeedWidget: Input image dimension not supported." );
}
s->SeedWidgetOn( );
} // fi
-
- /* TODO
- auto iIt = this->m_Interactors.begin( );
- for( ; iIt != this->m_Interactors.end( ); ++iIt )
- {
- _S* s = dynamic_cast< _S* >( ( *iIt )->GetInteractorStyle( ) );
- if( s != NULL )
- {
- if( this->m_Configured )
- {
- for( unsigned int i = 0; i < s->GetNumberOfSeeds( ); ++i )
- {
- s->GetSeedAsPoint( i, aux_pnt );
- typename I::PointType seed;
- for( unsigned int d = 0; d < dim; ++d )
- seed[ d ] = aux_pnt[ d ];
- out->AddPoint( seed );
-
- } // rof
- }
- else
- s->SeedWidgetOn( );
-
- } // fi
-
- } // rof
- */
this->m_Configured = true;
return( "" );
}