From 6691ec7e01f1eafdfb65574771f39098fd0a6e33 Mon Sep 17 00:00:00 2001 From: Leonardo Florez-Valencia Date: Sat, 16 Apr 2016 19:23:16 -0500 Subject: [PATCH] ... --- appli/TempAirwaysAppli/TempAirwaysAppli.cxx | 7 ++++-- ...AndBifurcationsFromMinimumSpanningTree.cxx | 25 ++++++------------- ...tsAndBifurcationsFromMinimumSpanningTree.h | 4 +-- .../ExtractPathFromMinimumSpanningTree.cxx | 23 ++++++----------- .../fpa/ExtractPathFromMinimumSpanningTree.h | 4 +-- .../fpa/GradientBaseImageFunctionSource.cxx | 25 ++++++++----------- plugins/fpa/GradientBaseImageFunctionSource.h | 6 ++--- plugins/fpa/ImageDijkstra.cxx | 16 +++++------- plugins/fpa/ImageDijkstra.h | 4 +-- plugins/fpa/ImageRegionGrow.cxx | 14 ++++------- plugins/fpa/ImageRegionGrow.h | 4 +-- plugins/fpa/InvertCostFunction.cxx | 12 ++++----- plugins/fpa/InvertCostFunction.h | 4 +-- plugins/fpa/MinimumSpanningTreeReader.cxx | 18 ++++++------- plugins/fpa/MinimumSpanningTreeReader.h | 4 +-- plugins/fpa/MinimumSpanningTreeWriter.cxx | 16 +++++------- plugins/fpa/MinimumSpanningTreeWriter.h | 4 +-- plugins/fpa/RegionGrowThresholdFunction.cxx | 14 ++++------- plugins/fpa/RegionGrowThresholdFunction.h | 4 +-- 19 files changed, 82 insertions(+), 126 deletions(-) diff --git a/appli/TempAirwaysAppli/TempAirwaysAppli.cxx b/appli/TempAirwaysAppli/TempAirwaysAppli.cxx index 9e3692d..ff6eaeb 100644 --- a/appli/TempAirwaysAppli/TempAirwaysAppli.cxx +++ b/appli/TempAirwaysAppli/TempAirwaysAppli.cxx @@ -121,8 +121,11 @@ int main( int argc, char* argv[] ) { for(unsigned int i = 0; i < treeInfoVector.size(); ++ i){ TreeInfo info = treeInfoVector[i]; - std::string err = info.myWorkspace->Execute( "eb" ); - if( err != "" ) + try + { + info.myWorkspace->Execute( "eb" ); + } + catch( itk::ExceptionObject& err ) { std::cerr << "Error: " << err << std::endl; std::exit( 1 ); diff --git a/plugins/fpa/ExtractEndPointsAndBifurcationsFromMinimumSpanningTree.cxx b/plugins/fpa/ExtractEndPointsAndBifurcationsFromMinimumSpanningTree.cxx index 8078a67..73fbad0 100644 --- a/plugins/fpa/ExtractEndPointsAndBifurcationsFromMinimumSpanningTree.cxx +++ b/plugins/fpa/ExtractEndPointsAndBifurcationsFromMinimumSpanningTree.cxx @@ -29,40 +29,30 @@ fpaPlugins::ExtractEndPointsAndBifurcationsFromMinimumSpanningTree:: } // ------------------------------------------------------------------------- -std::string fpaPlugins::ExtractEndPointsAndBifurcationsFromMinimumSpanningTree:: +void fpaPlugins::ExtractEndPointsAndBifurcationsFromMinimumSpanningTree:: _GenerateData( ) { auto image = this->GetInputData( "CostsImage" )->GetITK< itk::DataObject >( ); - std::string r = cpPlugin_Image_Demangle_Pixel_Dim( _GD0, image, float, 2 ); - if( r != "" ) r = cpPlugin_Image_Demangle_Pixel_Dim( _GD0, image, double, 2 ); - if( r != "" ) r = cpPlugin_Image_Demangle_Pixel_Dim( _GD0, image, float, 3 ); - if( r != "" ) r = cpPlugin_Image_Demangle_Pixel_Dim( _GD0, image, double, 3 ); - return( r ); + cpPlugins_Image_Demangle_Pixel_AllFloats ( _GD0, image, 2 ); + else cpPlugins_Image_Demangle_Pixel_AllFloats( _GD0, image, 3 ); + else this->_Error( "Invalid input costs." ); } // ------------------------------------------------------------------------- template< class _TImage > -std::string fpaPlugins::ExtractEndPointsAndBifurcationsFromMinimumSpanningTree:: +void fpaPlugins::ExtractEndPointsAndBifurcationsFromMinimumSpanningTree:: _GD0( _TImage* image ) { typedef fpa::Image::MinimumSpanningTree< _TImage::ImageDimension > _TMST; typedef fpa::Image::ExtractEndPointsAndBifurcationsFromMinimumSpanningTree< _TImage, _TMST > _TFilter; // Check input objects' integrity - if( image == NULL ) - return( - "fpaPlugins::ExtractEndPointsAndBifurcationsFromMinimumSpanningTree: No valid input costs image." - ); auto dmap = this->GetInputData( "DistanceMap" )->GetITK< _TImage >( ); if( dmap == NULL ) - return( - "fpaPlugins::ExtractEndPointsAndBifurcationsFromMinimumSpanningTree: Distance map does not have the same type as the costs image." - ); + this->_Error( "Distance map does not have the same type as the costs image." ); auto mst = this->GetInputData( "MST" )->GetITK< _TMST >( ); if( mst == NULL ) - return( - "fpaPlugins::ExtractEndPointsAndBifurcationsFromMinimumSpanningTree: No valid input tree." - ); + this->_Error( "No valid input tree." ); // Create filter and connect inputs _TFilter* filter = this->_CreateITK< _TFilter >( ); @@ -78,7 +68,6 @@ _GD0( _TImage* image ) this->GetOutputData( "Bifurcations" )->SetITK( filter->GetBifurcations( ) ); this->GetOutputData( "Collisions" )->SetITK( filter->GetCollisions( ) ); this->GetOutputData( "Skeleton" )->SetITK( filter->GetSkeleton( ) ); - return( "" ); } // eof - $RCSfile$ diff --git a/plugins/fpa/ExtractEndPointsAndBifurcationsFromMinimumSpanningTree.h b/plugins/fpa/ExtractEndPointsAndBifurcationsFromMinimumSpanningTree.h index 5b85ca5..27b0efc 100644 --- a/plugins/fpa/ExtractEndPointsAndBifurcationsFromMinimumSpanningTree.h +++ b/plugins/fpa/ExtractEndPointsAndBifurcationsFromMinimumSpanningTree.h @@ -32,10 +32,10 @@ namespace fpaPlugins ExtractEndPointsAndBifurcationsFromMinimumSpanningTree( ); virtual ~ExtractEndPointsAndBifurcationsFromMinimumSpanningTree( ); - virtual std::string _GenerateData( ) ITK_OVERRIDE; + virtual void _GenerateData( ) ITK_OVERRIDE; template< class _TImage > - inline std::string _GD0( _TImage* image ); + inline void _GD0( _TImage* image ); private: // Purposely not implemented. diff --git a/plugins/fpa/ExtractPathFromMinimumSpanningTree.cxx b/plugins/fpa/ExtractPathFromMinimumSpanningTree.cxx index c263b9c..7e41b4f 100644 --- a/plugins/fpa/ExtractPathFromMinimumSpanningTree.cxx +++ b/plugins/fpa/ExtractPathFromMinimumSpanningTree.cxx @@ -25,7 +25,7 @@ fpaPlugins::ExtractPathFromMinimumSpanningTree:: } // ------------------------------------------------------------------------- -std::string fpaPlugins::ExtractPathFromMinimumSpanningTree:: +void fpaPlugins::ExtractPathFromMinimumSpanningTree:: _GenerateData( ) { typedef fpa::Image::MinimumSpanningTree< 2 > _2DMST; @@ -34,33 +34,25 @@ _GenerateData( ) auto mst = this->GetInputData( "MST" )->GetITK< itk::DataObject >( ); auto mst2 = dynamic_cast< _2DMST* >( mst ); auto mst3 = dynamic_cast< _3DMST* >( mst ); - std::string r = this->_GD0( mst2 ); - if( r != "" ) r = this->_GD0( mst3 ); - return( r ); + if ( mst2 != NULL ) this->_GD0( mst2 ); + else if( mst3 != NULL ) this->_GD0( mst3 ); + else this->_Error( "Invalid input MST." ); } // ------------------------------------------------------------------------- template< class _TMST > -std::string fpaPlugins::ExtractPathFromMinimumSpanningTree:: +void fpaPlugins::ExtractPathFromMinimumSpanningTree:: _GD0( _TMST* mst ) { typedef fpa::Base::ExtractPathFromMinimumSpanningTree< _TMST > _TFilter; typedef cpExtensions::DataStructures::ImageIndexesContainer< _TMST::Dimension > _TVertices; - if( mst == NULL ) - return( - "fpaPlugins::ExtractPathFromMinimumSpanningTree: No valid input tree." - ); auto vertices = this->GetInputData( "Seeds" )->GetITK< _TVertices >( ); if( vertices == NULL ) - return( - "fpaPlugins::ExtractPathFromMinimumSpanningTree: No valid vertices." - ); + this->_Error( "No valid vertices." ); if( vertices->Get( ).size( ) < 2 ) - return( - "fpaPlugins::ExtractPathFromMinimumSpanningTree: Not enough vertices." - ); + this->_Error( "Not enough vertices." ); auto v0 = vertices->Get( )[ this->m_Parameters.GetUint( "Vertex0" ) ]; auto v1 = vertices->Get( )[ this->m_Parameters.GetUint( "Vertex1" ) ]; @@ -73,7 +65,6 @@ _GD0( _TMST* mst ) // Connect output and finish this->GetOutputData( "Output" )->SetITK( filter->GetOutput( ) ); - return( "" ); } // eof - $RCSfile$ diff --git a/plugins/fpa/ExtractPathFromMinimumSpanningTree.h b/plugins/fpa/ExtractPathFromMinimumSpanningTree.h index d0d407b..fd445bd 100644 --- a/plugins/fpa/ExtractPathFromMinimumSpanningTree.h +++ b/plugins/fpa/ExtractPathFromMinimumSpanningTree.h @@ -30,10 +30,10 @@ namespace fpaPlugins ExtractPathFromMinimumSpanningTree( ); virtual ~ExtractPathFromMinimumSpanningTree( ); - virtual std::string _GenerateData( ) ITK_OVERRIDE; + virtual void _GenerateData( ) ITK_OVERRIDE; template< class _TMST > - inline std::string _GD0( _TMST* mst ); + inline void _GD0( _TMST* mst ); private: // Purposely not implemented. diff --git a/plugins/fpa/GradientBaseImageFunctionSource.cxx b/plugins/fpa/GradientBaseImageFunctionSource.cxx index 926523d..df069d3 100644 --- a/plugins/fpa/GradientBaseImageFunctionSource.cxx +++ b/plugins/fpa/GradientBaseImageFunctionSource.cxx @@ -35,38 +35,34 @@ fpaPlugins::GradientBaseImageFunctionSource:: } // ------------------------------------------------------------------------- -std::string fpaPlugins::GradientBaseImageFunctionSource:: +void fpaPlugins::GradientBaseImageFunctionSource:: _GenerateData( ) { auto image = this->GetInputData( "Input" )->GetITK< itk::DataObject >( ); - std::string cpPlugin_Image_Demangle_VectorPixel_AllFloats( r, _GD0, image, itk::CovariantVector, 2 ); - if( r != "" ) cpPlugin_Image_Demangle_VectorPixel_AllFloats( r, _GD0, image, itk::CovariantVector, 3 ); - return( r ); + cpPlugins_Image_Demangle_VectorPixel_AllFloats ( _GD0, image, CovariantVector, 2 ); + else cpPlugins_Image_Demangle_VectorPixel_AllFloats( _GD0, image, CovariantVector, 3 ); + else this->_Error( "Invalid input image." ); } // ------------------------------------------------------------------------- template< class _TImage > -std::string fpaPlugins::GradientBaseImageFunctionSource:: +void fpaPlugins::GradientBaseImageFunctionSource:: _GD0( _TImage* image ) { typedef fpa::Image::Functors::GulsunTekMedialness< _TImage > _TGT; typedef fpa::Image::Functors::FluxMedialness< _TImage > _TFl; typedef fpa::Image::Functors::MFluxMedialness< _TImage > _TMFl; - if( image == NULL ) - return( "GradientBaseImageFunctionSource: Invalid input image." ); - auto ft = this->m_Parameters.GetSelectedChoice( "FunctionType" ); - if ( ft == "Gulsun&Tek" ) return( this->_GD1< _TImage, _TGT >( image ) ); - else if( ft == "Flux" ) return( this->_GD1< _TImage, _TFl >( image ) ); - else if( ft == "MFlux" ) return( this->_GD1< _TImage, _TMFl >( image ) ); - else - return( "GradientBaseImageFunctionSource: Invalid function type." ); + if ( ft == "Gulsun&Tek" ) this->_GD1< _TImage, _TGT >( image ); + else if( ft == "Flux" ) this->_GD1< _TImage, _TFl >( image ); + else if( ft == "MFlux" ) this->_GD1< _TImage, _TMFl >( image ); + else this->_Error( "Invalid function type." ); } // ------------------------------------------------------------------------- template< class _TImage, class _TFunction > -std::string fpaPlugins::GradientBaseImageFunctionSource:: +void fpaPlugins::GradientBaseImageFunctionSource:: _GD1( _TImage* image ) { typedef itk::Image< typename _TFunction::TOutput, _TImage::ImageDimension > _TOutImage; @@ -92,7 +88,6 @@ _GD1( _TImage* image ) // Connect output and finish this->GetOutputData( "Output" )->SetITK( filter->GetOutput( ) ); - return( "" ); } // eof - $RCSfile$ diff --git a/plugins/fpa/GradientBaseImageFunctionSource.h b/plugins/fpa/GradientBaseImageFunctionSource.h index 97862a2..feae730 100644 --- a/plugins/fpa/GradientBaseImageFunctionSource.h +++ b/plugins/fpa/GradientBaseImageFunctionSource.h @@ -30,13 +30,13 @@ namespace fpaPlugins GradientBaseImageFunctionSource( ); virtual ~GradientBaseImageFunctionSource( ); - virtual std::string _GenerateData( ) ITK_OVERRIDE; + virtual void _GenerateData( ) ITK_OVERRIDE; template< class _TImage > - inline std::string _GD0( _TImage* image ); + inline void _GD0( _TImage* image ); template< class _TImage, class _TFunction > - inline std::string _GD1( _TImage* image ); + inline void _GD1( _TImage* image ); private: // Purposely not implemented. diff --git a/plugins/fpa/ImageDijkstra.cxx b/plugins/fpa/ImageDijkstra.cxx index b906a21..b45999d 100644 --- a/plugins/fpa/ImageDijkstra.cxx +++ b/plugins/fpa/ImageDijkstra.cxx @@ -22,18 +22,18 @@ fpaPlugins::ImageDijkstra:: } // ------------------------------------------------------------------------- -std::string fpaPlugins::ImageDijkstra:: +void fpaPlugins::ImageDijkstra:: _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 ); + cpPlugins_Image_Demangle_Pixel_AllScalars ( _GD0, image, 2 ); + else cpPlugins_Image_Demangle_Pixel_AllScalars( _GD0, image, 3 ); + else this->_Error( "No valid input image." ); } // ------------------------------------------------------------------------- template< class _TImage > -std::string fpaPlugins::ImageDijkstra:: +void fpaPlugins::ImageDijkstra:: _GD0( _TImage* image ) { typedef float _TPixel; @@ -43,9 +43,6 @@ _GD0( _TImage* image ) typedef itk::FunctionBase< _TCost, _TCost > _TCostFunctor; typedef typename _TFilter::TMinimumSpanningTree _TMST; - if( image == NULL ) - return( "fpaPlugins::ImageDijkstra: Invalid image type." ); - auto base_functor = this->GetInputData( "CostFunctor" )->GetITK< itk::LightObject >( ); _TCostFunctor* functor = NULL; @@ -53,7 +50,7 @@ _GD0( _TImage* image ) { functor = dynamic_cast< _TCostFunctor* >( base_functor ); if( functor == NULL ) - return( "fpaPlugins::ImageDijkstra: Given cost functor is invalid." ); + this->_Error( "Given cost functor is invalid." ); } // fi @@ -68,7 +65,6 @@ _GD0( _TImage* image ) // Connect remaining output this->GetOutputData( "Output" )->SetITK( filter->GetOutput( ) ); this->GetOutputData( "MST" )->SetITK( filter->GetMinimumSpanningTree( ) ); - return( "" ); } // eof - $RCSfile$ diff --git a/plugins/fpa/ImageDijkstra.h b/plugins/fpa/ImageDijkstra.h index cb5b411..e4cb3de 100644 --- a/plugins/fpa/ImageDijkstra.h +++ b/plugins/fpa/ImageDijkstra.h @@ -25,10 +25,10 @@ namespace fpaPlugins ImageDijkstra( ); virtual ~ImageDijkstra( ); - virtual std::string _GenerateData( ) ITK_OVERRIDE; + virtual void _GenerateData( ) ITK_OVERRIDE; template< class _TImage > - std::string _GD0( _TImage* image ); + inline void _GD0( _TImage* image ); private: // Purposely not implemented. diff --git a/plugins/fpa/ImageRegionGrow.cxx b/plugins/fpa/ImageRegionGrow.cxx index 8ee71ca..16a47e8 100644 --- a/plugins/fpa/ImageRegionGrow.cxx +++ b/plugins/fpa/ImageRegionGrow.cxx @@ -22,18 +22,18 @@ fpaPlugins::ImageRegionGrow:: } // ------------------------------------------------------------------------- -std::string fpaPlugins::ImageRegionGrow:: +void fpaPlugins::ImageRegionGrow:: _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 ); + cpPlugins_Image_Demangle_Pixel_AllScalars ( _GD0, image, 2 ); + else cpPlugins_Image_Demangle_Pixel_AllScalars( _GD0, image, 3 ); + else this->_Error( "No valid input image." ); } // ------------------------------------------------------------------------- template< class _TImage > -std::string fpaPlugins::ImageRegionGrow:: +void fpaPlugins::ImageRegionGrow:: _GD0( _TImage* image ) { typedef unsigned short _TPixel; @@ -42,9 +42,6 @@ _GD0( _TImage* image ) typedef typename _TFilter::TGrowingFunction _TGrowFunctor; typedef typename _TFilter::TResult _TResult; - if( image == NULL ) - return( "fpaPlugins::ImageRegionGrow: Invalid image type." ); - // Create filter _TFilter* filter = this->_ConfigureFilter< _TFilter >( ); @@ -66,7 +63,6 @@ _GD0( _TImage* image ) // Connect remaining output this->GetOutputData( "Output" )->SetITK( filter->GetOutput( ) ); - return( "" ); } // eof - $RCSfile$ diff --git a/plugins/fpa/ImageRegionGrow.h b/plugins/fpa/ImageRegionGrow.h index be156c5..ce6a82e 100644 --- a/plugins/fpa/ImageRegionGrow.h +++ b/plugins/fpa/ImageRegionGrow.h @@ -25,10 +25,10 @@ namespace fpaPlugins ImageRegionGrow( ); virtual ~ImageRegionGrow( ); - virtual std::string _GenerateData( ) ITK_OVERRIDE; + virtual void _GenerateData( ) ITK_OVERRIDE; template< class _TImage > - std::string _GD0( _TImage* image ); + inline void _GD0( _TImage* image ); private: // Purposely not implemented. diff --git a/plugins/fpa/InvertCostFunction.cxx b/plugins/fpa/InvertCostFunction.cxx index 82631ef..abd4f1e 100644 --- a/plugins/fpa/InvertCostFunction.cxx +++ b/plugins/fpa/InvertCostFunction.cxx @@ -30,19 +30,18 @@ fpaPlugins::InvertCostFunction:: } // ------------------------------------------------------------------------- -std::string fpaPlugins::InvertCostFunction:: +void fpaPlugins::InvertCostFunction:: _GenerateData( ) { auto choice = this->m_Parameters.GetSelectedChoice( "ScalarType" ); - if ( choice == "float" ) return( this->_GD0< float >( ) ); - else if( choice == "double" ) return( this->_GD0< double >( ) ); - else - return( "fpaPlugins::InvertCostFunction: invalid scalar type." ); + if ( choice == "float" ) this->_GD0< float >( ); + else if( choice == "double" ) this->_GD0< double >( ); + else this->_Error( "Invalid scalar type." ); } // ------------------------------------------------------------------------- template< class _TScalar > -std::string fpaPlugins::InvertCostFunction:: +void fpaPlugins::InvertCostFunction:: _GD0( ) { typedef fpa::Base::Functors::InvertCostFunction< _TScalar > _TFunctor; @@ -57,7 +56,6 @@ _GD0( ) } // fi f->SetAlpha( this->m_Parameters.GetReal( "Alpha" ) ); f->SetBeta( this->m_Parameters.GetReal( "Beta" ) ); - return( "" ); } // eof - $RCSfile$ diff --git a/plugins/fpa/InvertCostFunction.h b/plugins/fpa/InvertCostFunction.h index f65c44a..c623914 100644 --- a/plugins/fpa/InvertCostFunction.h +++ b/plugins/fpa/InvertCostFunction.h @@ -26,10 +26,10 @@ namespace fpaPlugins InvertCostFunction( ); virtual ~InvertCostFunction( ); - virtual std::string _GenerateData( ) ITK_OVERRIDE; + virtual void _GenerateData( ) ITK_OVERRIDE; template< class _TScalar > - std::string _GD0( ); + inline void _GD0( ); private: // Purposely not implemented. diff --git a/plugins/fpa/MinimumSpanningTreeReader.cxx b/plugins/fpa/MinimumSpanningTreeReader.cxx index 8326dfb..16f421e 100644 --- a/plugins/fpa/MinimumSpanningTreeReader.cxx +++ b/plugins/fpa/MinimumSpanningTreeReader.cxx @@ -24,14 +24,14 @@ fpaPlugins::MinimumSpanningTreeReader:: } // ------------------------------------------------------------------------- -std::string fpaPlugins::MinimumSpanningTreeReader:: +void fpaPlugins::MinimumSpanningTreeReader:: _GenerateData( ) { // Infere MST dimensions auto fname = this->m_Parameters.GetOpenFileName( "FileName" ); std::ifstream input( fname.c_str( ) ); if( !input ) - return( + this->_Error( std::string( "MinimumSpanningTreeReader: Error opening file \"" ) + fname + std::string( "\"" ) @@ -40,15 +40,14 @@ _GenerateData( ) input >> dim; // Real execution - if ( dim == 2 ) return( this->_GD0< 2 >( fname ) ); - else if( dim == 3 ) return( this->_GD0< 3 >( fname ) ); - else - return( "MinimumSpanningTreeReader: invalid dimensions." ); + if ( dim == 2 ) this->_GD0< 2 >( fname ); + else if( dim == 3 ) this->_GD0< 3 >( fname ); + else this->_Error( "Invalid dimensions." ); } // ------------------------------------------------------------------------- template< unsigned int _NDim > -std::string fpaPlugins::MinimumSpanningTreeReader:: +void fpaPlugins::MinimumSpanningTreeReader:: _GD0( const std::string& fname ) { typedef fpa::Image::MinimumSpanningTree< _NDim > _TTree; @@ -62,13 +61,10 @@ _GD0( const std::string& fname ) } catch( itk::ExceptionObject& err ) { - return( - "MinimumSpanningTreeReader: " + std::string( err.GetDescription( ) ) - ); + this->_Error( err.GetDescription( ) ); } // yrt this->GetOutputData( "Output" )->SetITK( reader->GetOutput( ) ); - return( "" ); } // eof - $RCSfile$ diff --git a/plugins/fpa/MinimumSpanningTreeReader.h b/plugins/fpa/MinimumSpanningTreeReader.h index b8f3d27..dce25da 100644 --- a/plugins/fpa/MinimumSpanningTreeReader.h +++ b/plugins/fpa/MinimumSpanningTreeReader.h @@ -26,10 +26,10 @@ namespace fpaPlugins MinimumSpanningTreeReader( ); virtual ~MinimumSpanningTreeReader( ); - virtual std::string _GenerateData( ) ITK_OVERRIDE; + virtual void _GenerateData( ) ITK_OVERRIDE; template< unsigned int _NDim > - inline std::string _GD0( const std::string& fname ); + inline void _GD0( const std::string& fname ); private: // Purposely not implemented. diff --git a/plugins/fpa/MinimumSpanningTreeWriter.cxx b/plugins/fpa/MinimumSpanningTreeWriter.cxx index 9757006..d0f3559 100644 --- a/plugins/fpa/MinimumSpanningTreeWriter.cxx +++ b/plugins/fpa/MinimumSpanningTreeWriter.cxx @@ -24,7 +24,7 @@ fpaPlugins::MinimumSpanningTreeWriter:: } // ------------------------------------------------------------------------- -std::string fpaPlugins::MinimumSpanningTreeWriter:: +void fpaPlugins::MinimumSpanningTreeWriter:: _GenerateData( ) { typedef fpa::Image::MinimumSpanningTree< 2 > _2D; @@ -33,15 +33,14 @@ _GenerateData( ) auto _2d = this->GetInputData( "Input" )->GetITK< _2D >( ); auto _3d = this->GetInputData( "Input" )->GetITK< _3D >( ); - if ( _2d != NULL ) return( this->_GD0( _2d ) ); - else if( _3d != NULL ) return( this->_GD0( _3d ) ); - else - return( "MinimumSpanningTreeWriter: Not a valid MST." ); + if ( _2d != NULL ) this->_GD0( _2d ); + else if( _3d != NULL ) this->_GD0( _3d ); + else this->_Error( "Not a valid MST." ); } // ------------------------------------------------------------------------- template< class _TTree > -std::string fpaPlugins::MinimumSpanningTreeWriter:: +void fpaPlugins::MinimumSpanningTreeWriter:: _GD0( _TTree* tree ) { typedef fpa::IO::MinimumSpanningTreeWriter< _TTree > _TFilter; @@ -55,12 +54,9 @@ _GD0( _TTree* tree ) } catch( itk::ExceptionObject& err ) { - return( - "MinimumSpanningTreeWriter: " + std::string( err.GetDescription( ) ) - ); + this->_Error( err.GetDescription( ) ); } // yrt - return( "" ); } // eof - $RCSfile$ diff --git a/plugins/fpa/MinimumSpanningTreeWriter.h b/plugins/fpa/MinimumSpanningTreeWriter.h index 286e1de..6d2c02b 100644 --- a/plugins/fpa/MinimumSpanningTreeWriter.h +++ b/plugins/fpa/MinimumSpanningTreeWriter.h @@ -26,10 +26,10 @@ namespace fpaPlugins MinimumSpanningTreeWriter( ); virtual ~MinimumSpanningTreeWriter( ); - virtual std::string _GenerateData( ) ITK_OVERRIDE; + virtual void _GenerateData( ) ITK_OVERRIDE; template< class _TTree > - inline std::string _GD0( _TTree* tree ); + inline void _GD0( _TTree* tree ); private: // Purposely not implemented. diff --git a/plugins/fpa/RegionGrowThresholdFunction.cxx b/plugins/fpa/RegionGrowThresholdFunction.cxx index 1c27fe5..8dc341f 100644 --- a/plugins/fpa/RegionGrowThresholdFunction.cxx +++ b/plugins/fpa/RegionGrowThresholdFunction.cxx @@ -25,28 +25,25 @@ fpaPlugins::RegionGrowThresholdFunction:: } // ------------------------------------------------------------------------- -std::string fpaPlugins::RegionGrowThresholdFunction:: +void fpaPlugins::RegionGrowThresholdFunction:: _GenerateData( ) { auto image = this->GetInputData( "ReferenceImage" )->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 ); + cpPlugins_Image_Demangle_Pixel_AllScalars ( _GD0, image, 2 ); + else cpPlugins_Image_Demangle_Pixel_AllScalars( _GD0, image, 3 ); + else this->_Error( "No valid input image." ); } // ------------------------------------------------------------------------- template< class _TImage > -std::string fpaPlugins::RegionGrowThresholdFunction:: +void fpaPlugins::RegionGrowThresholdFunction:: _GD0( _TImage* image ) { typedef fpa::Image::Functors::RegionGrowThresholdFunction< _TImage > _TFunctor; - if( image == NULL ) - return( "fpaPlugins::RegionGrowThresholdFunction: invalid image type." ); - auto out = this->GetOutputData( "Output" ); auto f = out->GetITK< _TFunctor >( ); if( f == NULL ) @@ -58,7 +55,6 @@ _GD0( _TImage* image ) } // fi f->SetLowerThreshold( this->m_Parameters.GetReal( "LowerThreshold" ) ); f->SetUpperThreshold( this->m_Parameters.GetReal( "UpperThreshold" ) ); - return( "" ); } // eof - $RCSfile$ diff --git a/plugins/fpa/RegionGrowThresholdFunction.h b/plugins/fpa/RegionGrowThresholdFunction.h index 5a9c016..f2348c6 100644 --- a/plugins/fpa/RegionGrowThresholdFunction.h +++ b/plugins/fpa/RegionGrowThresholdFunction.h @@ -28,10 +28,10 @@ namespace fpaPlugins RegionGrowThresholdFunction( ); virtual ~RegionGrowThresholdFunction( ); - virtual std::string _GenerateData( ) ITK_OVERRIDE; + virtual void _GenerateData( ) ITK_OVERRIDE; template< class _TImage > - std::string _GD0( _TImage* image ); + inline void _GD0( _TImage* image ); private: // Purposely not implemented. -- 2.47.1