#include <cpPlugins/Interface/PointList.h>
+// -------------------------------------------------------------------------
+bool cpPlugins::Interface::PointList::
+HaveEuclideanPoints( ) const
+{
+ return( this->m_HaveEuclideanPoints );
+}
+
// -------------------------------------------------------------------------
unsigned long cpPlugins::Interface::PointList::
GetNumberOfPoints( ) const
// -------------------------------------------------------------------------
cpPlugins::Interface::PointList::
PointList( )
- : Superclass( )
+ : Superclass( ),
+ m_HaveEuclideanPoints( true )
{
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( );
protected:
unsigned long m_NumberOfPoints;
+ bool m_HaveEuclideanPoints;
};
} // ecapseman
this->_AddOutput< cpPlugins::Interface::PointList >( "Output" );
this->m_Parameters->ConfigureAsBool( "SeedsAreInRealSpace" );
- this->m_Parameters->SetBool( "SeedsAreInRealSpace", true );
+ this->m_Parameters->SetBool( "SeedsAreInRealSpace", false );
}
// -------------------------------------------------------------------------
std::string cpPlugins::Widgets::SeedWidget::
_GD0( itk::DataObject* image )
{
- std::cout << "update seeds" << std::endl;
-
typedef cpExtensions::Interaction::ImageInteractorStyle _S;
I* base_image = dynamic_cast< I* >( image );
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 );
// MPR
if( this->m_MPRViewer != NULL )
typename I::PointType seed;
for( unsigned int d = 0; d < dim; ++d )
seed[ d ] = aux_pnt[ d ];
- out->AddPoint( seed );
+
+ if( !real_space )
+ {
+ typename I::IndexType index;
+ if( base_image->TransformPhysicalPointToIndex( seed, index ) )
+ out->AddPoint( index );
+ }
+ else
+ out->AddPoint( seed );
} // rof
}
typename I::PointType seed;
for( unsigned int d = 0; d < dim; ++d )
seed[ d ] = aux_pnt[ d ];
- out->AddPoint( seed );
+ if( !real_space )
+ {
+ typename I::IndexType index;
+ if( base_image->TransformPhysicalPointToIndex( seed, index ) )
+ out->AddPoint( index );
+ }
+ else
+ out->AddPoint( seed );
} // rof
}