FOREACH(_instance ${_instances})
CompileInstances(
_lib_name
- ${PROJECT_BINARY_DIR}/lib
+ ${PROJECT_BINARY_DIR}/lib
${_instance} ${cpPlugins_NUMBER_OF_FILES}
"" "${prj_VERSION}" "${prj_SHORT_VERSION}"
)
** ==============
i cpPlugins_Images.h
+t cpExtensions/Algorithms/BezierCurveFunction
t cpExtensions/DataStructures/PolyLineParametricPath
t itkPath
t itkParametricPath
** == Instances ==
** ===============
+c cpExtensions::Algorithms::BezierCurveFunction< itk::Vector< #reals#, #process?_dims# > >
c itk::Path< double, itk::ContinuousIndex< double, #process_dims# >, #process_dims# >
c itk::ParametricPath< #process_dims# >
c itk::PolyLineParametricPath< #process_dims# >
#include <cpBaseQtApplication/Port.h>\r
#include <cpBaseQtApplication/Connection.h>\r
#include <cpBaseQtApplication/Editor.h>\r
+#include <cpPlugins/BaseObjects/Widget.h>\r
\r
// -------------------------------------------------------------------------\r
cpBaseQtApplication::Block::\r
QMenu menu;\r
QAction* configureAction = menu.addAction( "Configure" );\r
QAction* updateAction = menu.addAction( "Update" );\r
- QAction* selectedAction = menu.exec( evt->screenPos( ) );\r
+ auto widget =\r
+ dynamic_cast< cpPlugins::BaseObjects::Widget* >(\r
+ this->m_Filter.GetPointer( )\r
+ );\r
+ QAction* enableAction = NULL;\r
+ if( widget != NULL )\r
+ enableAction =\r
+ menu.addAction( ( widget->GetEnabled( ) )? "Disable": "Enable" );\r
\r
+ QAction* selectedAction = menu.exec( evt->screenPos( ) );\r
if( selectedAction == configureAction )\r
{\r
auto dlg = this->m_Filter->CreateQDialog( );\r
if( dlg != NULL )\r
dlg->exec( );\r
}\r
+ else if( selectedAction == enableAction )\r
+ {\r
+ if( widget != NULL )\r
+ widget->SetEnabled( !( widget->GetEnabled( ) ) );\r
+ }\r
else if( selectedAction == updateAction )\r
this->m_Editor->updateFilter( this->namePort( ).toStdString( ) );\r
}\r
#include <itkPolyLineParametricPath.h>
#include <itkImageBase.h>
+#include <cpExtensions/Algorithms/BezierCurveFunction.h>
namespace cpExtensions
{
typedef typename TImageBase::DirectionType TDirection;
typedef typename Superclass::ContinuousIndexType TContinuousIndex;
+ typedef typename TPoint::VectorType TVector;
+ typedef cpExtensions::Algorithms::BezierCurveFunction< TVector > TBezier;
+
public:
itkNewMacro( Self );
itkTypeMacro( PolyLineParametricPath, itk::PolyLineParametricPath );
itkSetMacro( Origin, TPoint );
public:
+ void AddVertex( const TContinuousIndex& vertex );
unsigned long GetSize( ) const;
TContinuousIndex GetVertex( unsigned long i ) const;
TPoint GetPoint( unsigned long i ) const;
+ TPoint GetSmoothPoint( double u ) const;
virtual void SetSpacing( const TSpacing& spac );
virtual void SetSpacing( const double spac[ _VDim ] );
Self& operator=( const Self& other );
protected:
+ typename TBezier::Pointer m_Bezier;
+
TSpacing m_Spacing;
TPoint m_Origin;
TDirection m_Direction;
#include <itkMath.h>
#include <itkNumericTraits.h>
+// -------------------------------------------------------------------------
+template< unsigned int _VDim >
+void cpExtensions::DataStructures::PolyLineParametricPath< _VDim >::
+AddVertex( const TContinuousIndex& vertex )
+{
+ this->Superclass::AddVertex( vertex );
+ this->m_Bezier->AddPoint(
+ this->GetPoint( this->GetSize( ) - 1 ).GetVectorFromOrigin( )
+ );
+ this->Modified( );
+}
+
// -------------------------------------------------------------------------
template< unsigned int _VDim >
unsigned long cpExtensions::DataStructures::PolyLineParametricPath< _VDim >::
return( pnt );
}
+// -------------------------------------------------------------------------
+template< unsigned int _VDim >
+typename cpExtensions::DataStructures::PolyLineParametricPath< _VDim >::
+TPoint cpExtensions::DataStructures::PolyLineParametricPath< _VDim >::
+GetSmoothPoint( double u ) const
+{
+ TPoint p;
+ p.Fill( 0 );
+ p += this->m_Bezier->Evaluate( u );
+ return( p );
+}
+
// -------------------------------------------------------------------------
template< unsigned int _VDim >
void cpExtensions::DataStructures::PolyLineParametricPath< _VDim >::
PolyLineParametricPath( )
: Superclass( )
{
+ this->m_Bezier = TBezier::New( );
+
this->m_Spacing.Fill( 1.0 );
this->m_Origin.Fill( 0.0 );
this->m_Direction.SetIdentity( );
#endif // cpExtensions_OS_Windows
// -------------------------------------------------------------------------
-#define cpExtensions_CHRONO \
- std::chrono::duration_cast< std::chrono::milliseconds >( \
- std::chrono::system_clock::now( ).time_since_epoch( ) \
+#define cpExtensions_CHRONO \
+ std::chrono::duration_cast< std::chrono::milliseconds >( \
+ std::chrono::system_clock::now( ).time_since_epoch( ) \
).count( )
// -------------------------------------------------------------------------
virtual void EnabledOff( );
virtual void Clear( ) = 0;
virtual void SetEnabled( bool v ) = 0;
+ virtual bool GetEnabled( ) const = 0;
protected:
Widget( );
{
if( fname.substr( pos ) == ext )
{
- std::regex re( lib );
-std::smatch match;
-if( std::regex_search( fname, match, re ) && match.size( ) >= 1 )
- {
- std::stringstream str;
- str
- << pth << cpPlugins_PATH_SEPARATOR << fname;
- libs.insert( str.str( ) );
- } // fi
+ std::regex re( lib );
+ std::smatch match;
+ if( std::regex_search( fname, match, re ) && match.size( ) >= 1 )
+ {
+ std::stringstream str;
+ str
+ << pth << cpPlugins_PATH_SEPARATOR << fname;
+ libs.insert( str.str( ) );
+ } // fi
} // fi
if( lib != "" )
{
if( this->m_Libraries.find( lib ) == this->m_Libraries.end( ) )
-{
- std::string error = "";
- void* hnd = cpPlugins::OS::DLLManager::Load( lib, error );
- if( hnd != NULL )
- this->m_Libraries[ lib ] = hnd;
+ {
+ std::string error = "";
+ void* hnd = cpPlugins::OS::DLLManager::Load( lib, error );
+ if( hnd != NULL )
+ this->m_Libraries[ lib ] = hnd;
-} // fi
+ } // fi
} // fi
if( !cpExtensions::IsPathSeparator( dir.back( ) ) )
fname << cpExtensions_PATH_SEPARATOR;
fname << cpPlugins_PATHS;
- std::string buffer;
- if( cpExtensions::Read( buffer, fname.str( ) ) )
- {
- std::istringstream input( buffer );
- for( std::string line; std::getline( input, line ); )
- envs << line << cpPlugins_ENV_SEPARATOR;
+ std::string buffer;
+ if( cpExtensions::Read( buffer, fname.str( ) ) )
+ {
+ std::istringstream input( buffer );
+ for( std::string line; std::getline( input, line ); )
+ envs << line << cpPlugins_ENV_SEPARATOR;
- } // fi
- if( envs.str( ).size( ) > 0 )
- this->AddEnvironments( envs.str( ) );
+ } // fi
+ if( envs.str( ).size( ) > 0 )
+ this->AddEnvironments( envs.str( ) );
}
// -------------------------------------------------------------------------
} // fi
}
+// -------------------------------------------------------------------------
+bool cpPluginsWidgets::LineWidget::
+GetEnabled( ) const
+{
+ auto wdg = this->GetVTK< const vtkLineWidget2 >( );
+ if( wdg != NULL )
+ {
+ vtkLineWidget2* w = const_cast< vtkLineWidget2* >( wdg );
+ return( w->GetEnabled( ) != 0 );
+ }
+ else
+ return( false );
+}
+
// -------------------------------------------------------------------------
cpPluginsWidgets::LineWidget::
LineWidget( )
public:
virtual void Clear( ) cpPlugins_OVERRIDE;
virtual void SetEnabled( bool v ) cpPlugins_OVERRIDE;
+ virtual bool GetEnabled( ) const cpPlugins_OVERRIDE;
protected:
typedef std::set< vtkProp* > TProps;
} // rof
}
+// -------------------------------------------------------------------------
+bool cpPluginsWidgets::SeedWidget::
+GetEnabled( ) const
+{
+ if( this->m_Widgets.size( ) > 0 )
+ {
+ auto i = this->m_Widgets.begin( );
+ TWidget* w = const_cast< TWidget* >( i->second.GetPointer( ) );
+ return( w->GetEnabled( ) != 0 );
+ }
+ else
+ return( false );
+}
+
// -------------------------------------------------------------------------
cpPluginsWidgets::SeedWidget::
SeedWidget( )
public:
virtual void Clear( ) cpPlugins_OVERRIDE;
virtual void SetEnabled( bool v ) cpPlugins_OVERRIDE;
+ virtual bool GetEnabled( ) const cpPlugins_OVERRIDE;
protected:
/**
} // fi
}
+// -------------------------------------------------------------------------
+bool cpPluginsWidgets::SplineWidget::
+GetEnabled( ) const
+{
+ auto wdg = this->GetVTK< const vtkSplineWidget >( );
+ if( wdg != NULL )
+ {
+ vtkSplineWidget* w = const_cast< vtkSplineWidget* >( wdg );
+ return( w->GetEnabled( ) != 0 );
+ }
+ else
+ return( false );
+}
+
// -------------------------------------------------------------------------
cpPluginsWidgets::SplineWidget::
SplineWidget( )
public:
virtual void Clear( ) cpPlugins_OVERRIDE;
virtual void SetEnabled( bool v ) cpPlugins_OVERRIDE;
+ virtual bool GetEnabled( ) const cpPlugins_OVERRIDE;
protected:
bool m_Configured;