#include #include #include #include #include #ifdef cpPlugins_QT4 # include #endif // cpPlugins_QT4 // ------------------------------------------------------------------------- QDialog* cpPluginscpExtensions::SkeletonReader:: CreateQDialog( ) { #ifdef cpPlugins_QT4 cpPlugins::QT::OpenFileDialog* dlg = NULL; if( QApplication::instance( ) != NULL ) { dlg = new cpPlugins::QT::OpenFileDialog( ); dlg->SetParameters( &( this->m_Parameters ), "FileName" ); } // fi return( dlg ); #else // cpPlugins_QT4 return( NULL ); #endif // cpPlugins_QT4 } // ------------------------------------------------------------------------- cpPluginscpExtensions::SkeletonReader:: SkeletonReader( ) : Superclass( ) { this->_ConfigureOutput< cpInstances::Skeleton >( "Output" ); this->m_Parameters.ConfigureAsOpenFileName( "FileName", "" ); this->m_Parameters.SetAcceptedFileExtensions( "FileName", "Skeleton files (*.txt)" ); } // ------------------------------------------------------------------------- cpPluginscpExtensions::SkeletonReader:: ~SkeletonReader( ) { } // ------------------------------------------------------------------------- void cpPluginscpExtensions::SkeletonReader:: _GenerateData( ) { std::string success = ""; #ifdef cpPlugins_CONFIG_PROCESS_DIMENSIONS_1 success = this->_GD0< 1 >( ); #endif // cpPlugins_CONFIG_PROCESS_DIMENSIONS_1 #ifdef cpPlugins_CONFIG_PROCESS_DIMENSIONS_2 if( success != "" ) success = this->_GD0< 2 >( ); #endif // cpPlugins_CONFIG_PROCESS_DIMENSIONS_2 #ifdef cpPlugins_CONFIG_PROCESS_DIMENSIONS_3 if( success != "" ) success = this->_GD0< 3 >( ); #endif // cpPlugins_CONFIG_PROCESS_DIMENSIONS_3 #ifdef cpPlugins_CONFIG_PROCESS_DIMENSIONS_4 if( success != "" ) success = this->_GD0< 4 >( ); #endif // cpPlugins_CONFIG_PROCESS_DIMENSIONS_4 if( success != "" ) this->_Error( success ); } // ------------------------------------------------------------------------- template< unsigned int _VDim > std::string cpPluginscpExtensions::SkeletonReader:: _GD0( ) { typedef cpExtensions::DataStructures::Skeleton< _VDim > _TSkeleton; typedef cpExtensions::Algorithms::SkeletonReader< _TSkeleton > _TReader; auto filter = this->_CreateITK< _TReader >( ); filter->SetFileName( this->m_Parameters.GetOpenFileName( "FileName" ) ); try { filter->Update( ); } catch( std::exception& err ) { return( err.what( ) ); } // yrt this->GetOutput( "Output" )->SetITK( filter->GetOutput( ) ); return( "" ); } // eof - $RCSfile$