[Insight-users] ProgressEvent and pipes ?

Maximilien Renard iixamaxii at gmail.com
Sun Aug 30 16:16:47 EDT 2009


Dear ITK Users,

I'm facing a problem. I was not able to figure out how to get the
progression of multiple filters linked together via a pipe (meaning the
input of the second filter is the output of the first :
Filter2->SetInput(Filter1->GetOutput());

I'm currently setting the observer on the last filter but it only sends the
progressEvent when the 2nd filter starts.

What am I doing wrong ?

This is an example of one my functions :

 void CVolumeData::Median(int Radius) {

typedef itk::MedianImageFilter < ITK3DImageType, ITK3DImageType> FilterType;

FilterType::Pointer Filter = FilterType::New();


 ITK3DImageType::SizeType indexRadius;

indexRadius[0] = Radius;

indexRadius[1] = Radius;

indexRadius[2] = Radius;

Filter->SetRadius(indexRadius);


 Filter->SetInput(GetITK3DImage());


 typedef itk::RescaleIntensityImageFilter<ITK3DImageType, ITK3DImageType>
RescaleFilterType;

RescaleFilterType::Pointer RescaleFilter = RescaleFilterType::New();


 RescaleFilter->SetInput(Filter->GetOutput());

RescaleFilter->SetOutputMaximum(4095);

RescaleFilter->SetOutputMinimum(0);


 typedef itk::CStyleCommand CommandType;

typedef CommandType::Pointer CommandPointer;

CommandPointer ProgressDialogCallback = CommandType::New();


ProgressDialogCallback->SetCallback((CommandType::FunctionPointer)&ITKProgressCallback);

ProgressDialogCallback->SetClientData(this);


 unsigned long int ObserverID =
RescaleFilter->AddObserver(itk::ProgressEvent(), ProgressDialogCallback);


 qDebug() << "LOL 1";


 RescaleFilter->Update();

SetITK3DImage(RescaleFilter->GetOutput());


 qDebug() << "LOL 2";


 if(m_MainView != NULL)

for(unsigned int i = 0, size = m_MainView->GetImageSubView().size(); i <
size; i++) {

m_MainView->GetImageSubView().at(i)->PrepareCache();

}


 RescaleFilter->RemoveObserver(ObserverID);


 GetProgressDialog()->close();


 qDebug() << "LOL 3";

}


Thank you very much for your help !

Best regards,


Maximilien Renard

P.S. I apologize if it was explained in the Software Guide in which case I
did not find it
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20090830/c21047e2/attachment.htm>


More information about the Insight-users mailing list