1 #include <cpExtensions/SkeletonReader.h>
2 #include <cpInstances/DataObjects/Skeleton.h>
4 #include <cpExtensions/DataStructures/Skeleton.h>
5 #include <cpExtensions/Algorithms/SkeletonReader.h>
6 #include <cpPlugins/QT/OpenFileDialog.h>
9 # include <QApplication>
10 #endif // cpPlugins_QT4
12 // -------------------------------------------------------------------------
13 QDialog* cpPluginscpExtensions::SkeletonReader::
17 cpPlugins::QT::OpenFileDialog* dlg = NULL;
18 if( QApplication::instance( ) != NULL )
20 dlg = new cpPlugins::QT::OpenFileDialog( );
21 dlg->SetParameters( &( this->m_Parameters ), "FileName" );
25 #else // cpPlugins_QT4
27 #endif // cpPlugins_QT4
30 // -------------------------------------------------------------------------
31 cpPluginscpExtensions::SkeletonReader::
35 this->_ConfigureOutput< cpInstances::DataObjects::Skeleton >( "Output" );
36 this->m_Parameters.ConfigureAsOpenFileName( "FileName", "" );
37 this->m_Parameters.SetAcceptedFileExtensions(
39 "Skeleton files (*.txt)"
43 // -------------------------------------------------------------------------
44 cpPluginscpExtensions::SkeletonReader::
49 // -------------------------------------------------------------------------
50 void cpPluginscpExtensions::SkeletonReader::
53 std::string success = "";
54 #ifdef cpPlugins_CONFIG_PROCESS_DIMENSIONS_1
55 success = this->_GD0< 1 >( );
56 #endif // cpPlugins_CONFIG_PROCESS_DIMENSIONS_1
57 #ifdef cpPlugins_CONFIG_PROCESS_DIMENSIONS_2
58 if( success != "" ) success = this->_GD0< 2 >( );
59 #endif // cpPlugins_CONFIG_PROCESS_DIMENSIONS_2
60 #ifdef cpPlugins_CONFIG_PROCESS_DIMENSIONS_3
61 if( success != "" ) success = this->_GD0< 3 >( );
62 #endif // cpPlugins_CONFIG_PROCESS_DIMENSIONS_3
63 #ifdef cpPlugins_CONFIG_PROCESS_DIMENSIONS_4
64 if( success != "" ) success = this->_GD0< 4 >( );
65 #endif // cpPlugins_CONFIG_PROCESS_DIMENSIONS_4
67 this->_Error( success );
70 // -------------------------------------------------------------------------
71 template< unsigned int _VDim >
72 std::string cpPluginscpExtensions::SkeletonReader::
75 typedef cpExtensions::DataStructures::Skeleton< _VDim > _TSkeleton;
76 typedef cpExtensions::Algorithms::SkeletonReader< _TSkeleton > _TReader;
78 auto filter = this->_CreateITK< _TReader >( );
79 filter->SetFileName( this->m_Parameters.GetOpenFileName( "FileName" ) );
84 catch( std::exception& err )
86 return( err.what( ) );
89 this->GetOutput( "Output" )->SetITK( filter->GetOutput( ) );