SUBDIRS(
bash
+ plugins
examples
PipelineEditor
)
${PROJECT_BINARY_DIR}/lib
)
CompileAppFromDir(PipelineEditor ${CMAKE_CURRENT_SOURCE_DIR})
- TARGET_LINK_LIBRARIES(
- PipelineEditor
- cpBaseQtApplication
- )
+ IF(BUILD_PipelineEditor)
+ TARGET_LINK_LIBRARIES(
+ PipelineEditor
+ cpBaseQtApplication
+ )
+ ENDIF(BUILD_PipelineEditor)
ENDIF(Qt4_FOUND)
## eof - $RCSfile$
--- /dev/null
+INCLUDE_DIRECTORIES(
+ ${PROJECT_SOURCE_DIR}/lib
+ ${PROJECT_BINARY_DIR}/lib
+ )
+SET(
+ _plugins_APPS
+ ExecutePipeline
+ )
+FOREACH(_app ${_plugins_APPS})
+ ADD_EXECUTABLE(cpPlugins_plugins_${_app} ${_app})
+ TARGET_LINK_LIBRARIES(cpPlugins_plugins_${_app} cpPlugins)
+ SET(
+ cpPlugins_plugins_${_app}_APP cpPlugins_plugins_${_app}
+ CACHE INTERNAL "bash program cpPlugins_plugins_${_app}"
+ )
+ENDFOREACH(_app)
+
+
+## eof - $RCSfile$
--- /dev/null
+#include <iostream>
+#include <cpPlugins/Interface/Plugins.h>
+#include <cpPlugins/Interface/Workspace.h>
+
+int main( int argc, char* argv[] )
+{
+ // Manage inputs
+ if( argc < 2 )
+ {
+ std::cerr
+ << "Usage: " << argv[ 0 ]
+ << " workspace [parameters]" << std::endl;
+ return( 1 );
+
+ } // fi
+
+ // Create interface and load library
+ cpPlugins::Interface::Plugins::Pointer interface =
+ cpPlugins::Interface::Plugins::New( );
+ try
+ {
+ interface->AddEnvironments( "." );
+ interface->LoadPaths( "." );
+ interface->LoadEnvironments( );
+ interface->GuessPlugins( );
+ }
+ catch( std::exception& err )
+ {
+ std::cerr << "Error caught: " << err.what( ) << std::endl;
+ return( 1 );
+
+ } // yrt
+
+ // Workspace
+ cpPlugins::Interface::Workspace::Pointer workspace =
+ cpPlugins::Interface::Workspace::New( );
+ try
+ {
+ workspace->Load( argv[ 1 ] );
+ }
+ catch( std::exception& err )
+ {
+ std::cerr
+ << "Error loading workspace \"" << argv[ 1 ]
+ << "\": " << err.what( ) << std::endl;
+ return( 1 );
+
+ } // yrt
+
+ // Execute filter
+ workspace->PrintExecutionOn( );
+ workspace->Execute( );
+
+ return( 0 );
+}
+
+// eof - $RCSfile$
app_name
app_dir
)
-FILE(GLOB_RECURSE _files "${app_dir}/*")
-PrepareSourceFiles(_srcs _hdrs _paths ${_files} ${ARGN})
-INCLUDE_DIRECTORIES(
- ${_paths}
- ${CMAKE_CURRENT_SOURCE_DIR}
- ${CMAKE_CURRENT_BINARY_DIR}
- )
-IF(_srcs)
- SET(_app_os_target)
- IF(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
- SET(_app_os_target WIN32)
- ELSEIF(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
- SET(_app_os_target MACOSX_BUNDLE)
- ENDIF(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
- ADD_EXECUTABLE(${app_name} ${_app_os_target} ${_srcs} ${_hdrs})
-ENDIF(_srcs)
+OPTION(BUILD_${app_name} "Build ${app_name}" OFF)
+IF(BUILD_${app_name})
+ FILE(GLOB_RECURSE _files "${app_dir}/*")
+ PrepareSourceFiles(_srcs _hdrs _paths ${_files} ${ARGN})
+ INCLUDE_DIRECTORIES(
+ ${_paths}
+ ${CMAKE_CURRENT_SOURCE_DIR}
+ ${CMAKE_CURRENT_BINARY_DIR}
+ )
+ IF(_srcs)
+ SET(_app_os_target)
+ IF(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
+ SET(_app_os_target WIN32)
+ ELSEIF(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
+ SET(_app_os_target MACOSX_BUNDLE)
+ ENDIF(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
+ ADD_EXECUTABLE(${app_name} ${_app_os_target} ${_srcs} ${_hdrs})
+ ENDIF(_srcs)
+ENDIF(BUILD_${app_name})
ENDFUNCTION()
## eof - $RCSfile$
void cpExtensions::Algorithms::PolyLineParametricPathToSimple3DCurve< _TPolyLine, _TCurve >::
SetInput( _TPolyLine* pl )
{
- this->Superclass::SetInput( 0, pl );
+ this->Superclass::SetNthInput( 0, pl );
}
// -------------------------------------------------------------------------
this->SetNumberOfRequiredInputs( 1 );
this->SetNumberOfRequiredOutputs( 1 );
typename _TCurve::Pointer curve = _TCurve::New( );
- this->Superclass::SetOutput( 0, curve );
+ this->Superclass::SetNthOutput( 0, curve );
}
// -------------------------------------------------------------------------
return;
// Add path
+ this->SetVertex( a, a );
+ this->SetVertex( b, b );
this->AddEdge( a, b, path );
this->AddEdge( b, a, path );
// TODO: this->Modified( );
{
if( i->second.first == OpenFileNameList )
{
- auto pos = name.find_last_of( "/\\" );
+ auto pos = v.find_last_of( "/\\" );
if( i->second.second == "" )
- i->second.second = name.substr( 0, pos );
+ i->second.second = v.substr( 0, pos );
i->second.second += std::string( "#" );
- i->second.second += name.substr( pos + 1 );
+ i->second.second += v.substr( pos + 1 );
this->Modified( );
} // fi
{
if( i->second.first == SaveFileNameList )
{
- auto pos = name.find_last_of( "/\\" );
+ auto pos = v.find_last_of( "/\\" );
if( i->second.second == "" )
- i->second.second = name.substr( 0, pos );
+ i->second.second = v.substr( 0, pos );
i->second.second += std::string( "#" );
- i->second.second += name.substr( pos + 1 );
+ i->second.second += v.substr( pos + 1 );
this->Modified( );
} // fi
IntPixels_AllDims itk::Image< #all_ints#, #process_dims# >
IntPixels_VisualDims itk::Image< #all_ints#, #process_dims# >
+RealPixels_AllDims itk::Image< #real_types#, #process_dims# >
+RealPixels_VisualDims itk::Image< #real_types#, #process_dims# >
ScalarPixels_AllDims itk::Image< #scalar_pixels#, #process_dims# >
ScalarPixels_VisualDims itk::Image< #scalar_pixels#, #visual_dims# >
ColorPixels_AllDims itk::Image< itk::#color_pixels#< #scalar_pixels# >, #process_dims# >
#include <cpPlugins/DataObjects/PolyLineParametricPath.h>
#include <cpExtensions/Visualization/PolyLineParametricPathToPolyData.h>
+#include <cpPlugins/DataObjects/PolyLineParametricPath_Demanglers.h>
+#include <cpExtensions/DataStructures/PolyLineParametricPath.h>
// -------------------------------------------------------------------------
void cpPlugins::DataObjects::PolyLineParametricPath::
SetITK( itk::LightObject* o )
{
- /* TODO
- typedef cpExtensions::DataStructures::PolyLineParametricPath< 1 > _T1;
- typedef cpExtensions::DataStructures::PolyLineParametricPath< 2 > _T2;
- typedef cpExtensions::DataStructures::PolyLineParametricPath< 3 > _T3;
- typedef cpExtensions::DataStructures::PolyLineParametricPath< 4 > _T4;
-
- this->Superclass::SetITK( o );
- auto l1 = dynamic_cast< _T1* >( o );
- auto l2 = dynamic_cast< _T2* >( o );
- auto l3 = dynamic_cast< _T3* >( o );
- auto l4 = dynamic_cast< _T4* >( o );
- if ( l1 != NULL ) this->_ITK_2_VTK( l1 );
- else if( l2 != NULL ) this->_ITK_2_VTK( l2 );
- else if( l3 != NULL ) this->_ITK_2_VTK( l3 );
- else if( l4 != NULL ) this->_ITK_2_VTK( l4 );
- else
- {
- this->m_VTK = NULL;
- this->m_ITKvVTK = NULL;
-
- } // fi
- */
+ this->Superclass::SetITK( o );
+ cpPlugins_Demangle_PolyLineParametricPath_All_1( o, _ITK_2_VTK )
+ {
+ this->m_VTK = NULL;
+ this->m_ITKvVTK = NULL;
+ }
}
// -------------------------------------------------------------------------
--- /dev/null
+All cpExtensions::DataStructures::PolyLineParametricPath< #process_dims# >
+
+** eof - $RCSfile$
#include <cpPlugins/DataObjects/Skeleton.h>
#include <cpExtensions/Visualization/SkeletonToPolyData.h>
+#include <cpPlugins/DataObjects/Skeleton_Demanglers.h>
+#include <cpExtensions/DataStructures/Skeleton.h>
// -------------------------------------------------------------------------
void cpPlugins::DataObjects::Skeleton::
SetITK( itk::LightObject* o )
{
- /* TODO
- typedef cpExtensions::DataStructures::Skeleton< 1 > _T1;
- typedef cpExtensions::DataStructures::Skeleton< 2 > _T2;
- typedef cpExtensions::DataStructures::Skeleton< 3 > _T3;
- typedef cpExtensions::DataStructures::Skeleton< 4 > _T4;
-
- this->Superclass::SetITK( o );
- auto l1 = dynamic_cast< _T1* >( o );
- auto l2 = dynamic_cast< _T2* >( o );
- auto l3 = dynamic_cast< _T3* >( o );
- auto l4 = dynamic_cast< _T4* >( o );
- if ( l1 != NULL ) this->_ITK_2_VTK( l1 );
- else if( l2 != NULL ) this->_ITK_2_VTK( l2 );
- else if( l3 != NULL ) this->_ITK_2_VTK( l3 );
- else if( l4 != NULL ) this->_ITK_2_VTK( l4 );
- else
- {
- this->m_VTK = NULL;
- this->m_ITKvVTK = NULL;
-
- } // fi
- */
+ cpPlugins_Demangle_Skeleton_All_1( o, _ITK_2_VTK )
+ {
+ this->m_VTK = NULL;
+ this->m_ITKvVTK = NULL;
+ }
}
// -------------------------------------------------------------------------
--- /dev/null
+All cpExtensions::DataStructures::Skeleton< #process_dims# >
+
+** eof - $RCSfile$
--- /dev/null
+#include <IO/ImageJSkeletonWriter.h>
+#include <cpPlugins/DataObjects/Skeleton.h>
+#include <cpPlugins/DataObjects/Skeleton_Demanglers.h>
+#include <cpPlugins/QT/SaveFileDialog.h>
+
+#include <cpExtensions/DataStructures/Skeleton.h>
+#include <cpExtensions/Utility.h>
+
+#ifdef cpPlugins_QT4
+# include <QApplication>
+#endif // cpPlugins_QT4
+
+// -------------------------------------------------------------------------
+QDialog* cpPluginsIO::ImageJSkeletonWriter::
+CreateQDialog( )
+{
+#ifdef cpPlugins_QT4
+ cpPlugins::QT::SaveFileDialog* dlg = NULL;
+ if( QApplication::instance( ) != NULL )
+ {
+ dlg = new cpPlugins::QT::SaveFileDialog( );
+ dlg->SetParameters( &( this->m_Parameters ), "FileName" );
+
+ } // fi
+ return( dlg );
+#else // cpPlugins_QT4
+ return( NULL );
+#endif // cpPlugins_QT4
+}
+
+// -------------------------------------------------------------------------
+cpPluginsIO::ImageJSkeletonWriter::
+ImageJSkeletonWriter( )
+ : Superclass( )
+{
+ this->_ConfigureInput< cpPlugins::DataObjects::Skeleton >( "Input", true, false );
+ this->m_Parameters.ConfigureAsSaveFileName( "FileName", "" );
+ this->m_Parameters.SetAcceptedFileExtensions(
+ "FileName",
+ "ImageJ files (*.txt)"
+ );
+}
+
+// -------------------------------------------------------------------------
+cpPluginsIO::ImageJSkeletonWriter::
+~ImageJSkeletonWriter( )
+{
+}
+
+// -------------------------------------------------------------------------
+void cpPluginsIO::ImageJSkeletonWriter::
+_GenerateData( )
+{
+ auto o = this->GetInputData( "Input" );
+ cpPlugins_Demangle_Skeleton_All_1( o, _GD0 )
+ this->_Error( "Invalid input skeleton type." );
+}
+
+// -------------------------------------------------------------------------
+template< class _TSkeleton >
+void cpPluginsIO::ImageJSkeletonWriter::
+_GD0( _TSkeleton* skeleton )
+{
+ std::stringstream data;
+ unsigned long id = 1;
+
+ auto mIt = skeleton->BeginEdgesRows( );
+ for( ; mIt != skeleton->EndEdgesRows( ); ++mIt )
+ {
+ /* TODO
+ mIt->first; --> this is the row index. <--
+ */
+ auto rIt = mIt->second.begin( );
+ for( ; rIt != mIt->second.end( ); ++rIt )
+ {
+ /* TODO
+ rIt->first; --> this is the column index.
+ */
+ auto eIt = rIt->second.begin( );
+ for( ; eIt != rIt->second.end( ); ++eIt )
+ {
+ auto path = *eIt;
+ auto p0 = path->GetSmoothPoint( 0 );
+ auto p1 = path->GetSmoothPoint( 1 );
+ double length = p1.EuclideanDistanceTo( p0 );
+ data
+ << id << "\t1\t" << length << "\t"
+ << p0[ 0 ] << "\t" << p0[ 1 ] << "\t"<< p0[ 2 ] << "\t"
+ << p1[ 0 ] << "\t" << p1[ 1 ] << "\t"<< p1[ 2 ] << "\t"
+ << p1.EuclideanDistanceTo( p0 ) << std::endl;
+ id++;
+
+ } // rof
+
+ } // rof
+
+ } // rof
+
+ if(
+ !(
+ cpExtensions::Write(
+ data.str( ), this->m_Parameters.GetSaveFileName( "FileName" )
+ )
+ )
+ )
+ this->_Error( "Could not write on ImageJ file." );
+}
+
+// eof - $RCSfile$
--- /dev/null
+#ifndef __cpPluginsIO__ImageJSkeletonWriter__h__
+#define __cpPluginsIO__ImageJSkeletonWriter__h__
+
+#include <cpPluginsIO_Export.h>
+#include <cpPlugins/BaseObjects/ProcessObject.h>
+
+namespace cpPluginsIO
+{
+ /**
+ */
+ class cpPluginsIO_EXPORT ImageJSkeletonWriter
+ : public cpPlugins::BaseObjects::ProcessObject
+ {
+ cpPluginsObject( ImageJSkeletonWriter, cpPlugins::BaseObjects::ProcessObject, IO );
+
+ public:
+ virtual QDialog* CreateQDialog( ) cpPlugins_OVERRIDE;
+
+ protected:
+ template< class _TSkeleton >
+ inline void _GD0( _TSkeleton* skeleton );
+ };
+
+} // ecapseman
+
+#endif // __cpPluginsIO__ImageJSkeletonWriter__h__
+
+// eof - $RCSfile$
std::string text = this->m_Parameters.GetString( "Text" );
std::vector< std::string > tok1, tok2;
cpExtensions::Tokenize( tok1, text, "#" );
- for( auto t1 = tok1.begin( ); t1 != tok1.end( ); ++t1 )
+ if( tok1.size( ) > seeds->GetPoints( )->GetNumberOfPoints( ) )
{
- if( *t1 != "" )
+ for( auto t1 = tok1.begin( ); t1 != tok1.end( ); ++t1 )
{
- cpExtensions::Tokenize( tok2, *t1, " " );
- double x[ 3 ];
- for( unsigned int d = 0; d < 3; ++d )
+ if( *t1 != "" )
{
- if( d < tok2.size( ) )
+ cpExtensions::Tokenize( tok2, *t1, " " );
+ double x[ 3 ];
+ for( unsigned int d = 0; d < 3; ++d )
{
- std::istringstream str( tok2[ d ] );
- str >> x[ d ];
- }
- else
- x[ d ] = double( 0 );
-
- } // rof
+ if( d < tok2.size( ) )
+ {
+ std::istringstream str( tok2[ d ] );
+ str >> x[ d ];
+ }
+ else
+ x[ d ] = double( 0 );
+
+ } // rof
+
+ seeds->GetPoints( )->InsertNextPoint( x );
+ seeds->GetVerts( )->InsertNextCell( 1 );
+ seeds->GetVerts( )->InsertCellPoint(
+ seeds->GetPoints( )->GetNumberOfPoints( ) - 1
+ );
+ seeds->Modified( );
- seeds->GetPoints( )->InsertNextPoint( x );
- seeds->GetVerts( )->InsertNextCell( 1 );
- seeds->GetVerts( )->InsertCellPoint(
- seeds->GetPoints( )->GetNumberOfPoints( ) - 1
- );
- seeds->Modified( );
+ } // fi
- } // fi
+ } // rof
- } // rof
+ } // fi
}
else
{