X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FcpExtensions%2FAlgorithms%2FCPRFilter.hxx;h=4a2169ed8f9aa182dd95022e5811a13797b1499a;hb=8ebfdf11e4b5d2a5b3a0c2b4752d176888f0bb16;hp=3b19a9fe6305db89b6fd093db1774885a748826c;hpb=dea0e89b762a27b1e4088f3d03b5169ca63a227f;p=cpPlugins.git diff --git a/lib/cpExtensions/Algorithms/CPRFilter.hxx b/lib/cpExtensions/Algorithms/CPRFilter.hxx index 3b19a9f..4a2169e 100644 --- a/lib/cpExtensions/Algorithms/CPRFilter.hxx +++ b/lib/cpExtensions/Algorithms/CPRFilter.hxx @@ -7,7 +7,7 @@ #include #include -#include +#include #include // ------------------------------------------------------------------------- @@ -16,6 +16,9 @@ const typename cpExtensions::Algorithms::CPRFilter< I, S >:: TAxis* cpExtensions::Algorithms::CPRFilter< I, S >:: GetAxis( ) const { + return( + dynamic_cast< const TAxis* >( this->itk::ProcessObject::GetInput( 1 ) ) + ); } // ------------------------------------------------------------------------- @@ -23,6 +26,7 @@ template< class I, class S > void cpExtensions::Algorithms::CPRFilter< I, S >:: SetAxis( const TAxis* axis ) { + this->itk::ProcessObject::SetNthInput( 1, const_cast< TAxis* >( axis ) ); } // ------------------------------------------------------------------------- @@ -32,7 +36,7 @@ CPRFilter( ) : Superclass( ) { this->m_Interpolator = - itk::NearestNeighborInterpolateImageFunction< I, S >::New( ); + itk::LinearInterpolateImageFunction< I, S >::New( ); } // ------------------------------------------------------------------------- @@ -42,6 +46,14 @@ cpExtensions::Algorithms::CPRFilter< I, S >:: { } +// ------------------------------------------------------------------------- +template< class I, class S > +void cpExtensions::Algorithms::CPRFilter< I, S >:: +GenerateOutputInformation( ) +{ + // Do nothing since the output has different geometry and topology. +} + // ------------------------------------------------------------------------- template< class I, class S > void cpExtensions::Algorithms::CPRFilter< I, S >:: @@ -86,6 +98,7 @@ GenerateData( ) { // Get geometrical data and correct Frenet frame S u = S( i ) / S( nSlices ); + std::cout << u << std::endl; _V vnex = bezier->Evaluate( u ); _M mnex = bezier->EvaluateFrenetFrame( u ); if( i > 0 ) @@ -105,6 +118,9 @@ GenerateData( ) slicer->SpacingFromMinimumOn( ); slicer->SetDefaultValue( background ); slicer->SetInterpolator( this->m_Interpolator ); + slicer->Update( ); + + std::cout << slicer->GetOutput( )->GetLargestPossibleRegion( ).GetSize( ) << std::endl; // Add output to join filter and keep track of the current slicer this->m_Join->SetInput( i, slicer->GetOutput( ) ); @@ -118,11 +134,12 @@ GenerateData( ) // 3. Finish join filter configuration this->m_Join->SetSpacing( double( len / S( nSlices + 1 ) ) ); + std::cout << this->m_Join->GetSpacing( ) << std::endl; this->m_Join->SetOrigin( double( 0 ) ); // 4. Graft outputs this->m_Join->GraftOutput( this->GetOutput( ) ); - this->m_Join->UpdateLargestPossibleRegion( ); + this->m_Join->Update( );//LargestPossibleRegion( ); this->GraftOutput( this->m_Join->GetOutput( ) ); }