SET(
App_QT_SOURCES
- ImageMPR.cxx
+ ImageMPR.cxx
)
SET(
App_SOURCES
- MementoState.cxx
- main.cxx
+ MementoState.cxx
+ main.cxx
)
SET(
App_QT_HEADERS
)
SET(
App_HEADERS
- MementoState.h
+ MementoState.h
)
FILE(GLOB App_QT_UI "${App_SOURCE_DIR}/*.ui")
FILE(GLOB App_QT_RES "${App_SOURCE_DIR}/*.qrc")
// -------------------------------------------------------------------------
MementoState::MementoState(long id, TPluginImage* _img)
{
- char * base = "state";
+ char base[] = "state";
std::ostringstream oss;
oss << id;
std::string str = oss.str();
vtkSmartPointer<vtkMetaImageReader>
MementoState::getMemento(long id)
{
- char * base = "state";
+ char base[] = "state";
std::ostringstream oss;
oss << id;
std::string str = oss.str();
// -------------------------------------------------------------------------
void MementoState::
save(const std::string& filename, const std::string& filenameRaw, TPluginImage* img) {
+ /* TODO
vtkSmartPointer<vtkMetaImageWriter> writer =
vtkSmartPointer<vtkMetaImageWriter>::New();
writer->SetInputData(img->GetVTK< vtkImageData >());
writer->SetFileName(filename.c_str());
writer->SetRAWFileName(filenameRaw.c_str());
writer->Write();
+ */
}
// -------------------------------------------------------------------------
vtkSmartPointer<vtkMetaImageReader>
MementoState::load(const std::string& filename) {
+ /* TODO
vtkSmartPointer<vtkMetaImageReader> reader =
vtkSmartPointer<vtkMetaImageReader>::New();
reader->SetFileName(filename.c_str());
reader->Update();
return reader;
+ */
}
// eof - $RCSfile$
## =========================
SET(
- EXAMPLES_PROGRAMS
+ EXAMPLES_PROGRAMS_ONLY_EXTENSIONS
+ example_TestQuadSplitter
+ )
+
+FOREACH(prog ${EXAMPLES_PROGRAMS_ONLY_EXTENSIONS})
+ ADD_EXECUTABLE(${prog} ${prog}.cxx)
+ TARGET_LINK_LIBRARIES(${prog} cpExtensions)
+ENDFOREACH(prog)
+
+SET(
+ EXAMPLES_PROGRAMS_ONLY_INTERFACE
example_TestParameters
example_LoadPlugins
+ )
+
+FOREACH(prog ${EXAMPLES_PROGRAMS_ONLY_INTERFACE})
+ ADD_EXECUTABLE(${prog} ${prog}.cxx)
+ TARGET_LINK_LIBRARIES(${prog} cpPlugins_Interface)
+ENDFOREACH(prog)
+
+SET(
+ EXAMPLES_PROGRAMS_WITH_PLUGINS
example_ReadWriteImage
example_View2DImage
##example_MarchingCubes
typedef itk::Index< 3 > TIndex;
typedef itk::Point< float, 3 > TPoint;
- TParameters parameters;
-
- parameters.Configure( TParameters::String, "StringParam" );
- parameters.Configure( TParameters::Bool, "BoolParam" );
- parameters.Configure( TParameters::Int, "IntParam" );
- parameters.Configure( TParameters::Uint, "UintParam" );
- parameters.Configure( TParameters::Real, "RealParam" );
- parameters.Configure( TParameters::Index, "IndexParam" );
- parameters.Configure( TParameters::Point, "PointParam" );
- parameters.Configure( TParameters::StringList, "StringListParam" );
- parameters.Configure( TParameters::BoolList, "BoolListParam" );
- parameters.Configure( TParameters::IntList, "IntListParam" );
- parameters.Configure( TParameters::UintList, "UintListParam" );
- parameters.Configure( TParameters::RealList, "RealListParam" );
- parameters.Configure( TParameters::IndexList, "IndexListParam" );
- parameters.Configure( TParameters::PointList, "PointListParam" );
-
- parameters.SetValueAsString( "StringParam", "test_value" );
- parameters.SetValueAsBool( "BoolParam", true );
- parameters.SetValueAsInt( "IntParam", -1234567 );
- parameters.SetValueAsUint( "UintParam", 1234567 );
- parameters.SetValueAsReal( "RealParam", 3.14159244444 );
- parameters.SetValueAsIndex( "IndexParam", 3, 4, -3, 2 );
- parameters.SetValueAsPoint( "PointParam", 3, 9.4, 8.3, 7.2 );
-
- parameters.ClearStringList( "StringListParam" );
- parameters.ClearBoolList( "BoolListParam" );
- parameters.ClearIntList( "IntListParam" );
- parameters.ClearUintList( "UintListParam" );
- parameters.ClearRealList( "RealListParam" );
- parameters.ClearIndexList( "IndexListParam" );
- parameters.ClearPointList( "PointListParam" );
-
- parameters.AddValueToStringList( "StringListParam", "one" );
- parameters.AddValueToStringList( "StringListParam", "two" );
- parameters.AddValueToStringList( "StringListParam", "three" );
- parameters.AddValueToStringList( "StringListParam", "four" );
-
- parameters.AddValueToBoolList( "BoolListParam", 1 );
- parameters.AddValueToBoolList( "BoolListParam", 0 );
- parameters.AddValueToBoolList( "BoolListParam", 0 );
- parameters.AddValueToBoolList( "BoolListParam", 1 );
- parameters.AddValueToBoolList( "BoolListParam", 1 );
-
- parameters.AddValueToIntList( "IntListParam", 1 );
- parameters.AddValueToIntList( "IntListParam", -2 );
- parameters.AddValueToIntList( "IntListParam", 3 );
- parameters.AddValueToIntList( "IntListParam", -4 );
- parameters.AddValueToIntList( "IntListParam", 5 );
- parameters.AddValueToIntList( "IntListParam", -6 );
- parameters.AddValueToIntList( "IntListParam", 7 );
- parameters.AddValueToIntList( "IntListParam", -8 );
- parameters.AddValueToIntList( "IntListParam", 9 );
- parameters.AddValueToIntList( "IntListParam", -10 );
- parameters.AddValueToIntList( "IntListParam", 11 );
-
- parameters.AddValueToUintList( "UintListParam", 1 );
- parameters.AddValueToUintList( "UintListParam", 2 );
- parameters.AddValueToUintList( "UintListParam", 3 );
- parameters.AddValueToUintList( "UintListParam", 4 );
- parameters.AddValueToUintList( "UintListParam", 5 );
- parameters.AddValueToUintList( "UintListParam", 6 );
- parameters.AddValueToUintList( "UintListParam", 7 );
- parameters.AddValueToUintList( "UintListParam", 8 );
- parameters.AddValueToUintList( "UintListParam", 9 );
- parameters.AddValueToUintList( "UintListParam", 10 );
- parameters.AddValueToUintList( "UintListParam", 11 );
-
- parameters.AddValueToRealList( "RealListParam", 1.9 );
- parameters.AddValueToRealList( "RealListParam", 2.8 );
- parameters.AddValueToRealList( "RealListParam", 3.7 );
- parameters.AddValueToRealList( "RealListParam", 4.6 );
- parameters.AddValueToRealList( "RealListParam", 5.5 );
- parameters.AddValueToRealList( "RealListParam", 6.4 );
- parameters.AddValueToRealList( "RealListParam", 7.3 );
- parameters.AddValueToRealList( "RealListParam", 8.2 );
- parameters.AddValueToRealList( "RealListParam", 9.1 );
- parameters.AddValueToRealList( "RealListParam", 1.0012 );
- parameters.AddValueToRealList( "RealListParam", 1.131245 );
-
- parameters.AddValueToIndexList( "IndexListParam", 3, -1, 2, 3 );
- parameters.AddValueToIndexList( "IndexListParam", 3, 2, -3, 4 );
- parameters.AddValueToIndexList( "IndexListParam", 3, 3, 4, 7 );
-
- parameters.AddValueToPointList( "PointListParam", 3, 3.45, 4.67, 7.9 );
- parameters.AddValueToPointList( "PointListParam", 3, 3.45, 4.67, 3.14 );
- parameters.AddValueToPointList( "PointListParam", 3, 1.45, 3.67, 2.14 );
- parameters.AddValueToPointList( "PointListParam", 3, 4.5, 6.7, 4.2 );
-
- std::vector< TParameters::TString > names = parameters.GetParameters( );
- std::cout << "Names:" << std::endl;
- for( unsigned int i = 0; i < names.size( ); ++i )
- std::cout
- << "\t... "
- << names[ i ] << " "
- << parameters.GetRawValue( names[ i ] ) << "("
- << parameters.GetParameterType( names[ i ] ) << ")"
- << std::endl;
-
- std::cout << std::endl << "Values with type checking" << std::endl;
- std::cout
- << "\t... " << "StringParam: "
- << parameters.GetValueAsString( "StringParam" ) << std::endl
- << "\t... " << "BoolParam: "
- << parameters.GetValueAsBool( "BoolParam" ) << std::endl
- << "\t... " << "IntParam: "
- << parameters.GetValueAsInt( "IntParam" ) << std::endl
- << "\t... " << "UintParam: "
- << parameters.GetValueAsUint( "UintParam" ) << std::endl
- << "\t... " << "RealParam: "
- << parameters.GetValueAsReal( "RealParam" ) << std::endl
- << "\t... " << "IndexParam: "
- << parameters.GetValueAsIndex< TIndex >( "IndexParam" ) << std::endl
- << "\t... " << "PointParam: "
- << parameters.GetValueAsPoint< TPoint >( "PointParam" ) << std::endl;
-
- std::vector< TParameters::TString > string_lst;
- std::vector< TParameters::TBool > bool_lst;
- std::vector< TParameters::TInt > int_lst;
- std::vector< TParameters::TUint > uint_lst;
- std::vector< TParameters::TReal > real_lst;
- std::vector< TIndex > index_lst;
- std::vector< TPoint > point_lst;
-
- parameters.GetValueAsStringList( string_lst, "StringListParam" );
- parameters.GetValueAsBoolList( bool_lst, "BoolListParam" );
- parameters.GetValueAsIntList( int_lst, "IntListParam" );
- parameters.GetValueAsUintList( uint_lst, "UintListParam" );
- parameters.GetValueAsRealList( real_lst, "RealListParam" );
- parameters.GetValueAsIndexList( index_lst, "IndexListParam" );
- parameters.GetValueAsPointList( point_lst, "PointListParam" );
-
- std::cout << "List parameters:" << std::endl;
- PrintList( string_lst, "StringListParam" );
- PrintList( bool_lst, "BoolListParam" );
- PrintList( int_lst, "IntListParam" );
- PrintList( uint_lst, "UintListParam" );
- PrintList( real_lst, "RealListParam" );
- PrintList( index_lst, "IndexListParam" );
- PrintList( point_lst, "PointListParam" );
+ TParameters::Pointer parameters = TParameters::New( );
+
+ TIndex idx; idx[ 0 ] = 1; idx[ 1 ] = 2; idx[ 2 ] = 3;
+ TPoint pnt; pnt[ 0 ] = 3.1; pnt[ 1 ] = 2.2; pnt[ 2 ] = 1.3;
+
+ parameters->ConfigureAsString( "StringParam", "String_Value" );
+ parameters->ConfigureAsBool( "BoolParam", false );
+ parameters->ConfigureAsInt( "IntParam", -314 );
+ parameters->ConfigureAsUint( "UintParam", 314 );
+ parameters->ConfigureAsReal( "RealParam", 3.14 );
+ parameters->ConfigureAsIndex( "IndexParam", 3, idx );
+ parameters->ConfigureAsPoint( "PointParam", 3, pnt );
+ parameters->ConfigureAsStringList( "StringListParam" );
+ parameters->ConfigureAsBoolList( "BoolListParam" );
+ parameters->ConfigureAsIntList( "IntListParam" );
+ parameters->ConfigureAsUintList( "UintListParam" );
+ parameters->ConfigureAsRealList( "RealListParam" );
+ parameters->ConfigureAsIndexList( "IndexListParam" );
+ parameters->ConfigureAsPointList( "PointListParam" );
+
+ std::vector< std::string > choices;
+ choices.push_back( "bat" );
+ choices.push_back( "deux" );
+ choices.push_back( "drei" );
+ choices.push_back( "cuatro" );
+ choices.push_back( "cinque" );
+ parameters->ConfigureAsChoices( "ChoicesParam", choices );
+
+ std::cout << "---------------------------------------------" << std::endl;
+ parameters->Print( std::cout );
+ std::cout << "---------------------------------------------" << std::endl;
+
+ parameters->SetString( "StringParam", "test_value" );
+ parameters->SetBool( "BoolParam", true );
+ parameters->SetInt( "IntParam", -1234567 );
+ parameters->SetUint( "UintParam", 1234567 );
+ parameters->SetReal( "RealParam", 3.14159244444 );
+
+ idx[ 0 ] = 10; idx[ 1 ] = 20; idx[ 2 ] = 30;
+ pnt[ 0 ] = 30.1; pnt[ 1 ] = 21.2; pnt[ 2 ] = 12.3;
+ parameters->SetIndex( "IndexParam", 3, idx );
+ parameters->SetPoint( "PointParam", 3, pnt );
+
+ std::cout << "---------------------------------------------" << std::endl;
+ parameters->Print( std::cout );
+ std::cout << "---------------------------------------------" << std::endl;
+
+ parameters->ClearStringList( "StringListParam" );
+ parameters->ClearBoolList( "BoolListParam" );
+ parameters->ClearIntList( "IntListParam" );
+ parameters->ClearUintList( "UintListParam" );
+ parameters->ClearRealList( "RealListParam" );
+ parameters->ClearIndexList( "IndexListParam" );
+ parameters->ClearPointList( "PointListParam" );
+
+ parameters->AddToStringList( "StringListParam", "one" );
+ parameters->AddToStringList( "StringListParam", "two" );
+ parameters->AddToStringList( "StringListParam", "three" );
+ parameters->AddToStringList( "StringListParam", "four" );
+
+ parameters->AddToBoolList( "BoolListParam", 1 );
+ parameters->AddToBoolList( "BoolListParam", 0 );
+ parameters->AddToBoolList( "BoolListParam", 0 );
+ parameters->AddToBoolList( "BoolListParam", 1 );
+ parameters->AddToBoolList( "BoolListParam", 1 );
+
+ parameters->AddToIntList( "IntListParam", 1 );
+ parameters->AddToIntList( "IntListParam", -2 );
+ parameters->AddToIntList( "IntListParam", 3 );
+ parameters->AddToIntList( "IntListParam", -4 );
+ parameters->AddToIntList( "IntListParam", 5 );
+ parameters->AddToIntList( "IntListParam", -6 );
+ parameters->AddToIntList( "IntListParam", 7 );
+ parameters->AddToIntList( "IntListParam", -8 );
+ parameters->AddToIntList( "IntListParam", 9 );
+ parameters->AddToIntList( "IntListParam", -10 );
+ parameters->AddToIntList( "IntListParam", 11 );
+
+ parameters->AddToUintList( "UintListParam", 1 );
+ parameters->AddToUintList( "UintListParam", 2 );
+ parameters->AddToUintList( "UintListParam", 3 );
+ parameters->AddToUintList( "UintListParam", 4 );
+ parameters->AddToUintList( "UintListParam", 5 );
+ parameters->AddToUintList( "UintListParam", 6 );
+ parameters->AddToUintList( "UintListParam", 7 );
+ parameters->AddToUintList( "UintListParam", 8 );
+ parameters->AddToUintList( "UintListParam", 9 );
+ parameters->AddToUintList( "UintListParam", 10 );
+ parameters->AddToUintList( "UintListParam", 11 );
+
+ parameters->AddToRealList( "RealListParam", 1.9 );
+ parameters->AddToRealList( "RealListParam", 2.8 );
+ parameters->AddToRealList( "RealListParam", 3.7 );
+ parameters->AddToRealList( "RealListParam", 4.6 );
+ parameters->AddToRealList( "RealListParam", 5.5 );
+ parameters->AddToRealList( "RealListParam", 6.4 );
+ parameters->AddToRealList( "RealListParam", 7.3 );
+ parameters->AddToRealList( "RealListParam", 8.2 );
+ parameters->AddToRealList( "RealListParam", 9.1 );
+ parameters->AddToRealList( "RealListParam", 1.0012 );
+ parameters->AddToRealList( "RealListParam", 1.131245 );
+
+ idx.Fill( 1 );
+ parameters->AddToIndexList( "IndexListParam", 3, idx );
+ idx.Fill( 2 );
+ parameters->AddToIndexList( "IndexListParam", 3, idx );
+ idx.Fill( 3 );
+ parameters->AddToIndexList( "IndexListParam", 3, idx );
+
+ pnt.Fill( 1.2 );
+ parameters->AddToPointList( "PointListParam", 3, pnt );
+ pnt.Fill( 3.14 );
+ parameters->AddToPointList( "PointListParam", 3, pnt );
+ pnt.Fill( 6.28 );
+ parameters->AddToPointList( "PointListParam", 3, pnt );
+ pnt.Fill( 1.63 );
+ parameters->AddToPointList( "PointListParam", 3, pnt );
+
+ std::cout << "---------------------------------------------" << std::endl;
+ parameters->Print( std::cout );
+ std::cout << "---------------------------------------------" << std::endl;
+
+ parameters->SetSelectedChoice( "ChoicesParam", "drei" );
+
+ std::cout << "---------------------------------------------" << std::endl;
+ parameters->Print( std::cout );
+ std::cout << "---------------------------------------------" << std::endl;
+
+ parameters->SetSelectedChoice( "ChoicesParam", "zeven" );
+
+ std::cout << "---------------------------------------------" << std::endl;
+ parameters->Print( std::cout );
+ std::cout << "---------------------------------------------" << std::endl;
return( 0 );
}
--- /dev/null
+#include <QApplication>
+#include <QTextEdit>
+#include <cpExtensions/QT/QuadSplitter.h>
+
+int main( int argc, char* argv[] )
+{
+ int ret = 0;
+#ifdef cpExtensions_Interface_QT4
+ QApplication app( argc, argv );
+
+ QTextEdit* t1 = new QTextEdit;
+ QTextEdit* t2 = new QTextEdit;
+ QTextEdit* t3 = new QTextEdit;
+ QTextEdit* t4 = new QTextEdit;
+
+ cpExtensions::QT::QuadSplitter quadSplit;
+ quadSplit.addWidgets( t1, t2, t3, t4 );
+ quadSplit.show( );
+ ret = app.exec( );
+#endif // cpExtensions_Interface_QT4
+ return( ret );
+}
+
+// eof - $RCSfile$
SET(LIBRARY_NAME cpExtensions)
+CONFIGURE_FILE(
+ Config.h.in
+ ${PROJECT_BINARY_DIR}/lib/cpExtensions/Config.h
+ @ONLY
+ )
+
## ===============
## = Source code =
## ===============
)
ENDFOREACH(dir)
+IF(USE_QT4)
+ FILE(GLOB LIB_QT_UI "QT/*.ui")
+ FILE(GLOB LIB_QT_Headers "QT/*.h")
+ FILE(GLOB LIB_QT_Sources "QT/*.cxx")
+ FILE(GLOB LIB_QT_Resources "QT/*.rc")
+
+ QT4_WRAP_UI(LIB_QT_Wrapped_Headers ${LIB_QT_UI})
+ QT4_WRAP_CPP(LIB_QT_Wrapped_MOC_Sources ${LIB_QT_Headers})
+ QT4_ADD_RESOURCES(LIB_QT_Wrapped_Resources_Sources ${LIB_QT_Resources})
+
+ SET(
+ LIB_HEADERS_H
+ ${LIB_HEADERS_H}
+ ${LIB_QT_Wrapped_Headers}
+ )
+ SET(
+ LIB_SOURCES_CXX
+ ${LIB_SOURCES_CXX}
+ ${LIB_QT_Sources}
+ ${LIB_QT_Wrapped_Headers}
+ ${LIB_QT_Wrapped_MOC_Sources}
+ ${LIB_QT_Wrapped_Resources_Sources}
+ )
+ENDIF(USE_QT4)
+
+
## =====================
## = Compilation rules =
## =====================
)
TARGET_LINK_LIBRARIES(
${LIBRARY_NAME}
+ ${QT_LIBRARIES}
${ITK_LIBRARIES}
${VTK_LIBRARIES}
)
--- /dev/null
+#ifndef __CPEXTENSIONS__CONFIG__H__
+#define __CPEXTENSIONS__CONFIG__H__
+
+#define cpExtensions_MAJOR_VERSION @prj_MAJOR_VERSION@
+#define cpExtensions_MINOR_VERSION @prj_MINOR_VERSION@
+#define cpExtensions_RELEASE_VERSION @prj_RELEASE_VERSION@
+#define cpExtensions_VERSION "@prj_VERSION@"
+
+#define cpExtensions_Interface_QT4_USED @QT4_FOUND@
+#if cpExtensions_Interface_QT4_USED == 1
+# define cpExtensions_Interface_QT4
+#else // cpExtensions_Interface_QT4_USED == 1
+# undef cpExtensions_Interface_QT4
+#endif // cpExtensions_Interface_QT4_USED == 1
+
+#endif // __CPEXTENSIONS__CONFIG__H__
+
+// eof - $RCSfile$
--- /dev/null
+#include <cpExtensions/QT/QuadSplitter.h>
+
+#include <cpExtensions/Config.h>
+
+#ifdef cpExtensions_Interface_QT4
+
+/**
+ * Inspired by:
+ * https://forum.qt.io/topic/7144/quad-splitter-windows-an-implementation/2
+ */
+
+// -------------------------------------------------------------------------
+cpExtensions::QT::QuadSplitter::
+QuadSplitter( QWidget* parent, Qt::WindowFlags f )
+ : QFrame( parent, f )
+{
+ this->m_Parent.setOrientation(Qt::Vertical);
+ this->m_Parent.addWidget(&this->m_Upper);
+ this->m_Parent.addWidget(&this->m_Bottom);
+
+ QObject::connect(
+ &this->m_Upper, SIGNAL( splitterMoved( int, int ) ),
+ this, SLOT( _SyncBottom( int, int ) )
+ );
+ QObject::connect(
+ &this->m_Bottom, SIGNAL( splitterMoved( int, int ) ),
+ this, SLOT( _SyncUpper( int, int ) )
+ );
+}
+
+// -------------------------------------------------------------------------
+cpExtensions::QT::QuadSplitter::
+~QuadSplitter( )
+{
+}
+
+// -------------------------------------------------------------------------
+void cpExtensions::QT::QuadSplitter::
+show( )
+{
+ this->m_Parent.show( );
+}
+
+// -------------------------------------------------------------------------
+void cpExtensions::QT::QuadSplitter::
+addWidgets( QWidget* a, QWidget* b, QWidget* c, QWidget* d )
+{
+ this->m_Upper.addWidget( a );
+ this->m_Upper.addWidget( b );
+ this->m_Bottom.addWidget( c );
+ this->m_Bottom.addWidget( d );
+}
+
+// -------------------------------------------------------------------------
+void cpExtensions::QT::QuadSplitter::
+_SyncBottom( int a, int b )
+{
+ this->m_Bottom.setSizes( m_Upper.sizes( ) );
+}
+
+// -------------------------------------------------------------------------
+void cpExtensions::QT::QuadSplitter::
+_SyncUpper( int a, int b )
+{
+ this->m_Upper.setSizes( m_Bottom.sizes( ) );
+}
+
+#endif // cpExtensions_Interface_QT4
+
+// eof - $RCSfile$
--- /dev/null
+#ifndef __CPEXTENSIONS__QT__QUADSPLITTER__H__
+#define __CPEXTENSIONS__QT__QUADSPLITTER__H__
+
+#include <cpExtensions/Config.h>
+
+#ifdef cpExtensions_Interface_QT4
+
+/**
+ * Inspired by:
+ * https://forum.qt.io/topic/7144/quad-splitter-windows-an-implementation/2
+ */
+
+#include <QFrame>
+#include <QSplitter>
+
+namespace cpExtensions
+{
+ namespace QT
+ {
+ /**
+ */
+ class QuadSplitter
+ : public QFrame
+ {
+ Q_OBJECT;
+
+ public:
+ QuadSplitter( QWidget* parent = 0, Qt::WindowFlags f = 0 );
+ virtual ~QuadSplitter( );
+
+ void show( );
+ void addWidgets( QWidget* a, QWidget* b, QWidget* c, QWidget* d );
+
+
+ private slots:
+ void _SyncBottom( int a, int b );
+ void _SyncUpper( int a, int b );
+
+ protected:
+ QSplitter m_Parent;
+ QSplitter m_Bottom;
+ QSplitter m_Upper;
+ };
+
+ } // ecapseman
+
+} // ecapseman
+
+#endif // cpExtensions_Interface_QT4
+
+#endif // __CPEXTENSIONS__QT__QUADSPLITTER__H__
+
+// eof - $RCSfile$
--- /dev/null
+#include <cpPlugins/Interface/BaseMPRWindow.h>
+
+#ifdef cpPlugins_Interface_QT4
+
+#include <cpPlugins/Interface/ui_BaseMPRWindow.h>
+
+// -------------------------------------------------------------------------
+cpPlugins::Interface::BaseMPRWindow::
+BaseMPRWindow( QWidget* parent )
+ : QMainWindow( parent ),
+ m_UI( new Ui::BaseMPRWindow )
+{
+ // Create and associate renderers
+ this->m_MPRObjects = vtkSmartPointer< TMPRObjects >::New( );
+ this->m_MPRObjects->SetRenderWindows(
+ this->m_UI->m_XVTK->GetRenderWindow( ),
+ this->m_UI->m_YVTK->GetRenderWindow( ),
+ this->m_UI->m_ZVTK->GetRenderWindow( ),
+ this->m_UI->m_WVTK->GetRenderWindow( )
+ );
+}
+
+// -------------------------------------------------------------------------
+cpPlugins::Interface::BaseMPRWindow::
+~BaseMPRWindow( )
+{
+ if( this->m_UI != NULL )
+ delete this->m_UI;
+}
+
+// -------------------------------------------------------------------------
+bool cpPlugins::Interface::BaseMPRWindow::
+_LoadPlugins( const std::string& fname )
+{
+ return( false );
+}
+
+// -------------------------------------------------------------------------
+bool cpPlugins::Interface::BaseMPRWindow::
+_LoadImage( const std::string& fname )
+{
+ return( false );
+}
+
+// -------------------------------------------------------------------------
+bool cpPlugins::Interface::BaseMPRWindow::
+_LoadMesh( const std::string& fname )
+{
+ return( false );
+}
+
+/*
+ TInterface m_Interface;
+
+ TProcessObject::Pointer m_ImageReader;
+ TProcessObject::Pointer m_ImageWriter;
+ TProcessObject::Pointer m_MeshReader;
+ TProcessObject::Pointer m_MeshWriter;
+
+ TImages m_Images;
+ TMeshes m_Meshes;
+*/
+
+#endif // cpPlugins_Interface_QT4
+
+// eof - $RCSfile$
--- /dev/null
+#ifndef __CPPLUGINS__INTERFACE__BASEMPRWINDOW__H__
+#define __CPPLUGINS__INTERFACE__BASEMPRWINDOW__H__
+
+#include <cpPlugins/Interface/Config.h>
+
+#ifdef cpPlugins_Interface_QT4
+
+#include <set>
+
+#include <QMainWindow>
+
+#include <vtkSmartPointer.h>
+
+#include <cpExtensions/Visualization/MPRObjects.h>
+#include <cpPlugins/Interface/Interface.h>
+#include <cpPlugins/Interface/ProcessObject.h>
+#include <cpPlugins/Interface/Image.h>
+#include <cpPlugins/Interface/Mesh.h>
+
+namespace Ui
+{
+ class BaseMPRWindow;
+}
+
+namespace cpPlugins
+{
+ namespace Interface
+ {
+ /**
+ */
+ class BaseMPRWindow
+ : public QMainWindow
+ {
+ Q_OBJECT;
+
+ public:
+ typedef cpPlugins::Interface::Interface TInterface;
+ typedef cpPlugins::Interface::ProcessObject TProcessObject;
+ typedef cpPlugins::Interface::DataObject TDataObject;
+ typedef cpPlugins::Interface::Image TImage;
+ typedef cpPlugins::Interface::Mesh TMesh;
+
+ typedef std::set< TImage::Pointer > TImages;
+ typedef std::set< TMesh::Pointer > TMeshes;
+
+ public:
+ explicit BaseMPRWindow( QWidget* parent = NULL );
+ virtual ~BaseMPRWindow( );
+
+ protected:
+ bool _LoadPlugins( const std::string& fname );
+ bool _LoadImage( const std::string& fname );
+ bool _LoadMesh( const std::string& fname );
+
+ protected:
+ Ui::BaseMPRWindow* m_UI;
+
+ typedef cpExtensions::Visualization::MPRObjects TMPRObjects;
+ vtkSmartPointer< TMPRObjects > m_MPRObjects;
+
+ TInterface m_Interface;
+
+ TProcessObject::Pointer m_ImageReader;
+ TProcessObject::Pointer m_ImageWriter;
+ TProcessObject::Pointer m_MeshReader;
+ TProcessObject::Pointer m_MeshWriter;
+
+ TImages m_Images;
+ TMeshes m_Meshes;
+ };
+
+ } // ecapseman
+
+} // ecapseman
+
+#endif // cpPlugins_Interface_QT4
+
+#endif // __CPPLUGINS__INTERFACE__BASEMPRWINDOW__H__
+
+// eof - $RCSfile$
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>BaseMPRWindow</class>
+ <widget class="QMainWindow" name="BaseMPRWindow">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>718</width>
+ <height>706</height>
+ </rect>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>718</width>
+ <height>706</height>
+ </size>
+ </property>
+ <property name="windowTitle">
+ <string>Put a fancy title here</string>
+ </property>
+ <widget class="QWidget" name="centralWidget">
+ <layout class="QGridLayout" name="gridLayout">
+ <item row="0" column="0">
+ <widget class="QSplitter" name="splitter_4">
+ <property name="minimumSize">
+ <size>
+ <width>700</width>
+ <height>400</height>
+ </size>
+ </property>
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <widget class="QSplitter" name="splitter_3">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <widget class="QSplitter" name="splitter">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <widget class="QVTKWidget" name="m_YVTK" native="true">
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>200</width>
+ <height>200</height>
+ </size>
+ </property>
+ </widget>
+ <widget class="QVTKWidget" name="m_XVTK" native="true">
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>200</width>
+ <height>200</height>
+ </size>
+ </property>
+ </widget>
+ </widget>
+ <widget class="QSplitter" name="splitter_2">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <widget class="QVTKWidget" name="m_ZVTK" native="true">
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>200</width>
+ <height>200</height>
+ </size>
+ </property>
+ </widget>
+ <widget class="QVTKWidget" name="m_WVTK" native="true">
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>200</width>
+ <height>200</height>
+ </size>
+ </property>
+ </widget>
+ </widget>
+ </widget>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QMenuBar" name="menuBar">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>718</width>
+ <height>27</height>
+ </rect>
+ </property>
+ <widget class="QMenu" name="menuFile">
+ <property name="title">
+ <string>&File</string>
+ </property>
+ <addaction name="actionOpenPlugins"/>
+ <addaction name="separator"/>
+ <addaction name="actionOpenInputImage"/>
+ <addaction name="actionOpenSegmentation"/>
+ <addaction name="actionOpenInputPolyData"/>
+ <addaction name="separator"/>
+ <addaction name="actionExit"/>
+ </widget>
+ <widget class="QMenu" name="MenuImageToImage">
+ <property name="title">
+ <string>Image to image</string>
+ </property>
+ </widget>
+ <widget class="QMenu" name="MenuImageToMesh">
+ <property name="title">
+ <string>Image to mesh</string>
+ </property>
+ </widget>
+ <widget class="QMenu" name="menuEdit">
+ <property name="title">
+ <string>Edit</string>
+ </property>
+ <addaction name="actionUndo"/>
+ <addaction name="actionRedo"/>
+ </widget>
+ <addaction name="menuFile"/>
+ <addaction name="menuEdit"/>
+ <addaction name="MenuImageToImage"/>
+ <addaction name="MenuImageToMesh"/>
+ </widget>
+ <action name="actionOpenInputImage">
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="text">
+ <string>Open image</string>
+ </property>
+ <property name="shortcut">
+ <string>Ctrl+O</string>
+ </property>
+ </action>
+ <action name="actionOpenPlugins">
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="text">
+ <string>Open plugins</string>
+ </property>
+ <property name="shortcut">
+ <string>Ctrl+P</string>
+ </property>
+ </action>
+ <action name="actionExit">
+ <property name="text">
+ <string>Exit</string>
+ </property>
+ </action>
+ <action name="actionOpenInputPolyData">
+ <property name="text">
+ <string>Open polydata</string>
+ </property>
+ <property name="shortcut">
+ <string>Ctrl+M</string>
+ </property>
+ </action>
+ <action name="actionDasdasd">
+ <property name="text">
+ <string>dasdasd</string>
+ </property>
+ </action>
+ <action name="actionOpenSegmentation">
+ <property name="text">
+ <string>Open segmentation</string>
+ </property>
+ </action>
+ <action name="actionUndo">
+ <property name="text">
+ <string>Undo</string>
+ </property>
+ <property name="shortcut">
+ <string>Ctrl+Z</string>
+ </property>
+ </action>
+ <action name="actionRedo">
+ <property name="text">
+ <string>Redo</string>
+ </property>
+ <property name="shortcut">
+ <string>Ctrl+Y</string>
+ </property>
+ </action>
+ </widget>
+ <layoutdefault spacing="6" margin="11"/>
+ <customwidgets>
+ <customwidget>
+ <class>QVTKWidget</class>
+ <extends>QWidget</extends>
+ <header>QVTKWidget.h</header>
+ </customwidget>
+ </customwidgets>
+ <resources/>
+ <connections>
+ <connection>
+ <sender>actionExit</sender>
+ <signal>triggered()</signal>
+ <receiver>BaseMPRWindow</receiver>
+ <slot>close()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>-1</x>
+ <y>-1</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>378</x>
+ <y>235</y>
+ </hint>
+ </hints>
+ </connection>
+ </connections>
+</ui>
SET(
LIB_QT_UI
ParametersListWidget.ui
+ BaseMPRWindow.ui
)
SET(
LIB_QT_Headers
ParametersListWidget.h
+ BaseMPRWindow.h
)
SET(
LIB_QT_Sources
ParametersListWidget.cxx
+ BaseMPRWindow.cxx
)
SET(
LIB_QT_Resources
${QT_LIBRARIES}
${ITK_LIBRARIES}
${VTK_LIBRARIES}
+ cpExtensions
)
## ========================
#ifndef __CPPLUGINS__INTERFACE__CONFIG__H__
#define __CPPLUGINS__INTERFACE__CONFIG__H__
-
#define cpPlugins_MAJOR_VERSION @prj_MAJOR_VERSION@
#define cpPlugins_MINOR_VERSION @prj_MINOR_VERSION@
#define cpPlugins_RELEASE_VERSION @prj_RELEASE_VERSION@
#include <cpPlugins/Interface/Parameters.h>
-#include <cstdarg>
-#include <cstdlib>
-#include <sstream>
-
-// -------------------------------------------------------------------------
-#define cpPlugins_Interface_Parameters_SetMacro( TYPE ) \
- void cpPlugins::Interface::Parameters:: \
- SetValueAs##TYPE( const TString& name, const T##TYPE& v ) \
- { \
- TParameters::iterator pIt = this->m_Parameters.find( name ); \
- if( pIt == this->m_Parameters.end( ) ) \
- return; \
- if( pIt->second.first != Self::TYPE ) \
- return; \
- std::stringstream ss; \
- ss << v; \
- pIt->second.second = ss.str( ); \
- }
-
-cpPlugins_Interface_Parameters_SetMacro( String );
-cpPlugins_Interface_Parameters_SetMacro( Bool );
-cpPlugins_Interface_Parameters_SetMacro( Int );
-cpPlugins_Interface_Parameters_SetMacro( Uint );
-cpPlugins_Interface_Parameters_SetMacro( Real );
-
-// -------------------------------------------------------------------------
-#define cpPlugins_Interface_Parameters_SetArrayMacro( TYPE, ATYPE ) \
- void cpPlugins::Interface::Parameters:: \
- SetValueAs##TYPE( const TString& name, const TUint& n, ... ) \
- { \
- TParameters::iterator pIt = this->m_Parameters.find( name ); \
- if( pIt == this->m_Parameters.end( ) ) \
- return; \
- if( pIt->second.first != Self::TYPE ) \
- return; \
- va_list v_lst; \
- va_start( v_lst, n ); \
- std::stringstream ss; \
- for( TUint i = 0; i < n; ++i ) \
- ss << va_arg( v_lst, ATYPE ) << ","; \
- va_end( v_lst ); \
- pIt->second.second = ss.str( ); \
- }
-
-cpPlugins_Interface_Parameters_SetArrayMacro( Index, int );
-cpPlugins_Interface_Parameters_SetArrayMacro( Point, double );
-// -------------------------------------------------------------------------
-#define cpPlugins_Interface_Parameters_SetListMacro( TYPE ) \
- void cpPlugins::Interface::Parameters:: \
- AddValueTo##TYPE##List( const TString& name, const T##TYPE& v ) \
- { \
- TParameters::iterator pIt = this->m_Parameters.find( name ); \
- if( pIt == this->m_Parameters.end( ) ) \
- return; \
- if( pIt->second.first != Self::TYPE##List ) \
- return; \
- std::stringstream ss; \
- ss << pIt->second.second << v << "#"; \
- pIt->second.second = ss.str( ); \
- }
-
-cpPlugins_Interface_Parameters_SetListMacro( String );
-cpPlugins_Interface_Parameters_SetListMacro( Bool );
-cpPlugins_Interface_Parameters_SetListMacro( Int );
-cpPlugins_Interface_Parameters_SetListMacro( Uint );
-cpPlugins_Interface_Parameters_SetListMacro( Real );
-
-// -------------------------------------------------------------------------
-#define cpPlugins_Interface_Parameters_SetArrayListMacro( TYPE, ATYPE ) \
- void cpPlugins::Interface::Parameters:: \
- AddValueTo##TYPE##List( const TString& name, const TUint& n, ... ) \
- { \
- TParameters::iterator pIt = this->m_Parameters.find( name ); \
- if( pIt == this->m_Parameters.end( ) ) \
- return; \
- if( pIt->second.first != Self::TYPE##List ) \
- return; \
- va_list v_lst; \
- va_start( v_lst, n ); \
- std::stringstream ss; \
- ss << pIt->second.second; \
- for( TUint i = 0; i < n; ++i ) \
- ss << va_arg( v_lst, ATYPE ) << ","; \
- va_end( v_lst ); \
- ss << "#"; \
- pIt->second.second = ss.str( ); \
- }
-
-cpPlugins_Interface_Parameters_SetArrayListMacro( Index, int );
-cpPlugins_Interface_Parameters_SetArrayListMacro( Point, double );
-
-// -------------------------------------------------------------------------
-#define cpPlugins_Interface_Parameters_ClearListMacro( TYPE ) \
- void cpPlugins::Interface::Parameters:: \
- Clear##TYPE##List( const TString& name ) \
- { \
- TParameters::iterator pIt = this->m_Parameters.find( name ); \
- if( pIt == this->m_Parameters.end( ) ) \
- return; \
- if( pIt->second.first != Self::TYPE##List ) \
- return; \
- pIt->second.second = ""; \
- }
-
-cpPlugins_Interface_Parameters_ClearListMacro( String );
-cpPlugins_Interface_Parameters_ClearListMacro( Bool );
-cpPlugins_Interface_Parameters_ClearListMacro( Int );
-cpPlugins_Interface_Parameters_ClearListMacro( Uint );
-cpPlugins_Interface_Parameters_ClearListMacro( Real );
-cpPlugins_Interface_Parameters_ClearListMacro( Index );
-cpPlugins_Interface_Parameters_ClearListMacro( Point );
+#include <sstream>
// -------------------------------------------------------------------------
-cpPlugins::Interface::Parameters::
-Parameters( )
+void cpPlugins::Interface::Parameters::
+Clear( )
{
- this->Clear( );
+ this->m_Parameters.clear( );
+ this->Modified( );
}
// -------------------------------------------------------------------------
-cpPlugins::Interface::Parameters::
-Parameters( const Self& other )
+void cpPlugins::Interface::Parameters::
+ConfigureAsString( const TString& name, const TString& v )
{
- this->m_Parameters = other.m_Parameters;
+ this->m_Parameters[ name ] = TParameter( Self::String, TValues( v, v ) );
+ this->Modified( );
}
// -------------------------------------------------------------------------
-cpPlugins::Interface::Parameters::
-~Parameters( )
-{
- this->Clear( );
-}
+#define cpPlugins_Parameters_Configure( Y ) \
+ void cpPlugins::Interface::Parameters:: \
+ ConfigureAs##Y( const TString& name, const T##Y& v ) \
+ { \
+ std::stringstream str; \
+ str << v; \
+ std::string s = str.str( ); \
+ this->m_Parameters[ name ] = \
+ TParameter( Self::Y, TValues( s, s ) ); \
+ this->Modified( ); \
+ }
-// -------------------------------------------------------------------------
-cpPlugins::Interface::Parameters::
-Self& cpPlugins::Interface::Parameters::
-operator=( const Self& other )
-{
- this->m_Parameters = other.m_Parameters;
- return( *this );
-}
+cpPlugins_Parameters_Configure( Bool );
+cpPlugins_Parameters_Configure( Int );
+cpPlugins_Parameters_Configure( Uint );
+cpPlugins_Parameters_Configure( Real );
// -------------------------------------------------------------------------
-void cpPlugins::Interface::Parameters::
-Clear( )
-{
- this->m_Parameters.clear( );
-}
+#define cpPlugins_Parameters_List_Configure( Y ) \
+ void cpPlugins::Interface::Parameters:: \
+ ConfigureAs##Y##List( const TString& name ) \
+ { \
+ this->m_Parameters[ name ] = \
+ TParameter( Self::Y##List, TValues( "", "" ) ); \
+ this->Modified( ); \
+ }
+
+cpPlugins_Parameters_List_Configure( String );
+cpPlugins_Parameters_List_Configure( Bool );
+cpPlugins_Parameters_List_Configure( Int );
+cpPlugins_Parameters_List_Configure( Uint );
+cpPlugins_Parameters_List_Configure( Real );
+cpPlugins_Parameters_List_Configure( Index );
+cpPlugins_Parameters_List_Configure( Point );
// -------------------------------------------------------------------------
void cpPlugins::Interface::Parameters::
-Configure( const Self::Type& type, const TString& name )
+ConfigureAsChoices(
+ const TString& name, const std::vector< TString >& choices
+ )
{
- this->m_Parameters[ name ] = TParameter( type, "" );
+ // It is invalid not to give choices when configuring
+ if( choices.size( ) == 0 )
+ return;
+
+ std::stringstream str_choices;
+ str_choices << choices[ 0 ];
+ for( unsigned int i = 1; i < choices.size( ); ++i )
+ str_choices << "#" << choices[ i ];
+ this->m_Parameters[ name ] =
+ TParameter( Self::Choices, TValues( str_choices.str( ), "" ) );
+ this->Modified( );
}
// -------------------------------------------------------------------------
-std::vector< cpPlugins::Interface::Parameters::TString >
-cpPlugins::Interface::Parameters::
-GetParameters( ) const
+void cpPlugins::Interface::Parameters::
+GetNames( std::vector< TString >& container ) const
{
- std::vector< TString > parameters;
- TParameters::const_iterator pIt = this->m_Parameters.begin( );
- for( ; pIt != this->m_Parameters.end( ); ++pIt )
- parameters.push_back( pIt->first );
- return( parameters );
+ container.clear( );
+ TParameters::const_iterator i = this->m_Parameters.begin( );
+ for( ; i != this->m_Parameters.end( ); ++i )
+ container.push_back( i->first );
}
// -------------------------------------------------------------------------
cpPlugins::Interface::Parameters::
Type cpPlugins::Interface::Parameters::
-GetParameterType( const TString& name ) const
+GetType( const TString& name ) const
{
- TParameters::const_iterator pIt = this->m_Parameters.find( name );
- if( pIt == this->m_Parameters.end( ) )
+ TParameters::const_iterator i = this->m_Parameters.find( name );
+ if( i != this->m_Parameters.end( ) )
+ return( i->second.first );
+ else
return( Self::NoType );
- return( pIt->second.first );
}
// -------------------------------------------------------------------------
-const cpPlugins::Interface::Parameters::
-TString& cpPlugins::Interface::Parameters::
-GetRawValue( const TString& name ) const
-{
- static const TString null_str = "";
- TParameters::const_iterator pIt = this->m_Parameters.find( name );
- if( pIt == this->m_Parameters.end( ) )
- return( null_str );
- return( pIt->second.second );
-}
+#define cpPlugins_Parameters_Has( Y ) \
+ bool cpPlugins::Interface::Parameters:: \
+ Has##Y( const TString& name ) const \
+ { \
+ TParameters::const_iterator i = this->m_Parameters.find( name ); \
+ if( i != this->m_Parameters.end( ) ) \
+ return( i->second.first == Self::Y ); \
+ else \
+ return( false ); \
+ }
+
+cpPlugins_Parameters_Has( String );
+cpPlugins_Parameters_Has( Bool );
+cpPlugins_Parameters_Has( Int );
+cpPlugins_Parameters_Has( Uint );
+cpPlugins_Parameters_Has( Real );
+cpPlugins_Parameters_Has( Index );
+cpPlugins_Parameters_Has( Point );
+cpPlugins_Parameters_Has( StringList );
+cpPlugins_Parameters_Has( BoolList );
+cpPlugins_Parameters_Has( IntList );
+cpPlugins_Parameters_Has( UintList );
+cpPlugins_Parameters_Has( RealList );
+cpPlugins_Parameters_Has( IndexList );
+cpPlugins_Parameters_Has( PointList );
+cpPlugins_Parameters_Has( Choices );
// -------------------------------------------------------------------------
-const cpPlugins::Interface::Parameters::
-TString& cpPlugins::Interface::Parameters::
-GetValueAsString( const TString& name ) const
+cpPlugins::Interface::Parameters::
+TString cpPlugins::Interface::Parameters::
+GetString( const TString& name ) const
{
- static const TString null_str = "";
- TParameters::const_iterator pIt = this->m_Parameters.find( name );
- if( pIt == this->m_Parameters.end( ) )
- return( null_str );
- if( pIt->second.first != Self::String )
- return( null_str );
-
- return( pIt->second.second );
+ TParameters::const_iterator i = this->m_Parameters.find( name );
+ if( i != this->m_Parameters.end( ) )
+ {
+ if( i->second.first == Self::String )
+ return( i->second.second.second );
+
+ } // fi
+ return( "" );
}
// -------------------------------------------------------------------------
cpPlugins::Interface::Parameters::
TBool cpPlugins::Interface::Parameters::
-GetValueAsBool( const TString& name ) const
+GetBool( const TString& name ) const
{
- TParameters::const_iterator pIt = this->m_Parameters.find( name );
- if( pIt == this->m_Parameters.end( ) )
- return( TBool( false ) );
- if( pIt->second.first != Self::Bool )
- return( TBool( false ) );
- return( TBool( std::atoi( pIt->second.second.c_str( ) ) == 1 ) );
+ TParameters::const_iterator i = this->m_Parameters.find( name );
+ if( i != this->m_Parameters.end( ) )
+ {
+ if( i->second.first == Self::Bool )
+ return( std::atoi( i->second.second.second.c_str( ) ) == 1 );
+
+ } // fi
+ return( false );
}
// -------------------------------------------------------------------------
cpPlugins::Interface::Parameters::
TInt cpPlugins::Interface::Parameters::
-GetValueAsInt( const TString& name ) const
+GetInt( const TString& name ) const
{
- TParameters::const_iterator pIt = this->m_Parameters.find( name );
- if( pIt == this->m_Parameters.end( ) )
- return( TInt( 0 ) );
- if( pIt->second.first != Self::Int )
- return( TInt( 0 ) );
- return( TInt( std::atoi( pIt->second.second.c_str( ) ) ) );
+ TParameters::const_iterator i = this->m_Parameters.find( name );
+ if( i != this->m_Parameters.end( ) )
+ {
+ if( i->second.first == Self::Int )
+ return( TInt( std::atoi( i->second.second.second.c_str( ) ) ) );
+
+ } // fi
+ return( TInt( 0 ) );
}
// -------------------------------------------------------------------------
cpPlugins::Interface::Parameters::
TUint cpPlugins::Interface::Parameters::
-GetValueAsUint( const TString& name ) const
+GetUint( const TString& name ) const
{
- TParameters::const_iterator pIt = this->m_Parameters.find( name );
- if( pIt == this->m_Parameters.end( ) )
- return( TUint( 0 ) );
- if( pIt->second.first != Self::Uint )
- return( TUint( 0 ) );
- return( TUint( std::atoi( pIt->second.second.c_str( ) ) ) );
+ TParameters::const_iterator i = this->m_Parameters.find( name );
+ if( i != this->m_Parameters.end( ) )
+ {
+ if( i->second.first == Self::Uint )
+ return( TUint( std::atoi( i->second.second.second.c_str( ) ) ) );
+
+ } // fi
+ return( TUint( 0 ) );
}
// -------------------------------------------------------------------------
cpPlugins::Interface::Parameters::
TReal cpPlugins::Interface::Parameters::
-GetValueAsReal( const TString& name ) const
+GetReal( const TString& name ) const
{
- TParameters::const_iterator pIt = this->m_Parameters.find( name );
- if( pIt == this->m_Parameters.end( ) )
- return( TReal( 0 ) );
- if( pIt->second.first != Self::Real )
- return( TReal( 0 ) );
- return( TReal( std::atof( pIt->second.second.c_str( ) ) ) );
+ TParameters::const_iterator i = this->m_Parameters.find( name );
+ if( i != this->m_Parameters.end( ) )
+ {
+ if( i->second.first == Self::Real )
+ return( TReal( std::atof( i->second.second.second.c_str( ) ) ) );
+
+ } // fi
+ return( TReal( 0 ) );
}
// -------------------------------------------------------------------------
void cpPlugins::Interface::Parameters::
-GetValueAsStringList(
- std::vector< TString >& lst, const TString& name
- ) const
+GetStringList( std::vector< TString >& lst, const TString& name ) const
{
lst.clear( );
- TParameters::const_iterator pIt = this->m_Parameters.find( name );
- if( pIt == this->m_Parameters.end( ) )
+ TParameters::const_iterator i = this->m_Parameters.find( name );
+ if( i == this->m_Parameters.end( ) )
return;
- if( pIt->second.first != Self::StringList )
+ if( i->second.first != Self::StringList )
return;
- std::istringstream ss( pIt->second.second );
+ std::istringstream str( i->second.second.second );
std::string token;
- while( std::getline( ss, token, '#' ) )
- if( token != "" )
- lst.push_back( token );
+ while( std::getline( str, token, '#' ) )
+ lst.push_back( token );
}
// -------------------------------------------------------------------------
void cpPlugins::Interface::Parameters::
-GetValueAsBoolList( std::vector< TBool >& lst, const TString& name ) const
+GetBoolList( std::vector< TBool >& lst, const TString& name ) const
{
lst.clear( );
- TParameters::const_iterator pIt = this->m_Parameters.find( name );
- if( pIt == this->m_Parameters.end( ) )
+ TParameters::const_iterator i = this->m_Parameters.find( name );
+ if( i == this->m_Parameters.end( ) )
return;
- if( pIt->second.first != Self::BoolList )
+ if( i->second.first != Self::BoolList )
return;
- std::istringstream ss( pIt->second.second );
+ std::istringstream str( i->second.second.second );
std::string token;
- while( std::getline( ss, token, '#' ) )
- if( token != "" )
- lst.push_back( TBool( std::atoi( token.c_str( ) ) == 1 ) );
+ while( std::getline( str, token, '#' ) )
+ lst.push_back( std::atoi( token.c_str( ) ) == 1 );
}
// -------------------------------------------------------------------------
void cpPlugins::Interface::Parameters::
-GetValueAsIntList( std::vector< TInt >& lst, const TString& name ) const
+GetIntList( std::vector< TInt >& lst, const TString& name ) const
{
lst.clear( );
- TParameters::const_iterator pIt = this->m_Parameters.find( name );
- if( pIt == this->m_Parameters.end( ) )
+ TParameters::const_iterator i = this->m_Parameters.find( name );
+ if( i == this->m_Parameters.end( ) )
return;
- if( pIt->second.first != Self::IntList )
+ if( i->second.first != Self::IntList )
return;
- std::istringstream ss( pIt->second.second );
+ std::istringstream str( i->second.second.second );
std::string token;
- while( std::getline( ss, token, '#' ) )
- if( token != "" )
- lst.push_back( TInt( std::atoi( token.c_str( ) ) ) );
+ while( std::getline( str, token, '#' ) )
+ lst.push_back( TInt( std::atoi( token.c_str( ) ) ) );
}
// -------------------------------------------------------------------------
void cpPlugins::Interface::Parameters::
-GetValueAsUintList( std::vector< TUint >& lst, const TString& name ) const
+GetUintList( std::vector< TUint >& lst, const TString& name ) const
{
lst.clear( );
- TParameters::const_iterator pIt = this->m_Parameters.find( name );
- if( pIt == this->m_Parameters.end( ) )
+ TParameters::const_iterator i = this->m_Parameters.find( name );
+ if( i == this->m_Parameters.end( ) )
return;
- if( pIt->second.first != Self::UintList )
+ if( i->second.first != Self::UintList )
return;
- std::istringstream ss( pIt->second.second );
+ std::istringstream str( i->second.second.second );
std::string token;
- while( std::getline( ss, token, '#' ) )
- if( token != "" )
- lst.push_back( TUint( std::atoi( token.c_str( ) ) ) );
+ while( std::getline( str, token, '#' ) )
+ lst.push_back( TUint( std::atoi( token.c_str( ) ) ) );
}
// -------------------------------------------------------------------------
void cpPlugins::Interface::Parameters::
-GetValueAsRealList( std::vector< TReal >& lst, const TString& name ) const
+GetRealList( std::vector< TReal >& lst, const TString& name ) const
{
lst.clear( );
- TParameters::const_iterator pIt = this->m_Parameters.find( name );
- if( pIt == this->m_Parameters.end( ) )
+ TParameters::const_iterator i = this->m_Parameters.find( name );
+ if( i == this->m_Parameters.end( ) )
return;
- if( pIt->second.first != Self::RealList )
+ if( i->second.first != Self::RealList )
return;
- std::istringstream ss( pIt->second.second );
+ std::istringstream str( i->second.second.second );
std::string token;
- while( std::getline( ss, token, '#' ) )
- if( token != "" )
- lst.push_back( TReal( std::atof( token.c_str( ) ) ) );
+ while( std::getline( str, token, '#' ) )
+ lst.push_back( TReal( std::atof( token.c_str( ) ) ) );
}
// -------------------------------------------------------------------------
-bool cpPlugins::Interface::Parameters::
-HasStringValue( const TString& name ) const
-{
- TParameters::const_iterator pIt = this->m_Parameters.find( name );
- if( pIt != this->m_Parameters.end( ) )
- return( pIt->second.first == Self::String );
- return( false );
-}
-
-// -------------------------------------------------------------------------
-bool cpPlugins::Interface::Parameters::
-HasBoolValue( const TString& name ) const
-{
- TParameters::const_iterator pIt = this->m_Parameters.find( name );
- if( pIt != this->m_Parameters.end( ) )
- return( pIt->second.first == Self::Bool );
- return( false );
-}
-
-// -------------------------------------------------------------------------
-bool cpPlugins::Interface::Parameters::
-HasIntValue( const TString& name ) const
-{
- TParameters::const_iterator pIt = this->m_Parameters.find( name );
- if( pIt != this->m_Parameters.end( ) )
- return( pIt->second.first == Self::Int );
- return( false );
-}
-
-// -------------------------------------------------------------------------
-bool cpPlugins::Interface::Parameters::
-HasUintValue( const TString& name ) const
+void cpPlugins::Interface::Parameters::
+GetChoices( std::vector< TString >& choices, const TString& name ) const
{
- TParameters::const_iterator pIt = this->m_Parameters.find( name );
- if( pIt != this->m_Parameters.end( ) )
- return( pIt->second.first == Self::Uint );
- return( false );
-}
+ choices.clear( );
+ TParameters::const_iterator i = this->m_Parameters.find( name );
+ if( i == this->m_Parameters.end( ) )
+ return;
+ if( i->second.first != Self::Choices )
+ return;
-// -------------------------------------------------------------------------
-bool cpPlugins::Interface::Parameters::
-HasRealValue( const TString& name ) const
-{
- TParameters::const_iterator pIt = this->m_Parameters.find( name );
- if( pIt != this->m_Parameters.end( ) )
- return( pIt->second.first == Self::Real );
- return( false );
+ std::istringstream str( i->second.second.first );
+ std::string token;
+ while( std::getline( str, token, '#' ) )
+ choices.push_back( token );
}
// -------------------------------------------------------------------------
-bool cpPlugins::Interface::Parameters::
-HasIndexValue( const TString& name ) const
+cpPlugins::Interface::Parameters::
+TString cpPlugins::Interface::Parameters::
+GetSelectedChoice( const TString& name ) const
{
- TParameters::const_iterator pIt = this->m_Parameters.find( name );
- if( pIt != this->m_Parameters.end( ) )
- return( pIt->second.first == Self::Index );
- return( false );
+ TParameters::const_iterator i = this->m_Parameters.find( name );
+ if( i == this->m_Parameters.end( ) )
+ return( "" );
+ if( i->second.first != Self::Choices )
+ return( "" );
+ return( i->second.second.second );
}
// -------------------------------------------------------------------------
-bool cpPlugins::Interface::Parameters::
-HasPointValue( const TString& name ) const
+void cpPlugins::Interface::Parameters::
+SetString( const TString& name, const TString& v )
{
- TParameters::const_iterator pIt = this->m_Parameters.find( name );
- if( pIt != this->m_Parameters.end( ) )
- return( pIt->second.first == Self::Point );
- return( false );
-}
+ TParameters::iterator i = this->m_Parameters.find( name );
+ if( i == this->m_Parameters.end( ) )
+ return;
+ if( i->second.first != Self::String )
+ return;
+ i->second.second.second = v;
+ this->Modified( );
+}
+
+// -------------------------------------------------------------------------
+#define cpPlugins_Parameters_Set( Y ) \
+ void cpPlugins::Interface::Parameters:: \
+ Set##Y( const TString& name, const T##Y& v ) \
+ { \
+ TParameters::iterator i = this->m_Parameters.find( name ); \
+ if( i == this->m_Parameters.end( ) ) \
+ return; \
+ if( i->second.first != Self::Y ) \
+ return; \
+ std::stringstream str; \
+ str << v; \
+ i->second.second.second = str.str( ); \
+ this->Modified( ); \
+ }
-// -------------------------------------------------------------------------
-bool cpPlugins::Interface::Parameters::
-HasStringListValue( const TString& name ) const
-{
- TParameters::const_iterator pIt = this->m_Parameters.find( name );
- if( pIt != this->m_Parameters.end( ) )
- return( pIt->second.first == Self::StringList );
- return( false );
-}
+cpPlugins_Parameters_Set( Bool );
+cpPlugins_Parameters_Set( Int );
+cpPlugins_Parameters_Set( Uint );
+cpPlugins_Parameters_Set( Real );
+
+// -------------------------------------------------------------------------
+#define cpPlugins_Parameters_Add( Y ) \
+ void cpPlugins::Interface::Parameters:: \
+ AddTo##Y##List( const TString& name, const T##Y& v ) \
+ { \
+ TParameters::iterator i = this->m_Parameters.find( name ); \
+ if( i == this->m_Parameters.end( ) ) \
+ return; \
+ if( i->second.first != Self::Y##List ) \
+ return; \
+ std::stringstream str; \
+ if( i->second.second.second == "" ) \
+ str << v; \
+ else \
+ str << "#" << v; \
+ i->second.second.second += str.str( ); \
+ this->Modified( ); \
+ }
-// -------------------------------------------------------------------------
-bool cpPlugins::Interface::Parameters::
-HasBoolListValue( const TString& name ) const
-{
- TParameters::const_iterator pIt = this->m_Parameters.find( name );
- if( pIt != this->m_Parameters.end( ) )
- return( pIt->second.first == Self::BoolList );
- return( false );
-}
+cpPlugins_Parameters_Add( String );
+cpPlugins_Parameters_Add( Bool );
+cpPlugins_Parameters_Add( Int );
+cpPlugins_Parameters_Add( Uint );
+cpPlugins_Parameters_Add( Real );
+
+// -------------------------------------------------------------------------
+#define cpPlugins_Parameters_Clear( Y ) \
+ void cpPlugins::Interface::Parameters:: \
+ Clear##Y##List( const TString& name ) \
+ { \
+ TParameters::iterator i = this->m_Parameters.find( name ); \
+ if( i == this->m_Parameters.end( ) ) \
+ return; \
+ if( i->second.first != Self::Y ) \
+ return; \
+ i->second.second.second = ""; \
+ this->Modified( ); \
+ }
-// -------------------------------------------------------------------------
-bool cpPlugins::Interface::Parameters::
-HasIntListValue( const TString& name ) const
-{
- TParameters::const_iterator pIt = this->m_Parameters.find( name );
- if( pIt != this->m_Parameters.end( ) )
- return( pIt->second.first == Self::IntList );
- return( false );
-}
+cpPlugins_Parameters_Clear( String );
+cpPlugins_Parameters_Clear( Bool );
+cpPlugins_Parameters_Clear( Int );
+cpPlugins_Parameters_Clear( Uint );
+cpPlugins_Parameters_Clear( Real );
+cpPlugins_Parameters_Clear( Index );
+cpPlugins_Parameters_Clear( Point );
// -------------------------------------------------------------------------
bool cpPlugins::Interface::Parameters::
-HasUintListValue( const TString& name ) const
-{
- TParameters::const_iterator pIt = this->m_Parameters.find( name );
- if( pIt != this->m_Parameters.end( ) )
- return( pIt->second.first == Self::UintList );
- return( false );
+SetSelectedChoice( const TString& name, const TString& choice )
+{
+ TParameters::iterator i = this->m_Parameters.find( name );
+ if( i == this->m_Parameters.end( ) )
+ return( false );
+ if( i->second.first != Self::Choices )
+ return( false );
+ if( i->second.second.first.find( choice ) != std::string::npos )
+ {
+ i->second.second.second = choice;
+ this->Modified( );
+ return( true );
+ }
+ else
+ return( false );
}
// -------------------------------------------------------------------------
-bool cpPlugins::Interface::Parameters::
-HasRealListValue( const TString& name ) const
+cpPlugins::Interface::Parameters::
+Parameters( )
+ : Superclass( )
{
- TParameters::const_iterator pIt = this->m_Parameters.find( name );
- if( pIt != this->m_Parameters.end( ) )
- return( pIt->second.first == Self::RealList );
- return( false );
+ this->Clear( );
}
// -------------------------------------------------------------------------
-bool cpPlugins::Interface::Parameters::
-HasIndexListValue( const TString& name ) const
+cpPlugins::Interface::Parameters::
+~Parameters( )
{
- TParameters::const_iterator pIt = this->m_Parameters.find( name );
- if( pIt != this->m_Parameters.end( ) )
- return( pIt->second.first == Self::IndexList );
- return( false );
}
// -------------------------------------------------------------------------
-bool cpPlugins::Interface::Parameters::
-HasPointListValue( const TString& name ) const
-{
- TParameters::const_iterator pIt = this->m_Parameters.find( name );
- if( pIt != this->m_Parameters.end( ) )
- return( pIt->second.first == Self::PointList );
- return( false );
+void cpPlugins::Interface::Parameters::
+PrintSelf( std::ostream& os, itk::Indent indent ) const
+{
+ TParameters::const_iterator i = this->m_Parameters.begin( );
+ for( ; i != this->m_Parameters.end( ); ++i )
+ os << indent
+ << i->first << ": ("
+ << i->second.first << " | "
+ << i->second.second.first << " | "
+ << i->second.second.second << ")"
+ << std::endl;
}
// eof - $RCSfile$
#ifndef __CPPLUGINS__INTERFACE__PARAMETERS__H__
#define __CPPLUGINS__INTERFACE__PARAMETERS__H__
+#include <cpPlugins/Interface/cpPlugins_Interface_Export.h>
+
#include <map>
#include <ostream>
#include <string>
#include <vector>
-#include <cpPlugins/Interface/cpPlugins_Interface_Export.h>
+
+#include <itkObject.h>
+#include <itkObjectFactory.h>
namespace cpPlugins
{
/**
*/
class cpPlugins_Interface_EXPORT Parameters
+ : public itk::Object
{
- // -------------------------------------------------------------------
- friend std::ostream& operator<<(
- std::ostream& os, const Parameters& p
- )
- {
- Parameters::TParameters::const_iterator pIt =
- p.m_Parameters.begin( );
- for( ; pIt != p.m_Parameters.end( ); ++pIt )
- {
- os
- << pIt->first << ": ("
- << pIt->second.first << ", "
- << pIt->second.second << ")"
- << std::endl;
-
- } // rof
- return( os );
- }
-
public:
- typedef Parameters Self;
+ typedef Parameters Self;
+ typedef itk::Object Superclass;
+ typedef itk::SmartPointer< Self > Pointer;
+ typedef itk::SmartPointer< const Self > ConstPointer;
enum Type
{
Uint , Real , Index ,
Point , StringList , BoolList ,
IntList , UintList , RealList ,
- IndexList , PointList , NoType
+ IndexList , PointList , Choices ,
+ NoType
};
typedef bool TBool;
typedef double TReal;
typedef std::string TString;
- typedef std::pair< Self::Type, TString > TParameter;
+ // NOTE: std::pair< default, value >
+ typedef std::pair< TString, TString > TValues;
+ typedef std::pair< Self::Type, TValues > TParameter;
typedef std::map< TString, TParameter > TParameters;
public:
- Parameters( );
- Parameters( const Self& other );
- virtual ~Parameters( );
-
- Self& operator=( const Self& other );
+ itkNewMacro( Self );
+ itkTypeMacro( cpPlugins::Interface::Parameters, itk::Object );
+ public:
+ // Parameters container configuration
void Clear( );
- void Configure( const Self::Type& type, const TString& name );
- void SetValueAsString( const TString& name, const TString& v );
- void SetValueAsBool( const TString& name, const TBool& v );
- void SetValueAsInt( const TString& name, const TInt& v );
- void SetValueAsUint( const TString& name, const TUint& v );
- void SetValueAsReal( const TString& name, const TReal& v );
- void SetValueAsIndex( const TString& name, const TUint& n, ... );
- void SetValueAsPoint( const TString& name, const TUint& n, ... );
-
- void AddValueToStringList( const TString& name, const TString& v );
- void AddValueToBoolList( const TString& name, const TBool& v );
- void AddValueToIntList( const TString& name, const TInt& v );
- void AddValueToUintList( const TString& name, const TUint& v );
- void AddValueToRealList( const TString& name, const TReal& v );
- void AddValueToIndexList( const TString& name, const TUint& n, ... );
- void AddValueToPointList( const TString& name, const TUint& n, ... );
- void ClearStringList( const TString& name );
- void ClearBoolList( const TString& name );
- void ClearIntList( const TString& name );
- void ClearUintList( const TString& name );
- void ClearRealList( const TString& name );
- void ClearIndexList( const TString& name );
- void ClearPointList( const TString& name );
-
- std::vector< TString > GetParameters( ) const;
- Self::Type GetParameterType( const TString& name ) const;
- const TString& GetRawValue( const TString& name ) const;
- const TString& GetValueAsString( const TString& name ) const;
- TBool GetValueAsBool( const TString& name ) const;
- TInt GetValueAsInt( const TString& name ) const;
- TUint GetValueAsUint( const TString& name ) const;
- TReal GetValueAsReal( const TString& name ) const;
+ void ConfigureAsString( const TString& name, const TString& v );
+ void ConfigureAsBool( const TString& name, const TBool& v );
+ void ConfigureAsInt( const TString& name, const TInt& v );
+ void ConfigureAsUint( const TString& name, const TUint& v );
+ void ConfigureAsReal( const TString& name, const TReal& v );
template< class I >
- I GetValueAsIndex( const TString& name ) const;
-
+ inline void ConfigureAsIndex(
+ const TString& name, const TUint& dim, const I& v
+ );
template< class P >
- P GetValueAsPoint( const TString& name ) const;
-
- void GetValueAsStringList(
+ inline void ConfigureAsPoint(
+ const TString& name, const TUint& dim, const P& v
+ );
+
+ void ConfigureAsStringList( const TString& name );
+ void ConfigureAsBoolList( const TString& name );
+ void ConfigureAsIntList( const TString& name );
+ void ConfigureAsUintList( const TString& name );
+ void ConfigureAsRealList( const TString& name );
+ void ConfigureAsIndexList( const TString& name );
+ void ConfigureAsPointList( const TString& name );
+ void ConfigureAsChoices(
+ const TString& name, const std::vector< TString >& choices
+ );
+
+ // Get methods
+ void GetNames( std::vector< TString >& container ) const;
+ Type GetType( const TString& name ) const;
+
+ bool HasString( const TString& name ) const;
+ bool HasBool( const TString& name ) const;
+ bool HasInt( const TString& name ) const;
+ bool HasUint( const TString& name ) const;
+ bool HasReal( const TString& name ) const;
+ bool HasIndex( const TString& name ) const;
+ bool HasPoint( const TString& name ) const;
+ bool HasStringList( const TString& name ) const;
+ bool HasBoolList( const TString& name ) const;
+ bool HasIntList( const TString& name ) const;
+ bool HasUintList( const TString& name ) const;
+ bool HasRealList( const TString& name ) const;
+ bool HasIndexList( const TString& name ) const;
+ bool HasPointList( const TString& name ) const;
+ bool HasChoices( const TString& name ) const;
+
+ TString GetString( const TString& name ) const;
+ TBool GetBool( const TString& name ) const;
+ TInt GetInt( const TString& name ) const;
+ TUint GetUint( const TString& name ) const;
+ TReal GetReal( const TString& name ) const;
+
+ void GetStringList(
std::vector< TString >& lst, const TString& name
) const;
- void GetValueAsBoolList(
+ void GetBoolList(
std::vector< TBool >& lst, const TString& name
) const;
- void GetValueAsIntList(
+ void GetIntList(
std::vector< TInt >& lst, const TString& name
) const;
- void GetValueAsUintList(
+ void GetUintList(
std::vector< TUint >& lst, const TString& name
) const;
- void GetValueAsRealList(
+ void GetRealList(
std::vector< TReal >& lst, const TString& name
) const;
- template< class I >
- void GetValueAsIndexList(
- std::vector< I >& lst, const TString& name
+ void GetChoices(
+ std::vector< TString >& choices, const TString& name
) const;
+ TString GetSelectedChoice( const TString& name ) const;
+ template< class I >
+ inline I GetIndex( const TString& name, const TUint& dim ) const;
template< class P >
- void GetValueAsPointList(
- std::vector< P >& lst, const TString& name
- ) const;
+ inline P GetPoint( const TString& name, const TUint& dim ) const;
+
+ template< class I >
+ inline void GetIndexList(
+ std::vector< I >& lst, const TString& name, const TUint& dim
+ ) const;
+ template< class P >
+ inline void GetPointList(
+ std::vector< P >& lst, const TString& name, const TUint& dim
+ ) const;
+
+ // Set methods
+ void SetString( const TString& name, const TString& v );
+ void SetBool( const TString& name, const TBool& v );
+ void SetInt( const TString& name, const TInt& v );
+ void SetUint( const TString& name, const TUint& v );
+ void SetReal( const TString& name, const TReal& v );
+
+ template< class I >
+ inline void SetIndex(
+ const TString& name, const TUint& dim, const I& v
+ );
+ template< class P >
+ inline void SetPoint(
+ const TString& name, const TUint& dim, const P& v
+ );
+
+ void AddToStringList( const TString& name, const TString& v );
+ void AddToBoolList( const TString& name, const TBool& v );
+ void AddToIntList( const TString& name, const TInt& v );
+ void AddToUintList( const TString& name, const TUint& v );
+ void AddToRealList( const TString& name, const TReal& v );
- bool HasStringValue( const TString& name ) const;
- bool HasBoolValue( const TString& name ) const;
- bool HasIntValue( const TString& name ) const;
- bool HasUintValue( const TString& name ) const;
- bool HasRealValue( const TString& name ) const;
- bool HasIndexValue( const TString& name ) const;
- bool HasPointValue( const TString& name ) const;
- bool HasStringListValue( const TString& name ) const;
- bool HasBoolListValue( const TString& name ) const;
- bool HasIntListValue( const TString& name ) const;
- bool HasUintListValue( const TString& name ) const;
- bool HasRealListValue( const TString& name ) const;
- bool HasIndexListValue( const TString& name ) const;
- bool HasPointListValue( const TString& name ) const;
+ template< class I >
+ inline void AddToIndexList(
+ const TString& name, const TUint& dim, const I& v
+ );
+ template< class P >
+ inline void AddToPointList(
+ const TString& name, const TUint& dim, const P& v
+ );
+
+ void ClearStringList( const TString& name );
+ void ClearBoolList( const TString& name );
+ void ClearIntList( const TString& name );
+ void ClearUintList( const TString& name );
+ void ClearRealList( const TString& name );
+ void ClearIndexList( const TString& name );
+ void ClearPointList( const TString& name );
+
+ bool SetSelectedChoice( const TString& name, const TString& choice );
+
+ protected:
+ Parameters( );
+ virtual ~Parameters( );
+ void PrintSelf( std::ostream& os, itk::Indent indent ) const;
+
+ private:
+ // Purposely not implemented
+ Parameters( const Self& other );
+ Self& operator=( const Self& other );
protected:
TParameters m_Parameters;
#ifndef __CPPLUGINS__INTERFACE__PARAMETERS__HXX__
#define __CPPLUGINS__INTERFACE__PARAMETERS__HXX__
-#include <cstdlib>
-#include <iostream>
-#include <sstream>
+// -------------------------------------------------------------------------
+template< class I >
+void cpPlugins::Interface::Parameters::
+ConfigureAsIndex( const TString& name, const TUint& dim, const I& v )
+{
+ std::stringstream str;
+ str << v[ 0 ];
+ for( unsigned int d = 1; d < dim; ++d )
+ str << ";" << v[ d ];
+ std::string s = str.str( );
+ this->m_Parameters[ name ] = TParameter( Self::Index, TValues( s, s ) );
+ this->Modified( );
+}
// -------------------------------------------------------------------------
-#define cpPlugins_Interface_Parameters_SetIndexOrPointMacro( NAME, TYPE ) \
- template< class T > \
- T cpPlugins::Interface::Parameters:: \
- GetValueAs##NAME( const TString& name ) const \
- { \
- T val; \
- TParameters::const_iterator pIt = this->m_Parameters.find( name ); \
- if( pIt != this->m_Parameters.end( ) ) \
- { \
- if( pIt->second.first == Self::NAME ) \
- { \
- std::istringstream ss( pIt->second.second ); \
- std::string token; \
- unsigned int i = 0; \
- while( std::getline( ss, token, ',' ) ) \
- { \
- if( token != "" ) \
- val[ i++ ] = TYPE( std::atof( token.c_str( ) ) ); \
- } \
- } \
- } \
- return( val ); \
- }
-
-cpPlugins_Interface_Parameters_SetIndexOrPointMacro( Index, long );
-cpPlugins_Interface_Parameters_SetIndexOrPointMacro( Point, double );
+template< class P >
+void cpPlugins::Interface::Parameters::
+ConfigureAsPoint( const TString& name, const TUint& dim, const P& v )
+{
+ std::stringstream str;
+ str << v[ 0 ];
+ for( unsigned int d = 1; d < dim; ++d )
+ str << ";" << v[ d ];
+ std::string s = str.str( );
+ this->m_Parameters[ name ] = TParameter( Self::Point, TValues( s, s ) );
+ this->Modified( );
+}
+
+// -------------------------------------------------------------------------
+template< class I >
+I cpPlugins::Interface::Parameters::
+GetIndex( const TString& name, const TUint& dim ) const
+{
+ I v;
+ TParameters::const_iterator i = this->m_Parameters.find( name );
+ if( i != this->m_Parameters.end( ) )
+ {
+ if( i->second.first == Self::Index )
+ {
+ std::istringstream str( i->second.second.second );
+ std::string token;
+ unsigned int d = 0;
+ while( std::getline( str, token, ';' ) && d < dim )
+ {
+ v[ d ] = std::atoi( token.c_str( ) );
+ d++;
+
+ } // elihw
+ return( v );
+
+ } // fi
+
+ } // fi
+
+ // If parameter not found
+ for( unsigned int d = 0; d < dim; ++d )
+ v[ d ] = 0;
+ return( v );
+}
+
+// -------------------------------------------------------------------------
+template< class P >
+P cpPlugins::Interface::Parameters::
+GetPoint( const TString& name, const TUint& dim ) const
+{
+ P v;
+ TParameters::const_iterator i = this->m_Parameters.find( name );
+ if( i != this->m_Parameters.end( ) )
+ {
+ if( i->second.first == Self::Point )
+ {
+ std::istringstream str( i->second.second.second );
+ std::string token;
+ unsigned int d = 0;
+ while( std::getline( str, token, ';' ) && d < dim )
+ {
+ v[ d ] = std::atof( token.c_str( ) );
+ d++;
+
+ } // elihw
+ return( v );
+
+ } // fi
+
+ } // fi
+
+ // If parameter not found
+ for( unsigned int d = 0; d < dim; ++d )
+ v[ d ] = float( 0 );
+ return( v );
+}
// -------------------------------------------------------------------------
template< class I >
void cpPlugins::Interface::Parameters::
-GetValueAsIndexList( std::vector< I >& lst, const TString& name ) const
+GetIndexList(
+ std::vector< I >& lst, const TString& name, const TUint& dim
+ ) const
{
lst.clear( );
- TParameters::const_iterator pIt = this->m_Parameters.find( name );
- if( pIt == this->m_Parameters.end( ) )
+
+ TParameters::const_iterator i = this->m_Parameters.find( name );
+ if( i == this->m_Parameters.end( ) )
return;
- if( pIt->second.first != Self::IndexList )
+ if( i->second.first == Self::IndexList )
return;
- std::istringstream ss( pIt->second.second );
+ std::istringstream str( i->second.second.second );
std::string token;
- while( std::getline( ss, token, ':' ) )
+ unsigned int d = 0;
+ while( std::getline( str, token, '#' ) )
{
- if( token != "" )
+ std::istringstream str2( token );
+ std::string token2;
+ unsigned int d = 0;
+ I v;
+ while( std::getline( str2, token2, ';' ) && d < dim )
{
- std::istringstream ts( token );
- std::string text;
- unsigned int i = 0;
- I idx;
- while( std::getline( ts, text, ',' ) )
- if( text != "" )
- idx[ i++ ] = std::atoi( text.c_str( ) );
- lst.push_back( idx );
+ v[ d ] = std::atoi( token.c_str( ) );
+ d++;
- } // fi
+ } // elihw
+ lst.push_back( v );
} // elihw
}
// -------------------------------------------------------------------------
template< class P >
void cpPlugins::Interface::Parameters::
-GetValueAsPointList( std::vector< P >& lst, const TString& name ) const
+GetPointList(
+ std::vector< P >& lst, const TString& name, const TUint& dim
+ ) const
{
lst.clear( );
- TParameters::const_iterator pIt = this->m_Parameters.find( name );
- if( pIt == this->m_Parameters.end( ) )
+
+ TParameters::const_iterator i = this->m_Parameters.find( name );
+ if( i == this->m_Parameters.end( ) )
return;
- if( pIt->second.first != Self::PointList )
+ if( i->second.first == Self::PointList )
return;
- std::istringstream ss( pIt->second.second );
+ std::istringstream str( i->second.second.second );
std::string token;
- while( std::getline( ss, token, ':' ) )
+ unsigned int d = 0;
+ while( std::getline( str, token, '#' ) )
{
- if( token != "" )
+ std::istringstream str2( token );
+ std::string token2;
+ unsigned int d = 0;
+ P v;
+ while( std::getline( str2, token2, ';' ) && d < dim )
{
- std::istringstream ts( token );
- std::string text;
- unsigned int i = 0;
- P pnt;
- while( std::getline( ts, text, ',' ) )
- if( text != "" )
- pnt[ i++ ] = std::atof( text.c_str( ) );
- lst.push_back( pnt );
+ v[ d ] = std::atof( token.c_str( ) );
+ d++;
- } // fi
+ } // elihw
+ lst.push_back( v );
} // elihw
}
+// -------------------------------------------------------------------------
+template< class I >
+void cpPlugins::Interface::Parameters::
+SetIndex( const TString& name, const TUint& dim, const I& v )
+{
+ TParameters::iterator i = this->m_Parameters.find( name );
+ if( i == this->m_Parameters.end( ) )
+ return;
+ if( i->second.first != Self::Index )
+ return;
+
+ std::stringstream str;
+ str << v[ 0 ];
+ for( unsigned int d = 1; d < dim; ++d )
+ str << ";" << v[ d ];
+ i->second.second.second = str.str( );
+ this->Modified( );
+}
+
+// -------------------------------------------------------------------------
+template< class P >
+void cpPlugins::Interface::Parameters::
+SetPoint( const TString& name, const TUint& dim, const P& v )
+{
+ TParameters::iterator i = this->m_Parameters.find( name );
+ if( i == this->m_Parameters.end( ) )
+ return;
+ if( i->second.first != Self::Point )
+ return;
+
+ std::stringstream str;
+ str << v[ 0 ];
+ for( unsigned int d = 1; d < dim; ++d )
+ str << ";" << v[ d ];
+ i->second.second.second = str.str( );
+ this->Modified( );
+}
+
+// -------------------------------------------------------------------------
+template< class I >
+void cpPlugins::Interface::Parameters::
+AddToIndexList( const TString& name, const TUint& dim, const I& v )
+{
+ TParameters::iterator i = this->m_Parameters.find( name );
+ if( i == this->m_Parameters.end( ) )
+ return;
+ if( i->second.first != Self::IndexList )
+ return;
+
+ std::stringstream str;
+ if( i->second.second.second == "" )
+ str << v[ 0 ];
+ else
+ str << "#" << v[ 0 ];
+ for( unsigned int d = 1; d < dim; ++d )
+ str << ";" << v[ d ];
+ i->second.second.second += str.str( );
+ this->Modified( );
+}
+
+// -------------------------------------------------------------------------
+template< class P >
+void cpPlugins::Interface::Parameters::
+AddToPointList( const TString& name, const TUint& dim, const P& v )
+{
+ TParameters::iterator i = this->m_Parameters.find( name );
+ if( i == this->m_Parameters.end( ) )
+ return;
+ if( i->second.first != Self::PointList )
+ return;
+
+ std::stringstream str;
+ if( i->second.second.second == "" )
+ str << v[ 0 ];
+ else
+ str << "#" << v[ 0 ];
+ for( unsigned int d = 1; d < dim; ++d )
+ str << ";" << v[ d ];
+ i->second.second.second += str.str( );
+ this->Modified( );
+}
+
#endif // __CPPLUGINS__INTERFACE__PARAMETERS__HXX__
// eof - $RCSfile$
// -------------------------------------------------------------------------
bool cpPlugins::Interface::
ParametersQtDialog(
- Parameters& parameters, const std::string& title, QWidget* parent
+ Parameters* parameters, const std::string& title, QWidget* parent
)
{
// Create dialog with a simple layout
verticalLayout->addWidget( dlg_title );
// Put values
- std::vector< std::string > names = parameters.GetParameters( );
+ std::vector< std::string > names;
+ parameters->GetNames( names );
std::vector< std::string >::const_iterator nIt = names.begin( );
for( ; nIt != names.end( ); ++nIt )
{
- Parameters::Type pt = parameters.GetParameterType( *nIt );
+ Parameters::Type pt = parameters->GetType( *nIt );
/* TODO
enum Type
{
QCheckBox* v_bool = new QCheckBox( dlg );
v_bool->setText( "[ON/OFF]" );
- v_bool->setChecked( parameters.GetValueAsBool( *nIt ) );
+ v_bool->setChecked( parameters->GetBool( *nIt ) );
w_input = v_bool;
}
else if( pt == Parameters::Uint )
QSpinBox* v_uint = new QSpinBox( dlg );
v_uint->setMinimum( 0 );
v_uint->setMaximum( std::numeric_limits< int >::max( ) );
- v_uint->setValue( parameters.GetValueAsUint( *nIt ) );
+ v_uint->setValue( parameters->GetUint( *nIt ) );
w_input = v_uint;
}
else if( pt == Parameters::Int )
QSpinBox* v_int = new QSpinBox( dlg );
v_int->setMinimum( -std::numeric_limits< int >::max( ) );
v_int->setMaximum( std::numeric_limits< int >::max( ) );
- v_int->setValue( parameters.GetValueAsInt( *nIt ) );
+ v_int->setValue( parameters->GetInt( *nIt ) );
w_input = v_int;
}
else if( pt == Parameters::Real )
v_double->setDecimals( 3 );
v_double->setMinimum( -std::numeric_limits< double >::max( ) );
v_double->setMaximum( std::numeric_limits< double >::max( ) );
- v_double->setValue( parameters.GetValueAsReal( *nIt ) );
+ v_double->setValue( parameters->GetReal( *nIt ) );
w_input = v_double;
}
else if(
nIt = names.begin( );
for( ; nIt != names.end( ); ++nIt )
{
- Parameters::Type pt = parameters.GetParameterType( *nIt );
+ Parameters::Type pt = parameters->GetType( *nIt );
if( pt == Parameters::String )
{
QLineEdit* v_string = dlg->findChild< QLineEdit* >( nIt->c_str( ) );
if( v_string != NULL )
- parameters.SetValueAsString( *nIt, v_string->text( ).toStdString( ) );
+ parameters->SetString( *nIt, v_string->text( ).toStdString( ) );
}
else if( pt == Parameters::Bool )
{
QCheckBox* v_bool = dlg->findChild< QCheckBox* >( nIt->c_str( ) );
if( v_bool != NULL )
- parameters.SetValueAsBool( *nIt, v_bool->isChecked( ) );
+ parameters->SetBool( *nIt, v_bool->isChecked( ) );
}
else if( pt == Parameters::Uint )
{
QSpinBox* v_uint = dlg->findChild< QSpinBox* >( nIt->c_str( ) );
if( v_uint != NULL )
- parameters.SetValueAsUint( *nIt, v_uint->value( ) );
+ parameters->SetUint( *nIt, v_uint->value( ) );
}
else if( pt == Parameters::Int )
{
QSpinBox* v_int = dlg->findChild< QSpinBox* >( nIt->c_str( ) );
if( v_int != NULL )
- parameters.SetValueAsInt( *nIt, v_int->value( ) );
+ parameters->SetInt( *nIt, v_int->value( ) );
}
else if( pt == Parameters::Real )
{
QDoubleSpinBox* v_double =
dlg->findChild< QDoubleSpinBox* >( nIt->c_str( ) );
if( v_double != NULL )
- parameters.SetValueAsReal( *nIt, v_double->value( ) );
+ parameters->SetReal( *nIt, v_double->value( ) );
}
else if(
pt == Parameters::StringList ||
{
std::vector< std::string > values = l_double->GetStringValues( );
for( int r = 0; r < values.size( ); ++r )
- parameters.AddValueToStringList( *nIt, values[ r ] );
+ parameters->AddToStringList( *nIt, values[ r ] );
}
else if( pt == Parameters::IntList )
{
std::vector< int > values = l_double->GetIntValues( );
for( int r = 0; r < values.size( ); ++r )
- parameters.AddValueToIntList( *nIt, values[ r ] );
+ parameters->AddToIntList( *nIt, values[ r ] );
}
else if( pt == Parameters::UintList )
{
std::vector< unsigned int > values = l_double->GetUintValues( );
for( int r = 0; r < values.size( ); ++r )
- parameters.AddValueToUintList( *nIt, values[ r ] );
+ parameters->AddToUintList( *nIt, values[ r ] );
}
else if( pt == Parameters::RealList )
{
std::vector< double > values = l_double->GetDoubleValues( );
for( int r = 0; r < values.size( ); ++r )
- parameters.AddValueToRealList( *nIt, values[ r ] );
+ parameters->AddToRealList( *nIt, values[ r ] );
} // fi
namespace Interface
{
bool cpPlugins_Interface_EXPORT ParametersQtDialog(
- Parameters& parameters,
+ Parameters* parameters,
const std::string& title,
QWidget* parent = NULL
);
#endif // cpPlugins_Interface_QT4
// -------------------------------------------------------------------------
-const cpPlugins::Interface::Parameters&
cpPlugins::Interface::ProcessObject::
-GetDefaultParameters( ) const
+TParameters* cpPlugins::Interface::ProcessObject::
+GetParameters( )
{
- return( this->m_DefaultParameters );
+ return( this->m_Parameters.GetPointer( ) );
}
// -------------------------------------------------------------------------
-void cpPlugins::Interface::ProcessObject::
-SetParameters( const cpPlugins::Interface::Parameters& params )
+const cpPlugins::Interface::ProcessObject::
+TParameters* cpPlugins::Interface::ProcessObject::
+GetParameters( ) const
{
- this->m_Parameters = params;
- this->Modified( );
+ return( this->m_Parameters.GetPointer( ) );
}
// -------------------------------------------------------------------------
#ifdef cpPlugins_Interface_QT4
- Parameters parameters = this->m_DefaultParameters;
r = cpPlugins::Interface::ParametersQtDialog(
- parameters,
+ this->m_Parameters,
this->GetClassName( ) + std::string( " basic configuration" ),
parent
);
- if( r )
- this->m_Parameters = parameters;
+ /*
+ if( r )
+ // TODO: !!! this->m_Parameters = parameters;
+ */
#endif // cpPlugins_Interface_QT4
m_ITKObject( NULL ),
m_VTKObject( NULL )
{
+ this->m_Parameters = TParameters::New( );
}
// -------------------------------------------------------------------------
typedef itk::SmartPointer< Self > Pointer;
typedef itk::SmartPointer< const Self > ConstPointer;
+ typedef Parameters TParameters;
+
public:
itkTypeMacro( ProcessObject, Object );
cpPlugins_Id_Macro(
);
public:
- virtual const Parameters& GetDefaultParameters( ) const;
- virtual void SetParameters( const Parameters& params );
+ virtual TParameters* GetParameters( );
+ virtual const TParameters* GetParameters( ) const;
virtual unsigned int GetNumberOfInputs( ) const;
virtual unsigned int GetNumberOfOutputs( ) const;
itk::ProcessObject::Pointer m_ITKObject;
vtkSmartPointer< vtkAlgorithm > m_VTKObject;
- Parameters m_DefaultParameters;
- Parameters m_Parameters;
+ Parameters::Pointer m_Parameters;
std::vector< DataObject::Pointer > m_Inputs;
std::vector< DataObject::Pointer > m_Outputs;
SUBDIRS(
IO
- BasicFilters
+ ## BasicFilters
)
## eof - $RCSfile$
dialog.setNameFilter( QFileDialog::tr( "All files (*)" ) );
if( dialog.exec( ) )
{
- this->m_Parameters = this->m_DefaultParameters;
QStringList names = dialog.selectedFiles( );
QStringList::const_iterator qIt = names.begin( );
for( ; qIt != names.end( ); ++qIt )
- this->m_Parameters.AddValueToStringList(
+ this->m_Parameters->AddToStringList(
"FileNames", qIt->toStdString( )
);
- this->m_Parameters.SetValueAsBool( "VectorType", false );
+ this->m_Parameters->SetBool( "VectorType", false );
r = true;
} // fi
this->SetNumberOfOutputs( 1 );
this->_MakeOutput< cpPlugins::Interface::Image >( 0 );
- using namespace cpPlugins::Interface;
- this->m_DefaultParameters.Configure( Parameters::StringList, "FileNames" );
- this->m_DefaultParameters.Configure( Parameters::Bool, "VectorType" );
- this->m_DefaultParameters.SetValueAsBool( "VectorType", false );
- this->m_Parameters = this->m_DefaultParameters;
+ this->m_Parameters->ConfigureAsStringList( "FileNames" );
+ this->m_Parameters->ConfigureAsBool( "VectorType", false );
}
// -------------------------------------------------------------------------
{
// Get filenames
TStringList names;
- this->m_Parameters.GetValueAsStringList( names, "FileNames" );
+ this->m_Parameters->GetStringList( names, "FileNames" );
std::string r = "";
if( names.size( ) >= 1 )
std::string cpPlugins::IO::ImageReader::
_GD1( const TStringList& names )
{
- if( this->m_Parameters.GetValueAsBool( "VectorType" ) )
+ if( this->m_Parameters->GetBool( "VectorType" ) )
return( this->_RealGD< itk::VectorImage< P, D > >( names ) );
else
return( this->_RealGD< itk::Image< P, D > >( names ) );
typedef itk::SmartPointer< Self > Pointer;
typedef itk::SmartPointer< const Self > ConstPointer;
- typedef
- std::vector< cpPlugins::Interface::Parameters::TString >
- TStringList;
+ typedef Superclass::TParameters TParameters;
+ typedef std::vector< TParameters::TString > TStringList;
public:
itkNewMacro( Self );
{
this->SetNumberOfInputs( 1 );
- using namespace cpPlugins::Interface;
- this->m_DefaultParameters.Configure( Parameters::String, "FileName" );
- this->m_Parameters = this->m_DefaultParameters;
+ this->m_Parameters->ConfigureAsString( "FileName", "" );
}
// -------------------------------------------------------------------------
itk::DataObject* itk_image = NULL;
std::string r = "";
- /*
cpPlugins_Image_Demangle_AllTypes( 2, image, itk_image, r, _RealGD );
else cpPlugins_Image_Demangle_AllTypes( 3, image, itk_image, r, _RealGD );
else cpPlugins_Image_Demangle_AllTypes( 4, image, itk_image, r, _RealGD );
else cpPlugins_VectorImage_Demangle_AllTypes( 2, image, itk_image, r, _RealGD );
else cpPlugins_VectorImage_Demangle_AllTypes( 3, image, itk_image, r, _RealGD );
else cpPlugins_VectorImage_Demangle_AllTypes( 4, image, itk_image, r, _RealGD );
- else */r = "ImageWriter: Input image type not supported.";
+ else r = "ImageWriter: Input image type not supported.";
return( r );
}
_RealGD( itk::DataObject* image )
{
// Get filename
- std::string fname = this->m_Parameters.GetValueAsString( "FileName" );
+ std::string fname = this->m_Parameters->GetString( "FileName" );
typedef itk::ImageFileWriter< I > _W;
_W* writer = this->_CreateITK< _W >( );
dialog.setNameFilter( QFileDialog::tr( "All files (*)" ) );
if( dialog.exec( ) )
{
- this->m_Parameters = this->m_DefaultParameters;
QStringList names = dialog.selectedFiles( );
- this->m_Parameters.SetValueAsString(
- "FileName", names[ 0 ].toStdString( )
- );
-
- /* TODO
- this->m_Parameters.SetValueAsString( "PixelType", "float" );
- this->m_Parameters.SetValueAsUint( "Dimension", 3 );
- */
+ this->m_Parameters->SetString( "FileName", names[ 0 ].toStdString( ) );
+ this->m_Parameters->SetSelectedChoice( "PixelType", "float" );
+ this->m_Parameters->SetUint( "Dimension", 3 );
r = true;
this->SetNumberOfOutputs( 1 );
this->_MakeOutput< cpPlugins::Interface::Mesh >( 0 );
- using namespace cpPlugins::Interface;
- this->m_DefaultParameters.Configure( Parameters::String, "FileName" );
- this->m_DefaultParameters.Configure( Parameters::String, "PixelType" );
- this->m_DefaultParameters.Configure( Parameters::Uint, "Dimension" );
- this->m_DefaultParameters.SetValueAsString( "PixelType", "float" );
- this->m_DefaultParameters.SetValueAsUint( "Dimension", 3 );
- this->m_Parameters = this->m_DefaultParameters;
+ std::vector< TParameters::TString > valid_types;
+ valid_types.push_back( "float" );
+ valid_types.push_back( "double" );
+ this->m_Parameters->ConfigureAsString( "FileName", "" );
+ this->m_Parameters->ConfigureAsChoices( "PixelType", valid_types );
+ this->m_Parameters->ConfigureAsUint( "Dimension", 3 );
}
// -------------------------------------------------------------------------
_GenerateData( )
{
using namespace cpPlugins::Interface;
- Parameters::TUint dim = this->m_Parameters.GetValueAsUint( "Dimension" );
+ Parameters::TUint dim = this->m_Parameters->GetUint( "Dimension" );
std::string r = "MeshReader: Mesh dimension not supported.";
if( dim == 2 )
r = this->_GD0< 2 >( );
_GD0( )
{
using namespace cpPlugins::Interface;
- Parameters::TString pt = this->m_Parameters.GetValueAsString( "PixelType" );
+ Parameters::TString pt =
+ this->m_Parameters->GetSelectedChoice( "PixelType" );
std::string r = "MeshReader: Mesh pixel type not supported";
if( pt == "float" ) r = this->_GD1< float, D >( );
else if( pt == "double" ) r = this->_GD1< double, D >( );
_GD1( )
{
// Get filename
- using namespace cpPlugins::Interface;
- Parameters::TString fname =
- this->m_Parameters.GetValueAsString( "FileName" );
+ std::string fname = this->m_Parameters->GetString( "FileName" );
vtkPolyDataReader* pdr = this->_CreateVTK< vtkPolyDataReader >( );
pdr->SetFileName( fname.c_str( ) );
{
this->SetNumberOfInputs( 1 );
- using namespace cpPlugins::Interface;
- this->m_DefaultParameters.Configure( Parameters::String, "FileName" );
- this->m_Parameters = this->m_DefaultParameters;
+ this->m_Parameters->ConfigureAsString( "FileName", "" );
}
// -------------------------------------------------------------------------
vtkPolyData* i = mesh->GetVTK< vtkPolyData >( );
if( i == NULL )
return( "MeshWriter: No suitable input." );
- std::string fname = this->m_Parameters.GetValueAsString( "FileName" );
+ std::string fname = this->m_Parameters->GetString( "FileName" );
vtkPolyDataWriter* pdw = this->_CreateVTK< vtkPolyDataWriter >( );
pdw->SetInputData( i );