## == Build different parts ==
## ===========================
-SUBDIRS(appli lib plugins)
-#SUBDIRS(appli cmake lib plugins)
+SUBDIRS(appli cmake lib plugins)
## eof - $RCSfile$
SUBDIRS(
bash
examples
- # PipelineEditor
+ PipelineEditor
)
## eof - $RCSfile$
IF(Qt4_FOUND)
- AppFromDir(_app_name ${CMAKE_CURRENT_SOURCE_DIR})
- IF(_app_name)
- TARGET_LINK_LIBRARIES(${_app_name} ${cpBaseQtApplication_LIB} ${cpPlugins_Paths_LIB})
- ENDIF(_app_name)
+ INCLUDE_DIRECTORIES(
+ ${PROJECT_SOURCE_DIR}
+ ${PROJECT_BINARY_DIR}
+ ${PROJECT_SOURCE_DIR}/lib
+ ${PROJECT_BINARY_DIR}/lib
+ )
+ CompileAppFromDir(PipelineEditor ${CMAKE_CURRENT_SOURCE_DIR})
+ TARGET_LINK_LIBRARIES(
+ PipelineEditor
+ cpBaseQtApplication
+ )
ENDIF(Qt4_FOUND)
## eof - $RCSfile$
#include <string>
// -------------------------------------------------------------------------
+#define cpPlugins_CONFIG_BOOLEAN_TYPES "@cpPlugins_CONFIG_BOOLEAN_TYPES@"
#define cpPlugins_CONFIG_INTEGER_TYPES "@cpPlugins_CONFIG_INTEGER_TYPES@"
#define cpPlugins_CONFIG_REAL_TYPES "@cpPlugins_CONFIG_REAL_TYPES@"
#define cpPlugins_CONFIG_PROCESS_DIMENSIONS "@cpPlugins_CONFIG_PROCESS_DIMENSIONS@"
// -----------------------------------------------------------------------
inline void LoadDefinitions( TCommands& commands )
{
+ commands[ "define" ].push_back(
+ std::string( "bool_types=" ) +
+ std::string( cpPlugins_CONFIG_BOOLEAN_TYPES )
+ );
commands[ "define" ].push_back(
std::string( "int_types=" ) +
std::string( cpPlugins_CONFIG_INTEGER_TYPES )
std::string( "matrices=" ) +
std::string( cpPlugins_CONFIG_MATRICES )
);
+ if( std::string( cpPlugins_CONFIG_INTEGER_TYPES ) != "" )
+ commands[ "define" ].push_back(
+ std::string( "uint_types=unsigned #int_types#" )
+ );
commands[ "define" ].push_back(
- std::string( "uint_types=unsigned #int_types#" )
- );
- commands[ "define" ].push_back(
- std::string( "scalar_pixels=#int_types#;#uint_types#;#real_types#" )
+ std::string(
+ "scalar_pixels=#bool_types#;#int_types#;#uint_types#;#real_types#"
+ )
);
}
## -------------------------------------------------------------------------
FUNCTION(
- CreateLib
- lib_name
- lib_type
+ PrepareSourceFiles
+ out_sources_list
+ out_headers_list
+ out_headers_paths
)
+SET(_config_extensions .c.in .cpp.in .cxx.in .h.in .hpp.in .hxx.in .ui.in)
+SET(_sources_extensions .c .cpp .cxx)
+SET(_headers_extensions .h .hpp .hxx)
+SET(_qt_ui_extensions .ui)
+SET(_demangler_extensions .d)
## -- Configure inputs
-SET(_config_extensions .c.in .cpp.in .cxx.in .h.in .hpp.in .hxx.in .ui.in)
SET(_all_files)
FOREACH(_file ${ARGN})
GET_FILENAME_COMPONENT(_ext ${_file} EXT)
ENDFOREACH(_file)
## -- Separate files
-SET(_sources_extensions .c .cpp .cxx)
-SET(_headers_extensions .h .hpp .hxx)
-SET(_qt_ui_extensions .ui)
-SET(_demangler_extensions .d)
SET(_srcs)
SET(_hdrs)
SET(_qts)
LIST(APPEND _hdrs_paths ${_path})
ENDIF(${_path_idx} EQUAL -1)
ENDFOREACH(_hdr)
+
+SET(${out_sources_list} ${_srcs} PARENT_SCOPE)
+SET(${out_headers_list} ${_hdrs} PARENT_SCOPE)
+SET(${out_headers_paths} ${_hdrs_paths} PARENT_SCOPE)
+
+ENDFUNCTION()
+
+## -------------------------------------------------------------------------
+FUNCTION(
+ CreateLib
+ lib_name
+ lib_type
+ )
+PrepareSourceFiles(_srcs _hdrs _paths ${ARGN})
INCLUDE_DIRECTORIES(
- ${_hdrs_paths}
+ ${_paths}
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR}
)
STATIC_DEFINE ${lib_name}_BUILT_AS_STATIC
)
ENDIF(_srcs)
-
ENDFUNCTION()
## -------------------------------------------------------------------------
ENDFUNCTION()
+## -------------------------------------------------------------------------
+FUNCTION(
+ CompileAppFromDir
+ app_name
+ app_dir
+ )
+FILE(GLOB_RECURSE _files "${app_dir}/*")
+PrepareSourceFiles(_srcs _hdrs _paths ${_files} ${ARGN})
+INCLUDE_DIRECTORIES(
+ ${_paths}
+ ${CMAKE_CURRENT_SOURCE_DIR}
+ ${CMAKE_CURRENT_BINARY_DIR}
+ )
+IF(_srcs)
+ SET(_app_os_target)
+ IF(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
+ SET(_app_os_target WIN32)
+ ELSEIF(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
+ SET(_app_os_target MACOSX_BUNDLE)
+ ENDIF(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
+ ADD_EXECUTABLE(${app_name} ${_app_os_target} ${_srcs} ${_hdrs})
+ENDIF(_srcs)
+ENDFUNCTION()
+
## eof - $RCSfile$
## ===============================
SET(cpPlugins_CONFIG_NUMBER_OF_FILES "10" CACHE STRING "Number of compiled files.")
+SET(cpPlugins_CONFIG_BOOLEAN_TYPES "bool" CACHE STRING "Accepted boolean types.")
SET(cpPlugins_CONFIG_INTEGER_TYPES "char;short;int;long" CACHE STRING "Accepted integer types.")
SET(cpPlugins_CONFIG_REAL_TYPES "float;double" CACHE STRING "Accepted real types.")
SET(cpPlugins_CONFIG_PROCESS_DIMENSIONS "1;2;3;4" CACHE STRING "Accepted processing dimensions.")
SET(
_all_configs
+ cpPlugins_CONFIG_BOOLEAN_TYPES
cpPlugins_CONFIG_INTEGER_TYPES
cpPlugins_CONFIG_REAL_TYPES
cpPlugins_CONFIG_PROCESS_DIMENSIONS
tinclude itk#matrices#:h|hxx
tinclude itk#diff_tensors#:h|hxx
tinclude itkSymmetricEigenAnalysis:h|hxx
+tinclude vnl/vnl_vector:h|hxx
+cinclude vnl/vnl_c_vector.hxx
+
+instances vnl_vector< bool >
instances itk::Array< #scalar_pixels# >
instances itk::FixedArray< #scalar_pixels#, #process_dims# >
instances itk::FixedArray< #scalar_pixels#, 8 >
tinclude itkImageSource:h|hxx
+cinclude complex
cinclude itk#color_pixels#.h
cinclude itk#vectors#.h
cinclude itk#diff_tensors#.h
cinclude itk#matrices#.h
instances itk::ImageSource< itk::Image< #scalar_pixels#, #process_dims# > >
+instances itk::ImageSource< itk::Image< std::complex< #real_types# >, #process_dims# > >
instances itk::ImageSource< itk::Image< itk::#color_pixels#< #scalar_pixels# >, #process_dims# > >
instances itk::ImageSource< itk::Image< itk::#vectors#< #real_types#, #process_dims# >, #process_dims# > >
instances itk::ImageSource< itk::Image< itk::#diff_tensors#< #real_types# >, 3 > >
tinclude itk#iter#:h|hxx
+cinclude complex
cinclude itk#color_pixels#.h
cinclude itk#vectors#.h
cinclude itk#diff_tensors#.h
cinclude itk#matrices#.h
instances itk::#iter#< itk::Image< #scalar_pixels#, #process_dims# > >
+instances itk::#iter#< itk::Image< std::complex< #real_types# >, #process_dims# > >
instances itk::#iter#< itk::Image< itk::#color_pixels#< #scalar_pixels# >, #process_dims# > >
instances itk::#iter#< itk::Image< itk::#vectors#< #real_types#, #process_dims# >, #process_dims# > >
instances itk::#iter#< itk::Image< itk::#diff_tensors#< #real_types# >, 3 > >
header #define ITK_MANUAL_INSTANTIATION
+define cells=Vertex;Line;Triangle;Polygon
+
tinclude itkMesh:h|hxx
tinclude itkPointSet:h|hxx
+tinclude itk#cells#Cell:h|hxx
+tinclude itkCellInterface:h|hxx
cinclude itkMapContainer.hxx
cinclude itkVectorContainer.hxx
+itk::CellInterface< #real_types#, itk::CellTraitsInfo< #visual_dims#, float, float, unsigned long, unsigned long, unsigned long, itk::Point< float, #visual_dims# >, itk::VectorContainer< unsigned long, itk::Point< float, #visual_dims# > >, std::set< unsigned long, std::less< unsigned long >, std::allocator< unsigned long > > > >
+
+instances itk::#cells#Cell< itk::CellInterface< #real_types#, itk::CellTraitsInfo< #visual_dims#, float, float, unsigned long, unsigned long, unsigned long, itk::Point< float, #visual_dims# >, itk::VectorContainer< unsigned long, itk::Point< float, #visual_dims# > >, std::set< unsigned long, std::less< unsigned long >, std::allocator< unsigned long > > > > >
+
instances itk::PointSet< #real_types#, #visual_dims# >
instances itk::Mesh< #real_types#, #visual_dims# >
tinclude itkImage:h|hxx
tinclude itkImportImageContainer:h|hxx
+cinclude complex
cinclude itk#color_pixels#.h
cinclude itk#vectors#.h
cinclude itk#diff_tensors#.h
cinclude itk#matrices#.h
instances itk::ImportImageContainer< unsigned long, #scalar_pixels# >
+instances itk::ImportImageContainer< unsigned long, std::complex< #real_types# > >
instances itk::ImportImageContainer< unsigned long, itk::#color_pixels#< #scalar_pixels# > >
instances itk::ImportImageContainer< unsigned long, itk::#vectors#< #real_types#, #process_dims# > >
instances itk::ImportImageContainer< unsigned long, itk::#diff_tensors#< #real_types# > >
instances itk::ImageBase< #process_dims# >
instances itk::Image< #scalar_pixels#, #process_dims# >
+instances itk::Image< std::complex< #real_types# >, #process_dims# >
instances itk::Image< itk::#color_pixels#< #scalar_pixels# >, #process_dims# >
instances itk::Image< itk::#vectors#< #real_types#, #process_dims# >, #process_dims# >
instances itk::Image< itk::#diff_tensors#< #real_types# >, 3 >
// Add input ports\r
auto inputs = this->m_Filter->GetInputsNames( );\r
for( auto iIt = inputs.begin( ); iIt != inputs.end( ); ++iIt )\r
- this->addInputPort( iIt->c_str( ) );\r
+ {\r
+ this->addInputPort(\r
+ iIt->c_str( ),\r
+ this->m_Filter->IsInputMultiple( iIt->c_str( ) )\r
+ );\r
+\r
+ } // rof\r
\r
// Add output ports\r
auto outputs = this->m_Filter->GetOutputsNames( );\r
\r
// -------------------------------------------------------------------------\r
cpBaseQtApplication::InputPort* cpBaseQtApplication::Block::\r
-addInputPort( const QString& txt )\r
+addInputPort( const QString& txt, bool multiple )\r
{\r
- InputPort* ip = new InputPort( this );\r
+ InputPort* ip = new InputPort( this, multiple );\r
ip->setExtendedName( "" );\r
ip->setName( txt );\r
this->m_InputPorts[ txt.toStdString( ) ] = ip;\r
void setEditor( Editor* editor );\r
\r
void setNamePort( const QString& txt );\r
- InputPort* addInputPort( const QString& txt );\r
+ InputPort* addInputPort( const QString& txt, bool multiple );\r
OutputPort* addOutputPort( const QString& txt );\r
\r
InputPort* inputPort( const QString& txt );\r
default:
break;
} // hctiws
- /* TODO
- if( event->key( ) == del_key )
- {
- auto _items = this->items( );
- auto i = _items.begin( );
- while( i != _items.end( ) )
- {
- if( ( *i )->isSelected( ) )
- {
- Block* b = dynamic_cast< Block* >( *i );
- Connection* c = dynamic_cast< Connection* >( *i );
- if( b != NULL )
- {
- if( this->m_Editor->deleteFilter( b->namePort( ).toStdString( ) ) )
- delete b;
- }
- else if( c != NULL )
- {
- if(
- this->m_Editor->deleteConnection(
- c->port1( )->block( )->namePort( ).toStdString( ),
- c->port2( )->block( )->namePort( ).toStdString( ),
- c->port1( )->name( ).toStdString( ),
- c->port2( )->name( ).toStdString( )
- )
- )
- delete c;
-
- } // fi
- i = _items.end( );
- }
- else
- i++;
-
- } // elihw
-
- } // fi
- */
}
// -------------------------------------------------------------------------
{\r
if( p != NULL )\r
{\r
- if( p->connection( ) == NULL )\r
- {\r
- p->setConnection( this );\r
- this->m_Port2 = p;\r
-\r
- } // fi\r
+ p->setConnection( this );\r
+ this->m_Port2 = p;\r
\r
} // fi\r
}\r
this->m_MainWindow->dataProperties( name, port );\r
}\r
\r
-/* TODO\r
-\r
-// -------------------------------------------------------------------------\r
-void cpBaseQtApplication::Editor::\r
-showOutputData(\r
- const std::string& filter_name, const std::string& output_name\r
- )\r
-{\r
- emit showFilterOutput( filter_name, output_name );\r
-}\r
-\r
-// -------------------------------------------------------------------------\r
-void cpBaseQtApplication::Editor::\r
-hideOutputData(\r
- const std::string& filter_name, const std::string& output_name\r
- )\r
-{\r
- emit hideFilterOutput( filter_name, output_name );\r
-}\r
-\r
-// -------------------------------------------------------------------------\r
-void cpBaseQtApplication::Editor::\r
-visualPropertiesOutputData(\r
- const std::string& filter_name, const std::string& output_name\r
- )\r
-{\r
- emit visualPropertiesFilterOutput( filter_name, output_name );\r
-}\r
-*/\r
-\r
// -------------------------------------------------------------------------\r
cpBaseQtApplication_Editor_Callback_CODE( ContextMenu )\r
{\r
{\r
if(\r
in->block( ) != out->block( ) &&\r
- !in->hasConnection( ) &&\r
+ ( !in->hasConnection( ) || in->isMultiple( ) ) &&\r
!in->isConnected( out ) &&\r
!out->isExtended( )\r
)\r
\r
// -------------------------------------------------------------------------\r
cpBaseQtApplication::InputPort::\r
-InputPort( QGraphicsItem* parent, QGraphicsScene* scene )\r
+InputPort( QGraphicsItem* parent, bool multiple, QGraphicsScene* scene )\r
: Superclass( parent, scene ),\r
- m_Connection( NULL )\r
+ m_IsMultiple( multiple )\r
{\r
}\r
\r
cpBaseQtApplication::InputPort::\r
~InputPort( )\r
{\r
- if( this->m_Connection != NULL )\r
- delete this->m_Connection;\r
+ this->m_Connection.clear( );\r
}\r
\r
// -------------------------------------------------------------------------\r
void cpBaseQtApplication::InputPort::\r
setExtend( bool extend )\r
{\r
- if( this->m_Connection == NULL )\r
+ if( this->m_Connection.size( ) == 0 )\r
{\r
this->m_IsExtended = extend;\r
this->m_ExtendedLabel->setVisible( extend );\r
bool cpBaseQtApplication::InputPort::\r
isConnected( Port* other )\r
{\r
- if( this->m_Connection != NULL )\r
- return(\r
- this->m_Connection->port1( ) == other &&\r
- this->m_Connection->port2( ) == this\r
- );\r
- else\r
- return( false );\r
+ bool conn = false;\r
+ auto i = this->m_Connection.begin( );\r
+ for( ; i != this->m_Connection.end( ); ++i )\r
+ conn |= ( ( *i )->port1( ) == other && ( *i )->port2( ) == this );\r
+ return( conn );\r
}\r
\r
// -------------------------------------------------------------------------\r
void cpBaseQtApplication::InputPort::\r
setConnection( Connection* c )\r
{\r
- this->m_Connection = c;\r
+ if( this->m_IsMultiple || this->m_Connection.size( ) == 0 )\r
+ this->m_Connection.push_back( c );\r
}\r
\r
// -------------------------------------------------------------------------\r
{\r
if( change == ItemScenePositionHasChanged )\r
{\r
- if( this->m_Connection != NULL )\r
+ for(\r
+ auto i = this->m_Connection.begin( );\r
+ i != this->m_Connection.end( );\r
+ ++i\r
+ )\r
{\r
- this->m_Connection->updatePosFromPorts( );\r
- this->m_Connection->updatePath( );\r
+ ( *i )->updatePosFromPorts( );\r
+ ( *i )->updatePath( );\r
\r
} // fi\r
\r
enum { Type = Superclass::Type + 3 };\r
\r
public:\r
- InputPort( QGraphicsItem* parent = NULL, QGraphicsScene* scene = NULL );\r
+ InputPort(\r
+ QGraphicsItem* parent,\r
+ bool multiple,\r
+ QGraphicsScene* scene = NULL\r
+ );\r
virtual ~InputPort( );\r
\r
virtual void setExtend( bool extend );\r
{ return( this->Type ); }\r
\r
void setConnection( Connection* c );\r
- inline Connection* connection( )\r
- { return( this->m_Connection ); }\r
- inline const Connection* connection( ) const\r
- { return( this->m_Connection ); }\r
+ inline Connection* connection( unsigned int i )\r
+ { return( this->m_Connection[ i ] ); }\r
+ inline const Connection* connection( unsigned int i ) const\r
+ { return( this->m_Connection[ i ] ); }\r
inline bool hasConnection( ) const\r
- { return( this->m_Connection != NULL ); }\r
+ { return( this->m_Connection.size( ) > 0 ); }\r
+ inline bool isMultiple( ) const\r
+ { return( this->m_IsMultiple ); }\r
\r
protected:\r
QVariant itemChange( GraphicsItemChange change, const QVariant& value );\r
virtual void _updateLabels( );\r
\r
protected:\r
- Connection* m_Connection;\r
+ std::vector< Connection* > m_Connection;\r
+ bool m_IsMultiple;\r
};\r
\r
/**\r
void cpPlugins::BaseObjects::MultipleInputsPort::
Add( cpPlugins::BaseObjects::DataObject* o )
{
- /* TODO
- if( o == NULL )
- return;
- auto otype = std::type_index( typeid( *o ) );
- if( this->m_Type == otype )
- this->m_Data.push_back( o );
- else
- throw std::logic_error(
- "cpPlugins::MultipleInputsPort: incompatible types \"" +
- std::string( otype.name( ) ) + std::string( "\" and \"" ) +
- std::string( this->m_Type.name( ) ) + std::string( "\"" )
- );
- */
+ if( this->m_Sample.IsNull( ) )
+ throw std::logic_error(
+ "cpPlugins::SingleDataPort: Port not yet configured"
+ );
+ if( o != NULL )
+ {
+ if( this->m_Sample->IsCompatible( o ) )
+ {
+ this->m_Data.push_back( o );
+ }
+ else
+ throw std::logic_error(
+ "cpPlugins::SingleDataPort: incompatible types \"" +
+ std::string( typeid( *o ).name( ) ) + std::string( "\" and \"" ) +
+ std::string( typeid( *( this->m_Sample.GetPointer( ) ) ).name( ) ) +
+ std::string( "\"" )
+ );
+
+ } // fi
}
// -------------------------------------------------------------------------
return( 0 );
}
+// -------------------------------------------------------------------------
+bool cpPlugins::BaseObjects::ProcessObject::
+IsInputMultiple( const std::string& n ) const
+{
+ auto i = this->m_Inputs.find( n );
+ if( i != this->m_Inputs.end( ) )
+ return( dynamic_cast< MultipleInputsPort* >( i->second ) != NULL );
+ else
+ return( false );
+}
+
// -------------------------------------------------------------------------
void cpPlugins::BaseObjects::ProcessObject::
AddInput( const std::string& n, cpPlugins::BaseObjects::DataObject* o )
unsigned int GetNumberOfInputs( ) const;
unsigned int GetNumberOfOutputs( ) const;
unsigned int GetInputSize( const std::string& n ) const;
+ bool IsInputMultiple( const std::string& n ) const;
template< class _TType = DataObject >
_TType* GetInput( const std::string& n, unsigned int i = 0 );
if( other->m_Points[ 1 ][ d ] > this->m_Points[ 1 ][ d ] )
this->m_Points[ 1 ][ d ] = other->m_Points[ 1 ][ d ];
this->Modified( );
+ this->_UpdateVTK( );
}
// -------------------------------------------------------------------------
IntPixels|d itk::Image< #all_ints#, d >
RealPixels|d itk::Image< #real_types#, d >
ScalarPixels|d itk::Image< #scalar_pixels#, d >
+ComplexPixels|d itk::Image< std::complex< #real_types# >, d >
ColorPixels|d itk::Image< itk::#color_pixels#< #scalar_pixels# >, d >
VectorPixels|d itk::Image< itk::#vectors#< #real_types#, d >, d >
DiffTensors3D itk::Image< itk::#diff_tensors#< #real_types# >, 3 >
#include <cpPlugins/DataObjects/Mesh.h>
+#include <cpPlugins/DataObjects/Mesh_Demanglers.h>
+
+#include <itkMesh.h>
+#include <itkLineCell.h>
+#include <itkTriangleCell.h>
+#include <itkPolygonCell.h>
#include <vtkPolyData.h>
// -------------------------------------------------------------------------
void cpPlugins::DataObjects::Mesh::
SetITK( itk::LightObject* o )
{
- /* TODO
- this->Superclass::SetITK( o );
- bool s = false;
- cpPlugins_Demangle_Meshes_Dims( o, _ITK_2_VTK );
- */
+ this->Superclass::SetITK( o );
+ cpPlugins_Demangle_Mesh_Meshes( o, _ITK_2_VTK, 2, );
+ cpPlugins_Demangle_Mesh_Meshes( o, _ITK_2_VTK, 3, );
+ {
+ this->m_VTK = NULL;
+
+ } // fi
+ this->Modified( );
}
// -------------------------------------------------------------------------
void cpPlugins::DataObjects::Mesh::
SetVTK( vtkObjectBase* o )
{
- /* TODO
- typedef itk::Mesh< double, 3 > _TMesh;
- typedef _TMesh::CellType _TCell;
- typedef _TCell::CellAutoPointer _TCellAutoPointer;
- typedef itk::LineCell< _TCell > _TLine;
- typedef itk::TriangleCell< _TCell > _TTriangle;
- typedef itk::PolygonCell< _TCell > _TPolygon;
-
- vtkPolyData* mesh = dynamic_cast< vtkPolyData* >( o );
- if( mesh == NULL )
- {
- this->m_ITK = NULL;
- this->Modified( );
- return;
-
- } // fi
-
- if( this->m_VTK.GetPointer( ) != mesh )
- {
- this->m_VTK = mesh;
-
- // Copy points
- _TMesh::Pointer imesh = _TMesh::New( );
- double point[ 3 ];
- for( long i = 0; i < mesh->GetNumberOfPoints( ); ++i )
- {
- mesh->GetPoint( i, point );
- _TMesh::PointType ipoint;
- ipoint[ 0 ] = point[ 0 ];
- ipoint[ 1 ] = point[ 1 ];
- ipoint[ 2 ] = point[ 2 ];
- imesh->SetPoint( i, ipoint );
-
- } // rof
-
- // Copy cells
- vtkCellArray* arrays[ 4 ];
- arrays[ 0 ] = mesh->GetLines( );
- arrays[ 1 ] = mesh->GetPolys( );
- arrays[ 2 ] = NULL; // TODO: mesh->GetStrips( );
- arrays[ 3 ] = mesh->GetVerts( );
-
- for( unsigned int c = 0; c < 4; c++ )
- {
- if( arrays[ c ] != NULL )
- {
- vtkSmartPointer< vtkIdList > ids =
- vtkSmartPointer< vtkIdList >::New( );
- arrays[ c ]->InitTraversal( );
- while( arrays[ c ]->GetNextCell( ids ) == 1 )
- {
- long nPoints = ids->GetNumberOfIds( );
- _TCellAutoPointer icell;
- if( nPoints == 2 )
- {
- icell.TakeOwnership( new _TLine );
- icell->SetPointId( 0, ids->GetId( 0 ) );
- icell->SetPointId( 1, ids->GetId( 1 ) );
- }
- else if( nPoints == 3 )
- {
- icell.TakeOwnership( new _TTriangle );
- icell->SetPointId( 0, ids->GetId( 0 ) );
- icell->SetPointId( 1, ids->GetId( 1 ) );
- icell->SetPointId( 2, ids->GetId( 2 ) );
- }
- else if( nPoints > 3 )
- {
- _TPolygon* polygon = new _TPolygon( );
- for( long j = 0; j < nPoints; ++j )
- polygon->AddPointId( ids->GetId( j ) );
- icell.TakeOwnership( polygon );
-
- } // fi
- imesh->SetCell( imesh->GetNumberOfCells( ), icell );
-
- } // elihw
-
- } // fi
-
- } // rof
- this->m_ITK = imesh;
- this->Modified( );
-
- } // fi
- */
+ typedef itk::Mesh< double, 3 > _TMesh;
+ typedef _TMesh::CellType _TCell;
+ typedef _TCell::CellAutoPointer _TCellAutoPointer;
+ typedef itk::LineCell< _TCell > _TLine;
+ typedef itk::TriangleCell< _TCell > _TTriangle;
+ typedef itk::PolygonCell< _TCell > _TPolygon;
+
+ vtkPolyData* mesh = dynamic_cast< vtkPolyData* >( o );
+ if( mesh == NULL )
+ {
+ this->m_ITK = NULL;
+ this->Modified( );
+ return;
+
+ } // fi
+
+ if( this->m_VTK.GetPointer( ) != mesh )
+ {
+ this->m_VTK = mesh;
+
+ // Copy points
+ _TMesh::Pointer imesh = _TMesh::New( );
+ double point[ 3 ];
+ for( long i = 0; i < mesh->GetNumberOfPoints( ); ++i )
+ {
+ mesh->GetPoint( i, point );
+ _TMesh::PointType ipoint;
+ ipoint[ 0 ] = point[ 0 ];
+ ipoint[ 1 ] = point[ 1 ];
+ ipoint[ 2 ] = point[ 2 ];
+ imesh->SetPoint( i, ipoint );
+
+ } // rof
+
+ // Copy cells
+ vtkCellArray* arrays[ 4 ];
+ arrays[ 0 ] = mesh->GetLines( );
+ arrays[ 1 ] = mesh->GetPolys( );
+ arrays[ 2 ] = NULL; // TODO: mesh->GetStrips( );
+ arrays[ 3 ] = mesh->GetVerts( );
+
+ for( unsigned int c = 0; c < 4; c++ )
+ {
+ if( arrays[ c ] != NULL )
+ {
+ vtkSmartPointer< vtkIdList > ids =
+ vtkSmartPointer< vtkIdList >::New( );
+ arrays[ c ]->InitTraversal( );
+ while( arrays[ c ]->GetNextCell( ids ) == 1 )
+ {
+ long nPoints = ids->GetNumberOfIds( );
+ _TCellAutoPointer icell;
+ if( nPoints == 2 )
+ {
+ icell.TakeOwnership( new _TLine );
+ icell->SetPointId( 0, ids->GetId( 0 ) );
+ icell->SetPointId( 1, ids->GetId( 1 ) );
+ }
+ else if( nPoints == 3 )
+ {
+ icell.TakeOwnership( new _TTriangle );
+ icell->SetPointId( 0, ids->GetId( 0 ) );
+ icell->SetPointId( 1, ids->GetId( 1 ) );
+ icell->SetPointId( 2, ids->GetId( 2 ) );
+ }
+ else if( nPoints > 3 )
+ {
+ _TPolygon* polygon = new _TPolygon( );
+ for( long j = 0; j < nPoints; ++j )
+ polygon->AddPointId( ids->GetId( j ) );
+ icell.TakeOwnership( polygon );
+
+ } // fi
+ imesh->SetCell( imesh->GetNumberOfCells( ), icell );
+
+ } // elihw
+
+ } // fi
+
+ } // rof
+ this->m_ITK = imesh;
+ this->Modified( );
+
+ } // fi
}
// -------------------------------------------------------------------------
{
}
+// -------------------------------------------------------------------------
+template< class _TMesh >
+void cpPlugins::DataObjects::Mesh::
+_ITK_2_VTK( _TMesh* mesh )
+{
+ long numPoints = mesh->GetNumberOfPoints( );
+ if( numPoints == 0 )
+ return;
+
+ vtkSmartPointer< vtkPoints > vpoints =
+ vtkSmartPointer< vtkPoints >::New( );
+ vpoints->SetNumberOfPoints( numPoints );
+ auto points = mesh->GetPoints( );
+
+ // Copy points
+ vtkIdType VTKId = 0;
+ std::map< vtkIdType, long > IndexMap;
+ for( auto i = points->Begin( ); i != points->End( ); ++i, VTKId++ )
+ {
+ IndexMap[ VTKId ] = i->Index( );
+ if( _TMesh::PointDimension == 2 )
+ vpoints->SetPoint(
+ VTKId,
+ i->Value( )[ 0 ], i->Value( )[ 1 ], 0
+ );
+ else if( _TMesh::PointDimension == 3 )
+ vpoints->SetPoint(
+ VTKId,
+ i->Value( )[ 0 ], i->Value( )[ 1 ], i->Value( )[ 2 ]
+ );
+
+ } // rof
+
+ // Copy cells
+ vtkSmartPointer< vtkCellArray > vcells =
+ vtkSmartPointer< vtkCellArray >::New( );
+ auto cells = mesh->GetCells( );
+ for( auto j = cells->Begin( ); j != cells->End( ); ++j )
+ {
+ auto cell = j->Value( );
+ vcells->InsertNextCell( cell->GetNumberOfPoints( ) );
+ for( auto k = cell->PointIdsBegin( ); k != cell->PointIdsEnd( ); ++k )
+ vcells->InsertCellPoint( IndexMap[ *k ] );
+
+ } // rof
+
+ // Final assignations
+ vtkSmartPointer< vtkPolyData > vmesh =
+ vtkSmartPointer< vtkPolyData >::New( );
+ vmesh->SetPoints( vpoints );
+ vmesh->SetPolys( vcells );
+ this->m_VTK = vmesh;
+ this->Modified( );
+}
+
// eof - $RCSfile$
-Meshes itk::Mesh< #real_types#, #process_dims# >
+Meshes|d itk::Mesh< #real_types#, d >
** eof - $RCSfile$
virtual ~Mesh( );
template< class _TMesh >
- inline void _ITK_2_VTK( _TMesh* mesh );
+ inline void _ITK_2_VTK( _TMesh* mesh );
private:
// Purposely not implemented
} // ecapseman
-#include <cpPlugins/DataObjects/Mesh.hxx>
-
#endif // __cpPlugins__DataObjects__Mesh__h__
// eof - $RCSfile$
+++ /dev/null
-#ifndef __cpPlugins__DataObjects__Mesh__hxx__
-#define __cpPlugins__DataObjects__Mesh__hxx__
-
-// TODO: #include <cpPlugins_Meshes.h>
-#include <vtkCellArray.h>
-#include <vtkPoints.h>
-#include <vtkPolyData.h>
-#include <vtkSmartPointer.h>
-
-// -------------------------------------------------------------------------
-template< class _TMesh >
-void cpPlugins::DataObjects::Mesh::
-_ITK_2_VTK( _TMesh* mesh )
-{
- long numPoints = mesh->GetNumberOfPoints( );
- if( numPoints == 0 )
- return;
-
- vtkSmartPointer< vtkPoints > vpoints =
- vtkSmartPointer< vtkPoints >::New( );
- vpoints->SetNumberOfPoints( numPoints );
- auto points = mesh->GetPoints( );
-
- // Copy points
- vtkIdType VTKId = 0;
- std::map< vtkIdType, long > IndexMap;
- for( auto i = points->Begin( ); i != points->End( ); ++i, VTKId++ )
- {
- IndexMap[ VTKId ] = i->Index( );
- if( _TMesh::PointDimension == 2 )
- vpoints->SetPoint(
- VTKId,
- i->Value( )[ 0 ], i->Value( )[ 1 ], 0
- );
- else if( _TMesh::PointDimension == 3 )
- vpoints->SetPoint(
- VTKId,
- i->Value( )[ 0 ], i->Value( )[ 1 ], i->Value( )[ 2 ]
- );
-
- } // rof
-
- // Copy cells
- vtkSmartPointer< vtkCellArray > vcells =
- vtkSmartPointer< vtkCellArray >::New( );
- auto cells = mesh->GetCells( );
- for( auto j = cells->Begin( ); j != cells->End( ); ++j )
- {
- auto cell = j->Value( );
- vcells->InsertNextCell( cell->GetNumberOfPoints( ) );
- for( auto k = cell->PointIdsBegin( ); k != cell->PointIdsEnd( ); ++k )
- vcells->InsertCellPoint( IndexMap[ *k ] );
-
- } // rof
-
- // Final assignations
- vtkSmartPointer< vtkPolyData > vmesh =
- vtkSmartPointer< vtkPolyData >::New( );
- vmesh->SetPoints( vpoints );
- vmesh->SetPolys( vcells );
- this->m_VTK = vmesh;
- this->Modified( );
-}
-
-#endif // __cpPlugins__DataObjects__Mesh__hxx__
-
-// eof - $RCSfile$
{
for( auto i = ins.begin( ); i != ins.end( ); ++i )
{
- auto od = orig->GetOutput( *o );
- auto id = dest->GetInput( *i );
- if( od != NULL && od == id )
- conns.push_back(
- std::pair< std::string, std::string >( *o, *i )
- );
+ unsigned int nInputs = dest->GetInputSize( *i );
+ for( unsigned j = 0; j < nInputs; ++j )
+ {
+ auto od = orig->GetOutput( *o );
+ auto id = dest->GetInput( *i, j );
+ if( od != NULL && od == id )
+ conns.push_back(
+ std::pair< std::string, std::string >( *o, *i )
+ );
+
+ } // rof
} // rof
auto od = orig->GetOutput( *oIt );
for( auto iIt = inputs.begin( ); iIt != inputs.end( ); ++iIt )
{
- auto id = dest->GetInput( *iIt );
- if( od != NULL && od == id )
+ unsigned int nInputs = dest->GetInputSize( *iIt );
+ for( unsigned int k = 0; k < nInputs; ++k )
{
- tinyxml2::XMLElement* e_conn = doc->NewElement( "Connection" );
- tinyxml2::XMLElement* e_orig = doc->NewElement( "Origin" );
- tinyxml2::XMLElement* e_dest = doc->NewElement( "Destination" );
- e_orig->SetAttribute( "Filter", orig->GetName( ) );
- e_orig->SetAttribute( "Name", oIt->c_str( ) );
- e_dest->SetAttribute( "Filter", dest->GetName( ) );
- e_dest->SetAttribute( "Name", iIt->c_str( ) );
- e_conn->LinkEndChild( e_orig );
- e_conn->LinkEndChild( e_dest );
- root->LinkEndChild( e_conn );
-
- } // fi
+ auto id = dest->GetInput( *iIt, k );
+ if( od != NULL && od == id )
+ {
+ tinyxml2::XMLElement* e_conn = doc->NewElement( "Connection" );
+ tinyxml2::XMLElement* e_orig = doc->NewElement( "Origin" );
+ tinyxml2::XMLElement* e_dest = doc->NewElement( "Destination" );
+ e_orig->SetAttribute( "Filter", orig->GetName( ) );
+ e_orig->SetAttribute( "Name", oIt->c_str( ) );
+ e_dest->SetAttribute( "Filter", dest->GetName( ) );
+ e_dest->SetAttribute( "Name", iIt->c_str( ) );
+ e_conn->LinkEndChild( e_orig );
+ e_conn->LinkEndChild( e_dest );
+ root->LinkEndChild( e_conn );
+
+ } // fi
+
+ } // rof
} // rof
GenericFilters
#ImageArithmeticFilters
#ImageBooleanFilters
- #ImageDistanceMaps
- ImageGenericFilters
+ ImageDistanceMaps
+ #ImageGenericFilters
#ImageGradientFilters
ImageMeshFilters
ImageSources
IO
MeshFilters
MeshSources
- Widgets
+ #Widgets
)
#IF(ParabolicMorphology_LOADED)
JoinBoundingBoxes( )
: Superclass( )
{
- this->_ConfigureInput( "Input0", true, false );
- this->_ConfigureInput( "Input1", false, false );
- this->_ConfigureInput( "Input2", false, false );
- this->_ConfigureInput( "Input3", false, false );
- this->_ConfigureInput( "Input4", false, false );
- this->_ConfigureInput( "Input5", false, false );
+ this->_ConfigureInput( "Inputs", true, true );
this->_ConfigureOutput< cpPlugins::DataObjects::BoundingBox >( "Output" );
}
{
typedef cpPlugins::BaseObjects::DataObject _TDO;
typedef cpPlugins::DataObjects::BoundingBox _TBB;
- _TDO* dobjs[ 5 ];
-
- auto do0 = dynamic_cast< _TDO* >( this->GetInput( "Input0" ) );
- dobjs[ 0 ] = dynamic_cast< _TDO* >( this->GetInput( "Input1" ) );
- dobjs[ 1 ] = dynamic_cast< _TDO* >( this->GetInput( "Input2" ) );
- dobjs[ 2 ] = dynamic_cast< _TDO* >( this->GetInput( "Input3" ) );
- dobjs[ 3 ] = dynamic_cast< _TDO* >( this->GetInput( "Input4" ) );
- dobjs[ 4 ] = dynamic_cast< _TDO* >( this->GetInput( "Input5" ) );
- auto out = dynamic_cast< _TBB* >( this->GetOutput( "Output" ) );
- out->SetDataObject( do0 );
- for( unsigned int d = 0; d < 5; ++d )
+ auto out = dynamic_cast< _TBB* >( this->GetOutput( "Output" ) );
+ unsigned int nInputs = this->GetInputSize( "Inputs" );
+ for( unsigned int i = 0; i < nInputs; ++i )
{
- if( dobjs[ d ] != NULL )
+ auto in = dynamic_cast< _TDO* >( this->GetInput( "Inputs", i ) );
+ if( i > 0 )
{
_TBB::Pointer bb = _TBB::New( );
- bb->SetDataObject( dobjs[ d ] );
+ bb->SetDataObject( in );
out->Blend( bb );
-
- } // fi
+ }
+ else
+ out->SetDataObject( in );
} // rof
}
class cpPluginsGenericFilters_EXPORT JoinBoundingBoxes
: public cpPlugins::BaseObjects::ProcessObject
{
- cpPluginsObject(
+ cpPluginsObject(
JoinBoundingBoxes,
cpPlugins::BaseObjects::ProcessObject,
GenericFilters
tinclude itk#io#:h|hxx
+cinclude complex
cinclude itk#color_pixels#.h
cinclude itk#vectors#.h
cinclude itk#diff_tensors#.h
cinclude itkSimpleDataObjectDecorator.hxx
instances itk::#io#< itk::Image< #scalar_pixels#, #process_dims# > >
+instances itk::#io#< itk::Image< std::complex< #real_types# >, #process_dims# > >
instances itk::#io#< itk::Image< itk::#color_pixels#< #scalar_pixels# >, #process_dims# > >
instances itk::#io#< itk::Image< itk::#vectors#< #real_types#, #process_dims# >, #process_dims# > >
instances itk::#io#< itk::Image< itk::#diff_tensors#< #real_types# >, 3 > >
}
else if( pt == itk::ImageIOBase::COMPLEX )
{
+#ifdef cpPlugins_CONFIG_INTEGER_TYPES_float
+ if( ct == itk::ImageIOBase::FLOAT ) success = this->_GD1< std::complex< float >, _Dim >( io );
+#endif // cpPlugins_CONFIG_INTEGER_TYPES_float
+#ifdef cpPlugins_CONFIG_INTEGER_TYPES_double
+ if( ct == itk::ImageIOBase::DOUBLE ) success = this->_GD1< std::complex< double >, _Dim >( io );
+#endif // cpPlugins_CONFIG_INTEGER_TYPES_double
}
else if( pt == itk::ImageIOBase::COVARIANTVECTOR )
{
+#ifdef cpPlugins_CONFIG_INTEGER_TYPES_float
+ if( ct == itk::ImageIOBase::FLOAT ) success = this->_GD1< itk::CovariantVector< float, _Dim >, _Dim >( io );
+#endif // cpPlugins_CONFIG_INTEGER_TYPES_float
+#ifdef cpPlugins_CONFIG_INTEGER_TYPES_double
+ if( ct == itk::ImageIOBase::FLOAT ) success = this->_GD1< itk::CovariantVector< double, _Dim >, _Dim >( io );
+#endif // cpPlugins_CONFIG_INTEGER_TYPES_double
}
else if( pt == itk::ImageIOBase::POINT )
{
+#ifdef cpPlugins_CONFIG_INTEGER_TYPES_float
+ if( ct == itk::ImageIOBase::FLOAT ) success = this->_GD1< itk::Point< float, _Dim >, _Dim >( io );
+#endif // cpPlugins_CONFIG_INTEGER_TYPES_float
+#ifdef cpPlugins_CONFIG_INTEGER_TYPES_double
+ if( ct == itk::ImageIOBase::FLOAT ) success = this->_GD1< itk::Point< double, _Dim >, _Dim >( io );
+#endif // cpPlugins_CONFIG_INTEGER_TYPES_double
}
else if( pt == itk::ImageIOBase::VECTOR )
{
+#ifdef cpPlugins_CONFIG_INTEGER_TYPES_float
+ if( ct == itk::ImageIOBase::FLOAT ) success = this->_GD1< itk::Vector< float, _Dim >, _Dim >( io );
+#endif // cpPlugins_CONFIG_INTEGER_TYPES_float
+#ifdef cpPlugins_CONFIG_INTEGER_TYPES_double
+ if( ct == itk::ImageIOBase::FLOAT ) success = this->_GD1< itk::Vector< double, _Dim >, _Dim >( io );
+#endif // cpPlugins_CONFIG_INTEGER_TYPES_double
}
else if( pt == itk::ImageIOBase::SYMMETRICSECONDRANKTENSOR )
{
+#ifdef cpPlugins_CONFIG_INTEGER_TYPES_float
+ if( ct == itk::ImageIOBase::FLOAT ) success = this->_GD1< itk::SymmetricSecondRankTensor< float, _Dim >, _Dim >( io );
+#endif // cpPlugins_CONFIG_INTEGER_TYPES_float
+#ifdef cpPlugins_CONFIG_INTEGER_TYPES_double
+ if( ct == itk::ImageIOBase::FLOAT ) success = this->_GD1< itk::SymmetricSecondRankTensor< double, _Dim >, _Dim >( io );
+#endif // cpPlugins_CONFIG_INTEGER_TYPES_double
}
else if( pt == itk::ImageIOBase::DIFFUSIONTENSOR3D )
{
if( _Dim == 3 )
{
+#ifdef cpPlugins_CONFIG_INTEGER_TYPES_float
+ if( ct == itk::ImageIOBase::FLOAT ) success = this->_GD1< itk::DiffusionTensor3D< float >, _Dim >( io );
+#endif // cpPlugins_CONFIG_INTEGER_TYPES_float
+#ifdef cpPlugins_CONFIG_INTEGER_TYPES_double
+ if( ct == itk::ImageIOBase::FLOAT ) success = this->_GD1< itk::DiffusionTensor3D< double >, _Dim >( io );
+#endif // cpPlugins_CONFIG_INTEGER_TYPES_double
}
else
this->_Error( "DiffusionTensor3D dimension not supported." );
}
else if( pt == itk::ImageIOBase::MATRIX )
{
+#ifdef cpPlugins_CONFIG_INTEGER_TYPES_float
+ if( ct == itk::ImageIOBase::FLOAT ) success = this->_GD1< itk::Matrix< float, _Dim, _Dim >, _Dim >( io );
+#endif // cpPlugins_CONFIG_INTEGER_TYPES_float
+#ifdef cpPlugins_CONFIG_INTEGER_TYPES_double
+ if( ct == itk::ImageIOBase::FLOAT ) success = this->_GD1< itk::Matrix< double, _Dim, _Dim >, _Dim >( io );
+#endif // cpPlugins_CONFIG_INTEGER_TYPES_double
}
else if( pt == itk::ImageIOBase::OFFSET )
{
}
else if( pt == itk::ImageIOBase::FIXEDARRAY )
{
- }
+ } // fi
return( success );
}
-#ifndef __CPPLUGINSIO__IMAGEREADER__H__
-#define __CPPLUGINSIO__IMAGEREADER__H__
+#ifndef __cpPluginsIO__ImageReader__h__
+#define __cpPluginsIO__ImageReader__h__
#include <cpPluginsIO_Export.h>
#include <cpPlugins/BaseObjects/ProcessObject.h>
} // ecapseman
-#endif // __CPPLUGINS__IO__IMAGEREADER__H__
+#endif // __cpPluginsIO__ImageReader__h__
// eof - $RCSfile$
-#ifndef __CPPLUGINSIO__IMAGEREADERQDIALOG__H__
-#define __CPPLUGINSIO__IMAGEREADERQDIALOG__H__
+#ifndef __cpPluginsIO__ImageReaderQDialog__h__
+#define __cpPluginsIO__ImageReaderQDialog__h__
#include <cpPlugins/Config.h>
#endif // cpPlugins_QT4
-#endif // __CPPLUGINS__IO__IMAGEREADERQDIALOG__H__
+#endif // __cpPluginsIO__ImageReaderQDialog__h__
// eof - $RCSfile$
_GenerateData( )
{
auto o = this->GetInputData( "Input" );
- cpPlugins_Demangle_Image_ProcessDims( o, _GD0, );
- cpPlugins_Demangle_Image_DiffTensors3D( o, _GD1, );
- this->_Error( "Invalid input image dimension." );
+ cpPlugins_Demangle_Image_ProcessDims( o, _GD0, )
+ cpPlugins_Demangle_Image_DiffTensors3D( o, _GD1, )
+ this->_Error( "Invalid input image dimension." );
}
// -------------------------------------------------------------------------
void cpPluginsIO::ImageWriter::
_GD0( _TImage* image )
{
- cpPlugins_Demangle_Image_IntPixels( image, _GD1, _TImage::ImageDimension, );
- cpPlugins_Demangle_Image_RealPixels( image, _GD1, _TImage::ImageDimension, );
- cpPlugins_Demangle_Image_ScalarPixels( image, _GD1, _TImage::ImageDimension, );
- cpPlugins_Demangle_Image_ColorPixels( image, _GD1, _TImage::ImageDimension, );
- cpPlugins_Demangle_Image_VectorPixels( image, _GD1, _TImage::ImageDimension, );
- this->_Error( "Invalid input image pixel type." );
+ cpPlugins_Demangle_Image_ScalarPixels( image, _GD1, _TImage::ImageDimension, )
+ cpPlugins_Demangle_Image_ComplexPixels( image, _GD1, _TImage::ImageDimension, )
+ cpPlugins_Demangle_Image_ColorPixels( image, _GD1, _TImage::ImageDimension, )
+ cpPlugins_Demangle_Image_VectorPixels( image, _GD1, _TImage::ImageDimension, )
+ this->_Error( "Invalid input image pixel type." );
}
// -------------------------------------------------------------------------
-#ifndef __CPPLUGINSIO__IMAGEWRITER__H__
-#define __CPPLUGINSIO__IMAGEWRITER__H__
+#ifndef __cpPluginsIO__ImageWriter__h__
+#define __cpPluginsIO__ImageWriter__h__
#include <cpPluginsIO_Export.h>
#include <cpPlugins/BaseObjects/ProcessObject.h>
} // ecapseman
-#endif // __CPPLUGINS__IO__IMAGEWRITER__H__
+#endif // __cpPluginsIO__ImageWriter__h__
// eof - $RCSfile$
-#ifndef __CPPLUGINSIO__IMAGEWRITERQDIALOG__H__
-#define __CPPLUGINSIO__IMAGEWRITERQDIALOG__H__
+#ifndef __cpPluginsIO__ImageWriterQDialog__h__
+#define __cpPluginsIO__ImageWriterQDialog__h__
#include <cpPlugins/Config.h>
#endif // cpPlugins_QT4
-#endif // __CPPLUGINS__IO__IMAGEWRITERQDIALOG__H__
+#endif // __cpPluginsIO__ImageWriterQDialog__h__
// eof - $RCSfile$
#include <IO/MeshWriter.h>
#include <cpPlugins/DataObjects/Mesh.h>
+
+#include <vtkPolyData.h>
#include <vtkPolyDataWriter.h>
// -------------------------------------------------------------------------
MeshWriter( )
: Superclass( )
{
- this->_ConfigureInput< cpPlugins::DataObjects::Mesh >( "Input", true, false );
+ typedef cpPlugins::DataObjects::Mesh _TMesh;
+
+ this->_ConfigureInput< _TMesh >( "Input", true, false );
this->m_Parameters.Clear( );
this->m_Parameters.ConfigureAsSaveFileName( "FileName" );
this->m_Parameters.SetAcceptedFileExtensions(
auto f = this->_CreateVTK< vtkPolyDataWriter >( );
f->SetFileName( this->m_Parameters.GetSaveFileName( "FileName" ).c_str( ) );
f->SetInputData( mesh );
+ f->SetFileTypeToBinary( );
f->Update( );
}
-#ifndef __CPPLUGINSIO__MESHWRITER__H__
-#define __CPPLUGINSIO__MESHWRITER__H__
+#ifndef __cpPluginsIO__MeshWriter__h__
+#define __cpPluginsIO__MeshWriter__h__
#include <cpPluginsIO_Export.h>
#include <cpPlugins/BaseObjects/ProcessObject.h>
} // ecapseman
-#endif // __CPPLUGINS__IO__MESHWRITER__H__
+#endif // __cpPluginsIO__MeshWriter__h__
// eof - $RCSfile$
--- /dev/null
+header #define ITK_MANUAL_INSTANTIATION
+
+define filters=SignedMaurerDistanceMapImageFilter
+define iter=ImageRegionConstIterator;ImageRegionIterator
+
+tinclude itk#filters#:h|hxx
+tinclude itk#iter#:h|h
+
+instances itk::#filters#< itk::Image< #scalar_pixels#, #process_dims# >, itk::Image< #real_types#, #process_dims# > >
+
+** eof - $RCSfile$
-#include <plugins/ImageDistanceMaps/SignedMaurerDistanceMapImageFilter.h>
+#include <ImageDistanceMaps/SignedMaurerDistanceMapImageFilter.h>
#include <cpPlugins/DataObjects/Image.h>
+#include <cpPlugins/DataObjects/Image_Demanglers.h>
-#include <cpPlugins_ImageIterators.h>
#include <itkSignedMaurerDistanceMapImageFilter.h>
-#include <itkSignedMaurerDistanceMapImageFilter.hxx>
-#include <itkBinaryContourImageFilter.hxx>
-#include <itkBinaryThresholdImageFilter.hxx>
-#include <itkUnaryFunctorImageFilter.hxx>
// -------------------------------------------------------------------------
cpPluginsImageDistanceMaps::SignedMaurerDistanceMapImageFilter::
SignedMaurerDistanceMapImageFilter( )
: Superclass( )
{
- this->_ConfigureInput< cpPlugins::DataObjects::Image >( "Input", true, false );
- this->_ConfigureOutput< cpPlugins::DataObjects::Image >( "Output" );
+ typedef cpPlugins::DataObjects::Image _TImage;
+
+ this->_ConfigureInput< _TImage >( "Input", true, false );
+ this->_ConfigureOutput< _TImage >( "Output" );
this->m_Parameters.ConfigureAsReal( "BackgroundValue" );
this->m_Parameters.ConfigureAsBool( "InsideIsPositive" );
this->m_Parameters.ConfigureAsBool( "UseImageSpacing" );
std::vector< std::string > choices;
+#ifdef cpPlugins_CONFIG_REAL_TYPES_float
choices.push_back( "float" );
+#endif // cpPlugins_CONFIG_REAL_TYPES_float
+#ifdef cpPlugins_CONFIG_REAL_TYPES_double
choices.push_back( "double" );
+#endif // cpPlugins_CONFIG_REAL_TYPES_double
this->m_Parameters.ConfigureAsChoices( "OutputResolution", choices );
this->m_Parameters.SetReal( "BackgroundValue", 0 );
this->m_Parameters.SetBool( "InsideIsPositive", true );
this->m_Parameters.SetBool( "SquaredDistance", false );
this->m_Parameters.SetBool( "UseImageSpacing", true );
- this->m_Parameters.SetSelectedChoice( "OutputResolution", "float" );
}
// -------------------------------------------------------------------------
_GenerateData( )
{
auto o = this->GetInputData( "Input" );
- cpPlugins_Demangle_ImageScalars( o, _GD0, 2 );
- else cpPlugins_Demangle_ImageScalars( o, _GD0, 3 );
- else this->_Error( "Invalid input image." );
+ cpPlugins_Demangle_Image_ProcessDims( o, _GD0, )
+ this->_Error( "Invalid input image dimension." );
}
// -------------------------------------------------------------------------
void cpPluginsImageDistanceMaps::SignedMaurerDistanceMapImageFilter::
_GD0( _TImage* image )
{
- typedef itk::Image< float, _TImage::ImageDimension > _TFDmap;
- typedef itk::Image< double, _TImage::ImageDimension > _TDDmap;
+ cpPlugins_Demangle_Image_ScalarPixels( image, _GD1, _TImage::ImageDimension, )
+ this->_Error( "Invalid input image pixel type." );
+}
+// -------------------------------------------------------------------------
+template< class _TImage >
+void cpPluginsImageDistanceMaps::SignedMaurerDistanceMapImageFilter::
+_GD1( _TImage* image )
+{
std::string out_res =
this->m_Parameters.GetSelectedChoice( "OutputResolution" );
- if( out_res == "float" ) this->_GD1< _TImage, _TFDmap >( image );
- else if( out_res == "double" ) this->_GD1< _TImage, _TDDmap >( image );
- else this->_Error( "Output resolution not supported." );
+#ifdef cpPlugins_CONFIG_REAL_TYPES_float
+ if( out_res == "float" ) this->_GD2< _TImage, float >( image );
+#endif // cpPlugins_CONFIG_REAL_TYPES_float
+#ifdef cpPlugins_CONFIG_REAL_TYPES_double
+ if( out_res == "double" ) this->_GD2< _TImage, double >( image );
+#endif // cpPlugins_CONFIG_REAL_TYPES_double
}
// -------------------------------------------------------------------------
-template< class _TImage, class _TDMap >
+template< class _TImage, class _TScalar >
void cpPluginsImageDistanceMaps::SignedMaurerDistanceMapImageFilter::
-_GD1( _TImage* image )
+_GD2( _TImage* image )
{
+ typedef itk::Image< _TScalar, _TImage::ImageDimension > _TDMap;
typedef
itk::SignedMaurerDistanceMapImageFilter< _TImage, _TDMap >
_TFilter;
#ifndef __cpPluginsImageDistanceMaps__SignedMaurerDistanceMapImageFilter__h__
#define __cpPluginsImageDistanceMaps__SignedMaurerDistanceMapImageFilter__h__
-#include <plugins/cpPluginsImageDistanceMaps_Export.h>
+#include <cpPluginsImageDistanceMaps_Export.h>
#include <cpPlugins/BaseObjects/ProcessObject.h>
namespace cpPluginsImageDistanceMaps
protected:
template< class _TImage >
- inline void _GD0( _TImage* image );
+ inline void _GD0( _TImage* image );
- template< class _TImage, class _TDMap >
- inline void _GD1( _TImage* image );
+ template< class _TImage >
+ inline void _GD1( _TImage* image );
+
+ template< class _TImage, class _TScalar >
+ inline void _GD2( _TImage* image );
};
} // ecapseman
MarchingCubes( )
: Superclass( )
{
- this->_ConfigureInput< cpPlugins::DataObjects::Image >( "Input", true, false );
- this->_ConfigureOutput< cpPlugins::DataObjects::Mesh >( "Output" );
+ typedef cpPlugins::DataObjects::Image _TImage;
+ typedef cpPlugins::DataObjects::Mesh _TMesh;
+
+ this->_ConfigureInput< _TImage >( "Input", true, false );
+ this->_ConfigureOutput< _TMesh >( "Output" );
this->m_Parameters.ConfigureAsRealList( "Thresholds" );
}
-#ifndef __CPPLUGINSIMAGEMESH__MARCHINGCUBES__H__
-#define __CPPLUGINSIMAGEMESH__MARCHINGCUBES__H__
+#ifndef __cpPluginsImageMeshFilters__MarchingCubes__h__
+#define __cpPluginsImageMeshFilters__MarchingCubes__h__
#include <cpPluginsImageMeshFilters_Export.h>
#include <cpPlugins/BaseObjects/ProcessObject.h>
} // ecapseman
-#endif // __CPPLUGINSIMAGEMESH__MARCHINGCUBES__H__
+#endif // __cpPluginsImageMeshFilters__MarchingCubes__h__
// eof - $RCSfile$
protected:
template< class _TMesh >
- inline void _GD0_2D( _TMesh* mesh );
+ inline void _GD0_2D( _TMesh* mesh );
template< class _TMesh >
- inline void _GD0_3D( _TMesh* mesh );
+ inline void _GD0_3D( _TMesh* mesh );
};
} // ecapseman
pixels.push_back( "long" );
pixels.push_back( "ulong" );
#endif // cpPlugins_CONFIG_INTEGER_TYPES_long
-#ifdef cpPlugins_CONFIG_INTEGER_TYPES_float
+#ifdef cpPlugins_CONFIG_REAL_TYPES_float
pixels.push_back( "float" );
-#endif // cpPlugins_CONFIG_INTEGER_TYPES_float
-#ifdef cpPlugins_CONFIG_INTEGER_TYPES_double
+#endif // cpPlugins_CONFIG_REAL_TYPES_float
+#ifdef cpPlugins_CONFIG_REAL_TYPES_double
pixels.push_back( "double" );
-#endif // cpPlugins_CONFIG_INTEGER_TYPES_double
+#endif // cpPlugins_CONFIG_REAL_TYPES_double
this->m_Parameters.ConfigureAsChoices( "PixelType", pixels );
std::vector< std::string > dims;
bool success = false;
auto pixel = this->m_Parameters.GetSelectedChoice( "PixelType" );
#ifdef cpPlugins_CONFIG_INTEGER_TYPES_char
- if( pixel == "char" ) success = this->_GD0< char >( );
- if( pixel == "uchar" ) success = this->_GD0< unsigned char >( );
+ if( pixel == "char" ) success = this->_GD0< char >( );
+ if( pixel == "uchar" ) success = this->_GD0< unsigned char >( );
#endif // cpPlugins_CONFIG_INTEGER_TYPES_char
#ifdef cpPlugins_CONFIG_INTEGER_TYPES_short
- if( pixel == "short" ) success = this->_GD0< short >( );
+ if( pixel == "short" ) success = this->_GD0< short >( );
if( pixel == "ushort" ) success = this->_GD0< unsigned short >( );
#endif // cpPlugins_CONFIG_INTEGER_TYPES_short
#ifdef cpPlugins_CONFIG_INTEGER_TYPES_int
- if( pixel == "int" ) success = this->_GD0< int >( );
- if( pixel == "uint" ) success = this->_GD0< unsigned int >( );
+ if( pixel == "int" ) success = this->_GD0< int >( );
+ if( pixel == "uint" ) success = this->_GD0< unsigned int >( );
#endif // cpPlugins_CONFIG_INTEGER_TYPES_int
#ifdef cpPlugins_CONFIG_INTEGER_TYPES_long
- if( pixel == "long" ) success = this->_GD0< long >( );
- if( pixel == "ulong" ) success = this->_GD0< unsigned long >( );
+ if( pixel == "long" ) success = this->_GD0< long >( );
+ if( pixel == "ulong" ) success = this->_GD0< unsigned long >( );
#endif // cpPlugins_CONFIG_INTEGER_TYPES_long
-#ifdef cpPlugins_CONFIG_INTEGER_TYPES_float
- if( pixel == "float" ) success = this->_GD0< float >( );
-#endif // cpPlugins_CONFIG_INTEGER_TYPES_float
-#ifdef cpPlugins_CONFIG_INTEGER_TYPES_double
+#ifdef cpPlugins_CONFIG_REAL_TYPES_float
+ if( pixel == "float" ) success = this->_GD0< float >( );
+#endif // cpPlugins_CONFIG_REAL_TYPES_float
+#ifdef cpPlugins_CONFIG_REAL_TYPES_double
if( pixel == "double" ) success = this->_GD0< double >( );
-#endif // cpPlugins_CONFIG_INTEGER_TYPES_double
+#endif // cpPlugins_CONFIG_REAL_TYPES_double
if( !success )
this->_Error( "Invalid pixel type." );
}
{
typedef cpPlugins::DataObjects::Mesh _TMesh;
- this->_ConfigureInput< _TMesh >( "Input0", true, false );
- this->_ConfigureInput< _TMesh >( "Input1", true, false );
- this->_ConfigureInput< _TMesh >( "Input2", false, false );
- this->_ConfigureInput< _TMesh >( "Input3", false, false );
- this->_ConfigureInput< _TMesh >( "Input4", false, false );
- this->_ConfigureInput< _TMesh >( "Input5", false, false );
+ this->_ConfigureInput< _TMesh >( "Inputs", true, true );
this->_ConfigureOutput< _TMesh >( "Output" );
}
void cpPluginsMeshFilters::AppendMeshesFilter::
_GenerateData( )
{
- auto m0 = this->GetInputData< vtkPolyData >( "Input0" );
- auto m1 = this->GetInputData< vtkPolyData >( "Input1" );
- auto m2 = this->GetInput( "Input2" );
- auto m3 = this->GetInput( "Input3" );
- auto m4 = this->GetInput( "Input4" );
- auto m5 = this->GetInput( "Input5" );
-
- if( m0 == NULL || m1 == NULL )
- this->_Error( "Invalid inputs." );
-
auto filter = this->_CreateVTK< vtkAppendPolyData >( );
- filter->AddInputData( m0 );
- filter->AddInputData( m1 );
- if( m2 != NULL ) filter->AddInputData( m2->GetVTK< vtkPolyData >( ) );
- if( m3 != NULL ) filter->AddInputData( m3->GetVTK< vtkPolyData >( ) );
- if( m4 != NULL ) filter->AddInputData( m4->GetVTK< vtkPolyData >( ) );
- if( m5 != NULL ) filter->AddInputData( m5->GetVTK< vtkPolyData >( ) );
+ unsigned int nInputs = this->GetInputSize( "Inputs" );
+ for( unsigned int i = 0; i < nInputs; ++i )
+ filter->AddInputData( this->GetInputData< vtkPolyData >( "Inputs", i ) );
filter->Update( );
-
this->GetOutput( "Output" )->SetVTK( filter->GetOutput( ) );
}