Self::_TMouseButtonEvent::MaxDoubleClick = delay;
}
+// -------------------------------------------------------------------------
+vtkObject* cpExtensions::Interaction::BaseInteractorStyle::
+GetAssociatedObject( )
+{
+ return( this->m_AssociatedObject );
+}
+
+// -------------------------------------------------------------------------
+const vtkObject* cpExtensions::Interaction::BaseInteractorStyle::
+GetAssociatedObject( ) const
+{
+ return( this->m_AssociatedObject );
+}
+
+// -------------------------------------------------------------------------
+void cpExtensions::Interaction::BaseInteractorStyle::
+SetAssociatedObject( vtkObject* obj )
+{
+ if( this->m_AssociatedObject != obj )
+ {
+ this->m_AssociatedObject = obj;
+ this->Modified( );
+
+ } // fi
+}
+
// -------------------------------------------------------------------------
void cpExtensions::Interaction::BaseInteractorStyle::
DelegateTDxEvent( unsigned long event, void* calldata )
cpExtensions::Interaction::BaseInteractorStyle::
BaseInteractorStyle( )
: Superclass( ),
+ m_AssociatedObject( NULL ),
m_MotionFactor( double( 10 ) )
{
this->m_LeftButtonEvent.Reset( );
#include <cpPlugins/Interface/BaseApplication.h>
#include <cpPlugins/Interface/Plugins.h>
#include <cpExtensions/Interaction/ImageInteractorStyle.h>
+#include <cpExtensions/Visualization/ImageSliceActors.h>
#include <vtkRenderWindowInteractor.h>
return;
typedef cpExtensions::Interaction::ImageInteractorStyle _TImageStyle;
+ typedef cpExtensions::Visualization::ImageSliceActors _TImageActors;
- // Activate seed widgets
+ // Get seeds
+ unsigned int nTotalSeeds = 0;
auto iIt = this->m_Filter->m_Interactors.begin( );
for( ; iIt != this->m_Filter->m_Interactors.end( ); ++iIt )
{
);
if( istyle == NULL )
continue;
+
+ // Get window level
+ _TImageActors* actors =
+ dynamic_cast< _TImageActors* >( istyle->GetAssociatedObject( ) );
+ if( actors != NULL )
+ {
+ this->m_Filter->GetParameters( )->SetReal( "Window", actors->GetWindow( ) );
+ this->m_Filter->GetParameters( )->SetReal( "Level", actors->GetLevel( ) );
+
+ } // fi
+
unsigned int nSeeds = istyle->GetNumberOfSeeds( );
for( unsigned int s = 0; s < nSeeds; ++s )
{
- double seed[ 3 ];
- istyle->GetSeed( s, seed );
+ if( nTotalSeeds < 2 )
+ {
+ double seed[ 3 ];
+ istyle->GetSeed( s, seed );
+ if( nTotalSeeds == 0 )
+ this->m_Filter->GetParameters( )->SetPoint( "Seed0", 3, seed );
+ else
+ this->m_Filter->GetParameters( )->SetPoint( "Seed1", 3, seed );
+
+ } // fi
+ nTotalSeeds++;
} // rof
} // rof
- /*
- vtkPlaneWidget* wdg = this->m_Filter->m_PlaneWidget;
- if( wdg == NULL )
- return;
-
- // Get/Set plane parameters
- double center[ 3 ], normal[ 3 ];
- wdg->GetCenter( center );
- wdg->GetNormal( normal );
-
- this->m_Filter->GetParameters( )->SetPoint( "PlaneCenter", 3, center );
- this->m_Filter->GetParameters( )->SetVector( "PlaneNormal", 3, normal );
// Update filter
auto plugins = this->m_Filter->GetPlugins( );
app->UpdateActualFilter( );
} // fi
- */
}
// -------------------------------------------------------------------------
inline std::string cpPlugins::BasicFilters::DoubleFloodImageFilter::
_RealGD( itk::DataObject* image )
{
- /*
typedef typename O::PixelType _OP;
typedef cpPlugins_BasicFilters_DoubleFloodImageFilter_Function< I > _F;
typedef itk::FloodFilledImageFunctionConditionalConstIterator< I, _F > _It;
- typename I::PointType pseed;
- pseed = this->m_Parameters->GetPoint< typename I::PointType >(
- "Seed", I::ImageDimension
+ typename I::PointType pseed0, pseed1;
+ pseed0 = this->m_Parameters->GetPoint< typename I::PointType >(
+ "Seed0", I::ImageDimension
+ );
+ pseed1 = this->m_Parameters->GetPoint< typename I::PointType >(
+ "Seed1", I::ImageDimension
);
double window = this->m_Parameters->GetReal( "Window" );
double level = this->m_Parameters->GetReal( "Level" );
_OP out_val = _OP( this->m_Parameters->GetUint( "OutsideValue" ) );
const I* in = dynamic_cast< const I* >( image );
- typename I::IndexType seed;
- in->TransformPhysicalPointToIndex( pseed, seed );
+ typename I::IndexType seed0, seed1;
+ in->TransformPhysicalPointToIndex( pseed0, seed0 );
+ in->TransformPhysicalPointToIndex( pseed1, seed1 );
typename O::Pointer out = O::New( );
out->SetLargestPossibleRegion( in->GetLargestPossibleRegion( ) );
f->SetWindow( window );
f->SetLevel( level );
_It i( in, f );
- i.AddSeed( seed );
+ i.AddSeed( seed0 );
+ i.AddSeed( seed1 );
for( i.GoToBegin( ); !i.IsAtEnd( ); ++i )
out->SetPixel( i.GetIndex( ), in_val );
return( "" );
}
else
-*/
return( "DoubleFloodImageFilter: output not correctly created." );
}