auto filter = this->m_Workspace->GetFilter( filter_name );
if( filter != NULL )
{
- auto output = filter->GetOutputData< _TDataObject >( output_name );
+ auto output = filter->GetOutputData( output_name );
if( output != NULL )
{
std::string data_name = output_name + "@" + filter_name;
--- /dev/null
+#ifndef __CPEXTENSIONS__DATASTRUCTURES__VECTORVALUESCONTAINER__H__
+#define __CPEXTENSIONS__DATASTRUCTURES__VECTORVALUESCONTAINER__H__
+
+#include <vector>
+#include <itkSimpleDataObjectDecorator.h>
+#include <itkSmartPointer.h>
+
+namespace cpExtensions
+{
+ namespace DataStructures
+ {
+ /**
+ */
+ template< class T >
+ class VectorValuesContainer
+ : public itk::SimpleDataObjectDecorator< std::vector< T > >
+ {
+ public:
+ typedef std::vector< T > TDecorated;
+ typedef VectorValuesContainer Self;
+ typedef itk::SimpleDataObjectDecorator< TDecorated > Superclass;
+ typedef itk::SmartPointer< Self > Pointer;
+ typedef itk::SmartPointer< const Self > ConstPointer;
+
+ typedef T TValue;
+ typedef typename TDecorated::iterator Iterator;
+ typedef typename TDecorated::const_iterator ConstIterator;
+
+ public:
+ itkNewMacro( Self );
+ itkTypeMacro( VectorValuesContainer, itkSimpleDataObjectDecorator );
+
+ public:
+ void PushBack( const T& v )
+ { this->Get( ).push_back( v ); this->Modified( ); }
+ void PopBack( const T& v )
+ { this->Get( ).pop_back( ); this->Modified( ); }
+ Iterator Begin( )
+ { return( this->Get( ).begin( ) ); }
+ Iterator End( )
+ { return( this->Get( ).end( ) ); }
+ ConstIterator Begin( ) const
+ { return( this->Get( ).begin( ) ); }
+ ConstIterator End( ) const
+ { return( this->Get( ).end( ) ); }
+
+ protected:
+ VectorValuesContainer( )
+ : Superclass( )
+ { }
+ virtual ~VectorValuesContainer( )
+ { }
+
+ private:
+ // Purposely not implemented
+ VectorValuesContainer( const Self& other );
+ Self& operator=( const Self& other );
+ };
+
+ } // ecapseman
+
+} // ecapseman
+
+#endif // __CPEXTENSIONS__DATASTRUCTURES__VECTORVALUESCONTAINER__H__
+
+// eof - $RCSfile$
#include <cpPlugins/Interface/PointList.h>
-// -------------------------------------------------------------------------
-bool cpPlugins::Interface::PointList::
-HaveEuclideanPoints( ) const
-{
- return( this->m_HaveEuclideanPoints );
-}
-
-// -------------------------------------------------------------------------
-unsigned long cpPlugins::Interface::PointList::
-GetNumberOfPoints( ) const
-{
- return( this->m_NumberOfPoints );
-}
-
-// -------------------------------------------------------------------------
-void cpPlugins::Interface::PointList::
-Clear( )
-{
- this->m_ITKObject = NULL;
- this->m_VTKObject = NULL;
- this->m_NumberOfPoints = 0;
-}
-
// -------------------------------------------------------------------------
cpPlugins::Interface::PointList::
PointList( )
- : Superclass( ),
- m_HaveEuclideanPoints( true )
+ : Superclass( )
{
- this->Clear( );
}
// -------------------------------------------------------------------------
itkTypeMacro( PointList, DataObject );
cpPlugins_Id_Macro( PointList, DataObject );
- itkBooleanMacro( HaveEuclideanPoints );
- itkGetConstMacro( HaveEuclideanPoints, bool );
- itkSetMacro( HaveEuclideanPoints, bool );
-
- public:
- bool HaveEuclideanPoints( ) const;
- unsigned long GetNumberOfPoints( ) const;
-
- void Clear( );
-
- template< class P >
- inline void AddPoint( const P& p );
-
- template< class P >
- inline P GetPoint( const unsigned long& i ) const;
-
protected:
PointList( );
virtual ~PointList( );
// Purposely not implemented
PointList( const Self& );
Self& operator=( const Self& );
-
- protected:
- unsigned long m_NumberOfPoints;
- bool m_HaveEuclideanPoints;
};
} // ecapseman
#ifndef __CPPLUGINS__INTERFACE__POINTLIST__HXX__
#define __CPPLUGINS__INTERFACE__POINTLIST__HXX__
-#include <itkSimpleDataObjectDecorator.h>
-#include <utility>
-#include <vector>
-
-// -------------------------------------------------------------------------
-template< class P >
-void cpPlugins::Interface::PointList::
-AddPoint( const P& p )
-{
- typedef itk::SimpleDataObjectDecorator< std::vector< P > > _T;
-
- _T* container = NULL;
- if( this->m_NumberOfPoints == 0 )
- {
- typename _T::Pointer obj = _T::New( );
- container = obj.GetPointer( );
- this->m_ITKObject = container;
- }
- else
- container = dynamic_cast< _T* >( this->m_ITKObject.GetPointer( ) );
-
- if( container != NULL )
- {
- container->Get( ).push_back( p );
- this->m_NumberOfPoints += 1;
-
- } // fi
-}
-
-// -------------------------------------------------------------------------
-template< class P >
-P cpPlugins::Interface::PointList::
-GetPoint( const unsigned long& i ) const
-{
- typedef itk::SimpleDataObjectDecorator< std::vector< P > > _T;
-
- P ret;
- if( i < this->m_NumberOfPoints )
- {
- _T* container = dynamic_cast< _T* >( this->m_ITKObject.GetPointer( ) );
- if( container != NULL )
- ret = container->Get( )[ i ];
-
- } // fi
- return( ret );
-}
+// TODO: erase this file
#endif // __CPPLUGINS__INTERFACE__POINTLIST__HXX__
return( this->m_ExposedOutputPorts );
}
+// -------------------------------------------------------------------------
+cpPlugins::Interface::
+OutputProcessObjectPort& cpPlugins::Interface::Workspace::
+GetExposedOutput( const std::string& name )
+{
+ static OutputProcessObjectPort null_port;
+
+ auto i = this->m_ExposedOutputPorts.find( name );
+ if( i != this->m_ExposedOutputPorts.end( ) )
+ {
+ TFilter* filter = this->GetFilter( i->second.first );
+ if( filter != NULL )
+ return( filter->GetOutput( i->second.second ) );
+
+ } // fi
+ return( null_port );
+}
+
+// -------------------------------------------------------------------------
+const cpPlugins::Interface::
+OutputProcessObjectPort& cpPlugins::Interface::Workspace::
+GetExposedOutput( const std::string& name ) const
+{
+ static const OutputProcessObjectPort null_port;
+
+ auto i = this->m_ExposedOutputPorts.find( name );
+ if( i != this->m_ExposedOutputPorts.end( ) )
+ {
+ const TFilter* filter = this->GetFilter( i->second.first );
+ if( filter != NULL )
+ return( filter->GetOutput( i->second.second ) );
+
+ } // fi
+ return( null_port );
+}
+
// -------------------------------------------------------------------------
std::string cpPlugins::Interface::Workspace::
Execute( )
const TExposedPorts& GetExposedInputPorts( ) const;
const TExposedPorts& GetExposedOutputPorts( ) const;
- TData* GetExposedInput( const std::string& name );
- const TData* GetExposedInput( const std::string& name ) const;
- TData* GetExposedOutput( const std::string& name );
- const TData* GetExposedOutput( const std::string& name ) const;
+ OutputProcessObjectPort& GetExposedOutput( const std::string& name );
+ const OutputProcessObjectPort& GetExposedOutput( const std::string& name ) const;
// Pipeline execution
std::string Execute( );
std::string cpPlugins::BasicFilters::AppendMeshesFilter::
_GenerateData( )
{
- auto m0 = this->GetInputData< cpPlugins::Interface::Mesh >( "Input0" );
- auto m1 = this->GetInputData< cpPlugins::Interface::Mesh >( "Input1" );
+ auto m0 = this->GetInputData( "Input0" );
+ auto m1 = this->GetInputData( "Input1" );
auto filter = this->_CreateVTK< vtkAppendPolyData >( );
filter->AddInputData( m0->GetVTK< vtkPolyData >( ) );
filter->AddInputData( m1->GetVTK< vtkPolyData >( ) );
filter->Update( );
- auto out = this->GetOutputData< cpPlugins::Interface::Mesh >( "Output" );
+ auto out = this->GetOutputData( "Output" );
out->SetVTK( filter->GetOutput( ) );
return( "" );
}
std::string cpPlugins::BasicFilters::BinaryErodeImageFilter::
_GenerateData( )
{
- auto image = this->GetInputData< cpPlugins::Interface::Image >( "Input" );
+ auto image = this->GetInputData( "Input" );
itk::DataObject* itk_image = NULL;
std::string r = "";
cpPlugins_Image_Demangle_AllScalarTypes( 2, image, itk_image, r, _GD0 );
filter->Update( );
// Connect output
- auto out = this->GetOutputData< cpPlugins::Interface::Image >( "Output" );
+ auto out = this->GetOutputData( "Output" );
out->SetITK( filter->GetOutput( ) );
return( "" );
}
std::string cpPlugins::BasicFilters::BinaryThresholdImageFilter::
_GenerateData( )
{
- auto image = this->GetInputData< cpPlugins::Interface::Image >( "Input" );
+ auto image = this->GetInputData( "Input" );
itk::DataObject* itk_image = NULL;
std::string r = "";
cpPlugins_Image_Demangle_AllScalarTypes( 2, image, itk_image, r, _GD0 );
filter->Update( );
// Connect output
- auto out = this->GetOutputData< cpPlugins::Interface::Image >( "Output" );
+ auto out = this->GetOutputData( "Output" );
out->SetITK( filter->GetOutput( ) );
return( "" );
}
_GenerateData( )
{
// Get inputs
- auto mesh = this->GetInputData< cpPlugins::Interface::Mesh >( "InputMesh" );
- auto function =
- this->GetInputData< cpPlugins::Interface::ImplicitFunction >(
- "InputFunction"
- );
+ auto mesh = this->GetInputData( "InputMesh" );
+ auto function = this->GetInputData( "InputFunction" );
vtkCutter* cutter = this->_CreateVTK< vtkCutter >( );
cutter->DebugOn( );
cutter->SetInputData( mesh->GetVTK< vtkPolyData >( ) );
cutter->Update( );
// Execute filter
- auto out = this->GetOutputData< cpPlugins::Interface::Mesh >( "Output" );
+ auto out = this->GetOutputData( "Output" );
out->SetVTK( cutter->GetOutput( ) );
return( "" );
std::string cpPlugins::BasicFilters::ExtractSliceImageFilter::
_GenerateData( )
{
- auto image = this->GetInputData< cpPlugins::Interface::Image >( "Input" );
+ auto image = this->GetInputData( "Input" );
itk::DataObject* itk_image = NULL;
std::string r = "";
/*
filter->Update( );
// Connect output
- auto out = this->GetOutputData< cpPlugins::Interface::Image >( "Output" );
+ auto out = this->GetOutputData( "Output" );
out->SetITK( filter->GetOutput( ) );
return( "" );
}
std::string cpPlugins::BasicFilters::ImageInterpolatorSource::
_GenerateData( )
{
- auto image =
- this->GetInputData< cpPlugins::Interface::Image >( "ReferenceImage" );
+ auto image = this->GetInputData( "ReferenceImage" );
itk::DataObject* itk_image = NULL;
std::string r = "";
cpPlugins_Image_Demangle_AllScalarTypes( 2, image, itk_image, r, _GD0 );
std::string cpPlugins::BasicFilters::ImageInterpolatorSource::
_GD1( )
{
- auto out =
- this->GetOutputData< cpPlugins::Interface::DataObject >( "Output" );
+ auto out = this->GetOutputData( "Output" );
if( out->GetITK< T >( ) == NULL )
{
typename T::Pointer res = T::New( );
// Get bounding box
double bbox[ 6 ];
- auto image = this->GetInputData< cpPlugins::Interface::Image >( "Input" );
+ auto image = this->GetInputData( "Input" );
bool input_found = false;
if( image != NULL )
{
input_found = true;
} // fi
- auto mesh = this->GetInputData< cpPlugins::Interface::Mesh >( "Input" );
+ auto mesh = this->GetInputData( "Input" );
if( mesh != NULL )
{
mesh->GetVTK< vtkPolyData >( )->GetBounds( bbox );
std::string cpPlugins::BasicFilters::MacheteFilter::
_GenerateData( )
{
- auto image = this->GetInputData< cpPlugins::Interface::Image >( "Input" );
+ auto image = this->GetInputData( "Input" );
if( image != NULL )
return( this->_FromImage( image ) );
- auto mesh = this->GetInputData< cpPlugins::Interface::Mesh >( "Input" );
+ auto mesh = this->GetInputData( "Input" );
if( mesh == NULL )
return( this->_FromMesh( mesh ) );
return( "MacheteFilter: No valid input." );
// -------------------------------------------------------------------------
std::string cpPlugins::BasicFilters::MacheteFilter::
-_FromImage( cpPlugins::Interface::Image* image )
+_FromImage( cpPlugins::Interface::DataObject* image )
{
itk::DataObject* itk_image = NULL;
std::string r = "";
// -------------------------------------------------------------------------
std::string cpPlugins::BasicFilters::MacheteFilter::
-_FromMesh( cpPlugins::Interface::Mesh* mesh )
+_FromMesh( cpPlugins::Interface::DataObject* mesh )
{
return( "" );
}
filter->Update( );
// Connect outputs (and correct their types and names)
- _TImage* pos_out = this->GetOutputData< _TImage >( "PositiveOutput" );
+ _TObj* pos_out = this->GetOutputData( "PositiveOutput" );
if( pos_out == NULL )
{
this->_AddOutput< _TImage >( "PositiveOutput" );
- pos_out = this->GetOutputData< _TImage >( "PositiveOutput" );
+ pos_out = this->GetOutputData( "PositiveOutput" );
} // fi
- _TImage* neg_out = this->GetOutputData< _TImage >( "NegativeOutput" );
+ _TObj* neg_out = this->GetOutputData( "NegativeOutput" );
if( neg_out == NULL )
{
this->_AddOutput< _TImage >( "NegativeOutput" );
- neg_out = this->GetOutputData< _TImage >( "NegativeOutput" );
+ neg_out = this->GetOutputData( "NegativeOutput" );
} // fi
virtual std::string _GenerateData( );
- std::string _FromImage( cpPlugins::Interface::Image* image );
- std::string _FromMesh( cpPlugins::Interface::Mesh* mesh );
+ std::string _FromImage( cpPlugins::Interface::DataObject* image );
+ std::string _FromMesh( cpPlugins::Interface::DataObject* mesh );
template< class I >
inline std::string _RealImage( itk::DataObject* dobj );
std::string cpPlugins::BasicFilters::MacheteImageFilter::
_GenerateData()
{
- auto image = this->GetInputData< cpPlugins::Interface::Image >("Input");
+ auto image = this->GetInputData("Input");
itk::DataObject* itk_image = NULL;
std::string r = "";
cpPlugins_Image_Demangle_AllScalarTypes(2, image, itk_image, r, _GD0);
filter->Update();
// Connect output
- auto out = this->GetOutputData< cpPlugins::Interface::Image >("Output");
+ auto out = this->GetOutputData("Output");
out->SetITK( filter->GetOutput( ) );
return("");
}
_GenerateData( )
{
// Get input
- auto image = this->GetInputData< cpPlugins::Interface::Image >( "Input" );
+ auto image = this->GetInputData( "Input" );
vtkImageData* vtk_image = image->GetVTK< vtkImageData >( );
if( vtk_image == NULL )
return( "MarchingCubes: Input does not have a valid VTK conversion." );
return( "MarchingCubes: Input data does not have a valid dimension." );
// Execute filter
- auto out = this->GetOutputData< cpPlugins::Interface::Mesh >( "Output" );
+ auto out = this->GetOutputData( "Output" );
out->SetVTK( pd );
return( "" );
}
std::string cpPlugins::BasicFilters::MedianImageFilter::
_GenerateData( )
{
- auto image = this->GetInputData< cpPlugins::Interface::Image >( "Input" );
+ auto image = this->GetInputData( "Input" );
itk::DataObject* itk_image = NULL;
std::string r = "";
cpPlugins_Image_Demangle_AllScalarTypes( 2, image, itk_image, r, _GD0 );
filter->Update( );
// Connect output
- auto out = this->GetOutputData< cpPlugins::Interface::Image >( "Output" );
+ auto out = this->GetOutputData( "Output" );
out->SetITK( filter->GetOutput( ) );
return( "" );
}
std::string cpPlugins::BasicFilters::MultiplyImageFilter::
_GenerateData( )
{
- auto image = this->GetInputData< cpPlugins::Interface::Image >( "Input0" );
+ auto image = this->GetInputData( "Input0" );
itk::DataObject* itk_image = NULL;
std::string r = "";
cpPlugins_Image_Demangle_AllScalarTypes( 2, image, itk_image, r, _GD0 );
filter->Update( );
// Connect output
- auto out = this->GetOutputData< cpPlugins::Interface::Image >( "Output" );
+ auto out = this->GetOutputData( "Output" );
out->SetITK( filter->GetOutput( ) );
return( "" );
}
std::string cpPlugins::BasicFilters::OtsuThresholdImageFilter::
_GenerateData( )
{
- auto image = this->GetInputData< cpPlugins::Interface::Image >( "Input" );
+ auto image = this->GetInputData( "Input" );
itk::DataObject* itk_image = NULL;
std::string r = "";
cpPlugins_Image_Demangle_AllScalarTypes( 2, image, itk_image, r, _GD0 );
filter->Update( );
// Connect output
- auto out = this->GetOutputData< cpPlugins::Interface::Image >( "Output" );
+ auto out = this->GetOutputData( "Output" );
out->SetITK( filter->GetOutput( ) );
return( "" );
}
std::string cpPlugins::BasicFilters::RGBImageToOtherChannelsFilter::
_GenerateData( )
{
- auto image = this->GetInputData< cpPlugins::Interface::Image >( "Input" );
+ auto image = this->GetInputData( "Input" );
itk::DataObject* itk_image = NULL;
std::string r = "";
cpPlugins_Image_Demangle_AllRGBTypes( 2, image, itk_image, r, _GD0 );
filter->Update( );
// Connect output
- auto out = this->GetOutputData< cpPlugins::Interface::Image >( "Output" );
+ auto out = this->GetOutputData( "Output" );
out->SetITK( filter->GetOutput( ) );
return( "" );
}
std::string cpPlugins::BasicFilters::SignedMaurerDistanceMapImageFilter::
_GenerateData( )
{
- auto image = this->GetInputData< cpPlugins::Interface::Image >( "Input" );
+ auto image = this->GetInputData( "Input" );
itk::DataObject* itk_image = NULL;
std::string r = "";
cpPlugins_Image_Demangle_AllScalarTypes( 2, image, itk_image, r, _GD0 );
filter->Update( );
// Connect output
- auto out = this->GetOutputData< cpPlugins::Interface::Image >( "Output" );
+ auto out = this->GetOutputData( "Output" );
out->SetITK( filter->GetOutput( ) );
return( "" );
}
src->Update( );
// Execute filter
- auto out = this->GetOutputData< cpPlugins::Interface::Mesh >( "Output" );
+ auto out = this->GetOutputData( "Output" );
out->SetVTK( src->GetOutput( ) );
return( "" );
}
typedef itk::Mesh< float, 3 > _3F;
typedef itk::Mesh< double, 3 > _3D;
- auto input = this->GetInputData< cpPlugins::Interface::Mesh >( "Input" );
+ auto input = this->GetInputData( "Input" );
auto in_3f = input->GetITK< _3F >( );
auto in_3d = input->GetITK< _3D >( );
if ( in_3f != NULL ) return( this->_GD0( in_3f ) );
filter->Update( );
// Connect output
- auto out = this->GetOutputData< cpPlugins::Interface::Image >( "Output" );
+ auto out = this->GetOutputData( "Output" );
out->SetITK( filter->GetOutput( ) );
return( "" );
}
std::string cpPlugins::IO::ImageReader::
_RealGD( const TStringList& names )
{
- auto out = this->GetOutputData< cpPlugins::Interface::Image >( "Output" );
+ auto out = this->GetOutputData( "Output" );
std::string r = "";
if( names.size( ) == 1 )
{
std::string cpPlugins::IO::ImageWriter::
_GD0_Image( )
{
- auto image = this->GetInputData< cpPlugins::Interface::Image >( "Input" );
+ auto image = this->GetInputData( "Input" );
itk::DataObject* itk_image = NULL;
std::string r = "";
cpPlugins_Image_Demangle_AllTypes( D, image, itk_image, r, _RealGD );
std::string cpPlugins::IO::ImageWriter::
_GD0_VectorImage( )
{
- auto image = this->GetInputData< cpPlugins::Interface::Image >( "Input" );
+ auto image = this->GetInputData( "Input" );
itk::DataObject* itk_image = NULL;
std::string r = "";
cpPlugins_VectorImage_Demangle_AllTypes( D, image, itk_image, r, _RealGD );
stlr->SetFileName( fname.c_str( ) );
stlr->Update( );
- auto out = this->GetOutputData< cpPlugins::Interface::Mesh >( "Output" );
+ auto out = this->GetOutputData( "Output" );
out->SetVTK( stlr->GetOutput( ) );
return( "" );
}
pdr->SetFileName( fname.c_str( ) );
pdr->Update( );
- auto out = this->GetOutputData< cpPlugins::Interface::Mesh >( "Output" );
+ auto out = this->GetOutputData( "Output" );
out->SetVTK( pdr->GetOutput( ) );
return( "" );
}
std::string cpPlugins::IO::MeshWriter::
_GenerateData( )
{
- auto mesh = this->GetInputData< cpPlugins::Interface::Mesh >( "Input" );
+ auto mesh = this->GetInputData( "Input" );
vtkPolyData* i = mesh->GetVTK< vtkPolyData >( );
if( i == NULL )
return( "MeshWriter: No suitable input." );
#include <cpPlugins/Interface/PointList.h>
#include <cpPlugins/Interface/SimpleMPRWidget.h>
#include <cpExtensions/Interaction/ImageInteractorStyle.h>
+#include <cpExtensions/DataStructures/VectorValuesContainer.h>
#include <vtkRenderWindowInteractor.h>
typedef itk::ImageBase< 2 > _2DImage;
typedef itk::ImageBase< 3 > _3DImage;
- auto image =
- this->GetInputData< cpPlugins::Interface::Image >( "ReferenceImage" );
+ auto image = this->GetInputData( "ReferenceImage" );
itk::DataObject* itk_image = image->GetITK< _2DImage >( );
if( itk_image != NULL )
return( this->_GD0< _2DImage >( itk_image ) );
template< class I >
std::string cpPlugins::Widgets::SeedWidget::
_GD0( itk::DataObject* image )
+{
+ if( this->m_Parameters->GetBool( "SeedsAreInRealSpace" ) )
+ return( this->_GD1_Points< I >( dynamic_cast< I* >( image ) ) );
+ else
+ return( this->_GD1_Vertices< I >( dynamic_cast< I* >( image ) ) );
+}
+
+// -------------------------------------------------------------------------
+template< class I >
+std::string cpPlugins::Widgets::SeedWidget::
+_GD1_Points( I* image )
{
typedef cpExtensions::Interaction::ImageInteractorStyle _S;
+ typedef itk::Point< double, I::ImageDimension > _P;
+ typedef cpExtensions::DataStructures::VectorValuesContainer< _P > _Container;
+
+ auto container = this->_CreateITK< _Container >( );
- I* base_image = dynamic_cast< I* >( image );
- auto out =
- this->GetOutputData< cpPlugins::Interface::PointList >( "Output" );
double aux_pnt[ 3 ];
unsigned int dim = ( I::ImageDimension < 3 )? I::ImageDimension: 3;
- bool real_space = this->m_Parameters->GetBool( "SeedsAreInRealSpace" );
- // Prepare output
- out->Clear( );
- out->SetHaveEuclideanPoints( real_space );
+ container->Get( ).clear( );
// MPR
if( this->m_MPRViewer != NULL )
for( unsigned int i = 0; i < s->GetNumberOfSeeds( ); ++i )
{
s->GetSeedAsPoint( i, aux_pnt );
- typename I::PointType seed;
+ _P seed;
for( unsigned int d = 0; d < dim; ++d )
seed[ d ] = aux_pnt[ d ];
-
- if( !real_space )
- {
- typename I::IndexType index;
- if( base_image->TransformPhysicalPointToIndex( seed, index ) )
- out->AddPoint( index );
- }
- else
- out->AddPoint( seed );
+ container->PushBack( seed );
} // rof
}
for( unsigned int i = 0; i < s->GetNumberOfSeeds( ); ++i )
{
s->GetSeedAsPoint( i, aux_pnt );
- typename I::PointType seed;
+ _P seed;
for( unsigned int d = 0; d < dim; ++d )
seed[ d ] = aux_pnt[ d ];
- if( !real_space )
+ container->PushBack( seed );
+
+ } // rof
+ }
+ else
+ s->SeedWidgetOn( );
+
+ } // fi
+ this->m_Configured = true;
+
+ auto out = this->GetOutputData( "Output" );
+ out->SetITK( container );
+ return( "" );
+}
+
+// -------------------------------------------------------------------------
+template< class I >
+std::string cpPlugins::Widgets::SeedWidget::
+_GD1_Vertices( I* image )
+{
+ typedef cpExtensions::Interaction::ImageInteractorStyle _S;
+ typedef cpExtensions::DataStructures::VectorValuesContainer< typename I::IndexType > _Container;
+
+ auto container = this->_CreateITK< _Container >( );
+
+ double aux_pnt[ 3 ];
+ unsigned int dim = ( I::ImageDimension < 3 )? I::ImageDimension: 3;
+
+ container->Get( ).clear( );
+
+ // MPR
+ if( this->m_MPRViewer != NULL )
+ {
+ for( unsigned int i = 0; i < 4; ++i )
+ {
+ _S* s =
+ dynamic_cast< _S* >(
+ this->m_MPRViewer->GetInteractor( i )->GetInteractorStyle( )
+ );
+ if( s != NULL )
+ {
+ if( this->m_Configured )
{
- typename I::IndexType index;
- if( base_image->TransformPhysicalPointToIndex( seed, index ) )
- out->AddPoint( index );
+ for( unsigned int i = 0; i < s->GetNumberOfSeeds( ); ++i )
+ {
+ s->GetSeedAsPoint( i, aux_pnt );
+ typename I::PointType seed;
+ for( unsigned int d = 0; d < dim; ++d )
+ seed[ d ] = aux_pnt[ d ];
+ typename I::IndexType idx;
+ if( image->TransformPhysicalPointToIndex( seed, idx ) )
+ container->PushBack( idx );
+
+ } // rof
}
else
- out->AddPoint( seed );
+ s->SeedWidgetOn( );
+
+ } // fi
+
+ } // rof
+
+ } // fi
+
+ // Single interactor
+ _S* s = dynamic_cast< _S* >( this->m_SingleInteractor );
+ if( s != NULL )
+ {
+ if( this->m_Configured )
+ {
+ for( unsigned int i = 0; i < s->GetNumberOfSeeds( ); ++i )
+ {
+ s->GetSeedAsPoint( i, aux_pnt );
+ typename I::PointType seed;
+ for( unsigned int d = 0; d < dim; ++d )
+ seed[ d ] = aux_pnt[ d ];
+ typename I::IndexType idx;
+ if( image->TransformPhysicalPointToIndex( seed, idx ) )
+ container->PushBack( idx );
} // rof
}
} // fi
this->m_Configured = true;
+
+ auto out = this->GetOutputData( "Output" );
+ out->SetITK( container );
return( "" );
}
template< class I >
inline std::string _GD0( itk::DataObject* image );
+ template< class I >
+ inline std::string _GD1_Points( I* image );
+
+ template< class I >
+ inline std::string _GD1_Vertices( I* image );
+
private:
// Purposely not implemented
SeedWidget( const Self& );