X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FcpPlugins%2FPlugins%2FBasicFilters%2FDoubleFloodImageFilter.cxx;h=aeaa590d0a85ce9a2b0cd34c53a934a7be389bd5;hb=da7cadeecad8bf04551591e9cb9e86977e2cbb47;hp=af44e53e27cc6df44be5a0a376f1ac2df6fcc4cb;hpb=950ea6d252c9a5bc5be29d413497fe0ef69e6703;p=cpPlugins.git diff --git a/lib/cpPlugins/Plugins/BasicFilters/DoubleFloodImageFilter.cxx b/lib/cpPlugins/Plugins/BasicFilters/DoubleFloodImageFilter.cxx index af44e53..aeaa590 100644 --- a/lib/cpPlugins/Plugins/BasicFilters/DoubleFloodImageFilter.cxx +++ b/lib/cpPlugins/Plugins/BasicFilters/DoubleFloodImageFilter.cxx @@ -1,8 +1,7 @@ #include "DoubleFloodImageFilter.h" #include -#include -#include #include +#include #include @@ -20,6 +19,7 @@ DoubleFloodImageFilter_Dialog( : QDialog( parent, f | Qt::WindowStaysOnTopHint ), m_Filter( filter ) { +/* TODO this->m_Title = new QLabel( this ); this->m_Title->setText( "Execute simple vessel segmentation filter" ); @@ -35,28 +35,34 @@ DoubleFloodImageFilter_Dialog( QObject::connect( bb, SIGNAL( accepted( ) ), this, SLOT( accept( ) ) ); QObject::connect( bb, SIGNAL( rejected( ) ), this, SLOT( reject( ) ) ); this->m_ToolsLayout->addWidget( bb ); +*/ } // ------------------------------------------------------------------------- cpPlugins::BasicFilters::DoubleFloodImageFilter_Dialog:: ~DoubleFloodImageFilter_Dialog( ) { +/* delete this->m_Title; delete this->m_ToolsLayout; delete this->m_MainLayout; +*/ } // ------------------------------------------------------------------------- void cpPlugins::BasicFilters::DoubleFloodImageFilter_Dialog:: accept( ) { +/* // Get interactive widget if( this->m_Filter == NULL ) 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 ) { @@ -66,27 +72,35 @@ accept( ) ); 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->GetSeedAsPoint( 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( ); @@ -97,19 +111,20 @@ accept( ) app->UpdateActualFilter( ); } // fi - */ +*/ } // ------------------------------------------------------------------------- void cpPlugins::BasicFilters::DoubleFloodImageFilter_Dialog:: reject( ) { +/* auto plugins = this->m_Filter->GetPlugins( ); if( plugins != NULL ) plugins->DeactivateFilter( ); this->Superclass::reject( ); +*/ } - #endif // cpPlugins_Interface_QT4 // ------------------------------------------------------------------------- @@ -117,6 +132,7 @@ cpPlugins::BasicFilters::DoubleFloodImageFilter:: DialogResult cpPlugins::BasicFilters::DoubleFloodImageFilter:: ExecConfigurationDialog( QWidget* parent ) { +/* TODO #ifdef cpPlugins_Interface_QT4 typedef cpExtensions::Interaction::ImageInteractorStyle _TImageStyle; @@ -139,16 +155,18 @@ ExecConfigurationDialog( QWidget* parent ) } // rof if( !at_least_one ) - return( Self::DialogResult_Cancel ); - + return( false ); + // Create dialog this->m_Dialog = new DoubleFloodImageFilter_Dialog( NULL, this ); this->m_Dialog->show( ); - return( Self::DialogResult_Modal ); + return( true ); #else // cpPlugins_Interface_QT4 - return( Self::DialogResult_Cancel ); + return( false ); #endif // cpPlugins_Interface_QT4 +*/ + return( false ); } // ------------------------------------------------------------------------- @@ -156,16 +174,22 @@ cpPlugins::BasicFilters::DoubleFloodImageFilter:: DoubleFloodImageFilter( ) : Superclass( ) { + /* TODO this->_AddInput( "Input" ); this->_MakeOutput< cpPlugins::Interface::Image >( "Output" ); - double seed[ 3 ] = { double( 0 ) }; - this->m_Parameters->ConfigureAsPoint( "Seed0", 3, seed ); - this->m_Parameters->ConfigureAsPoint( "Seed1", 3, seed ); - this->m_Parameters->ConfigureAsReal( "Window", 0 ); - this->m_Parameters->ConfigureAsReal( "Level", 0 ); - this->m_Parameters->ConfigureAsUint( "InsideValue", 255 ); - this->m_Parameters->ConfigureAsUint( "OutsideValue", 0 ); + this->m_Parameters->ConfigureAsPoint( "Seed0" ); + this->m_Parameters->ConfigureAsPoint( "Seed1" ); + this->m_Parameters->ConfigureAsReal( "Window" ); + this->m_Parameters->ConfigureAsReal( "Level" ); + this->m_Parameters->ConfigureAsUint( "InsideValue" ); + this->m_Parameters->ConfigureAsUint( "OutsideValue" ); + + this->m_Parameters->SetReal( "Window", 0 ); + this->m_Parameters->SetReal( "Level", 0 ); + this->m_Parameters->SetUint( "InsideValue", 255 ); + this->m_Parameters->SetUint( "OutsideValue", 0 ); + */ } // ------------------------------------------------------------------------- @@ -178,6 +202,7 @@ cpPlugins::BasicFilters::DoubleFloodImageFilter:: std::string cpPlugins::BasicFilters::DoubleFloodImageFilter:: _GenerateData( ) { + /* TODO cpPlugins::Interface::Image* image = this->GetInput< cpPlugins::Interface::Image >( "Input" ); if( image == NULL ) @@ -189,6 +214,8 @@ _GenerateData( ) else cpPlugins_Image_Demangle_AllScalarTypes( 3, image, itk_image, r, _GD0 ); else r = "DoubleFloodImageFilter: Input image type not supported."; return( r ); + */ + return( "" ); } // ------------------------------------------------------------------------- @@ -196,14 +223,19 @@ template< class I > std::string cpPlugins::BasicFilters::DoubleFloodImageFilter:: _GD0( itk::DataObject* image ) { + /* TODO return( this->_RealGD< I, itk::Image< unsigned char, I::ImageDimension > >( image ) ); + */ + return( "" ); + } // ------------------------------------------------------------------------- +/* TODO template< class I, class R = float > class cpPlugins_BasicFilters_DoubleFloodImageFilter_Function : public itk::ImageFunction< I, bool, R > @@ -287,20 +319,24 @@ protected: mutable unsigned char m_StartValue; mutable bool m_Start; }; +*/ // ------------------------------------------------------------------------- template< class I, class O > inline std::string cpPlugins::BasicFilters::DoubleFloodImageFilter:: _RealGD( itk::DataObject* image ) { - /* + /* TODO 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" ); @@ -308,8 +344,9 @@ _RealGD( itk::DataObject* image ) _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( ) ); @@ -326,7 +363,8 @@ _RealGD( itk::DataObject* image ) 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 ); @@ -340,8 +378,9 @@ _RealGD( itk::DataObject* image ) return( "" ); } else -*/ return( "DoubleFloodImageFilter: output not correctly created." ); + */ + return( "" ); } // eof - $RCSfile$