From e29096b7c37e89da4cda28bde9102cdb9ff159ea Mon Sep 17 00:00:00 2001 From: Leonardo Florez-Valencia Date: Mon, 14 Mar 2016 12:47:59 -0500 Subject: [PATCH] More bugs smashed --- appli/bash/CMakeLists.txt | 1 + appli/bash/cpPlugins_CreateInstances.cxx | 333 ++++++++++++++++++ lib/cpPlugins/CMakeLists.txt | 5 +- lib/cpPlugins/Image.h | 2 +- lib/cpPlugins/Image.hxx | 6 +- lib/cpPlugins_ITKInstances/Base.cxx | 25 +- lib/cpPlugins_ITKInstances/Base.h | 89 ----- .../Base_explicit_description.txt | 41 +++ lib/cpPlugins_ITKInstances/CMakeLists.txt | 147 ++++---- lib/cpPlugins_ITKInstances/Config.h | 21 -- lib/cpPlugins_ITKInstances/Image.cxx | 16 +- lib/cpPlugins_ITKInstances/Image.h | 251 ------------- lib/cpPlugins_ITKInstances/ImageFilters.cxx | 5 + .../ImageFilters_explicit_description.txt | 16 + lib/cpPlugins_ITKInstances/ImageIterators.cxx | 7 + .../ImageIterators_explicit_description.txt | 53 +++ .../Image_explicit_description.txt | 23 ++ plugins/cpPluginsIO/ImageReader.cxx | 89 +++-- plugins/cpPluginsIO/ImageReader.h | 4 +- plugins/cpPluginsIO/ImageWriter.cxx | 12 +- plugins/cpPluginsIO/ImageWriter.h | 8 +- .../BinaryContourImageFilter.cxx | 100 ++++++ .../BinaryContourImageFilter.h | 47 +++ .../BinaryThresholdImageFilter.cxx | 73 ++-- .../BinaryThresholdImageFilter.h | 8 +- .../HistogramThresholdImageFilter.cxx | 86 +++++ .../HistogramThresholdImageFilter.h | 47 +++ .../ImageToHistogramFilter.cxx | 73 ++++ .../ImageToHistogramFilter.h | 44 +++ .../MaskedImageToHistogramFilter.cxx | 76 ++++ .../MaskedImageToHistogramFilter.h | 47 +++ .../OtsuThresholdImageFilter.cxx | 34 +- .../OtsuThresholdImageFilter.h | 8 +- .../SignedMaurerDistanceMapImageFilter.cxx | 29 +- .../SignedMaurerDistanceMapImageFilter.h | 8 +- plugins/cpPluginsWidgets/SeedWidget.cxx | 32 +- plugins/cpPluginsWidgets/SeedWidget.h | 12 +- 37 files changed, 1301 insertions(+), 577 deletions(-) create mode 100644 appli/bash/cpPlugins_CreateInstances.cxx delete mode 100644 lib/cpPlugins_ITKInstances/Base.h create mode 100644 lib/cpPlugins_ITKInstances/Base_explicit_description.txt delete mode 100644 lib/cpPlugins_ITKInstances/Config.h delete mode 100644 lib/cpPlugins_ITKInstances/Image.h create mode 100644 lib/cpPlugins_ITKInstances/ImageFilters.cxx create mode 100644 lib/cpPlugins_ITKInstances/ImageFilters_explicit_description.txt create mode 100644 lib/cpPlugins_ITKInstances/ImageIterators.cxx create mode 100644 lib/cpPlugins_ITKInstances/ImageIterators_explicit_description.txt create mode 100644 lib/cpPlugins_ITKInstances/Image_explicit_description.txt create mode 100644 plugins/cpPluginsImageFilters/BinaryContourImageFilter.cxx create mode 100644 plugins/cpPluginsImageFilters/BinaryContourImageFilter.h create mode 100644 plugins/cpPluginsImageFilters/HistogramThresholdImageFilter.cxx create mode 100644 plugins/cpPluginsImageFilters/HistogramThresholdImageFilter.h create mode 100644 plugins/cpPluginsImageFilters/ImageToHistogramFilter.cxx create mode 100644 plugins/cpPluginsImageFilters/ImageToHistogramFilter.h create mode 100644 plugins/cpPluginsImageFilters/MaskedImageToHistogramFilter.cxx create mode 100644 plugins/cpPluginsImageFilters/MaskedImageToHistogramFilter.h diff --git a/appli/bash/CMakeLists.txt b/appli/bash/CMakeLists.txt index 2eac91c..7d9154c 100644 --- a/appli/bash/CMakeLists.txt +++ b/appli/bash/CMakeLists.txt @@ -1,6 +1,7 @@ SET( bash_SOURCES cpPlugins_HostCreator + cpPlugins_CreateInstances ) FOREACH(program ${bash_SOURCES}) diff --git a/appli/bash/cpPlugins_CreateInstances.cxx b/appli/bash/cpPlugins_CreateInstances.cxx new file mode 100644 index 0000000..a09b822 --- /dev/null +++ b/appli/bash/cpPlugins_CreateInstances.cxx @@ -0,0 +1,333 @@ +#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; + +// ------------------------------------------------------------------------- +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 + ); + +// ------------------------------------------------------------------------- +int main( int argc, char* argv[] ) +{ + if( argc < 5 ) + { + std::cerr + << "Usage: " << argv[ 0 ] + << " input_definitions dir library_name header_filename" + << 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 ]; + + // Load file into a buffer + std::ifstream file_stream( input_definitions_file_name.c_str( ) ); + if( !file_stream ) + { + std::cerr + << "Error opening file: \"" + << input_definitions_file_name << "\"" + << 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 ) + { + // 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( ) ]; + std::strcpy( buffer, combIt->c_str( ) ); + 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 + + 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 ); + delete buffer; + + } // rof + } + else + all_real_classes.push_back( name ); + + } // rof + + // Write files + std::ofstream out_str( head_fname.c_str( ) ); + if( !out_str ) + { + std::cerr << "Error opening file \"" << head_fname << "\"" << std::endl; + return( 1 ); + + } // fi + + 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( ); + + return( 0 ); +} + +// ------------------------------------------------------------------------- +TVector Tokenize( const std::string& str, const std::string& delims ) +{ + TVector tokens; + if( str.size( ) > 0 ) + { + char* buffer = new char[ str.size( ) + 1 ]; + std::strcpy( buffer, str.c_str( ) ); + buffer[ str.size( ) ] = '\0'; + char* it = std::strtok( buffer, delims.c_str( ) ); + while( it != NULL ) + { + tokens.push_back( std::string( it ) ); + it = std::strtok( NULL, delims.c_str( ) ); + + } // elihw + delete buffer; + + } // fi + return( tokens ); +} + +// ------------------------------------------------------------------------- +TSet Combine( const TSet& X, const TSet& Y ) +{ + TSet Z; + for( auto xIt = X.begin( ); xIt != X.end( ); ++xIt ) + { + for( auto yIt = Y.begin( ); yIt != Y.end( ); ++yIt ) + { + std::stringstream val; + val << *xIt << "#" << *yIt; + Z.insert( val.str( ) ); + + } // rof + + } // rof + return( Z ); +} + +// ------------------------------------------------------------------------- +void Replace( + std::string& str, const std::string& sub, const std::string& nsub + ) +{ + size_t index = 0; + while( true ) + { + index = str.find( sub, index ); + if( index == std::string::npos ) break; + str.replace( index, sub.size( ), nsub ); + index += sub.size( ); + + } // elihw +} + +// eof - $RCSfile$ diff --git a/lib/cpPlugins/CMakeLists.txt b/lib/cpPlugins/CMakeLists.txt index 8efbc6c..565c9c1 100644 --- a/lib/cpPlugins/CMakeLists.txt +++ b/lib/cpPlugins/CMakeLists.txt @@ -83,7 +83,10 @@ SET( SET( target_LIBRARIES - cpPlugins_ITKInstances + cpPlugins_ITKInstances_Base + cpPlugins_ITKInstances_Image + cpPlugins_ITKInstances_ImageIterators + cpPlugins_ITKInstances_ImageFilters ${VTK_LIBRARIES} ) IF(NOT WIN32) diff --git a/lib/cpPlugins/Image.h b/lib/cpPlugins/Image.h index 2bdde70..3144d28 100644 --- a/lib/cpPlugins/Image.h +++ b/lib/cpPlugins/Image.h @@ -37,7 +37,7 @@ namespace cpPlugins template< class P, unsigned int D > inline bool _ITK_2_VTK_1( itk::LightObject* o ); - template< class I > + template< class T > inline bool _ITK_2_VTK_2( itk::LightObject* o ); private: diff --git a/lib/cpPlugins/Image.hxx b/lib/cpPlugins/Image.hxx index dd6ef10..47778dd 100644 --- a/lib/cpPlugins/Image.hxx +++ b/lib/cpPlugins/Image.hxx @@ -70,13 +70,13 @@ _ITK_2_VTK_1( itk::LightObject* o ) } // ------------------------------------------------------------------------- -template< class I > +template< class T > bool cpPlugins::Image:: _ITK_2_VTK_2( itk::LightObject* o ) { - typedef itk::ImageToVTKImageFilter< I > _I2V; + typedef itk::ImageToVTKImageFilter< T > _I2V; - I* image = dynamic_cast< I* >( o ); + T* image = dynamic_cast< T* >( o ); if( image != NULL ) { _I2V* f = dynamic_cast< _I2V* >( this->m_ITKvVTK.GetPointer( ) ); diff --git a/lib/cpPlugins_ITKInstances/Base.cxx b/lib/cpPlugins_ITKInstances/Base.cxx index 0ecd951..4d792de 100644 --- a/lib/cpPlugins_ITKInstances/Base.cxx +++ b/lib/cpPlugins_ITKInstances/Base.cxx @@ -1,6 +1,29 @@ - #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( 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.h b/lib/cpPlugins_ITKInstances/Base.h deleted file mode 100644 index 9c767d9..0000000 --- a/lib/cpPlugins_ITKInstances/Base.h +++ /dev/null @@ -1,89 +0,0 @@ -#ifndef __CPPLUGINS_ITKINSTANCES__BASE__H__ -#define __CPPLUGINS_ITKINSTANCES__BASE__H__ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/* - * ========================================================================= - * Define scalar FixedArray's - * ========================================================================= - */ -#define cpPlugins_ITKInstances_FixedArrays( T, D ) \ - cpPlugins_ITKInstances_PREFIX itk::FixedArray< T, D >; \ - cpPlugins_ITKInstances_PREFIX itk::Vector< T, D >; \ - cpPlugins_ITKInstances_PREFIX itk::Point< T, D > - -cpPlugins_ITKInstances_FixedArrays( float, 1 ); -cpPlugins_ITKInstances_FixedArrays( float, 2 ); -cpPlugins_ITKInstances_FixedArrays( float, 3 ); -cpPlugins_ITKInstances_FixedArrays( float, 4 ); - -cpPlugins_ITKInstances_FixedArrays( double, 1 ); -cpPlugins_ITKInstances_FixedArrays( double, 2 ); -cpPlugins_ITKInstances_FixedArrays( double, 3 ); -cpPlugins_ITKInstances_FixedArrays( double, 4 ); - -/* - * ========================================================================= - * Define scalar Array's - * ========================================================================= - */ -#define cpPlugins_ITKInstances_Array( T ) \ - cpPlugins_ITKInstances_PREFIX itk::Array< T > - -cpPlugins_ITKInstances_Array( char ); -cpPlugins_ITKInstances_Array( short ); -cpPlugins_ITKInstances_Array( int ); -cpPlugins_ITKInstances_Array( long ); -cpPlugins_ITKInstances_Array( float ); -cpPlugins_ITKInstances_Array( double ); -cpPlugins_ITKInstances_Array( unsigned char ); -cpPlugins_ITKInstances_Array( unsigned short ); -cpPlugins_ITKInstances_Array( unsigned int ); -cpPlugins_ITKInstances_Array( unsigned long ); - -/* - * ========================================================================= - * Define scalar SimpleDataObjectDecorator's - * ========================================================================= - */ -cpPlugins_ITKInstances_PREFIX itk::SimpleDataObjectDecorator< bool >; -cpPlugins_ITKInstances_PREFIX itk::SimpleDataObjectDecorator< char >; -cpPlugins_ITKInstances_PREFIX itk::SimpleDataObjectDecorator< short >; -cpPlugins_ITKInstances_PREFIX itk::SimpleDataObjectDecorator< int >; -cpPlugins_ITKInstances_PREFIX itk::SimpleDataObjectDecorator< long >; -cpPlugins_ITKInstances_PREFIX itk::SimpleDataObjectDecorator< float >; -cpPlugins_ITKInstances_PREFIX itk::SimpleDataObjectDecorator< double >; -cpPlugins_ITKInstances_PREFIX itk::SimpleDataObjectDecorator< unsigned char >; -cpPlugins_ITKInstances_PREFIX itk::SimpleDataObjectDecorator< unsigned short >; -cpPlugins_ITKInstances_PREFIX itk::SimpleDataObjectDecorator< unsigned int >; -cpPlugins_ITKInstances_PREFIX itk::SimpleDataObjectDecorator< unsigned long >; -cpPlugins_ITKInstances_PREFIX itk::SimpleDataObjectDecorator< std::string >; -cpPlugins_ITKInstances_PREFIX itk::SimpleDataObjectDecorator< itk::Array< char > >; -cpPlugins_ITKInstances_PREFIX itk::SimpleDataObjectDecorator< itk::Array< short > >; -cpPlugins_ITKInstances_PREFIX itk::SimpleDataObjectDecorator< itk::Array< int > >; -cpPlugins_ITKInstances_PREFIX itk::SimpleDataObjectDecorator< itk::Array< long > >; -cpPlugins_ITKInstances_PREFIX itk::SimpleDataObjectDecorator< itk::Array< float > >; -cpPlugins_ITKInstances_PREFIX itk::SimpleDataObjectDecorator< itk::Array< double > >; -cpPlugins_ITKInstances_PREFIX itk::SimpleDataObjectDecorator< itk::Array< unsigned char > >; -cpPlugins_ITKInstances_PREFIX itk::SimpleDataObjectDecorator< itk::Array< unsigned short > >; -cpPlugins_ITKInstances_PREFIX itk::SimpleDataObjectDecorator< itk::Array< unsigned int > >; -cpPlugins_ITKInstances_PREFIX itk::SimpleDataObjectDecorator< itk::Array< unsigned long > >; -cpPlugins_ITKInstances_PREFIX itk::SimpleDataObjectDecorator< std::vector< itk::Index< 2 > > >; -cpPlugins_ITKInstances_PREFIX itk::SimpleDataObjectDecorator< std::vector< itk::Index< 3 > > >; -cpPlugins_ITKInstances_PREFIX itk::SimpleDataObjectDecorator< std::vector< itk::Point< float, 2 > > >; -cpPlugins_ITKInstances_PREFIX itk::SimpleDataObjectDecorator< std::vector< itk::Point< double, 2 > > >; -cpPlugins_ITKInstances_PREFIX itk::SimpleDataObjectDecorator< std::vector< itk::Point< float, 3 > > >; -cpPlugins_ITKInstances_PREFIX itk::SimpleDataObjectDecorator< std::vector< itk::Point< double, 3 > > >; - -#endif // __CPPLUGINS_ITKINSTANCES__BASE__H__ - -// eof - $RCSfile$ diff --git a/lib/cpPlugins_ITKInstances/Base_explicit_description.txt b/lib/cpPlugins_ITKInstances/Base_explicit_description.txt new file mode 100644 index 0000000..0b4d7de --- /dev/null +++ b/lib/cpPlugins_ITKInstances/Base_explicit_description.txt @@ -0,0 +1,41 @@ +i complex +i string +i vector +i itkArray.h +i itkConvertPixelBuffer.h +i itkDefaultConvertPixelTraits.h +i itkFixedArray.h +i itkImportImageContainer.h +i itkIndex.h +i itkMatrix.h +i itkPoint.h +i itkVector.h +i itkRGBPixel.h +i itkRGBAPixel.h +i itkSimpleDataObjectDecorator.h +c itk::Array< #1 > +c itk::FixedArray< #1 , #2 > +c itk::Point< #5 , #2 > +c itk::Vector< #5 , #2 > +c itk::Matrix< #5 , #2 , #2 > +c itk::RGBPixel< #1 > +c itk::RGBAPixel< #1 > +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 , itk::RGBPixel< #4 > , itk::DefaultConvertPixelTraits< itk::RGBPixel< #4 > > > +c itk::ConvertPixelBuffer< #1 , itk::RGBAPixel< #4 > , itk::DefaultConvertPixelTraits< itk::RGBAPixel< #4 > > > +c itk::ImportImageContainer< unsigned long , #1 > +c itk::ImportImageContainer< unsigned long , std::complex< #5 > > +c itk::ImportImageContainer< unsigned long , itk::RGBPixel< #1 > > +c itk::ImportImageContainer< unsigned long , itk::RGBAPixel< #1 > > +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 diff --git a/lib/cpPlugins_ITKInstances/CMakeLists.txt b/lib/cpPlugins_ITKInstances/CMakeLists.txt index f246d90..1135fe5 100644 --- a/lib/cpPlugins_ITKInstances/CMakeLists.txt +++ b/lib/cpPlugins_ITKInstances/CMakeLists.txt @@ -1,78 +1,89 @@ -## ============================= -## = Set names and directories = -## ============================= - -SET(lib_NAME cpPlugins_ITKInstances) SET(lib_DIR cpPlugins_ITKInstances) - -## =============== -## = 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") - -# =================================== -# = Integrate all source file names = -# =================================== - +SET(target_LIBRARIES ${ITK_LIBRARIES} ${VTK_LIBRARIES}) SET( - lib_HEADERS - ${lib_HEADERS_H} - ${lib_HEADERS_HPP} - ${lib_HEADERS_HXX} + libs_SOURCES + Base + Image + ImageIterators + ImageFilters ) - -SET( - lib_SOURCES - ${lib_SOURCES_C} - ${lib_SOURCES_CPP} - ${lib_SOURCES_CXX} +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} ) - -SET( - target_LIBRARIES - ${ITK_LIBRARIES} - ${VTK_LIBRARIES} +TARGET_LINK_LIBRARIES( + cpPlugins_ITKInstances_Image + cpPlugins_ITKInstances_Base ) - -## ===================== -## = Compilation rules = -## ===================== - -ADD_LIBRARY(${lib_NAME} SHARED ${lib_SOURCES}) -SET_TARGET_PROPERTIES( - ${lib_NAME} PROPERTIES - VERSION "${prj_VER}" - SOVERSION "${prj_sVER}" +TARGET_LINK_LIBRARIES( + cpPlugins_ITKInstances_ImageIterators + cpPlugins_ITKInstances_Image ) -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_NAME}_Export.h - STATIC_DEFINE ${lib_NAME}_BUILT_AS_STATIC +TARGET_LINK_LIBRARIES( + cpPlugins_ITKInstances_ImageFilters + cpPlugins_ITKInstances_ImageIterators ) -TARGET_LINK_LIBRARIES(${lib_NAME} ${target_LIBRARIES}) -## ======================== -## == Installation rules == -## ======================== +# # =================================== +# # = Integrate all source file names = +# # =================================== -INSTALL( - TARGETS ${lib_NAME} - RUNTIME DESTINATION bin - LIBRARY DESTINATION lib - ARCHIVE DESTINATION lib/static - ) -INSTALL( - FILES - ${lib_HEADERS} - DESTINATION include/${lib_DIR} - ) +# 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$ +# ## eof - $RCSfile$ diff --git a/lib/cpPlugins_ITKInstances/Config.h b/lib/cpPlugins_ITKInstances/Config.h deleted file mode 100644 index 5e4b1b1..0000000 --- a/lib/cpPlugins_ITKInstances/Config.h +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef __CPPLUGINS_ITKINSTANCES__CONFIG__H__ -#define __CPPLUGINS_ITKINSTANCES__CONFIG__H__ - -#include - -/* - * ========================================================================= - * Discover what we are doing: building or using - * ========================================================================= - */ -#ifdef cpPlugins_ITKInstances_EXPORTS -# undef ITK_MANUAL_INSTANTIATION -# define cpPlugins_ITKInstances_PREFIX template class cpPlugins_ITKInstances_EXPORT -#else // cpPlugins_ITKInstances_EXPORTS -# define ITK_MANUAL_INSTANTIATION -# define cpPlugins_ITKInstances_PREFIX extern template class -#endif // cpPlugins_ITKInstances_EXPORTS - -#endif // __CPPLUGINS_ITKINSTANCES__CONFIG__H__ - -// eof - $RCSfile$ diff --git a/lib/cpPlugins_ITKInstances/Image.cxx b/lib/cpPlugins_ITKInstances/Image.cxx index 4fcf5ea..9090add 100644 --- a/lib/cpPlugins_ITKInstances/Image.cxx +++ b/lib/cpPlugins_ITKInstances/Image.cxx @@ -1,19 +1,17 @@ - #include // ------------------------------------------------------------------------- -#define cpPlugins_ITKInstances_ostream( D ) \ - template cpPlugins_ITKInstances_EXPORT std::ostream& operator<< < D > \ - ( std::ostream& o, const ImageRegion< D >& r ) +#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_ostream( 1 ); - cpPlugins_ITKInstances_ostream( 2 ); - cpPlugins_ITKInstances_ostream( 3 ); - cpPlugins_ITKInstances_ostream( 4 ); + 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/Image.h b/lib/cpPlugins_ITKInstances/Image.h deleted file mode 100644 index 3069e31..0000000 --- a/lib/cpPlugins_ITKInstances/Image.h +++ /dev/null @@ -1,251 +0,0 @@ -#ifndef __CPPLUGINS_ITKINSTANCES__IMAGE__H__ -#define __CPPLUGINS_ITKINSTANCES__IMAGE__H__ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/* - * ========================================================================= - * Define scalar ImageBase's - * ========================================================================= - */ -#define cpPlugins_ITKInstances_ImageBase( D ) \ - cpPlugins_ITKInstances_PREFIX itk::ImageBase< D > - -cpPlugins_ITKInstances_ImageBase( 1 ); -cpPlugins_ITKInstances_ImageBase( 2 ); -cpPlugins_ITKInstances_ImageBase( 3 ); -cpPlugins_ITKInstances_ImageBase( 4 ); - -/* - * ========================================================================= - * Define pixel-based objects - * ========================================================================= - */ -#define cpPlugins_ITKInstances_ConvertPixelBuffer( T, U, V ) \ - cpPlugins_ITKInstances_PREFIX itk::ConvertPixelBuffer< T, U, itk::DefaultConvertPixelTraits< V > > - -#define cpPlugins_ITKInstances_ColorPixel( T ) \ - cpPlugins_ITKInstances_PREFIX itk::RGBPixel< T >; \ - cpPlugins_ITKInstances_PREFIX itk::RGBAPixel< T > - -#define cpPlugins_ITKInstances_ConvertPixelBuffer_AllTypes( U ) \ - cpPlugins_ITKInstances_PREFIX itk::ImportImageContainer< unsigned long, U >; \ - cpPlugins_ITKInstances_ConvertPixelBuffer( char, U, U ); \ - cpPlugins_ITKInstances_ConvertPixelBuffer( short, U, U ); \ - cpPlugins_ITKInstances_ConvertPixelBuffer( int, U, U ); \ - cpPlugins_ITKInstances_ConvertPixelBuffer( long, U, U ); \ - cpPlugins_ITKInstances_ConvertPixelBuffer( float, U, U ); \ - cpPlugins_ITKInstances_ConvertPixelBuffer( double, U, U ); \ - cpPlugins_ITKInstances_ConvertPixelBuffer( unsigned char, U, U ); \ - cpPlugins_ITKInstances_ConvertPixelBuffer( unsigned short, U, U ); \ - cpPlugins_ITKInstances_ConvertPixelBuffer( unsigned int, U, U ); \ - cpPlugins_ITKInstances_ConvertPixelBuffer( unsigned long, U, U ) - -cpPlugins_ITKInstances_ColorPixel( char ); -cpPlugins_ITKInstances_ColorPixel( short ); -cpPlugins_ITKInstances_ColorPixel( int ); -cpPlugins_ITKInstances_ColorPixel( long ); -cpPlugins_ITKInstances_ColorPixel( float ); -cpPlugins_ITKInstances_ColorPixel( double ); -cpPlugins_ITKInstances_ColorPixel( unsigned char ); -cpPlugins_ITKInstances_ColorPixel( unsigned short ); -cpPlugins_ITKInstances_ColorPixel( unsigned int ); -cpPlugins_ITKInstances_ColorPixel( unsigned long ); - -cpPlugins_ITKInstances_ConvertPixelBuffer_AllTypes( char ); -cpPlugins_ITKInstances_ConvertPixelBuffer_AllTypes( short ); -cpPlugins_ITKInstances_ConvertPixelBuffer_AllTypes( int ); -cpPlugins_ITKInstances_ConvertPixelBuffer_AllTypes( long ); -cpPlugins_ITKInstances_ConvertPixelBuffer_AllTypes( float ); -cpPlugins_ITKInstances_ConvertPixelBuffer_AllTypes( double ); -cpPlugins_ITKInstances_ConvertPixelBuffer_AllTypes( unsigned char ); -cpPlugins_ITKInstances_ConvertPixelBuffer_AllTypes( unsigned short ); -cpPlugins_ITKInstances_ConvertPixelBuffer_AllTypes( unsigned int ); -cpPlugins_ITKInstances_ConvertPixelBuffer_AllTypes( unsigned long ); - -cpPlugins_ITKInstances_ConvertPixelBuffer_AllTypes( itk::RGBPixel< char > ); -cpPlugins_ITKInstances_ConvertPixelBuffer_AllTypes( itk::RGBPixel< short > ); -cpPlugins_ITKInstances_ConvertPixelBuffer_AllTypes( itk::RGBPixel< int > ); -cpPlugins_ITKInstances_ConvertPixelBuffer_AllTypes( itk::RGBPixel< long > ); -cpPlugins_ITKInstances_ConvertPixelBuffer_AllTypes( itk::RGBPixel< float > ); -cpPlugins_ITKInstances_ConvertPixelBuffer_AllTypes( itk::RGBPixel< double > ); -cpPlugins_ITKInstances_ConvertPixelBuffer_AllTypes( itk::RGBPixel< unsigned char > ); -cpPlugins_ITKInstances_ConvertPixelBuffer_AllTypes( itk::RGBPixel< unsigned short > ); -cpPlugins_ITKInstances_ConvertPixelBuffer_AllTypes( itk::RGBPixel< unsigned int > ); -cpPlugins_ITKInstances_ConvertPixelBuffer_AllTypes( itk::RGBPixel< unsigned long > ); - -cpPlugins_ITKInstances_ConvertPixelBuffer_AllTypes( itk::RGBAPixel< char > ); -cpPlugins_ITKInstances_ConvertPixelBuffer_AllTypes( itk::RGBAPixel< short > ); -cpPlugins_ITKInstances_ConvertPixelBuffer_AllTypes( itk::RGBAPixel< int > ); -cpPlugins_ITKInstances_ConvertPixelBuffer_AllTypes( itk::RGBAPixel< long > ); -cpPlugins_ITKInstances_ConvertPixelBuffer_AllTypes( itk::RGBAPixel< float > ); -cpPlugins_ITKInstances_ConvertPixelBuffer_AllTypes( itk::RGBAPixel< double > ); -cpPlugins_ITKInstances_ConvertPixelBuffer_AllTypes( itk::RGBAPixel< unsigned char > ); -cpPlugins_ITKInstances_ConvertPixelBuffer_AllTypes( itk::RGBAPixel< unsigned short > ); -cpPlugins_ITKInstances_ConvertPixelBuffer_AllTypes( itk::RGBAPixel< unsigned int > ); -cpPlugins_ITKInstances_ConvertPixelBuffer_AllTypes( itk::RGBAPixel< unsigned long > ); - -/* - * ========================================================================= - * Define scalar Image's - * ========================================================================= - */ -#define cpPlugins_ITKInstances_ScalarImage( P, D ) \ - cpPlugins_ITKInstances_PREFIX itk::Image< P, D >; \ - cpPlugins_ITKInstances_PREFIX itk::ImageTransformer< itk::Image< P, D > >; \ - cpPlugins_ITKInstances_PREFIX itk::ImageSource< itk::Image< P, D > >; \ - cpPlugins_ITKInstances_PREFIX itk::ImageConstIteratorWithIndex< itk::Image< P, D > >; \ - cpPlugins_ITKInstances_PREFIX itk::ImageIteratorWithIndex< itk::Image< P, D > >; \ - cpPlugins_ITKInstances_PREFIX itk::ImageRegionConstIterator< itk::Image< P, D > >; \ - cpPlugins_ITKInstances_PREFIX itk::ImageRegionIterator< itk::Image< P, D > >; \ - cpPlugins_ITKInstances_PREFIX itk::ImageScanlineConstIterator< itk::Image< P, D > >; \ - cpPlugins_ITKInstances_PREFIX itk::ImageScanlineIterator< itk::Image< P, D > > - -#define cpPlugins_ITKInstances_ScalarImage_AllDims( P ) \ - cpPlugins_ITKInstances_ScalarImage( P, 1 ); \ - cpPlugins_ITKInstances_ScalarImage( P, 2 ); \ - cpPlugins_ITKInstances_ScalarImage( P, 3 ); \ - cpPlugins_ITKInstances_ScalarImage( P, 4 ) - -cpPlugins_ITKInstances_ScalarImage_AllDims( char ); -cpPlugins_ITKInstances_ScalarImage_AllDims( short ); -cpPlugins_ITKInstances_ScalarImage_AllDims( int ); -cpPlugins_ITKInstances_ScalarImage_AllDims( long ); -cpPlugins_ITKInstances_ScalarImage_AllDims( float ); -cpPlugins_ITKInstances_ScalarImage_AllDims( double ); -cpPlugins_ITKInstances_ScalarImage_AllDims( unsigned char ); -cpPlugins_ITKInstances_ScalarImage_AllDims( unsigned short ); -cpPlugins_ITKInstances_ScalarImage_AllDims( unsigned int ); -cpPlugins_ITKInstances_ScalarImage_AllDims( unsigned long ); - -cpPlugins_ITKInstances_ScalarImage_AllDims( itk::RGBPixel< char > ); -cpPlugins_ITKInstances_ScalarImage_AllDims( itk::RGBPixel< short > ); -cpPlugins_ITKInstances_ScalarImage_AllDims( itk::RGBPixel< int > ); -cpPlugins_ITKInstances_ScalarImage_AllDims( itk::RGBPixel< long > ); -cpPlugins_ITKInstances_ScalarImage_AllDims( itk::RGBPixel< float > ); -cpPlugins_ITKInstances_ScalarImage_AllDims( itk::RGBPixel< double > ); -cpPlugins_ITKInstances_ScalarImage_AllDims( itk::RGBPixel< unsigned char > ); -cpPlugins_ITKInstances_ScalarImage_AllDims( itk::RGBPixel< unsigned short > ); -cpPlugins_ITKInstances_ScalarImage_AllDims( itk::RGBPixel< unsigned int > ); -cpPlugins_ITKInstances_ScalarImage_AllDims( itk::RGBPixel< unsigned long > ); - -cpPlugins_ITKInstances_ScalarImage_AllDims( itk::RGBAPixel< char > ); -cpPlugins_ITKInstances_ScalarImage_AllDims( itk::RGBAPixel< short > ); -cpPlugins_ITKInstances_ScalarImage_AllDims( itk::RGBAPixel< int > ); -cpPlugins_ITKInstances_ScalarImage_AllDims( itk::RGBAPixel< long > ); -cpPlugins_ITKInstances_ScalarImage_AllDims( itk::RGBAPixel< float > ); -cpPlugins_ITKInstances_ScalarImage_AllDims( itk::RGBAPixel< double > ); -cpPlugins_ITKInstances_ScalarImage_AllDims( itk::RGBAPixel< unsigned char > ); -cpPlugins_ITKInstances_ScalarImage_AllDims( itk::RGBAPixel< unsigned short > ); -cpPlugins_ITKInstances_ScalarImage_AllDims( itk::RGBAPixel< unsigned int > ); -cpPlugins_ITKInstances_ScalarImage_AllDims( itk::RGBAPixel< unsigned long > ); - -/* - * ========================================================================= - * Define scalar ItkVtkGlue - * ========================================================================= - */ -#define cpPlugins_ITKInstances_ItkVtkGlueScalarImage( P, D ) \ - cpPlugins_ITKInstances_PREFIX itk::ImageToVTKImageFilter< itk::Image< P, D > > - -#define cpPlugins_ITKInstances_ItkVtkGlueScalarImage_AllDims( P ) \ - cpPlugins_ITKInstances_ItkVtkGlueScalarImage( P, 2 ); \ - cpPlugins_ITKInstances_ItkVtkGlueScalarImage( P, 3 ) - -cpPlugins_ITKInstances_ItkVtkGlueScalarImage_AllDims( char ); -cpPlugins_ITKInstances_ItkVtkGlueScalarImage_AllDims( short ); -cpPlugins_ITKInstances_ItkVtkGlueScalarImage_AllDims( int ); -cpPlugins_ITKInstances_ItkVtkGlueScalarImage_AllDims( long ); -cpPlugins_ITKInstances_ItkVtkGlueScalarImage_AllDims( float ); -cpPlugins_ITKInstances_ItkVtkGlueScalarImage_AllDims( double ); -cpPlugins_ITKInstances_ItkVtkGlueScalarImage_AllDims( unsigned char ); -cpPlugins_ITKInstances_ItkVtkGlueScalarImage_AllDims( unsigned short ); -cpPlugins_ITKInstances_ItkVtkGlueScalarImage_AllDims( unsigned int ); -cpPlugins_ITKInstances_ItkVtkGlueScalarImage_AllDims( unsigned long ); - -cpPlugins_ITKInstances_ItkVtkGlueScalarImage_AllDims( itk::RGBPixel< char > ); -cpPlugins_ITKInstances_ItkVtkGlueScalarImage_AllDims( itk::RGBPixel< short > ); -cpPlugins_ITKInstances_ItkVtkGlueScalarImage_AllDims( itk::RGBPixel< int > ); -cpPlugins_ITKInstances_ItkVtkGlueScalarImage_AllDims( itk::RGBPixel< long > ); -cpPlugins_ITKInstances_ItkVtkGlueScalarImage_AllDims( itk::RGBPixel< float > ); -cpPlugins_ITKInstances_ItkVtkGlueScalarImage_AllDims( itk::RGBPixel< double > ); -cpPlugins_ITKInstances_ItkVtkGlueScalarImage_AllDims( itk::RGBPixel< unsigned char > ); -cpPlugins_ITKInstances_ItkVtkGlueScalarImage_AllDims( itk::RGBPixel< unsigned short > ); -cpPlugins_ITKInstances_ItkVtkGlueScalarImage_AllDims( itk::RGBPixel< unsigned int > ); -cpPlugins_ITKInstances_ItkVtkGlueScalarImage_AllDims( itk::RGBPixel< unsigned long > ); - -cpPlugins_ITKInstances_ItkVtkGlueScalarImage_AllDims( itk::RGBAPixel< char > ); -cpPlugins_ITKInstances_ItkVtkGlueScalarImage_AllDims( itk::RGBAPixel< short > ); -cpPlugins_ITKInstances_ItkVtkGlueScalarImage_AllDims( itk::RGBAPixel< int > ); -cpPlugins_ITKInstances_ItkVtkGlueScalarImage_AllDims( itk::RGBAPixel< long > ); -cpPlugins_ITKInstances_ItkVtkGlueScalarImage_AllDims( itk::RGBAPixel< float > ); -cpPlugins_ITKInstances_ItkVtkGlueScalarImage_AllDims( itk::RGBAPixel< double > ); -cpPlugins_ITKInstances_ItkVtkGlueScalarImage_AllDims( itk::RGBAPixel< unsigned char > ); -cpPlugins_ITKInstances_ItkVtkGlueScalarImage_AllDims( itk::RGBAPixel< unsigned short > ); -cpPlugins_ITKInstances_ItkVtkGlueScalarImage_AllDims( itk::RGBAPixel< unsigned int > ); -cpPlugins_ITKInstances_ItkVtkGlueScalarImage_AllDims( itk::RGBAPixel< unsigned long > ); - -/* - * ========================================================================= - * Define scalar shaped iterators - * ========================================================================= - */ -#define cpPlugins_ITKInstances_ScalarImage_ShapedIterators( P, D ) \ - cpPlugins_ITKInstances_PREFIX itk::ImageLinearConstIteratorWithIndex< itk::Image< P, D > >; \ - cpPlugins_ITKInstances_PREFIX itk::ImageLinearIteratorWithIndex< itk::Image< P, D > >; \ - cpPlugins_ITKInstances_PREFIX itk::ConstantBoundaryCondition< itk::Image< P, D >, itk::Image< P, D > >; \ - cpPlugins_ITKInstances_PREFIX itk::PeriodicBoundaryCondition< itk::Image< P, D >, itk::Image< P, D > >; \ - cpPlugins_ITKInstances_PREFIX itk::ZeroFluxNeumannBoundaryCondition< itk::Image< P, D >, itk::Image< P, D > >; \ - cpPlugins_ITKInstances_PREFIX itk::ConstNeighborhoodIterator< itk::Image< P, D >, itk::ConstantBoundaryCondition< itk::Image< P, D >, itk::Image< P, D > > >; \ - cpPlugins_ITKInstances_PREFIX itk::NeighborhoodIterator< itk::Image< P, D >, itk::ConstantBoundaryCondition< itk::Image< P, D >, itk::Image< P, D > > >; \ - cpPlugins_ITKInstances_PREFIX itk::ConstNeighborhoodIterator< itk::Image< P, D >, itk::PeriodicBoundaryCondition< itk::Image< P, D >, itk::Image< P, D > > >; \ - cpPlugins_ITKInstances_PREFIX itk::NeighborhoodIterator< itk::Image< P, D >, itk::PeriodicBoundaryCondition< itk::Image< P, D >, itk::Image< P, D > > >; \ - cpPlugins_ITKInstances_PREFIX itk::ConstNeighborhoodIterator< itk::Image< P, D >, itk::ZeroFluxNeumannBoundaryCondition< itk::Image< P, D >, itk::Image< P, D > > >; \ - cpPlugins_ITKInstances_PREFIX itk::NeighborhoodIterator< itk::Image< P, D >, itk::ZeroFluxNeumannBoundaryCondition< itk::Image< P, D >, itk::Image< P, D > > >; \ - cpPlugins_ITKInstances_PREFIX itk::ConstShapedNeighborhoodIterator< itk::Image< P, D >, itk::ZeroFluxNeumannBoundaryCondition< itk::Image< P, D >, itk::Image< P, D > > >; \ - cpPlugins_ITKInstances_PREFIX itk::ShapedNeighborhoodIterator< itk::Image< P, D >, itk::ZeroFluxNeumannBoundaryCondition< itk::Image< P, D >, itk::Image< P, D > > > - -#define cpPlugins_ITKInstances_ScalarImage_ShapedIterators_AllTypes( D ) \ - cpPlugins_ITKInstances_ScalarImage_ShapedIterators( char, D ); \ - cpPlugins_ITKInstances_ScalarImage_ShapedIterators( short, D ); \ - cpPlugins_ITKInstances_ScalarImage_ShapedIterators( int, D ); \ - cpPlugins_ITKInstances_ScalarImage_ShapedIterators( long, D ); \ - cpPlugins_ITKInstances_ScalarImage_ShapedIterators( float, D ); \ - cpPlugins_ITKInstances_ScalarImage_ShapedIterators( double, D ); \ - cpPlugins_ITKInstances_ScalarImage_ShapedIterators( unsigned char, D ); \ - cpPlugins_ITKInstances_ScalarImage_ShapedIterators( unsigned short, D ); \ - cpPlugins_ITKInstances_ScalarImage_ShapedIterators( unsigned int, D ); \ - cpPlugins_ITKInstances_ScalarImage_ShapedIterators( unsigned long, D ) - -cpPlugins_ITKInstances_ScalarImage_ShapedIterators_AllTypes( 1 ); -cpPlugins_ITKInstances_ScalarImage_ShapedIterators_AllTypes( 2 ); -cpPlugins_ITKInstances_ScalarImage_ShapedIterators_AllTypes( 3 ); -cpPlugins_ITKInstances_ScalarImage_ShapedIterators_AllTypes( 4 ); - -#endif // __CPPLUGINS_ITKINSTANCES__IMAGE__H__ - -// eof - $RCSfile$ diff --git a/lib/cpPlugins_ITKInstances/ImageFilters.cxx b/lib/cpPlugins_ITKInstances/ImageFilters.cxx new file mode 100644 index 0000000..5e33701 --- /dev/null +++ b/lib/cpPlugins_ITKInstances/ImageFilters.cxx @@ -0,0 +1,5 @@ +#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 new file mode 100644 index 0000000..dae6d97 --- /dev/null +++ b/lib/cpPlugins_ITKInstances/ImageFilters_explicit_description.txt @@ -0,0 +1,16 @@ +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< itk::RGBPixel< #1 > , #2 > > +c itk::ImageSource< itk::Image< itk::RGBAPixel< #1 > , #2 > > +c itk::ImageToImageFilter< itk::Image< #1 , #2 > , itk::Image< #4 , #2 > > +c itk::InPlaceImageFilter< itk::Image< #1 , #2 > , itk::Image< #4 , #2 > > +c itk::ImageTransformer< itk::Image< #1 , #2 > > +a #1 = #integers;#floats +a #2 = #all_dims +a #3 = #floats +a #4 = #integers;#floats diff --git a/lib/cpPlugins_ITKInstances/ImageIterators.cxx b/lib/cpPlugins_ITKInstances/ImageIterators.cxx new file mode 100644 index 0000000..4e1863c --- /dev/null +++ b/lib/cpPlugins_ITKInstances/ImageIterators.cxx @@ -0,0 +1,7 @@ +#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 new file mode 100644 index 0000000..68e90fd --- /dev/null +++ b/lib/cpPlugins_ITKInstances/ImageIterators_explicit_description.txt @@ -0,0 +1,53 @@ +f cpPlugins_ITKInstances/Image.h +i itkImageConstIteratorWithIndex.h +i itkImageIteratorWithIndex.h +i itkImageLinearConstIteratorWithIndex.h +i itkImageLinearIteratorWithIndex.h +i itkImageRegionConstIterator.h +i itkImageRegionIterator.h +i itkImageScanlineConstIterator.h +i itkImageScanlineIterator.h +i itkConstNeighborhoodIterator.h +i itkNeighborhoodIterator.h +i itkConstShapedNeighborhoodIterator.h +i itkShapedNeighborhoodIterator.h +c itk::ImageRegionConstIterator< itk::Image< #1 , #2 > > +c itk::ImageRegionConstIterator< itk::Image< std::complex< #3 >, #2 > > +c itk::ImageRegionConstIterator< itk::Image< itk::RGBPixel< #1 > , #2 > > +c itk::ImageRegionConstIterator< itk::Image< itk::RGBAPixel< #1 > , #2 > > +c itk::ImageRegionIterator< itk::Image< #1 , #2 > > +c itk::ImageRegionIterator< itk::Image< std::complex< #3 > , #2 > > +c itk::ImageRegionIterator< itk::Image< itk::RGBPixel< #1 > , #2 > > +c itk::ImageRegionIterator< itk::Image< itk::RGBAPixel< #1 > , #2 > > +c itk::ImageConstIteratorWithIndex< itk::Image< #1 , #2 > > +c itk::ImageConstIteratorWithIndex< itk::Image< std::complex< #3 > , #2 > > +c itk::ImageConstIteratorWithIndex< itk::Image< itk::RGBPixel< #1 > , #2 > > +c itk::ImageConstIteratorWithIndex< itk::Image< itk::RGBAPixel< #1 > , #2 > > +c itk::ImageIteratorWithIndex< itk::Image< #1 , #2 > > +c itk::ImageIteratorWithIndex< itk::Image< std::complex< #3 > , #2 > > +c itk::ImageIteratorWithIndex< itk::Image< itk::RGBPixel< #1 > , #2 > > +c itk::ImageIteratorWithIndex< itk::Image< itk::RGBAPixel< #1 > , #2 > > +c itk::ImageLinearConstIteratorWithIndex< itk::Image< #1 , #2 > > +c itk::ImageLinearConstIteratorWithIndex< itk::Image< std::complex< #3 > , #2 > > +c itk::ImageLinearConstIteratorWithIndex< itk::Image< itk::RGBPixel< #1 > , #2 > > +c itk::ImageLinearConstIteratorWithIndex< itk::Image< itk::RGBAPixel< #1 > , #2 > > +c itk::ImageLinearIteratorWithIndex< itk::Image< #1 , #2 > > +c itk::ImageLinearIteratorWithIndex< itk::Image< std::complex< #3 > , #2 > > +c itk::ImageLinearIteratorWithIndex< itk::Image< itk::RGBPixel< #1 > , #2 > > +c itk::ImageLinearIteratorWithIndex< itk::Image< itk::RGBAPixel< #1 > , #2 > > +c itk::ImageScanlineConstIterator< itk::Image< #1 , #2 > > +c itk::ImageScanlineConstIterator< itk::Image< std::complex< #3 > , #2 > > +c itk::ImageScanlineConstIterator< itk::Image< itk::RGBPixel< #1 > , #2 > > +c itk::ImageScanlineConstIterator< itk::Image< itk::RGBAPixel< #1 > , #2 > > +c itk::ImageScanlineIterator< itk::Image< #1 , #2 > > +c itk::ImageScanlineIterator< itk::Image< std::complex< #3 > , #2 > > +c itk::ImageScanlineIterator< itk::Image< itk::RGBPixel< #1 > , #2 > > +c itk::ImageScanlineIterator< itk::Image< itk::RGBAPixel< #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 diff --git a/lib/cpPlugins_ITKInstances/Image_explicit_description.txt b/lib/cpPlugins_ITKInstances/Image_explicit_description.txt new file mode 100644 index 0000000..dcad0a2 --- /dev/null +++ b/lib/cpPlugins_ITKInstances/Image_explicit_description.txt @@ -0,0 +1,23 @@ +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::Image< #1 , #2 > +c itk::Image< std::complex< #4 > , #2 > +c itk::Image< itk::RGBPixel< #1 > , #2 > +c itk::Image< itk::RGBAPixel< #1 > , #2 > +c itk::ImageToVTKImageFilter< itk::Image< #1 , #3 > > +c itk::ImageToVTKImageFilter< itk::Image< itk::RGBPixel< #1 > , #3 > > +c itk::ImageToVTKImageFilter< itk::Image< itk::RGBAPixel< #1 > , #3 > > +a #1 = #integers;#floats +a #2 = #all_dims +a #3 = #all_visual_dims +a #4 = #floats +a #5 = #integers_ptr;#floats_ptr diff --git a/plugins/cpPluginsIO/ImageReader.cxx b/plugins/cpPluginsIO/ImageReader.cxx index c515c9e..7215b10 100644 --- a/plugins/cpPluginsIO/ImageReader.cxx +++ b/plugins/cpPluginsIO/ImageReader.cxx @@ -73,10 +73,15 @@ _GenerateData( ) } // ------------------------------------------------------------------------- -template< unsigned int D > +template< unsigned int _Dim > std::string cpPluginsIO::ImageReader:: _GD0( itk::ImageIOBase* io ) { + typedef unsigned char uchar; + typedef unsigned short ushort; + typedef unsigned int uint; + typedef unsigned long ulong; + itk::ImageIOBase::IOComponentType ct = io->GetComponentType( ); itk::ImageIOBase::IOPixelType pt = io->GetPixelType( ); @@ -85,16 +90,16 @@ _GD0( itk::ImageIOBase* io ) { switch( ct ) { - case itk::ImageIOBase::CHAR : r = this->_GD1< char, D >( io ); break; - case itk::ImageIOBase::SHORT : r = this->_GD1< short, D >( io ); break; - case itk::ImageIOBase::INT : r = this->_GD1< int, D >( io ); break; - case itk::ImageIOBase::LONG : r = this->_GD1< long, D >( io ); break; - case itk::ImageIOBase::FLOAT : r = this->_GD1< float, D >( io ); break; - case itk::ImageIOBase::DOUBLE : r = this->_GD1< double, D >( io ); break; - case itk::ImageIOBase::UCHAR : r = this->_GD1< unsigned char, D >( io ); break; - case itk::ImageIOBase::USHORT : r = this->_GD1< unsigned short, D >( io ); break; - case itk::ImageIOBase::UINT : r = this->_GD1< unsigned int, D >( io ); break; - case itk::ImageIOBase::ULONG : r = this->_GD1< unsigned long, D >( io ); break; + case itk::ImageIOBase::CHAR : r = this->_GD1< char, _Dim >( io ); break; + case itk::ImageIOBase::SHORT : r = this->_GD1< short, _Dim >( io ); break; + case itk::ImageIOBase::INT : r = this->_GD1< int, _Dim >( io ); break; + case itk::ImageIOBase::LONG : r = this->_GD1< long, _Dim >( io ); break; + case itk::ImageIOBase::FLOAT : r = this->_GD1< float, _Dim >( io ); break; + case itk::ImageIOBase::DOUBLE : r = this->_GD1< double, _Dim >( io ); break; + case itk::ImageIOBase::UCHAR : r = this->_GD1< uchar, _Dim >( io ); break; + case itk::ImageIOBase::USHORT : r = this->_GD1< ushort, _Dim >( io ); break; + case itk::ImageIOBase::UINT : r = this->_GD1< uint, _Dim >( io ); break; + case itk::ImageIOBase::ULONG : r = this->_GD1< ulong, _Dim >( io ); break; default: r = "IO::ImageReader: Scalar pixel type not supported."; break; @@ -104,16 +109,16 @@ _GD0( itk::ImageIOBase* io ) { switch( ct ) { - case itk::ImageIOBase::CHAR : r = this->_GD1< itk::RGBPixel< char >, D >( io ); break; - case itk::ImageIOBase::SHORT : r = this->_GD1< itk::RGBPixel< short >, D >( io ); break; - case itk::ImageIOBase::INT : r = this->_GD1< itk::RGBPixel< int >, D >( io ); break; - case itk::ImageIOBase::LONG : r = this->_GD1< itk::RGBPixel< long >, D >( io ); break; - case itk::ImageIOBase::FLOAT : r = this->_GD1< itk::RGBPixel< float >, D >( io ); break; - case itk::ImageIOBase::DOUBLE : r = this->_GD1< itk::RGBPixel< double >, D >( io ); break; - case itk::ImageIOBase::UCHAR : r = this->_GD1< itk::RGBPixel< unsigned char >, D >( io ); break; - case itk::ImageIOBase::USHORT : r = this->_GD1< itk::RGBPixel< unsigned short >, D >( io ); break; - case itk::ImageIOBase::UINT : r = this->_GD1< itk::RGBPixel< unsigned int >, D >( io ); break; - case itk::ImageIOBase::ULONG : r = this->_GD1< itk::RGBPixel< unsigned long >, D >( io ); break; + case itk::ImageIOBase::CHAR : r = this->_GD1< itk::RGBPixel< char >, _Dim >( io ); break; + case itk::ImageIOBase::SHORT : r = this->_GD1< itk::RGBPixel< short >, _Dim >( io ); break; + case itk::ImageIOBase::INT : r = this->_GD1< itk::RGBPixel< int >, _Dim >( io ); break; + case itk::ImageIOBase::LONG : r = this->_GD1< itk::RGBPixel< long >, _Dim >( io ); break; + case itk::ImageIOBase::FLOAT : r = this->_GD1< itk::RGBPixel< float >, _Dim >( io ); break; + case itk::ImageIOBase::DOUBLE : r = this->_GD1< itk::RGBPixel< double >, _Dim >( io ); break; + case itk::ImageIOBase::UCHAR : r = this->_GD1< itk::RGBPixel< uchar >, _Dim >( io ); break; + case itk::ImageIOBase::USHORT : r = this->_GD1< itk::RGBPixel< ushort >, _Dim >( io ); break; + case itk::ImageIOBase::UINT : r = this->_GD1< itk::RGBPixel< uint >, _Dim >( io ); break; + case itk::ImageIOBase::ULONG : r = this->_GD1< itk::RGBPixel< ulong >, _Dim >( io ); break; default: r = "IO::ImageReader: RGB pixel type not supported."; break; @@ -123,21 +128,32 @@ _GD0( itk::ImageIOBase* io ) { switch( ct ) { - case itk::ImageIOBase::CHAR : r = this->_GD1< itk::RGBAPixel< char >, D >( io ); break; - case itk::ImageIOBase::SHORT : r = this->_GD1< itk::RGBAPixel< short >, D >( io ); break; - case itk::ImageIOBase::INT : r = this->_GD1< itk::RGBAPixel< int >, D >( io ); break; - case itk::ImageIOBase::LONG : r = this->_GD1< itk::RGBAPixel< long >, D >( io ); break; - case itk::ImageIOBase::FLOAT : r = this->_GD1< itk::RGBAPixel< float >, D >( io ); break; - case itk::ImageIOBase::DOUBLE : r = this->_GD1< itk::RGBAPixel< double >, D >( io ); break; - case itk::ImageIOBase::UCHAR : r = this->_GD1< itk::RGBAPixel< unsigned char >, D >( io ); break; - case itk::ImageIOBase::USHORT : r = this->_GD1< itk::RGBAPixel< unsigned short >, D >( io ); break; - case itk::ImageIOBase::UINT : r = this->_GD1< itk::RGBAPixel< unsigned int >, D >( io ); break; - case itk::ImageIOBase::ULONG : r = this->_GD1< itk::RGBAPixel< unsigned long >, D >( io ); break; + case itk::ImageIOBase::CHAR : r = this->_GD1< itk::RGBAPixel< char >, _Dim >( io ); break; + case itk::ImageIOBase::SHORT : r = this->_GD1< itk::RGBAPixel< short >, _Dim >( io ); break; + case itk::ImageIOBase::INT : r = this->_GD1< itk::RGBAPixel< int >, _Dim >( io ); break; + case itk::ImageIOBase::LONG : r = this->_GD1< itk::RGBAPixel< long >, _Dim >( io ); break; + case itk::ImageIOBase::FLOAT : r = this->_GD1< itk::RGBAPixel< float >, _Dim >( io ); break; + case itk::ImageIOBase::DOUBLE : r = this->_GD1< itk::RGBAPixel< double >, _Dim >( io ); break; + case itk::ImageIOBase::UCHAR : r = this->_GD1< itk::RGBAPixel< uchar >, _Dim >( io ); break; + case itk::ImageIOBase::USHORT : r = this->_GD1< itk::RGBAPixel< ushort >, _Dim >( io ); break; + case itk::ImageIOBase::UINT : r = this->_GD1< itk::RGBAPixel< uint >, _Dim >( io ); break; + case itk::ImageIOBase::ULONG : r = this->_GD1< itk::RGBAPixel< ulong >, _Dim >( io ); break; default: r = "IO::ImageReader: RGBA pixel type not supported."; break; } // hctiws } + else if( pt == itk::ImageIOBase::COMPLEX ) + { + switch( ct ) + { + case itk::ImageIOBase::FLOAT : r = this->_GD1< std::complex< float >, _Dim >( io ); break; + case itk::ImageIOBase::DOUBLE : r = this->_GD1< std::complex< double >, _Dim >( io ); break; + default: + r = "IO::ImageReader: complex pixel type not supported."; + break; + } // hctiws + } /* TODO else if( pt == itk::ImageIOBase::VECTOR ) { @@ -154,9 +170,6 @@ _GD0( itk::ImageIOBase* io ) else if( pt == itk::ImageIOBase::DIFFUSIONTENSOR3D ) { } - else if( pt == itk::ImageIOBase::COMPLEX ) - { - } else if( pt == itk::ImageIOBase::OFFSET ) { } @@ -173,18 +186,18 @@ _GD0( itk::ImageIOBase* io ) } // ------------------------------------------------------------------------- -template< class P, unsigned int D > +template< class _TPixel, unsigned int _Dim > std::string cpPluginsIO::ImageReader:: _GD1( itk::ImageIOBase* io ) { - typedef itk::Image< P, D > _I; + typedef itk::Image< _TPixel, _Dim > _TImage; // Get filenames std::string r = ""; auto fnames = this->m_Parameters.GetOpenFileNameList( "FileNames" ); if( fnames.size( ) == 1 ) { - auto f = this->_CreateITK< itk::ImageFileReader< _I > >( ); + auto f = this->_CreateITK< itk::ImageFileReader< _TImage > >( ); f->SetFileName( fnames[ 0 ] ); f->SetImageIO( io ); try @@ -199,7 +212,7 @@ _GD1( itk::ImageIOBase* io ) } else // if( fnames.size( ) > 1 ) { - auto f = this->_CreateITK< itk::ImageSeriesReader< _I > >( ); + auto f = this->_CreateITK< itk::ImageSeriesReader< _TImage > >( ); for( auto i = fnames.begin( ); i != fnames.end( ); ++i ) f->AddFileName( *i ); f->SetImageIO( io ); diff --git a/plugins/cpPluginsIO/ImageReader.h b/plugins/cpPluginsIO/ImageReader.h index a0b5c19..a12edcc 100644 --- a/plugins/cpPluginsIO/ImageReader.h +++ b/plugins/cpPluginsIO/ImageReader.h @@ -33,10 +33,10 @@ namespace cpPluginsIO virtual std::string _GenerateData( ) override; - template< unsigned int D > + template< unsigned int _Dim > inline std::string _GD0( itk::ImageIOBase* io ); - template< class P, unsigned int D > + template< class _TPixel, unsigned int _Dim > inline std::string _GD1( itk::ImageIOBase* io ); private: diff --git a/plugins/cpPluginsIO/ImageWriter.cxx b/plugins/cpPluginsIO/ImageWriter.cxx index 76be57c..b14c928 100644 --- a/plugins/cpPluginsIO/ImageWriter.cxx +++ b/plugins/cpPluginsIO/ImageWriter.cxx @@ -45,11 +45,11 @@ _GenerateData( ) } // ------------------------------------------------------------------------- -template< class I > +template< class _TInput > std::string cpPluginsIO::ImageWriter:: -_GD0( I* image ) +_GD0( _TInput* image ) { - static const unsigned int D = I::ImageDimension; + static const unsigned int D = _TInput::ImageDimension; if( image == NULL ) return( "IO::ImageWriter: Invalid image dimension." ); @@ -59,13 +59,13 @@ _GD0( I* image ) } // ------------------------------------------------------------------------- -template< class I > +template< class _TInput > std::string cpPluginsIO::ImageWriter:: -_GD1( I* image ) +_GD1( _TInput* image ) { if( image == NULL ) return( "IO::ImageWriter: Invalid pixel type." ); - auto f = this->_CreateITK< itk::ImageFileWriter< I > >( ); + auto f = this->_CreateITK< itk::ImageFileWriter< _TInput > >( ); f->SetFileName( this->m_Parameters.GetSaveFileName( "FileName" ) ); f->SetInput( image ); f->Update( ); diff --git a/plugins/cpPluginsIO/ImageWriter.h b/plugins/cpPluginsIO/ImageWriter.h index a6c9b79..ba0fb03 100644 --- a/plugins/cpPluginsIO/ImageWriter.h +++ b/plugins/cpPluginsIO/ImageWriter.h @@ -28,11 +28,11 @@ namespace cpPluginsIO virtual std::string _GenerateData( ) override; - template< class I > - inline std::string _GD0( I* image ); + template< class _TInput > + inline std::string _GD0( _TInput* image ); - template< class I > - inline std::string _GD1( I* image ); + template< class _TInput > + inline std::string _GD1( _TInput* image ); private: // Purposely not implemented diff --git a/plugins/cpPluginsImageFilters/BinaryContourImageFilter.cxx b/plugins/cpPluginsImageFilters/BinaryContourImageFilter.cxx new file mode 100644 index 0000000..487f687 --- /dev/null +++ b/plugins/cpPluginsImageFilters/BinaryContourImageFilter.cxx @@ -0,0 +1,100 @@ +#include +#include +#include + +#include +#include +#include + +// ------------------------------------------------------------------------- +cpPluginsImageFilters::BinaryContourImageFilter:: +BinaryContourImageFilter( ) + : Superclass( ) +{ + this->_AddInput( "Input" ); + this->_AddOutput< cpPlugins::Image >( "Output" ); + + this->m_Parameters.ConfigureAsBool( "FullyConnected" ); + this->m_Parameters.ConfigureAsReal( "BackgroundValue" ); + this->m_Parameters.ConfigureAsReal( "ForegroundValue" ); + std::vector< std::string > choices; + choices.push_back( "float" ); + choices.push_back( "double" ); + this->m_Parameters.ConfigureAsChoices( "OutputResolution", choices ); + + this->m_Parameters.SetBool( "FullyConnected", false ); + this->m_Parameters.SetReal( "BackgroundValue", 0 ); + this->m_Parameters.SetReal( "ForegroundValue", 1 ); + this->m_Parameters.SetSelectedChoice( "OutputResolution", "float" ); +} + +// ------------------------------------------------------------------------- +cpPluginsImageFilters::BinaryContourImageFilter:: +~BinaryContourImageFilter( ) +{ +} + +// ------------------------------------------------------------------------- +std::string cpPluginsImageFilters::BinaryContourImageFilter:: +_GenerateData( ) +{ + auto image = this->GetInputData( "Input" )->GetITK< itk::DataObject >( ); + std::string cpPlugin_Image_Demangle_Pixel_AllScalars( r, _GD0, image, 2 ); + if( r != "" ) cpPlugin_Image_Demangle_Pixel_AllScalars( r, _GD0, image, 3 ); + return( r ); +} + +// ------------------------------------------------------------------------- +template< class _TImage > +std::string cpPluginsImageFilters::BinaryContourImageFilter:: +_GD0( _TImage* image ) +{ + if( image != NULL ) + { + std::string out_res = + this->m_Parameters.GetSelectedChoice( "OutputResolution" ); + if( out_res == "float" ) + return( + this->_GD1< _TImage, itk::Image< float, _TImage::ImageDimension > >( + image + ) + ); + else // if( out_res == "double" ) + return( + this->_GD1< _TImage, itk::Image< double, _TImage::ImageDimension > >( + image + ) + ); + } + else + return( + "ImageFilters::BinaryContourImageFilter: No valid input image." + ); +} + +// ------------------------------------------------------------------------- +template< class _TImage, class _TContourImage > +std::string cpPluginsImageFilters::BinaryContourImageFilter:: +_GD1( _TImage* image ) +{ + typedef itk::BinaryContourImageFilter< _TImage, _TContourImage > _F; + + // Get parameters + bool fc = this->m_Parameters.GetBool( "FullyConnected" ); + double bv = this->m_Parameters.GetReal( "BackgroundValue" ); + double fv = this->m_Parameters.GetReal( "ForegroundValue" ); + + // Configure filter + _F* filter = this->_CreateITK< _F >( ); + filter->SetInput( image ); + filter->SetFullyConnected( fc ); + filter->SetBackgroundValue( bv ); + filter->SetForegroundValue( fv ); + filter->Update( ); + + // Connect output + this->GetOutputData( "Output" )->SetITK( filter->GetOutput( ) ); + return( "" ); +} + +// eof - $RCSfile$ diff --git a/plugins/cpPluginsImageFilters/BinaryContourImageFilter.h b/plugins/cpPluginsImageFilters/BinaryContourImageFilter.h new file mode 100644 index 0000000..eead0e1 --- /dev/null +++ b/plugins/cpPluginsImageFilters/BinaryContourImageFilter.h @@ -0,0 +1,47 @@ +#ifndef __CPPLUGINSIMAGEFILTERS__BINARYCONTOURIMAGEFILTER__H__ +#define __CPPLUGINSIMAGEFILTERS__BINARYCONTOURIMAGEFILTER__H__ + +#include +#include + +namespace cpPluginsImageFilters +{ + /** + */ + class cpPluginsImageFilters_EXPORT BinaryContourImageFilter + : public cpPlugins::ProcessObject + { + public: + typedef BinaryContourImageFilter Self; + typedef cpPlugins::ProcessObject Superclass; + typedef itk::SmartPointer< Self > Pointer; + typedef itk::SmartPointer< const Self > ConstPointer; + + public: + itkNewMacro( Self ); + itkTypeMacro( BinaryContourImageFilter, cpPlugins::ProcessObject ); + cpPlugins_Id_Macro( BinaryContourImageFilter, ImageFilters ); + + protected: + BinaryContourImageFilter( ); + virtual ~BinaryContourImageFilter( ); + + virtual std::string _GenerateData( ); + + template< class _TImage > + inline std::string _GD0( _TImage* image ); + + template< class _TImage, class _TContourImage > + inline std::string _GD1( _TImage* image ); + + private: + // Purposely not implemented + BinaryContourImageFilter( const Self& ); + Self& operator=( const Self& ); + }; + +} // ecapseman + +#endif // __CPPLUGINSIMAGEFILTERS__BINARYCONTOURIMAGEFILTER__H__ + +// eof - $RCSfile$ diff --git a/plugins/cpPluginsImageFilters/BinaryThresholdImageFilter.cxx b/plugins/cpPluginsImageFilters/BinaryThresholdImageFilter.cxx index 5915829..6545d56 100644 --- a/plugins/cpPluginsImageFilters/BinaryThresholdImageFilter.cxx +++ b/plugins/cpPluginsImageFilters/BinaryThresholdImageFilter.cxx @@ -1,10 +1,9 @@ #include #include +#include #include #include -#include -#include #include // ------------------------------------------------------------------------- @@ -20,10 +19,24 @@ BinaryThresholdImageFilter( ) this->m_Parameters.ConfigureAsUint( "InsideValue" ); this->m_Parameters.ConfigureAsUint( "OutsideValue" ); + std::vector< std::string > choices; + choices.push_back( "char" ); + choices.push_back( "short" ); + choices.push_back( "int" ); + choices.push_back( "long" ); + choices.push_back( "float" ); + choices.push_back( "double" ); + choices.push_back( "unsigned char" ); + choices.push_back( "unsigned short" ); + choices.push_back( "unsigned int" ); + choices.push_back( "unsigned long" ); + this->m_Parameters.ConfigureAsChoices( "OutputResolution", choices ); + this->m_Parameters.SetReal( "LowerThresholdValue", 0 ); this->m_Parameters.SetReal( "UpperThresholdValue", 10000 ); - this->m_Parameters.SetUint( "InsideValue", 1 ); - this->m_Parameters.SetUint( "OutsideValue", 0 ); + this->m_Parameters.SetReal( "InsideValue", 1 ); + this->m_Parameters.SetReal( "OutsideValue", 0 ); + this->m_Parameters.SetSelectedChoice( "OutputResolution", "unsigned char" ); } // ------------------------------------------------------------------------- @@ -45,16 +58,35 @@ _GenerateData( ) } // ------------------------------------------------------------------------- -template< class I > +template< class _TImage > std::string cpPluginsImageFilters::BinaryThresholdImageFilter:: -_GD0( I* image ) +_GD0( _TImage* image ) { if( image != NULL ) - return( - this->_GD1< I, itk::Image< unsigned char, I::ImageDimension > >( - image - ) - ); + { + auto choice = this->m_Parameters.GetSelectedChoice( "OutputResolution" ); + if( choice == "char" ) + return( this->_GD1< _TImage, char >( image ) ); + else if( choice == "short" ) + return( this->_GD1< _TImage, short >( image ) ); + else if( choice == "int" ) + return( this->_GD1< _TImage, int >( image ) ); + else if( choice == "long" ) + return( this->_GD1< _TImage, long >( image ) ); + else if( choice == "float" ) + return( this->_GD1< _TImage, float >( image ) ); + else if( choice == "double" ) + return( this->_GD1< _TImage, double >( image ) ); + else if( choice == "unsigned char" ) + return( this->_GD1< _TImage, unsigned char >( image ) ); + else if( choice == "unsigned short" ) + return( this->_GD1< _TImage, unsigned short >( image ) ); + else if( choice == "unsigned int" ) + return( this->_GD1< _TImage, unsigned int >( image ) ); + else if( choice == "unsigned long" ) + return( this->_GD1< _TImage, unsigned long >( image ) ); + else return( "BinaryThresholdImageFilter: no valid output type." ); + } else return( "ImageFilters::BinaryThresholdImageFilter: No valid input image." @@ -62,19 +94,20 @@ _GD0( I* image ) } // ------------------------------------------------------------------------- -template< class I, class O > +template< class _TImage, class _TBinaryPixel > std::string cpPluginsImageFilters::BinaryThresholdImageFilter:: -_GD1( I* image ) +_GD1( _TImage* image ) { - typedef itk::BinaryThresholdImageFilter< I, O > _F; - typedef typename I::PixelType _IP; - typedef typename O::PixelType _OP; + typedef itk::Image< _TBinaryPixel, _TImage::ImageDimension > _TBinaryImage; + typedef itk::BinaryThresholdImageFilter< _TImage, _TBinaryImage > _F; + typedef typename _TImage::PixelType _TP; + typedef typename _TBinaryImage::PixelType _UP; // Get parameters - _IP lower_val = _IP( this->m_Parameters.GetReal( "LowerThresholdValue" ) ); - _IP upper_val = _IP( this->m_Parameters.GetReal( "UpperThresholdValue" ) ); - _OP in_val = _OP( this->m_Parameters.GetUint( "InsideValue" ) ); - _OP out_val = _OP( this->m_Parameters.GetUint( "OutsideValue" ) ); + _TP lower_val = _TP( this->m_Parameters.GetReal( "LowerThresholdValue" ) ); + _TP upper_val = _TP( this->m_Parameters.GetReal( "UpperThresholdValue" ) ); + _UP in_val = _UP( this->m_Parameters.GetReal( "InsideValue" ) ); + _UP out_val = _UP( this->m_Parameters.GetReal( "OutsideValue" ) ); // Configure filter _F* filter = this->_CreateITK< _F >( ); diff --git a/plugins/cpPluginsImageFilters/BinaryThresholdImageFilter.h b/plugins/cpPluginsImageFilters/BinaryThresholdImageFilter.h index 1d80104..9fecb4b 100644 --- a/plugins/cpPluginsImageFilters/BinaryThresholdImageFilter.h +++ b/plugins/cpPluginsImageFilters/BinaryThresholdImageFilter.h @@ -28,11 +28,11 @@ namespace cpPluginsImageFilters virtual std::string _GenerateData( ); - template< class I > - inline std::string _GD0( I* image ); + template< class _TImage > + inline std::string _GD0( _TImage* image ); - template< class I, class O > - inline std::string _GD1( I* image ); + template< class _TImage, class _TBinaryPixel > + inline std::string _GD1( _TImage* image ); private: // Purposely not implemented diff --git a/plugins/cpPluginsImageFilters/HistogramThresholdImageFilter.cxx b/plugins/cpPluginsImageFilters/HistogramThresholdImageFilter.cxx new file mode 100644 index 0000000..f3addf4 --- /dev/null +++ b/plugins/cpPluginsImageFilters/HistogramThresholdImageFilter.cxx @@ -0,0 +1,86 @@ +#include +#include +#include + +#include +#include +#include + +// ------------------------------------------------------------------------- +cpPluginsImageFilters::HistogramThresholdImageFilter:: +HistogramThresholdImageFilter( ) + : Superclass( ) +{ + this->_AddInput( "Input" ); + this->_AddInput( "Calculator" ); + this->_AddInput( "Mask", false ); + this->_AddOutput< cpPlugins::Image >( "Output" ); + + this->m_Parameters.ConfigureAsUint( "NumberOfHistogramBins" ); + this->m_Parameters.ConfigureAsBool( "AutoMinimumMaximum" ); + this->m_Parameters.ConfigureAsBool( "MaskOutput" ); + this->m_Parameters.ConfigureAsReal( "MaskValue" ); + this->m_Parameters.ConfigureAsReal( "Threshold" ); + + this->m_Parameters.SetUint( "NumberOfHistogramBins", 256 ); + this->m_Parameters.SetBool( "AutoMinimumMaximum", true ); + this->m_Parameters.SetBool( "MaskOutput", false ); + this->m_Parameters.SetReal( "MaskValue", 1 ); + this->m_Parameters.SetReal( "Threshold", 0 ); +} + +// ------------------------------------------------------------------------- +cpPluginsImageFilters::HistogramThresholdImageFilter:: +~HistogramThresholdImageFilter( ) +{ +} + +// ------------------------------------------------------------------------- +std::string cpPluginsImageFilters::HistogramThresholdImageFilter:: +_GenerateData( ) +{ + auto image = this->GetInputData( "Input" )->GetITK< itk::DataObject >( ); + std::string cpPlugin_Image_Demangle_Pixel_AllScalars( r, _GD0, image, 1 ); + if( r != "" ) cpPlugin_Image_Demangle_Pixel_AllScalars( r, _GD0, image, 2 ); + if( r != "" ) cpPlugin_Image_Demangle_Pixel_AllScalars( r, _GD0, image, 3 ); + if( r != "" ) cpPlugin_Image_Demangle_Pixel_AllScalars( r, _GD0, image, 4 ); + return( r ); +} + +// ------------------------------------------------------------------------- +template< class _TImage > +std::string cpPluginsImageFilters::HistogramThresholdImageFilter:: +_GD0( _TImage* image ) +{ + if( image != NULL ) + return( + this->_GD1< _TImage, itk::Image< unsigned char, _TImage::ImageDimension > >( image ) + ); + else + return( + "ImageFilters::HistogramThresholdImageFilter: No valid input image." + ); +} + +// ------------------------------------------------------------------------- +template< class _TImage, class _TBinaryImage > +std::string cpPluginsImageFilters::HistogramThresholdImageFilter:: +_GD1( _TImage* image ) +{ + typedef itk::HistogramThresholdImageFilter< _TImage, _TBinaryImage > _F; + typedef typename _TImage::PixelType _TP; + typedef typename _TBinaryImage::PixelType _UP; + + // Get parameters + + // Configure filter + _F* filter = this->_CreateITK< _F >( ); + filter->SetInput( image ); + filter->Update( ); + + // Connect output + this->GetOutputData( "Output" )->SetITK( filter->GetOutput( ) ); + return( "HistogramThresholdImage: not complete yet." ); +} + +// eof - $RCSfile$ diff --git a/plugins/cpPluginsImageFilters/HistogramThresholdImageFilter.h b/plugins/cpPluginsImageFilters/HistogramThresholdImageFilter.h new file mode 100644 index 0000000..464629d --- /dev/null +++ b/plugins/cpPluginsImageFilters/HistogramThresholdImageFilter.h @@ -0,0 +1,47 @@ +#ifndef __CPPLUGINSIMAGEFILTERS__HISTOGRAMTHRESHOLDIMAGEFILTER__H__ +#define __CPPLUGINSIMAGEFILTERS__HISTOGRAMTHRESHOLDIMAGEFILTER__H__ + +#include +#include + +namespace cpPluginsImageFilters +{ + /** + */ + class cpPluginsImageFilters_EXPORT HistogramThresholdImageFilter + : public cpPlugins::ProcessObject + { + public: + typedef HistogramThresholdImageFilter Self; + typedef cpPlugins::ProcessObject Superclass; + typedef itk::SmartPointer< Self > Pointer; + typedef itk::SmartPointer< const Self > ConstPointer; + + public: + itkNewMacro( Self ); + itkTypeMacro( HistogramThresholdImageFilter, cpPlugins::ProcessObject ); + cpPlugins_Id_Macro( HistogramThresholdImageFilter, ImageFilters ); + + protected: + HistogramThresholdImageFilter( ); + virtual ~HistogramThresholdImageFilter( ); + + virtual std::string _GenerateData( ); + + template< class _TImage > + inline std::string _GD0( _TImage* image ); + + template< class _TImage, class _TBinaryImage > + inline std::string _GD1( _TImage* image ); + + private: + // Purposely not implemented + HistogramThresholdImageFilter( const Self& ); + Self& operator=( const Self& ); + }; + +} // ecapseman + +#endif // __CPPLUGINSIMAGEFILTERS__HISTOGRAMTHRESHOLDIMAGEFILTER__H__ + +// eof - $RCSfile$ diff --git a/plugins/cpPluginsImageFilters/ImageToHistogramFilter.cxx b/plugins/cpPluginsImageFilters/ImageToHistogramFilter.cxx new file mode 100644 index 0000000..85699e3 --- /dev/null +++ b/plugins/cpPluginsImageFilters/ImageToHistogramFilter.cxx @@ -0,0 +1,73 @@ +#include +#include +#include + +#include +#include +/* + #include + #include + #include +*/ + +// ------------------------------------------------------------------------- +cpPluginsImageFilters::ImageToHistogramFilter:: +ImageToHistogramFilter( ) + : Superclass( ) +{ + this->_AddInput( "Input" ); + this->_AddOutput< cpPlugins::DataObject >( "Output" ); +} + +// ------------------------------------------------------------------------- +cpPluginsImageFilters::ImageToHistogramFilter:: +~ImageToHistogramFilter( ) +{ +} + +// ------------------------------------------------------------------------- +std::string cpPluginsImageFilters::ImageToHistogramFilter:: +_GenerateData( ) +{ + auto image = this->GetInputData( "Input" )->GetITK< itk::DataObject >( ); + std::string cpPlugin_Image_Demangle_Pixel_AllScalars( r, _GD0, image, 1 ); + if( r != "" ) cpPlugin_Image_Demangle_Pixel_AllScalars( r, _GD0, image, 2 ); + if( r != "" ) cpPlugin_Image_Demangle_Pixel_AllScalars( r, _GD0, image, 3 ); + if( r != "" ) cpPlugin_Image_Demangle_Pixel_AllScalars( r, _GD0, image, 4 ); + return( r ); +} + +// ------------------------------------------------------------------------- +template< class _TImage > +std::string cpPluginsImageFilters::ImageToHistogramFilter:: +_GD0( _TImage* image ) +{ + typedef itk::Statistics::ImageToHistogramFilter< _TImage > _F; + /* + typedef typename _TImage::PixelType _TP; + typedef typename _TBinaryImage::PixelType _UP; + + // Get parameters + _TP lower_val = _TP( this->m_Parameters.GetReal( "LowerThresholdValue" ) ); + _TP upper_val = _TP( this->m_Parameters.GetReal( "UpperThresholdValue" ) ); + _UP in_val = _UP( this->m_Parameters.GetUint( "InsideValue" ) ); + _UP out_val = _UP( this->m_Parameters.GetUint( "OutsideValue" ) ); + */ + + // Configure filter + _F* filter = this->_CreateITK< _F >( ); + /* + filter->SetInput( image ); + filter->SetLowerThreshold( lower_val ); + filter->SetUpperThreshold( upper_val ); + filter->SetInsideValue( in_val ); + filter->SetOutsideValue( out_val ); + filter->Update( ); + + // Connect output + this->GetOutputData( "Output" )->SetITK( filter->GetOutput( ) ); + */ + return( "ImageToHistogramFilter: not ready yet." ); +} + +// eof - $RCSfile$ diff --git a/plugins/cpPluginsImageFilters/ImageToHistogramFilter.h b/plugins/cpPluginsImageFilters/ImageToHistogramFilter.h new file mode 100644 index 0000000..8a09d4f --- /dev/null +++ b/plugins/cpPluginsImageFilters/ImageToHistogramFilter.h @@ -0,0 +1,44 @@ +#ifndef __CPPLUGINSIMAGEFILTERS__IMAGETOHISTOGRAMFILTER__H__ +#define __CPPLUGINSIMAGEFILTERS__IMAGETOHISTOGRAMFILTER__H__ + +#include +#include + +namespace cpPluginsImageFilters +{ + /** + */ + class cpPluginsImageFilters_EXPORT ImageToHistogramFilter + : public cpPlugins::ProcessObject + { + public: + typedef ImageToHistogramFilter Self; + typedef cpPlugins::ProcessObject Superclass; + typedef itk::SmartPointer< Self > Pointer; + typedef itk::SmartPointer< const Self > ConstPointer; + + public: + itkNewMacro( Self ); + itkTypeMacro( ImageToHistogramFilter, cpPlugins::ProcessObject ); + cpPlugins_Id_Macro( ImageToHistogramFilter, ImageFilters ); + + protected: + ImageToHistogramFilter( ); + virtual ~ImageToHistogramFilter( ); + + virtual std::string _GenerateData( ); + + template< class _TImage > + inline std::string _GD0( _TImage* image ); + + private: + // Purposely not implemented + ImageToHistogramFilter( const Self& ); + Self& operator=( const Self& ); + }; + +} // ecapseman + +#endif // __CPPLUGINSIMAGEFILTERS__IMAGETOHISTOGRAMFILTER__H__ + +// eof - $RCSfile$ diff --git a/plugins/cpPluginsImageFilters/MaskedImageToHistogramFilter.cxx b/plugins/cpPluginsImageFilters/MaskedImageToHistogramFilter.cxx new file mode 100644 index 0000000..61b2bbe --- /dev/null +++ b/plugins/cpPluginsImageFilters/MaskedImageToHistogramFilter.cxx @@ -0,0 +1,76 @@ +#include +#include +#include + +#include +#include + +// ------------------------------------------------------------------------- +cpPluginsImageFilters::MaskedImageToHistogramFilter:: +MaskedImageToHistogramFilter( ) + : Superclass( ) +{ + this->_AddInput( "Input" ); + this->_AddInput( "Mask" ); + this->_AddOutput< cpPlugins::DataObject >( "Output" ); +} + +// ------------------------------------------------------------------------- +cpPluginsImageFilters::MaskedImageToHistogramFilter:: +~MaskedImageToHistogramFilter( ) +{ +} + +// ------------------------------------------------------------------------- +std::string cpPluginsImageFilters::MaskedImageToHistogramFilter:: +_GenerateData( ) +{ + auto image = this->GetInputData( "Input" )->GetITK< itk::DataObject >( ); + std::string cpPlugin_Image_Demangle_Pixel_AllScalars( r, _GD0, image, 1 ); + if( r != "" ) cpPlugin_Image_Demangle_Pixel_AllScalars( r, _GD0, image, 2 ); + if( r != "" ) cpPlugin_Image_Demangle_Pixel_AllScalars( r, _GD0, image, 3 ); + if( r != "" ) cpPlugin_Image_Demangle_Pixel_AllScalars( r, _GD0, image, 4 ); + return( r ); +} + +// ------------------------------------------------------------------------- +template< class _TImage > +std::string cpPluginsImageFilters::MaskedImageToHistogramFilter:: +_GD0( _TImage* image ) +{ + if( image != NULL ) + return( + this->_GD1< _TImage, itk::Image< unsigned char, _TImage::ImageDimension > >( image ) + ); + else + return( + "ImageFilters::MaskedImageToHistogramFilter: No valid input image." + ); +} + +// ------------------------------------------------------------------------- +template< class _TImage, class _TMask > +std::string cpPluginsImageFilters::MaskedImageToHistogramFilter:: +_GD1( _TImage* image ) +{ + typedef itk::Statistics::MaskedImageToHistogramFilter< _TImage, _TMask > _F; + + // Get parameters + + // Configure filter + _F* filter = this->_CreateITK< _F >( ); + /* + filter->SetInput( image ); + filter->SetLowerThreshold( lower_val ); + filter->SetUpperThreshold( upper_val ); + filter->SetInsideValue( in_val ); + filter->SetOutsideValue( out_val ); + filter->Update( ); + + // Connect output + this->GetOutputData( "Output" )->SetITK( filter->GetOutput( ) ); + */ + return( "MaskedImageToHistogramFilter: not ready yet." ); +} + +// eof - $RCSfile$ diff --git a/plugins/cpPluginsImageFilters/MaskedImageToHistogramFilter.h b/plugins/cpPluginsImageFilters/MaskedImageToHistogramFilter.h new file mode 100644 index 0000000..79481f9 --- /dev/null +++ b/plugins/cpPluginsImageFilters/MaskedImageToHistogramFilter.h @@ -0,0 +1,47 @@ +#ifndef __CPPLUGINSIMAGEFILTERS__MASKEDIMAGETOHISTOGRAMFILTER__H__ +#define __CPPLUGINSIMAGEFILTERS__MASKEDIMAGETOHISTOGRAMFILTER__H__ + +#include +#include + +namespace cpPluginsImageFilters +{ + /** + */ + class cpPluginsImageFilters_EXPORT MaskedImageToHistogramFilter + : public cpPlugins::ProcessObject + { + public: + typedef MaskedImageToHistogramFilter Self; + typedef cpPlugins::ProcessObject Superclass; + typedef itk::SmartPointer< Self > Pointer; + typedef itk::SmartPointer< const Self > ConstPointer; + + public: + itkNewMacro( Self ); + itkTypeMacro( MaskedImageToHistogramFilter, cpPlugins::ProcessObject ); + cpPlugins_Id_Macro( MaskedImageToHistogramFilter, ImageFilters ); + + protected: + MaskedImageToHistogramFilter( ); + virtual ~MaskedImageToHistogramFilter( ); + + virtual std::string _GenerateData( ); + + template< class _TImage > + inline std::string _GD0( _TImage* image ); + + template< class _TImage, class _TMask > + inline std::string _GD1( _TImage* image ); + + private: + // Purposely not implemented + MaskedImageToHistogramFilter( const Self& ); + Self& operator=( const Self& ); + }; + +} // ecapseman + +#endif // __CPPLUGINSIMAGEFILTERS__MASKEDIMAGETOHISTOGRAMFILTER__H__ + +// eof - $RCSfile$ diff --git a/plugins/cpPluginsImageFilters/OtsuThresholdImageFilter.cxx b/plugins/cpPluginsImageFilters/OtsuThresholdImageFilter.cxx index c08eb20..177d464 100644 --- a/plugins/cpPluginsImageFilters/OtsuThresholdImageFilter.cxx +++ b/plugins/cpPluginsImageFilters/OtsuThresholdImageFilter.cxx @@ -1,15 +1,17 @@ #include #include +#include #include -#include -#include -#include -#include -#include -#include #include #include +/* + #include + #include + #include + #include + #include +*/ // ------------------------------------------------------------------------- cpPluginsImageFilters::OtsuThresholdImageFilter:: @@ -47,34 +49,34 @@ _GenerateData( ) } // ------------------------------------------------------------------------- -template< class I > +template< class _TImage > std::string cpPluginsImageFilters::OtsuThresholdImageFilter:: -_GD0( I* image ) +_GD0( _TImage* image ) { if( image != NULL ) return( - this->_GD1< I, itk::Image< unsigned char, I::ImageDimension > >( image ) + this->_GD1< _TImage, itk::Image< unsigned char, _TImage::ImageDimension > >( image ) ); else return( "ImageFilters::OtsuThresholdImageFilter: No valid input image." ); } // ------------------------------------------------------------------------- -template< class I, class O > +template< class _TImage, class _TBinaryImage > std::string cpPluginsImageFilters::OtsuThresholdImageFilter:: -_GD1( I* image ) +_GD1( _TImage* image ) { - typedef itk::OtsuThresholdImageFilter< I, O > _F; - typedef typename O::PixelType _OP; + typedef itk::OtsuThresholdImageFilter< _TImage, _TBinaryImage > _F; + typedef typename _TBinaryImage::PixelType _UP; // Get parameters unsigned int bins = this->m_Parameters.GetUint( "NumberOfHistogramBins" ); - _OP in_val = _OP( this->m_Parameters.GetUint( "InsideValue" ) ); - _OP out_val = _OP( this->m_Parameters.GetUint( "OutsideValue" ) ); + _UP in_val = _UP( this->m_Parameters.GetUint( "InsideValue" ) ); + _UP out_val = _UP( this->m_Parameters.GetUint( "OutsideValue" ) ); // Configure filter _F* filter = this->_CreateITK< _F >( ); - filter->SetInput( dynamic_cast< I* >( image ) ); + filter->SetInput( image ); filter->SetNumberOfHistogramBins( bins ); filter->SetInsideValue( out_val ); // WARNING: these are inverted filter->SetOutsideValue( in_val ); diff --git a/plugins/cpPluginsImageFilters/OtsuThresholdImageFilter.h b/plugins/cpPluginsImageFilters/OtsuThresholdImageFilter.h index 6c20f50..a583ad5 100644 --- a/plugins/cpPluginsImageFilters/OtsuThresholdImageFilter.h +++ b/plugins/cpPluginsImageFilters/OtsuThresholdImageFilter.h @@ -28,11 +28,11 @@ namespace cpPluginsImageFilters virtual std::string _GenerateData( ); - template< class I > - inline std::string _GD0( I* image ); + template< class _TImage > + inline std::string _GD0( _TImage* image ); - template< class I, class O > - inline std::string _GD1( I* image ); + template< class _TImage, class _TBinaryImage > + inline std::string _GD1( _TImage* image ); private: // Purposely not implemented diff --git a/plugins/cpPluginsImageFilters/SignedMaurerDistanceMapImageFilter.cxx b/plugins/cpPluginsImageFilters/SignedMaurerDistanceMapImageFilter.cxx index fcb03cd..fcdb255 100644 --- a/plugins/cpPluginsImageFilters/SignedMaurerDistanceMapImageFilter.cxx +++ b/plugins/cpPluginsImageFilters/SignedMaurerDistanceMapImageFilter.cxx @@ -1,13 +1,16 @@ #include #include +#include #include #include -#include -#include -#include -#include -#include +/* + #include + #include + #include + #include + #include +*/ // ------------------------------------------------------------------------- cpPluginsImageFilters::SignedMaurerDistanceMapImageFilter:: @@ -51,9 +54,9 @@ _GenerateData( ) } // ------------------------------------------------------------------------- -template< class I > +template< class _TImage > std::string cpPluginsImageFilters::SignedMaurerDistanceMapImageFilter:: -_GD0( I* image ) +_GD0( _TImage* image ) { if( image != NULL ) { @@ -61,11 +64,11 @@ _GD0( I* image ) this->m_Parameters.GetSelectedChoice( "OutputResolution" ); if( out_res == "float" ) return( - this->_GD1< I, itk::Image< float, I::ImageDimension > >( image ) + this->_GD1< _TImage, itk::Image< float, _TImage::ImageDimension > >( image ) ); else if( out_res == "double" ) return( - this->_GD1< I, itk::Image< double, I::ImageDimension > >( image ) + this->_GD1< _TImage, itk::Image< double, _TImage::ImageDimension > >( image ) ); else return( "ImageFilters::SignedMaurerDistanceMapImageFilter: Output resolution not supported." ); @@ -77,11 +80,11 @@ _GD0( I* image ) } // ------------------------------------------------------------------------- -template< class I, class O > +template< class _TImage, class _TDMap > std::string cpPluginsImageFilters::SignedMaurerDistanceMapImageFilter:: -_GD1( I* image ) +_GD1( _TImage* image ) { - typedef itk::SignedMaurerDistanceMapImageFilter< I, O > _F; + typedef itk::SignedMaurerDistanceMapImageFilter< _TImage, _TDMap > _F; // Get parameters double back_value = this->m_Parameters.GetReal( "BackgroundValue" ); @@ -92,7 +95,7 @@ _GD1( I* image ) // Configure filter _F* filter = this->_CreateITK< _F >( ); filter->SetInput( image ); - filter->SetBackgroundValue( ( typename I::PixelType )( back_value ) ); + filter->SetBackgroundValue( ( typename _TImage::PixelType )( back_value ) ); filter->SetInsideIsPositive( pos_inside ); filter->SetSquaredDistance( sqr_dist ); filter->SetUseImageSpacing( use_spac ); diff --git a/plugins/cpPluginsImageFilters/SignedMaurerDistanceMapImageFilter.h b/plugins/cpPluginsImageFilters/SignedMaurerDistanceMapImageFilter.h index 745193d..d8630b7 100644 --- a/plugins/cpPluginsImageFilters/SignedMaurerDistanceMapImageFilter.h +++ b/plugins/cpPluginsImageFilters/SignedMaurerDistanceMapImageFilter.h @@ -33,11 +33,11 @@ namespace cpPluginsImageFilters virtual std::string _GenerateData( ); - template< class I > - inline std::string _GD0( I* image ); + template< class _TImage > + inline std::string _GD0( _TImage* image ); - template< class I, class O > - inline std::string _GD1( I* image ); + template< class _TImage, class _TDMap > + inline std::string _GD1( _TImage* image ); private: // Purposely not implemented diff --git a/plugins/cpPluginsWidgets/SeedWidget.cxx b/plugins/cpPluginsWidgets/SeedWidget.cxx index c5c014e..34e8efb 100644 --- a/plugins/cpPluginsWidgets/SeedWidget.cxx +++ b/plugins/cpPluginsWidgets/SeedWidget.cxx @@ -44,34 +44,34 @@ _GenerateData( ) } // ------------------------------------------------------------------------- -template< class I > +template< class _TImage > std::string cpPluginsWidgets::SeedWidget:: -_GD0( I* image ) +_GD0( _TImage* image ) { if( image != NULL ) { if( this->m_Parameters.GetBool( "SeedsAreInRealSpace" ) ) - return( this->_GD1_Points< I >( image ) ); + return( this->_GD1_Points( image ) ); else - return( this->_GD1_Vertices< I >( image ) ); + return( this->_GD1_Vertices( image ) ); } else return( "Widgets::SeedWidget: Input image dimension not supported." ); } // ------------------------------------------------------------------------- -template< class I > +template< class _TImage > std::string cpPluginsWidgets::SeedWidget:: -_GD1_Points( I* image ) +_GD1_Points( _TImage* image ) { typedef cpExtensions::Interaction::ImageInteractorStyle _S; - typedef itk::Point< double, I::ImageDimension > _P; + typedef itk::Point< double, _TImage::ImageDimension > _P; typedef itk::SimpleDataObjectDecorator< std::vector< _P > > _Container; auto container = this->_CreateITK< _Container >( ); double aux_pnt[ 3 ]; - unsigned int dim = ( I::ImageDimension < 3 )? I::ImageDimension: 3; + unsigned int dim = ( _TImage::ImageDimension < 3 )? _TImage::ImageDimension: 3; container->Get( ).clear( ); @@ -134,18 +134,18 @@ _GD1_Points( I* image ) } // ------------------------------------------------------------------------- -template< class I > +template< class _TImage > std::string cpPluginsWidgets::SeedWidget:: -_GD1_Vertices( I* image ) +_GD1_Vertices( _TImage* image ) { typedef cpExtensions::Interaction::ImageInteractorStyle _S; typedef - itk::SimpleDataObjectDecorator< std::vector< typename I::IndexType > > + itk::SimpleDataObjectDecorator< std::vector< typename _TImage::IndexType > > _Container; auto container = this->_CreateITK< _Container >( ); double aux_pnt[ 3 ]; - unsigned int dim = ( I::ImageDimension < 3 )? I::ImageDimension: 3; + unsigned int dim = ( _TImage::ImageDimension < 3 )? _TImage::ImageDimension: 3; container->Get( ).clear( ); @@ -165,10 +165,10 @@ _GD1_Vertices( I* image ) for( unsigned int i = 0; i < s->GetNumberOfSeeds( ); ++i ) { s->GetSeedAsPoint( i, aux_pnt ); - typename I::PointType seed; + typename _TImage::PointType seed; for( unsigned int d = 0; d < dim; ++d ) seed[ d ] = aux_pnt[ d ]; - typename I::IndexType idx; + typename _TImage::IndexType idx; if( image->TransformPhysicalPointToIndex( seed, idx ) ) container->Get( ).push_back( idx ); @@ -192,10 +192,10 @@ _GD1_Vertices( I* image ) for( unsigned int i = 0; i < s->GetNumberOfSeeds( ); ++i ) { s->GetSeedAsPoint( i, aux_pnt ); - typename I::PointType seed; + typename _TImage::PointType seed; for( unsigned int d = 0; d < dim; ++d ) seed[ d ] = aux_pnt[ d ]; - typename I::IndexType idx; + typename _TImage::IndexType idx; if( image->TransformPhysicalPointToIndex( seed, idx ) ) container->Get( ).push_back( idx ); diff --git a/plugins/cpPluginsWidgets/SeedWidget.h b/plugins/cpPluginsWidgets/SeedWidget.h index 7b02d94..eab98fc 100644 --- a/plugins/cpPluginsWidgets/SeedWidget.h +++ b/plugins/cpPluginsWidgets/SeedWidget.h @@ -31,14 +31,14 @@ namespace cpPluginsWidgets virtual std::string _GenerateData( ); - template< class I > - inline std::string _GD0( I* image ); + template< class _TImage > + inline std::string _GD0( _TImage* image ); - template< class I > - inline std::string _GD1_Points( I* image ); + template< class _TImage > + inline std::string _GD1_Points( _TImage* image ); - template< class I > - inline std::string _GD1_Vertices( I* image ); + template< class _TImage > + inline std::string _GD1_Vertices( _TImage* image ); private: // Purposely not implemented -- 2.47.1