[Insight-users] How to refresh a filter? filter->Update() doesen't
refresh it!
Karthik Krishnan
Karthik.Krishnan at kitware.com
Thu Mar 16 03:52:04 EST 2006
In general there shouldn't be a reason to call Modified() in ITK
filters, the pipeline mechanics should take care of that. In your case,
you are changing the pixel values with the SetPixel( .. ) method on the
image. Unlike most other methods, image->SetPixel(.. ) will not change
the modified time of the image. (It would be very inefficient to check
every time if a pixel value is different from what it was and set an
MTime, during a SetPixel call).
So you might consider having the line m_Eigen->Modified() *before*, not
after the update method.
charfeddine amir wrote:
> Hi Kevin,
> thx for reply
> i tried the filter->Modified too but it doesen't refresh it.
> I'm using a pipeline of filter:
>
> m_Hx = GaussianFilterType::New();
> m_Hy = GaussianFilterType::New();
>
> m_Hx->SetDirection( 0 );
> m_Hy->SetDirection( 1 );
>
> m_H1x = GaussianFilterType::New();
>
> m_H1x->SetDirection( 0 );
>
> m_H1x->SetOrder( GaussianFilterType::FirstOrder );
>
> m_H1xy = GaussianFilterType::New();
> m_H1xy->SetDirection( 1 );
> m_H1xy->SetOrder( GaussianFilterType::FirstOrder );
>
> m_H2x = GaussianFilterType::New();
> m_H2y = GaussianFilterType::New();
>
> m_H2x->SetDirection( 0 );
> m_H2y->SetDirection( 1 );
>
> m_H2x->SetOrder( GaussianFilterType::SecondOrder );
> m_H2y->SetOrder( GaussianFilterType::SecondOrder );
>
> m_Hx->SetInputImage( m_DiasstoledImage );
> m_Hy->SetInputImage( m_DiasstoledImage );
>
> m_H1x->SetInputImage( m_Hy->GetOutput() );
>
> m_H2x->SetInputImage( m_Hy->GetOutput() );
> m_H2y->SetInputImage( m_Hx->GetOutput() );
>
> m_H1xy->SetInputImage( m_H1x->GetOutput() );
>
> m_Eigen = EigenFilterType::New();
> &nbs! p;
> m_Eigen->SetInput1( m_H2x->GetOutput() );
> m_Eigen->SetInput2( m_H1xy->GetOutput() );
> m_Eigen->SetInput3( m_H2y->GetOutput() );
> SetSigma();
>
> and this is where i apply the Eigen Filter (On volume):
>
> void
> MyAppBase
> ::RunGaussian()
> {
> SetSigma();
> this->ShowStatus("Application du filtre Gaussien...");
>
> for(k=0; k<m_inputimagesize[2]; k++)
> {
> pixelIndex[2]=k;
>
> for(j=0; j<m_inputimagesize[1]; j++)
> { m_diasstoledimageindex[1]=j;
> pixelIndex[1]=j;
>
> for(i=0; i<m_inputimagesize[0]; i++)
> {
> m_diasstoledimageindex[0]=i;
> pixelIndex[0]=i;
> pixelValue = m_ImageReader->GetOutput()->GetPixel(
> pixelIndex );//à partir de l'image originale
> &nb! sp; //pixelValue = m_OutputImage->GetPixel( pixelIndex
> );//à partir de l'image segmentée
>
> m_DiasstoledImage->SetPixel(m_diasstoledimageindex,pixelValue);
> }
> }
>
> m_Eigen->Update();
> m_Eigen->Modified();
> m_outputvolumeindex[2]=k;
>
> for(j=0; j<m_inputimagesize[1]; j++)
> {
> m_diasstoledimageindex[1]=j;
> m_outputvolumeindex[1]=j;
> for(i=0; i<m_inputimagesize[0]; i++)
> {
> m_diasstoledimageindex[0]=i;
> m_outputvolumeindex[0]=i;
> pixelValue = m_Eigen->GetOutput()->GetPixel(
> m_diasstoledimageindex);//à partir de l'image en diasstole filtrée
> m_FiltredVolume->SetPixel(m_outputvolumeindex,pixelValue);
>
> }
> }
>
> }
>
> this->ShowStatus("Application du filtre terminée");
> }
>
> when i visualize the volume, all slices are the same, the first slice
> isuued from the EigenFilter, so i think the Eigen Filter is not
> refreshing!
> could any one help me ?
> thx for your time,
> Regards.
>
> */"Kevin H. Hobbs" <kevin.hobbs.1 at ohiou.edu>/* a écrit :
>
> On Wed, 2006-03-15 at 18:12 +0100, charfeddine amir wrote:
>> Hi all
>> plz tell me how to refresh a filter?
>> i try the Update() method , but it refresh only ! the first time, and
>> keep the same data after,
>> thx for reply,
>> Regards.
>>
>>
> filter->Modified();
>
>
> ------------------------------------------------------------------------
> Nouveau : téléphonez moins cher avec Yahoo! Messenger ! Découvez les
> tarifs exceptionnels pour appeler la France et l'international.
> Téléchargez
> <http://us.rd.yahoo.com/messenger/mail_taglines/default/*http://fr.beta.messenger.yahoo.com>
> la version beta.
>
>------------------------------------------------------------------------
>
>_______________________________________________
>Insight-users mailing list
>Insight-users at itk.org
>http://www.itk.org/mailman/listinfo/insight-users
>
>
More information about the Insight-users
mailing list