From: Leonardo Florez-Valencia Date: Mon, 4 Apr 2016 03:03:39 +0000 (-0500) Subject: ... X-Git-Tag: v0.1~212 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=d300d9869563bae0ac020e7ed00a5a9905c897fb;p=cpPlugins.git ... --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 0b47e42..fc58dd7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -35,6 +35,8 @@ INCLUDE_DIRECTORIES( ${PROJECT_BINARY_DIR} ${PROJECT_SOURCE_DIR}/lib ${PROJECT_BINARY_DIR}/lib + ${PROJECT_SOURCE_DIR}/lib/cpPlugins_Instances + ${PROJECT_BINARY_DIR}/lib/cpPlugins_Instances ${PROJECT_SOURCE_DIR}/plugins ${PROJECT_BINARY_DIR}/plugins ${PROJECT_SOURCE_DIR}/lib/third_party diff --git a/appli/bash/cpPlugins_CreateInstances.cxx b/appli/bash/cpPlugins_CreateInstances.cxx index 99eb60e..e9a4590 100644 --- a/appli/bash/cpPlugins_CreateInstances.cxx +++ b/appli/bash/cpPlugins_CreateInstances.cxx @@ -1,25 +1,30 @@ +#include +#include + #include +#include #include -#include -#include -#include #include -#include -#include -#include -#include #include +#include // ------------------------------------------------------------------------- -typedef std::set< std::string > TSet; -typedef std::map< std::string, TSet > TInstances; -typedef std::vector< std::string > TVector; +typedef std::vector< std::string > TLines; +typedef std::map< char, TLines > TParsedLines; +typedef std::map< std::string, TLines > TVariables; // ------------------------------------------------------------------------- -TVector Tokenize( const std::string& str, const std::string& delims ); -TSet Combine( const TSet& X, const TSet& Y ); -void Replace( - std::string& str, const std::string& sub, const std::string& nsub +TLines Tokenize( const std::string& str, const std::string& delims ); +std::string Replace( + const std::string& str, const std::string& sub, const std::string& nsub + ); +bool ReadFile( TParsedLines& lines, const std::string& fname ); +void ExpandGroups( TLines& res, const TLines& lines ); +void ExpandVariables( TLines& res, const TLines& lines, const TVariables& vars ); +void ParseIncludes( TLines& res, const TLines& lines, const std::string& ext ); +void PrintLines( + const std::string& prefix, const std::string& suffix, + const TLines& lines, std::ostream& out ); // ------------------------------------------------------------------------- @@ -29,256 +34,140 @@ int main( int argc, char* argv[] ) { std::cerr << "Usage: " << argv[ 0 ] - << " input_definitions dir library_name header_filename" + << " input_definitions library_name header_file source_file" << std::endl; return( 1 ); } // fi - std::string input_definitions_file_name = argv[ 1 ]; - std::string dir = argv[ 2 ]; - std::string library_name = argv[ 3 ]; - std::string head_fname = argv[ 4 ]; + std::string lname = argv[ 2 ]; - // Load file into a buffer - std::ifstream file_stream( input_definitions_file_name.c_str( ) ); - if( !file_stream ) + // Read file and simple parse it + TParsedLines lines; + if( !ReadFile( lines, argv[ 1 ] ) ) { std::cerr << "Error opening file: \"" - << input_definitions_file_name << "\"" + << argv[ 1 ] << "\"" << std::endl; return( 1 ); } // fi - std::string buf; - file_stream.seekg( 0, std::ios::end ); - buf.reserve( file_stream.tellg( ) ); - file_stream.seekg( 0, std::ios::beg ); - buf.assign( - ( std::istreambuf_iterator< char >( file_stream ) ), - std::istreambuf_iterator< char >( ) - ); - file_stream.close( ); - std::istringstream input_str( buf ); - - // Process file - std::string line; - TVector incl, first_incl; - TInstances instances; - TVector classes; - while( std::getline( input_str, line ) ) - { - if( line[ 0 ] == 'f' ) - { - first_incl.push_back( line.substr( line.find_first_not_of( ' ', 1 ) ) ); - } - else if( line[ 0 ] == 'i' ) - { - incl.push_back( line.substr( line.find_first_not_of( ' ', 1 ) ) ); - } - else if( line[ 0 ] == 'c' ) - { - classes.push_back( line.substr( line.find_first_not_of( ' ', 1 ) ) ); - } - else if( line[ 0 ] == 'a' ) - { - TVector tokens = Tokenize( line, "=" ); - - // Get argument name - TVector arg_tokens = Tokenize( tokens[ 0 ], " " ); - std::string arg = arg_tokens[ 0 ]; - unsigned int i = 0; - while( arg[ 0 ] != '#' && i < arg_tokens.size( ) ) - arg = arg_tokens[ ++i ]; - - // Get values - TVector values_tokens = Tokenize( tokens[ 1 ], ";" ); - for( auto t = values_tokens.begin( ); t != values_tokens.end( ); ++t ) - { - std::string value = t->substr( t->find_first_not_of( ' ' ) ); - unsigned int value_len = value.size( ); - while( value[ value_len - 1 ] == ' ' && value_len > 0 ) - value_len--; - value = value.substr( 0, value_len ); - - if( value == "#integers" ) - { - instances[ arg ].insert( "char" ); - instances[ arg ].insert( "short" ); - instances[ arg ].insert( "int" ); - instances[ arg ].insert( "long" ); - instances[ arg ].insert( "unsigned char" ); - instances[ arg ].insert( "unsigned short" ); - instances[ arg ].insert( "unsigned int" ); - instances[ arg ].insert( "unsigned long" ); - } - else if( value == "#integers_ptr" ) - { - instances[ arg ].insert( "char*" ); - instances[ arg ].insert( "short*" ); - instances[ arg ].insert( "int*" ); - instances[ arg ].insert( "long*" ); - instances[ arg ].insert( "unsigned char*" ); - instances[ arg ].insert( "unsigned short*" ); - instances[ arg ].insert( "unsigned int*" ); - instances[ arg ].insert( "unsigned long*" ); - } - else if( value == "#floats" ) - { - instances[ arg ].insert( "double" ); - instances[ arg ].insert( "float" ); - } - else if( value == "#floats_ptr" ) - { - instances[ arg ].insert( "double*" ); - instances[ arg ].insert( "float*" ); - } - else if( value == "#all_dims" ) - { - instances[ arg ].insert( "1" ); - instances[ arg ].insert( "2" ); - instances[ arg ].insert( "3" ); - instances[ arg ].insert( "4" ); - } - else if( value == "#all_visual_dims" ) - { - instances[ arg ].insert( "2" ); - instances[ arg ].insert( "3" ); - } - else - instances[ arg ].insert( value ); - - } // rof - } // fi - - } // elihw - - // Span all possible types - TVector all_real_classes; - for( auto clsIt = classes.begin( ); clsIt != classes.end( ); ++clsIt ) + // Build definitions + TVariables vars; + for( auto dIt = lines[ 'd' ].begin( ); dIt != lines[ 'd' ].end( ); ++dIt ) { - // Extract types - std::string name = clsIt->substr( clsIt->find_first_not_of( " " ) ); - std::string tok = name; - auto sharpPos = tok.find_first_of( "#" ); - TInstances li; - while( sharpPos != std::string::npos ) - { - tok = tok.substr( sharpPos ); - auto spacePos = tok.find_first_of( " " ); - auto arg = tok.substr( 0, spacePos ); - auto aIt = instances.find( arg ); - if( aIt != instances.end( ) ) - li[ arg ] = aIt->second; - tok = tok.substr( spacePos ); - sharpPos = tok.find_first_of( "#" ); - - } // eliwh - if( li.size( ) > 0 ) - { - // Combine types - TSet combs; - if( li.size( ) > 1 ) - { - auto iIt = li.begin( ); - auto jIt = iIt; - jIt++; - for( ; jIt != li.end( ); ++iIt, ++jIt ) - { - if( iIt == li.begin( ) ) - combs = Combine( iIt->second, jIt->second ); - else - combs = Combine( combs, jIt->second ); - - } // rof - } - else - combs = li.begin( )->second; - - // Write instantiations - for( auto combIt = combs.begin( ); combIt != combs.end( ); ++combIt ) - { - char* buffer = new char[ combIt->size( ) + 1 ]; - std::strcpy( buffer, combIt->c_str( ) ); - buffer[ combIt->size( ) ] = '\0'; - char* tok = std::strtok( buffer, "#" ); - std::map< std::string, std::string > real_instance; - for( auto lIt = li.begin( ); lIt != li.end( ); ++lIt ) - { - real_instance[ lIt->first ] = std::string( tok ); - tok = std::strtok( NULL, "#" ); - - } // rof - delete buffer; - - std::string real_name = name; - auto riIt = real_instance.begin( ); - for( ; riIt != real_instance.end( ); ++riIt ) - Replace( real_name, riIt->first, riIt->second ); - all_real_classes.push_back( real_name ); - - } // rof - } - else - all_real_classes.push_back( name ); + auto tokens = Tokenize( *dIt, "=;" ); + auto tIt = tokens.begin( ); + auto vName = *tIt; + tIt++; + for( ; tIt != tokens.end( ); ++tIt ) + vars[ vName ].push_back( *tIt ); } // rof - // Write files - std::ofstream out_str( head_fname.c_str( ) ); - if( !out_str ) + // First include section + TLines first_includes; + ParseIncludes( first_includes, lines[ 'f' ], "" ); + + TLines normal_includes; + ParseIncludes( normal_includes, lines[ 'i' ], "" ); + + TLines template_includes; + ParseIncludes( template_includes, lines[ 't' ], "" ); + + TLines template_sources; + ParseIncludes( template_sources, lines[ 't' ], "xx" ); + + // Expand groups + TLines classes; + ExpandGroups( classes, lines[ 'c' ] ); + + // Expand variables + TLines real_classes; + ExpandVariables( real_classes, classes, vars ); + + // Prepare precompiler options + TLines global_header; + std::stringstream global_header_stream; + global_header_stream + << "#ifndef __" << lname << "__H__" << std::endl + << "#define __" << lname << "__H__" << std::endl<< std::endl + << "#include " << std::endl << std::endl; + global_header.push_back( global_header_stream.str( ) ); + + TLines macro_header; + std::stringstream macro_header_stream; + macro_header_stream + << "#ifdef " << lname << "_EXPORTS" << std::endl + << "# define " << lname << "_PREFIX template class " + << lname << "_EXPORT" << std::endl + << "#else // " << lname << "_EXPORTS" << std::endl + << "# define " << lname << "_PREFIX extern template class" << std::endl + << "#endif // " << lname << "_EXPORTS" << std::endl; + macro_header.push_back( macro_header_stream.str( ) ); + + TLines end_global_header; + std::stringstream end_global_header_stream; + end_global_header_stream + << "#endif // __" << lname << "__H__" << std::endl; + end_global_header.push_back( end_global_header_stream.str( ) ); + + // Write header file + std::ofstream header_file( argv[ 3 ] ); + if( !header_file ) { - std::cerr << "Error opening file \"" << head_fname << "\"" << std::endl; + std::cerr + << "Error opening \"" << argv[ 3 ] << "\" for writing." << std::endl; return( 1 ); } // fi + PrintLines( "", "", global_header, header_file ); + header_file + << "#include <" << lname << "_Export.h>" << std::endl << std::endl; + PrintLines( "", "", lines[ 'b' ], header_file ); + header_file << std::endl; + PrintLines( "", "", first_includes, header_file ); + PrintLines( "", "", macro_header, header_file ); + PrintLines( "", "", normal_includes, header_file ); + PrintLines( "", "", template_includes, header_file ); + header_file << std::endl << "#ifdef " << lname << "_EXPORTS" << std::endl; + PrintLines( "", "", template_sources, header_file ); + header_file << "#endif // " << lname << "_EXPORTS" << std::endl; + header_file << std::endl; + PrintLines( lname + std::string( "_PREFIX " ), ";", real_classes, header_file ); + header_file << std::endl; + PrintLines( "", "", end_global_header, header_file ); + header_file.close( ); + + // Write source file + std::ofstream source_file( argv[ 4 ] ); + if( !source_file ) + { + std::cerr + << "Error opening \"" << argv[ 3 ] << "\" for writing." << std::endl; + return( 1 ); - out_str << "#ifndef __" << dir << "__" << library_name << "__H__" << std::endl; - out_str << "#define __" << dir << "__" << library_name << "__H__" << std::endl << std::endl; - out_str << "#include <" << dir << "/" << library_name << "_Export.h>" << std::endl; - - // First incl - for( auto inclIt = first_incl.begin( ); inclIt != first_incl.end( ); ++inclIt ) - out_str - << "#include <" << *inclIt << ">" << std::endl; - out_str << std::endl; - - std::string base_name = dir + std::string( "_" ) + library_name; - out_str - << std::endl - << "#ifdef " << base_name << "_EXPORTS" << std::endl - << "# undef ITK_MANUAL_INSTANTIATION" << std::endl - << "# define " << base_name << "_PREFIX template class " << base_name << "_EXPORT" << std::endl - << "#else" << std::endl - << "# define ITK_MANUAL_INSTANTIATION" << std::endl - << "# define " << base_name << "_PREFIX extern template class" << std::endl - << "#endif" << std::endl << std::endl; - - // Incl - for( auto inclIt = incl.begin( ); inclIt != incl.end( ); ++inclIt ) - out_str - << "#include <" << *inclIt << ">" << std::endl; - out_str << std::endl; - - // All classes - for( auto clsIt = all_real_classes.begin( ); clsIt != all_real_classes.end( ); ++clsIt ) - out_str - << base_name << "_PREFIX " << *clsIt << ";" << std::endl; - out_str << std::endl; - - out_str << "#endif // __" << dir << "__" << library_name << "__H__" << std::endl; - out_str << std::endl << "// eof" << std::endl; - - out_str.close( ); - + } // fi + source_file + << "#include \"" << argv[ 3 ] << "\"" << std::endl; + /* TODO + PrintLines( "", "", first_includes, source_file ); + PrintLines( "", "", template_includes, source_file ); + source_file << std::endl; + PrintLines( + std::string( "template class " ) + lname + std::string( "_EXPORT " ), + ";", real_classes, source_file + ); + */ + source_file.close( ); return( 0 ); } // ------------------------------------------------------------------------- -TVector Tokenize( const std::string& str, const std::string& delims ) +TLines Tokenize( const std::string& str, const std::string& delims ) { - TVector tokens; + TLines tokens; if( str.size( ) > 0 ) { char* buffer = new char[ str.size( ) + 1 ]; @@ -298,37 +187,163 @@ TVector Tokenize( const std::string& str, const std::string& delims ) } // ------------------------------------------------------------------------- -TSet Combine( const TSet& X, const TSet& Y ) +std::string Replace( + const std::string& str, const std::string& sub, const std::string& nsub + ) +{ + std::string res = str; + size_t index = 0; + while( true ) + { + index = res.find( sub, index ); + if( index == std::string::npos ) break; + res.replace( index, sub.size( ), nsub ); + index += sub.size( ); + + } // elihw + return( res ); +} + +// ------------------------------------------------------------------------- +bool ReadFile( TParsedLines& lines, const std::string& fname ) { - TSet Z; - for( auto xIt = X.begin( ); xIt != X.end( ); ++xIt ) + // Load file into a string stream + std::ifstream file_stream( fname.c_str( ) ); + if( !file_stream ) + return( false ); + std::string buffer; + file_stream.seekg( 0, std::ios::end ); + buffer.reserve( file_stream.tellg( ) ); + file_stream.seekg( 0, std::ios::beg ); + buffer.assign( + ( std::istreambuf_iterator< char >( file_stream ) ), + std::istreambuf_iterator< char >( ) + ); + file_stream.close( ); + std::istringstream input_stream( buffer ); + + // Read line by line + std::string line; + while( std::getline( input_stream, line ) ) { - for( auto yIt = Y.begin( ); yIt != Y.end( ); ++yIt ) + auto cmd_pos = line.end( ); + auto arg_pos = line.end( ); + auto lIt = line.begin( ); + while( lIt != line.end( ) ) { - std::stringstream val; - val << *xIt << "#" << *yIt; - Z.insert( val.str( ) ); + if( !std::isblank( *lIt ) ) + { + if( cmd_pos == line.end( ) ) + { + cmd_pos = lIt; + ++lIt; + } + else if( arg_pos == line.end( ) ) + { + arg_pos = lIt; + lIt = line.end( ); + + } // fi + } + else + ++lIt; + + } // elihw + char cmd = *cmd_pos; + std::string arg; + arg.resize( line.end( ) - arg_pos ); + std::copy( arg_pos, line.end( ), arg.begin( ) ); + lines[ cmd ].push_back( arg ); + + } // elihw + return( true ); +} - } // rof +// ------------------------------------------------------------------------- +void ExpandGroups( TLines& res, const TLines& lines ) +{ + for( auto lIt = lines.begin( ); lIt != lines.end( ); ++lIt ) + { + auto b_pos = lIt->find( "#{" ); + if( b_pos != std::string::npos ) + { + auto e_pos = lIt->find( "}" ); + auto expansion = lIt->substr( b_pos + 2, e_pos - b_pos - 2 ); + auto tokens = Tokenize( expansion, ";" ); + for( auto tIt = tokens.begin( ); tIt != tokens.end( ); ++tIt ) + *tIt = lIt->substr( 0, b_pos ) + *tIt + lIt->substr( e_pos + 1 ); + ExpandGroups( res, tokens ); + } + else + res.push_back( *lIt ); } // rof - return( Z ); } // ------------------------------------------------------------------------- -void Replace( - std::string& str, const std::string& sub, const std::string& nsub - ) +void ExpandVariables( TLines& res, const TLines& lines, const TVariables& vars ) { - size_t index = 0; - while( true ) + const char* int_types[] = { "char", "short", "int", "long" }; + const char* float_types[] = { "float", "double" }; + unsigned int n_int_types = 4, n_float_types = 2; + for( auto lIt = lines.begin( ); lIt != lines.end( ); ++lIt ) { - index = str.find( sub, index ); - if( index == std::string::npos ) break; - str.replace( index, sub.size( ), nsub ); - index += sub.size( ); + auto b_pos = lIt->find( "#" ); + if( b_pos != std::string::npos ) + { + auto tokens = Tokenize( lIt->substr( b_pos ), " ,;:{}[]()\"$&<>" ); + std::string cmd = tokens[ 0 ]; + if( + cmd == "#int_types" || cmd == "#uint_types" || cmd == "#float_types" + ) + { + const char** types = ( cmd == "#float_types" )? float_types: int_types; + unsigned int size = ( cmd == "#float_types" )? n_float_types: n_int_types; + std::string ustr = ( ( cmd == "#uint_types" )? "unsigned ": "" ); + TLines new_res; + for( unsigned int i = 0; i < size; ++i ) + new_res.push_back( Replace( *lIt, cmd, ustr + types[ i ] ) ); + ExpandVariables( res, new_res, vars ); + } + else + { + auto vIt = vars.find( cmd ); + if( vIt != vars.end( ) ) + { + TLines new_res; + for( + auto wIt = vIt->second.begin( ); wIt != vIt->second.end( ); ++wIt + ) + new_res.push_back( Replace( *lIt, cmd, *wIt ) ); + ExpandVariables( res, new_res, vars ); - } // elihw + } // fi + + } // fi + } + else + res.push_back( *lIt ); + + } // rof +} + +// ------------------------------------------------------------------------- +void ParseIncludes( TLines& res, const TLines& lines, const std::string& ext ) +{ + for( auto lIt = lines.begin( ); lIt != lines.end( ); ++lIt ) + res.push_back( + std::string( "#include <" ) + *lIt + ext + std::string( ">" ) + ); +} + +// ------------------------------------------------------------------------- +void PrintLines( + const std::string& prefix, const std::string& suffix, + const TLines& lines, std::ostream& out + ) +{ + for( auto i = lines.begin( ); i != lines.end( ); ++i ) + out << prefix << *i << suffix << std::endl; } // eof - $RCSfile$ diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index c1d958e..a40928e 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -2,7 +2,7 @@ SUBDIRS( ItkVtkGlue third_party cpExtensions - cpPlugins_ITKInstances + cpPlugins_Instances cpPlugins ) IF(USE_QT4) diff --git a/lib/cpPlugins/CMakeLists.txt b/lib/cpPlugins/CMakeLists.txt index 8cf91bd..fc2f2a7 100644 --- a/lib/cpPlugins/CMakeLists.txt +++ b/lib/cpPlugins/CMakeLists.txt @@ -83,14 +83,14 @@ SET( SET( target_LIBRARIES + cpPlugins_Base + cpPlugins_Image + cpPlugins_Mesh + cpPlugins_ImageFiltersBase + cpPlugins_ImageIO + cpPlugins_ImageIterators + cpPlugins_ImageITK2VTK cpPlugins_tinyxml2 - cpPlugins_ITKInstances_Base - cpPlugins_ITKInstances_Image - cpPlugins_ITKInstances_ImageIterators - cpPlugins_ITKInstances_ImageFilters - cpPlugins_ITKInstances_Paths - cpPlugins_ITKInstances_Mesh - ${VTK_LIBRARIES} ) IF(NOT WIN32) SET( diff --git a/lib/cpPlugins/Config.h.in b/lib/cpPlugins/Config.h.in index f33375a..6cec4ad 100644 --- a/lib/cpPlugins/Config.h.in +++ b/lib/cpPlugins/Config.h.in @@ -2,6 +2,7 @@ #define __CPPLUGINS__CONFIG__H__ #include +#include #include /* @@ -21,7 +22,6 @@ * ========================================================================= */ -#define ITK_MANUAL_INSTANTIATION #define cpPlugins_CONFIG_FILE "plugins.cfg" #define cpPlugins_QT4_USED @QT4_FOUND@ diff --git a/lib/cpPlugins/Image.hxx b/lib/cpPlugins/Image.hxx index 6caf7f0..1378dc8 100644 --- a/lib/cpPlugins/Image.hxx +++ b/lib/cpPlugins/Image.hxx @@ -1,7 +1,7 @@ #ifndef __CPPLUGINS__IMAGE__HXX__ #define __CPPLUGINS__IMAGE__HXX__ -#include +#include // ------------------------------------------------------------------------- template< unsigned int D > diff --git a/lib/cpPlugins_Config.h b/lib/cpPlugins_Config.h index 6b245b1..84314e8 100644 --- a/lib/cpPlugins_Config.h +++ b/lib/cpPlugins_Config.h @@ -3,6 +3,8 @@ #include +#define ITK_MANUAL_INSTANTIATION + #ifndef ITK_DELETE_FUNCTION # define ITK_DELETE_FUNCTION #endif // ITK_DELETE_FUNCTION diff --git a/lib/cpPlugins_ITKInstances/Base.cxx b/lib/cpPlugins_ITKInstances/Base.cxx deleted file mode 100644 index ab20534..0000000 --- a/lib/cpPlugins_ITKInstances/Base.cxx +++ /dev/null @@ -1,34 +0,0 @@ -#include - -// ------------------------------------------------------------------------- -#define cpPlugins_ITKInstances_Base_ostream( O, T, D ) \ - template cpPlugins_ITKInstances_Base_EXPORT std::ostream& operator<< < T, D >( std::ostream& o, const O< T, D >& r ) - -namespace itk -{ - cpPlugins_ITKInstances_Base_ostream( FixedArray, float, 2 ); - cpPlugins_ITKInstances_Base_ostream( FixedArray, double, 2 ); - cpPlugins_ITKInstances_Base_ostream( FixedArray, float, 3 ); - cpPlugins_ITKInstances_Base_ostream( FixedArray, double, 3 ); - - cpPlugins_ITKInstances_Base_ostream( Point, float, 1 ); - cpPlugins_ITKInstances_Base_ostream( Vector, float, 1 ); - cpPlugins_ITKInstances_Base_ostream( Point, double, 1 ); - cpPlugins_ITKInstances_Base_ostream( Vector, double, 1 ); - cpPlugins_ITKInstances_Base_ostream( Point, float, 2 ); - cpPlugins_ITKInstances_Base_ostream( Vector, float, 2 ); - cpPlugins_ITKInstances_Base_ostream( Point, double, 2 ); - cpPlugins_ITKInstances_Base_ostream( Vector, double, 2 ); - cpPlugins_ITKInstances_Base_ostream( Point, float, 3 ); - cpPlugins_ITKInstances_Base_ostream( Vector, float, 3 ); - cpPlugins_ITKInstances_Base_ostream( Point, double, 3 ); - cpPlugins_ITKInstances_Base_ostream( Vector, double, 3 ); - cpPlugins_ITKInstances_Base_ostream( Point, float, 4 ); - cpPlugins_ITKInstances_Base_ostream( Vector, float, 4 ); - cpPlugins_ITKInstances_Base_ostream( Point, double, 4 ); - cpPlugins_ITKInstances_Base_ostream( Vector, double, 4 ); -} - -// ...aaand that's all folks! - -// eof - $RCSfile$ diff --git a/lib/cpPlugins_ITKInstances/Base_explicit_description.txt b/lib/cpPlugins_ITKInstances/Base_explicit_description.txt deleted file mode 100644 index 92aa6ab..0000000 --- a/lib/cpPlugins_ITKInstances/Base_explicit_description.txt +++ /dev/null @@ -1,54 +0,0 @@ -f cpPlugins_Config.h -i complex -i map -i string -i vector -i itkArray.h -i itkArray2D.h -i itkConvertPixelBuffer.h -i itkDefaultConvertPixelTraits.h -i itkFixedArray.h -i itkImportImageContainer.h -i itkIndex.h -i itkMatrix.h -i itkPoint.h -i itkCovariantVector.h -i itkVector.h -i itkRGBPixel.h -i itkRGBAPixel.h -i itkSimpleDataObjectDecorator.h -i itkDataObjectDecorator.h -i itkAffineTransform.h -i itkTransform.h -c itk::Array< #1 > -c itk::FixedArray< #1 , #2 > -c itk::FixedArray< float , 6 > -c itk::FixedArray< double , 6 > -c itk::Point< #5 , #2 > -c itk::Vector< #5 , #2 > -c itk::CovariantVector< #5 , #2 > -c itk::Matrix< #5 , #2 , #2 > -c #7 < #1 > -c itk::Array2D < #5 > -c itk::Transform < #5 , #2 , #2 > -c itk::DataObjectDecorator< itk::Transform < #5 , #2 , #2 > > -c itk::SimpleDataObjectDecorator< #1 > -c itk::SimpleDataObjectDecorator< #3 > -c itk::SimpleDataObjectDecorator< std::vector< itk::Index< #6 > > > -c itk::SimpleDataObjectDecorator< std::vector< itk::Point< #5 , #6 > > > -c itk::SimpleDataObjectDecorator< itk::Array< #1 > > -c itk::ConvertPixelBuffer< #1 , #4 , itk::DefaultConvertPixelTraits< #4 > > -c itk::ConvertPixelBuffer< #1 , std::complex< #5 > , itk::DefaultConvertPixelTraits< std::complex< #5 > > > -c itk::ConvertPixelBuffer< #1 , #7 < #4 > , itk::DefaultConvertPixelTraits< #7 < #4 > > > -c itk::ImportImageContainer< unsigned long , #1 > -c itk::ImportImageContainer< unsigned long , std::complex< #5 > > -c itk::ImportImageContainer< unsigned long , #7 < #1 > > -c itk::ImportImageContainer< unsigned long , #8 < #5 , #2 > > -a #1 = #integers;#floats -a #2 = #all_dims -a #3 = bool;std::string -a #4 = #integers;#floats -a #5 = #floats -a #6 = #all_visual_dims -a #7 = itk::RGBPixel;itk::RGBAPixel -a #8 = itk::Vector;itk::CovariantVector diff --git a/lib/cpPlugins_ITKInstances/CMakeLists.txt b/lib/cpPlugins_ITKInstances/CMakeLists.txt deleted file mode 100644 index 76bf738..0000000 --- a/lib/cpPlugins_ITKInstances/CMakeLists.txt +++ /dev/null @@ -1,99 +0,0 @@ -SET(lib_DIR cpPlugins_ITKInstances) -SET(target_LIBRARIES ${ITK_LIBRARIES} ${VTK_LIBRARIES}) -SET( - libs_SOURCES - Base - Image - ImageIterators - ImageFilters - Paths - Mesh - ) -FOREACH(lib_SRC ${libs_SOURCES}) - SET(desc_NAME "${lib_SRC}_explicit_description.txt") - SET(header_NAME "${CMAKE_CURRENT_BINARY_DIR}/${lib_SRC}.h") - SET(source_NAME "${lib_SRC}.cxx") - SET(lib_NAME cpPlugins_ITKInstances_${lib_SRC}) - ADD_CUSTOM_COMMAND( - OUTPUT ${header_NAME} - DEPENDS cpPlugins_CreateInstances ${desc_NAME} - COMMAND cpPlugins_CreateInstances ${CMAKE_CURRENT_SOURCE_DIR}/${desc_NAME} ${lib_DIR} ${lib_SRC} ${header_NAME} - ) - ADD_LIBRARY(${lib_NAME} SHARED ${source_NAME} ${header_NAME}) - SET_TARGET_PROPERTIES( - ${lib_NAME} PROPERTIES - VERSION "${prj_VER}" - SOVERSION "${prj_sVER}" - ) - GENERATE_EXPORT_HEADER( - ${lib_NAME} - BASE_NAME ${lib_NAME} - EXPORT_MACRO_NAME ${lib_NAME}_EXPORT - EXPORT_FILE_NAME ${PROJECT_BINARY_DIR}/lib/${lib_DIR}/${lib_SRC}_Export.h - STATIC_DEFINE ${lib_NAME}_BUILT_AS_STATIC - ) -ENDFOREACH(lib_SRC) -TARGET_LINK_LIBRARIES( - cpPlugins_ITKInstances_Base - ${target_LIBRARIES} - ) -TARGET_LINK_LIBRARIES( - cpPlugins_ITKInstances_Image - cpPlugins_ITKInstances_Base - ) -TARGET_LINK_LIBRARIES( - cpPlugins_ITKInstances_ImageIterators - cpPlugins_ITKInstances_Image - ) -TARGET_LINK_LIBRARIES( - cpPlugins_ITKInstances_ImageFilters - cpPlugins_ITKInstances_ImageIterators - ) -TARGET_LINK_LIBRARIES( - cpPlugins_ITKInstances_Paths - cpPlugins_ITKInstances_Base - ) -TARGET_LINK_LIBRARIES( - cpPlugins_ITKInstances_Mesh - cpPlugins_ITKInstances_Base - ) - -# # =================================== -# # = Integrate all source file names = -# # =================================== - -# SET( -# lib_HEADERS -# ${lib_HEADERS_H} -# ${lib_HEADERS_HPP} -# ${lib_HEADERS_HXX} -# ) - -# SET( -# lib_SOURCES -# ${lib_SOURCES_C} -# ${lib_SOURCES_CPP} -# ${lib_SOURCES_CXX} -# ) - -# ## ===================== -# ## = Compilation rules = -# ## ===================== - -# ## ======================== -# ## == Installation rules == -# ## ======================== - -# INSTALL( -# TARGETS ${lib_NAME} -# RUNTIME DESTINATION bin -# LIBRARY DESTINATION lib -# ARCHIVE DESTINATION lib/static -# ) -# INSTALL( -# FILES -# ${lib_HEADERS} -# DESTINATION include/${lib_DIR} -# ) - -# ## eof - $RCSfile$ diff --git a/lib/cpPlugins_ITKInstances/Image.cxx b/lib/cpPlugins_ITKInstances/Image.cxx deleted file mode 100644 index 4d9976f..0000000 --- a/lib/cpPlugins_ITKInstances/Image.cxx +++ /dev/null @@ -1,18 +0,0 @@ -#include -#include - -// ------------------------------------------------------------------------- -#define cpPlugins_ITKInstances_Image_ImageRegion( D ) \ - template cpPlugins_ITKInstances_Image_EXPORT std::ostream& operator<< < D >( std::ostream& o, const itk::ImageRegion< D >& r ) - -namespace itk -{ - cpPlugins_ITKInstances_Image_ImageRegion( 1 ); - cpPlugins_ITKInstances_Image_ImageRegion( 2 ); - cpPlugins_ITKInstances_Image_ImageRegion( 3 ); - cpPlugins_ITKInstances_Image_ImageRegion( 4 ); -} - -// ...aaand that's all folks! - -// eof - $RCSfile$ diff --git a/lib/cpPlugins_ITKInstances/ImageFilters.cxx b/lib/cpPlugins_ITKInstances/ImageFilters.cxx deleted file mode 100644 index 5e33701..0000000 --- a/lib/cpPlugins_ITKInstances/ImageFilters.cxx +++ /dev/null @@ -1,5 +0,0 @@ -#include - -// ...aaand that's all folks! - -// eof - $RCSfile$ diff --git a/lib/cpPlugins_ITKInstances/ImageFilters_explicit_description.txt b/lib/cpPlugins_ITKInstances/ImageFilters_explicit_description.txt deleted file mode 100644 index 88ed85c..0000000 --- a/lib/cpPlugins_ITKInstances/ImageFilters_explicit_description.txt +++ /dev/null @@ -1,19 +0,0 @@ -f cpPlugins_ITKInstances/ImageIterators.h -i itkImageSource.h -i itkImageToImageFilter.h -i itkInPlaceImageFilter.h -i itkImageTransformer.h -c itk::ImageSource< itk::Image< #1 , #2 > > -c itk::ImageSource< itk::Image< std::complex< #3 > , #2 > > -c itk::ImageSource< itk::Image< #5 < #1 > , #2 > > -c itk::ImageToImageFilter< itk::Image< #1 , #2 > , itk::Image< #4 , #2 > > -c itk::ImageToImageFilter< itk::Image< #1 , 2 > , itk::Image< #1 , 3 > > -c itk::ImageToImageFilter< itk::Image< #1 , 3 > , itk::Image< #1 , 2 > > -c itk::InPlaceImageFilter< itk::Image< #1 , #2 > , itk::Image< #4 , #2 > > -c itk::InPlaceImageFilter< itk::Image< #1 , 3 > , itk::Image< #1 , 2 > > -c itk::ImageTransformer< itk::Image< #1 , #2 > > -a #1 = #integers;#floats -a #2 = #all_dims -a #3 = #floats -a #4 = #integers;#floats -a #5 = itk::RGBPixel;itk::RGBAPixel diff --git a/lib/cpPlugins_ITKInstances/ImageIterators.cxx b/lib/cpPlugins_ITKInstances/ImageIterators.cxx deleted file mode 100644 index 4e1863c..0000000 --- a/lib/cpPlugins_ITKInstances/ImageIterators.cxx +++ /dev/null @@ -1,7 +0,0 @@ -#define ITK_LEGACY_REMOVE - -#include - -// ...aaand that's all folks! - -// eof - $RCSfile$ diff --git a/lib/cpPlugins_ITKInstances/ImageIterators_explicit_description.txt b/lib/cpPlugins_ITKInstances/ImageIterators_explicit_description.txt deleted file mode 100644 index 90d5cdc..0000000 --- a/lib/cpPlugins_ITKInstances/ImageIterators_explicit_description.txt +++ /dev/null @@ -1,29 +0,0 @@ -f cpPlugins_ITKInstances/Image.h -i itkImageConstIteratorWithIndex.h -i itkImageIteratorWithIndex.h -i itkImageLinearConstIteratorWithIndex.h -i itkImageLinearIteratorWithIndex.h -i itkImageRegionConstIterator.h -i itkImageRegionIterator.h -i itkImageRegionConstIteratorWithIndex.h -i itkImageRegionIteratorWithIndex.h -i itkImageScanlineConstIterator.h -i itkImageScanlineIterator.h -i itkConstNeighborhoodIterator.h -i itkNeighborhoodIterator.h -i itkConstShapedNeighborhoodIterator.h -i itkShapedNeighborhoodIterator.h -c #5 < itk::Image< #1 , #2 > > -c #5 < itk::Image< std::complex< #3 >, #2 > > -c #5 < itk::Image< itk::RGBPixel< #1 > , #2 > > -c #5 < itk::Image< itk::RGBAPixel< #1 > , #2 > > -c #4 < itk::Image< #1 , #2 >, itk::Image< #1 , #2 > > -c itk::ConstNeighborhoodIterator< itk::Image< #1 , #2 >, #4 < itk::Image< #1 , #2 >, itk::Image< #1 , #2 > > > -c itk::NeighborhoodIterator< itk::Image< #1 , #2 >, #4 < itk::Image< #1 , #2 >, itk::Image< #1 , #2 > > > -c itk::ConstShapedNeighborhoodIterator< itk::Image< #1 , #2 >, #4 < itk::Image< #1 , #2 >, itk::Image< #1 , #2 > > > -c itk::ShapedNeighborhoodIterator< itk::Image< #1 , #2 >, #4 < itk::Image< #1 , #2 >, itk::Image< #1 , #2 > > > -a #1 = #integers;#floats -a #2 = #all_dims -a #3 = #floats -a #4 = itk::ZeroFluxNeumannBoundaryCondition -a #5 = itk::ImageRegionConstIterator;itk::ImageRegionIterator;itk::ImageRegionConstIteratorWithIndex;itk::ImageRegionIteratorWithIndex;itk::ImageConstIteratorWithIndex;itk::ImageIteratorWithIndex;itk::ImageLinearConstIteratorWithIndex;itk::ImageLinearIteratorWithIndex;itk::ImageScanlineConstIterator;itk::ImageScanlineIterator diff --git a/lib/cpPlugins_ITKInstances/Image_explicit_description.txt b/lib/cpPlugins_ITKInstances/Image_explicit_description.txt deleted file mode 100644 index 8811f6e..0000000 --- a/lib/cpPlugins_ITKInstances/Image_explicit_description.txt +++ /dev/null @@ -1,25 +0,0 @@ -f cpPlugins_ITKInstances/Base.h -i complex -i itkHistogram.h -i itkHistogramAlgorithmBase.h -i itkImage.h -i itkImageToVTKImageFilter.h -i itkNeighborhood.h -c itk::Neighborhood< #1 , #2 , itk::NeighborhoodAllocator< #1 > > -c itk::Neighborhood< #5 , #2 , itk::NeighborhoodAllocator< #5 > > -c itk::Statistics::Histogram< #1 > -c itk::HistogramAlgorithmBase< itk::Statistics::Histogram< #1 > > -c itk::ImageRegion< #2 > -c itk::Image< #1 , #2 > -c itk::Image< std::complex< #4 > , #2 > -c itk::Image< #6 < #1 > , #2 > -c itk::Image< #7 < #4 , #2 > , #2 > -c itk::ImageToVTKImageFilter< itk::Image< #1 , #3 > > -c itk::ImageToVTKImageFilter< itk::Image< #6 < #1 > , #3 > > -a #1 = #integers;#floats -a #2 = #all_dims -a #3 = #all_visual_dims -a #4 = #floats -a #5 = #integers_ptr;#floats_ptr -a #6 = itk::RGBPixel;itk::RGBAPixel -a #7 = itk::Vector;itk::CovariantVector diff --git a/lib/cpPlugins_ITKInstances/Mesh.cxx b/lib/cpPlugins_ITKInstances/Mesh.cxx deleted file mode 100644 index 1f9b90c..0000000 --- a/lib/cpPlugins_ITKInstances/Mesh.cxx +++ /dev/null @@ -1,5 +0,0 @@ -#include - -// ...aaand that's all folks! - -// eof - $RCSfile$ diff --git a/lib/cpPlugins_ITKInstances/Mesh_explicit_description.txt b/lib/cpPlugins_ITKInstances/Mesh_explicit_description.txt deleted file mode 100644 index dba8916..0000000 --- a/lib/cpPlugins_ITKInstances/Mesh_explicit_description.txt +++ /dev/null @@ -1,17 +0,0 @@ -f cpPlugins_ITKInstances/Base.h -i itkBoundingBox.h -i itkPointSet.h -i itkMesh.h -i itkLineCell.h -i itkPolygonCell.h -i itkTriangleCell.h -c itk::VectorContainer < unsigned long , itk::CellInterface< #1 , itk::CellTraitsInfo< #2 , float , float , unsigned long , unsigned long , unsigned long , itk::Point< float , #2 > , itk::VectorContainer< unsigned long , itk::Point< float , #2 > > , std::set< unsigned long , std::less< unsigned long > , std::allocator< unsigned long > > > >* > -c itk::VectorContainer< unsigned long, itk::Point< #1 , #2 > > -c itk::BoundingBox< unsigned long , #2 , float, itk::VectorContainer< unsigned long , itk::Point< float , #2 > > > -c itk::PointSet< #1 , #2 > -c #4 < #1 , #2 > -c #3 < itk::CellInterface< #1 , itk::CellTraitsInfo< #2 , float , float , unsigned long , unsigned long , unsigned long , itk::Point< float , #2 > , itk::VectorContainer< unsigned long , itk::Point< float , #2 > > , std::set< unsigned long , std::less< unsigned long > , std::allocator< unsigned long > > > > > -a #1 = #floats -a #2 = #all_visual_dims -a #3 = itk::LineCell;itk::PolygonCell;itk::TriangleCell -a #4 = itk::Mesh diff --git a/lib/cpPlugins_ITKInstances/Paths.cxx b/lib/cpPlugins_ITKInstances/Paths.cxx deleted file mode 100644 index e9f63ed..0000000 --- a/lib/cpPlugins_ITKInstances/Paths.cxx +++ /dev/null @@ -1,5 +0,0 @@ -#include - -// ...aaand that's all folks! - -// eof - $RCSfile$ diff --git a/lib/cpPlugins_ITKInstances/Paths_explicit_description.txt b/lib/cpPlugins_ITKInstances/Paths_explicit_description.txt deleted file mode 100644 index b09c8dc..0000000 --- a/lib/cpPlugins_ITKInstances/Paths_explicit_description.txt +++ /dev/null @@ -1,5 +0,0 @@ -f cpPlugins_ITKInstances/Base.h -i itkPolyLineParametricPath.h -c itk::VectorContainer< unsigned int, itk::ContinuousIndex< double, #1 > > -c itk::PolyLineParametricPath< #1 > -a #1 = #all_visual_dims diff --git a/lib/cpPlugins_Instances/Base.i b/lib/cpPlugins_Instances/Base.i new file mode 100644 index 0000000..5495635 --- /dev/null +++ b/lib/cpPlugins_Instances/Base.i @@ -0,0 +1,27 @@ +i string +i vector +i itkIndex.h +t itkArray.h +t itkFixedArray.h +t itkCovariantVector.h +t itkMatrix.h +t itkPoint.h +t itkVector.h +t itkRGBPixel.h +t itkRGBAPixel.h +t itkSimpleDataObjectDecorator.h +t itkVectorContainer.h + +c itk::Array< #scalars > +c itk::FixedArray< #scalars, #dims > +c itk::FixedArray< float, 6 > +c #{itk::CovariantVector;itk::Point;itk::Vector}< #float_types, #dims > +c #{itk::RGBPixel;itk::RGBAPixel}< #scalars > +c itk::Matrix< #float_types, #dims, #dims > +c itk::SimpleDataObjectDecorator< #{#scalars;std::string} > +c itk::SimpleDataObjectDecorator< std::vector< itk::Index< #{2;3} > > > +c itk::SimpleDataObjectDecorator< std::vector< itk::Point< #float_types, #{2;3} > > > +c itk::VectorContainer< unsigned long, itk::Point< #float_types, #dims > > + +d #scalars=#int_types;#uint_types;#float_types +d #dims=1;2;3;4 diff --git a/lib/cpPlugins_Instances/Base_extra.cxx b/lib/cpPlugins_Instances/Base_extra.cxx new file mode 100644 index 0000000..0e1912c --- /dev/null +++ b/lib/cpPlugins_Instances/Base_extra.cxx @@ -0,0 +1,41 @@ +#include +#include + +#include +#include +#include + +#include +#include +#include + +// ------------------------------------------------------------------------- +#define cpPlugins_Base_extra_SimpleArray( V, D ) \ + template cpPlugins_Base_EXPORT \ + std::ostream& itk::operator<< < D >( \ + std::ostream& a, itk::V< D > const& b \ + ) + +cpPlugins_Base_extra_SimpleArray( ImageRegion, 1 ); +cpPlugins_Base_extra_SimpleArray( ImageRegion, 2 ); +cpPlugins_Base_extra_SimpleArray( ImageRegion, 3 ); +cpPlugins_Base_extra_SimpleArray( ImageRegion, 4 ); + +// ------------------------------------------------------------------------- +#define cpPlugins_Base_extra_Array( V, T, D ) \ + template cpPlugins_Base_EXPORT \ + std::ostream& itk::operator<< < T, D >( \ + std::ostream& a, itk::V< T, D > const& b \ + ) + +cpPlugins_Base_extra_Array( Point, double, 1 ); +cpPlugins_Base_extra_Array( Point, double, 2 ); +cpPlugins_Base_extra_Array( Point, double, 3 ); +cpPlugins_Base_extra_Array( Point, double, 4 ); + +cpPlugins_Base_extra_Array( Vector, double, 1 ); +cpPlugins_Base_extra_Array( Vector, double, 2 ); +cpPlugins_Base_extra_Array( Vector, double, 3 ); +cpPlugins_Base_extra_Array( Vector, double, 4 ); + +// eof - $RCSfile$ diff --git a/lib/cpPlugins_Instances/CMakeLists.txt b/lib/cpPlugins_Instances/CMakeLists.txt new file mode 100644 index 0000000..04b61b8 --- /dev/null +++ b/lib/cpPlugins_Instances/CMakeLists.txt @@ -0,0 +1,116 @@ +FILE( + GLOB libs_DEFS RELATIVE + "${CMAKE_CURRENT_SOURCE_DIR}" + "${CMAKE_CURRENT_SOURCE_DIR}/*.i" + ) + +FOREACH(i ${libs_DEFS}) + GET_FILENAME_COMPONENT(l_DEF ${i} NAME_WE) + SET(i_FILE "${CMAKE_CURRENT_SOURCE_DIR}/${l_DEF}.i") + SET(h_FILE "${CMAKE_CURRENT_BINARY_DIR}/${l_DEF}.h") + SET(s_FILE "${CMAKE_CURRENT_BINARY_DIR}/${l_DEF}.cxx") + SET(o_FILE "${CMAKE_CURRENT_SOURCE_DIR}/${l_DEF}_extra.cxx") + SET(l_NAME "cpPlugins_${l_DEF}") + ADD_CUSTOM_COMMAND( + OUTPUT ${h_FILE} ${s_FILE} + DEPENDS cpPlugins_CreateInstances ${i_FILE} + COMMAND cpPlugins_CreateInstances ${i_FILE} ${l_NAME} ${h_FILE} ${s_FILE} + ) + IF(EXISTS ${o_FILE}) + ADD_LIBRARY(${l_NAME} SHARED ${s_FILE} ${o_FILE}) + ELSE(EXISTS ${o_FILE}) + ADD_LIBRARY(${l_NAME} SHARED ${s_FILE}) + ENDIF(EXISTS ${o_FILE}) + SET_TARGET_PROPERTIES( + ${l_NAME} PROPERTIES + VERSION "${prj_VER}" + SOVERSION "${prj_sVER}" + ) + GENERATE_EXPORT_HEADER( + ${l_NAME} + BASE_NAME ${l_NAME} + EXPORT_MACRO_NAME ${l_NAME}_EXPORT + EXPORT_FILE_NAME ${CMAKE_CURRENT_BINARY_DIR}/${l_NAME}_Export.h + STATIC_DEFINE ${l_NAME}_BUILT_AS_STATIC + ) +ENDFOREACH(i) + +## Target links +TARGET_LINK_LIBRARIES( + cpPlugins_Base + ${ITK_LIBRARIES} + ${VTK_LIBRARIES} + ) +TARGET_LINK_LIBRARIES( + cpPlugins_Image + cpPlugins_Base + ) +TARGET_LINK_LIBRARIES( + cpPlugins_Mesh + cpPlugins_Base + ) +TARGET_LINK_LIBRARIES( + cpPlugins_ImageFiltersBase + cpPlugins_Image + ) +TARGET_LINK_LIBRARIES( + cpPlugins_ImageITK2VTK + cpPlugins_ImageFiltersBase + ) +TARGET_LINK_LIBRARIES( + cpPlugins_ImageIterators + cpPlugins_Image + ) +TARGET_LINK_LIBRARIES( + cpPlugins_ImageIO + cpPlugins_ImageFiltersBase + cpPlugins_ImageIterators + ) +TARGET_LINK_LIBRARIES( + cpPlugins_ThresholdFilters + cpPlugins_ImageFiltersBase + ) +TARGET_LINK_LIBRARIES( + cpPlugins_DistanceMapFilters + cpPlugins_ThresholdFilters + ) + +# # =================================== +# # = Integrate all source file names = +# # =================================== + +# SET( +# lib_HEADERS +# ${lib_HEADERS_H} +# ${lib_HEADERS_HPP} +# ${lib_HEADERS_HXX} +# ) + +# SET( +# lib_SOURCES +# ${lib_SOURCES_C} +# ${lib_SOURCES_CPP} +# ${lib_SOURCES_CXX} +# ) + +# ## ===================== +# ## = Compilation rules = +# ## ===================== + +# ## ======================== +# ## == Installation rules == +# ## ======================== + +# INSTALL( +# TARGETS ${l_NAME} +# RUNTIME DESTINATION bin +# LIBRARY DESTINATION lib +# ARCHIVE DESTINATION lib/static +# ) +# INSTALL( +# FILES +# ${lib_HEADERS} +# DESTINATION include/${lib_DIR} +# ) + +## eof - $RCSfile$ diff --git a/lib/cpPlugins_Instances/DistanceMapFilters.i b/lib/cpPlugins_Instances/DistanceMapFilters.i new file mode 100644 index 0000000..0ad35d7 --- /dev/null +++ b/lib/cpPlugins_Instances/DistanceMapFilters.i @@ -0,0 +1,8 @@ +f cpPlugins_Instances/ImageFiltersBase.h +f cpPlugins_Instances/ImageIterators.h +t itkSignedMaurerDistanceMapImageFilter.h + +c itk::SignedMaurerDistanceMapImageFilter< itk::Image< #scalars, #dims >, itk::Image< #float_types, #dims > > + +d #scalars=#int_types;#uint_types;#float_types +d #dims=1;2;3;4 diff --git a/lib/cpPlugins_Instances/Image.i b/lib/cpPlugins_Instances/Image.i new file mode 100644 index 0000000..49c8e3d --- /dev/null +++ b/lib/cpPlugins_Instances/Image.i @@ -0,0 +1,19 @@ +f cpPlugins_Instances/Base.h +i complex +t itkImageRegion.h +t itkImportImageContainer.h +t itkImageBase.h +t itkImage.h + +c itk::ImageRegion< #dims > +c itk::ImportImageContainer< unsigned long, #{#scalars;#colors;#complex} > +c itk::ImportImageContainer< unsigned long, #vectors< #float_types, #dims > > +c itk::ImageBase< #dims > +c itk::Image< #{#scalars;#colors;#complex}, #dims > +c itk::Image< #vectors< #float_types, #dims >, #dims > + +d #scalars=#int_types;#uint_types;#float_types +d #colors=itk::RGBPixel< #scalars >;itk::RGBAPixel< #scalars > +d #complex=std::complex< #float_types > +d #vectors=itk::CovariantVector;itk::Point;itk::Vector +d #dims=1;2;3;4 diff --git a/lib/cpPlugins_Instances/ImageFiltersBase.i b/lib/cpPlugins_Instances/ImageFiltersBase.i new file mode 100644 index 0000000..355cf6c --- /dev/null +++ b/lib/cpPlugins_Instances/ImageFiltersBase.i @@ -0,0 +1,12 @@ +f cpPlugins_Instances/Image.h +t itkImageSource.h +t itkImageToImageFilter.h + +c itk::ImageSource< itk::Image< #{#scalars;#colors;#complex}, #dims > > +c itk::ImageSource< itk::Image< #vectors< #float_types, #dims >, #dims > > + +d #scalars=#int_types;#uint_types;#float_types +d #colors=itk::RGBPixel< #scalars >;itk::RGBAPixel< #scalars > +d #complex=std::complex< #float_types > +d #vectors=itk::CovariantVector;itk::Point;itk::Vector +d #dims=1;2;3;4 diff --git a/lib/cpPlugins_Instances/ImageIO.i b/lib/cpPlugins_Instances/ImageIO.i new file mode 100644 index 0000000..faec127 --- /dev/null +++ b/lib/cpPlugins_Instances/ImageIO.i @@ -0,0 +1,20 @@ +b #include +b #undef ITKIOImageBase_HIDDEN +b #define ITKIOImageBase_HIDDEN +f cpPlugins_Instances/Image.h +t itkImageFileReader.h +t itkImageFileWriter.h +t itkImageSeriesReader.h +t itkConvertPixelBuffer.h +t itkImageAlgorithm.h +i itkImageIOFactory.h +i itkGDCMSeriesFileNames.h + +c #{itk::ImageFileReader;itk::ImageFileWriter;itk::ImageSeriesReader}< itk::Image< #{#scalars;#colors;#complex}, #dims > > +c #{itk::ImageFileReader;itk::ImageFileWriter;itk::ImageSeriesReader}< itk::Image< #vectors< #float_types, #dims >, #dims > > + +d #scalars=#int_types;#uint_types;#float_types +d #colors=itk::RGBPixel< #scalars >;itk::RGBAPixel< #scalars > +d #complex=std::complex< #float_types > +d #vectors=itk::CovariantVector;itk::Point;itk::Vector +d #dims=1;2;3;4 diff --git a/lib/cpPlugins_Instances/ImageITK2VTK.i b/lib/cpPlugins_Instances/ImageITK2VTK.i new file mode 100644 index 0000000..e1451fe --- /dev/null +++ b/lib/cpPlugins_Instances/ImageITK2VTK.i @@ -0,0 +1,14 @@ +f cpPlugins_Instances/Image.h +t itkImageToVTKImageFilter.h +t itkVTKImageToImageFilter.h +t itkVTKImageExport.h +t itkVTKImageImport.h + +c #filters< itk::Image< #{#scalars;#colors}, #dims > > +c #filters< itk::Image< #vectors< #float_types, #dims >, #dims > > + +d #scalars=#int_types;#uint_types;#float_types +d #colors=itk::RGBPixel< #scalars >;itk::RGBAPixel< #scalars > +d #vectors=itk::CovariantVector;itk::Point;itk::Vector +d #dims=2;3 +d #filters=itk::ImageToVTKImageFilter;itk::VTKImageToImageFilter diff --git a/lib/cpPlugins_Instances/ImageIterators.i b/lib/cpPlugins_Instances/ImageIterators.i new file mode 100644 index 0000000..834610c --- /dev/null +++ b/lib/cpPlugins_Instances/ImageIterators.i @@ -0,0 +1,16 @@ +b #define ITK_LEGACY_REMOVE +f cpPlugins_Instances/Image.h +t itkImageRegionConstIterator.h +t itkImageRegionIterator.h +t itkImageScanlineConstIterator.h +t itkImageScanlineIterator.h + +c #iterators< itk::Image< #{#scalars;#colors;#complex}, #dims > > +c #iterators< itk::Image< #vectors< #float_types, #dims >, #dims > > + +d #scalars=#int_types;#uint_types;#float_types +d #colors=itk::RGBPixel< #scalars >;itk::RGBAPixel< #scalars > +d #complex=std::complex< #float_types > +d #vectors=itk::CovariantVector;itk::Point;itk::Vector +d #dims=1;2;3;4 +d #iterators=itk::ImageRegionConstIterator;itk::ImageRegionIterator;itk::ImageScanlineConstIterator;itk::ImageScanlineIterator \ No newline at end of file diff --git a/lib/cpPlugins_Instances/Mesh.i b/lib/cpPlugins_Instances/Mesh.i new file mode 100644 index 0000000..040ddec --- /dev/null +++ b/lib/cpPlugins_Instances/Mesh.i @@ -0,0 +1,10 @@ +f cpPlugins_Instances/Base.h +t itkMesh.h +t itkPointSet.h +t itkBoundingBox.h +t itkMapContainer.h +t itkVectorContainer.h + +c #{itk::PointSet;itk::Mesh}< #float_types, #dims > + +d #dims=2;3 diff --git a/lib/cpPlugins_Instances/ThresholdFilters.i b/lib/cpPlugins_Instances/ThresholdFilters.i new file mode 100644 index 0000000..6a26d1c --- /dev/null +++ b/lib/cpPlugins_Instances/ThresholdFilters.i @@ -0,0 +1,7 @@ +f cpPlugins_Instances/ImageFiltersBase.h +t itkBinaryThresholdImageFilter.h + +c itk::BinaryThresholdImageFilter< itk::Image< #scalars, #dims >, itk::Image< #{unsigned char;#float_types}, #dims > > + +d #scalars=#int_types;#uint_types;#float_types +d #dims=1;2;3;4 diff --git a/plugins/CMakeLists.txt b/plugins/CMakeLists.txt index d39875a..11ab113 100644 --- a/plugins/CMakeLists.txt +++ b/plugins/CMakeLists.txt @@ -1,9 +1,5 @@ SUBDIRS( cpPluginsIO - cpPluginsImageFilters - cpPluginsMeshFilters - cpPluginsImageMeshFilters - cpPluginsVisualization cpPluginsWidgets ) diff --git a/plugins/cpPluginsIO/CMakeLists.txt b/plugins/cpPluginsIO/CMakeLists.txt index 1a8c84d..8fe59cd 100644 --- a/plugins/cpPluginsIO/CMakeLists.txt +++ b/plugins/cpPluginsIO/CMakeLists.txt @@ -5,17 +5,22 @@ SET(lib_DIR cpPluginsIO) ## = 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 "${CMAKE_CURRENT_SOURCE_DIR}/*.h") +FILE(GLOB lib_HEADERS_HPP "${CMAKE_CURRENT_SOURCE_DIR}/*.hpp") +FILE(GLOB lib_HEADERS_HXX "${CMAKE_CURRENT_SOURCE_DIR}/*.hxx") +FILE(GLOB lib_SOURCES_C "${CMAKE_CURRENT_SOURCE_DIR}/*.c") +FILE(GLOB lib_SOURCES_CPP "${CMAKE_CURRENT_SOURCE_DIR}/*.cpp") +FILE(GLOB lib_SOURCES_CXX "${CMAKE_CURRENT_SOURCE_DIR}/*.cxx") # =================================== # = Integrate all source file names = # =================================== +SET( + lib_HOST + ${CMAKE_CURRENT_BINARY_DIR}/${lib_NAME}_Host.cxx + ) + SET( lib_HEADERS ${lib_HEADERS_H} @@ -40,11 +45,11 @@ SET( ## ===================== ADD_CUSTOM_COMMAND( - OUTPUT ${lib_NAME}_Host.cxx + OUTPUT ${lib_HOST} DEPENDS cpPlugins_HostCreator ${LIB_HEADERS_H} - COMMAND cpPlugins_HostCreator ${lib_NAME}_Host.cxx ${lib_HEADERS_H} + COMMAND cpPlugins_HostCreator ${lib_HOST} ${lib_HEADERS_H} ) -ADD_LIBRARY(${lib_NAME} SHARED ${lib_NAME}_Host.cxx ${lib_SOURCES}) +ADD_LIBRARY(${lib_NAME} SHARED ${lib_HOST} ${lib_SOURCES}) SET_TARGET_PROPERTIES( ${lib_NAME} PROPERTIES VERSION "${prj_VER}" diff --git a/plugins/cpPluginsIO/DicomSeriesReader.cxx b/plugins/cpPluginsIO/DicomSeriesReader.cxx index e53e249..019a713 100644 --- a/plugins/cpPluginsIO/DicomSeriesReader.cxx +++ b/plugins/cpPluginsIO/DicomSeriesReader.cxx @@ -16,8 +16,7 @@ #include #include - -#include +#include /** */ diff --git a/plugins/cpPluginsIO/ImageReader.cxx b/plugins/cpPluginsIO/ImageReader.cxx index 7215b10..225bcde 100644 --- a/plugins/cpPluginsIO/ImageReader.cxx +++ b/plugins/cpPluginsIO/ImageReader.cxx @@ -1,11 +1,6 @@ #include #include - -#include -#include -#include -#include -#include +#include // ------------------------------------------------------------------------- cpPluginsIO::ImageReader:: diff --git a/plugins/cpPluginsIO/ImageWriter.cxx b/plugins/cpPluginsIO/ImageWriter.cxx index b14c928..ca4710a 100644 --- a/plugins/cpPluginsIO/ImageWriter.cxx +++ b/plugins/cpPluginsIO/ImageWriter.cxx @@ -1,9 +1,6 @@ #include #include - -#include -#include -#include +#include // ------------------------------------------------------------------------- cpPluginsIO::ImageWriter:: @@ -63,9 +60,11 @@ template< class _TInput > std::string cpPluginsIO::ImageWriter:: _GD1( _TInput* image ) { + typedef itk::ImageFileWriter< _TInput > _TFilter; + if( image == NULL ) return( "IO::ImageWriter: Invalid pixel type." ); - auto f = this->_CreateITK< itk::ImageFileWriter< _TInput > >( ); + auto f = this->_CreateITK< _TFilter >( ); f->SetFileName( this->m_Parameters.GetSaveFileName( "FileName" ) ); f->SetInput( image ); f->Update( );