[Insight-users] Help with DisconnectPipeline()
Miller, James V (Research)
millerjv at crd.ge.com
Fri Aug 5 11:32:23 EDT 2005
Isabelle,
Second question first, I believe when you DisconnectPipeline, that changes the state of the ReleaseDataFlag on the object being disconnected. DisconnectPipeline
forces the source filter to create an new output and that output will be configured with the same setting of the ReleaseDataFlag as previous output.
First question now. There are two things I think that you need to address:
1. Your logic seems a little circular. If someone chooses to do histogram equalization, you are taking the output of the rescale, running histogram equalization on it, and then rescaling it AGAIN. If the user unchecks the histogram equalization, you set the rescaleFilters input to the original output of the rescale filter and end up rescaling it AGAIN.
2. Downstream processing: Once you disconnect the output of the rescale filter, a new output object is created in its place. But if you had other filters consuming the old output of the rescale filter, they are not rewired to the new output. So that anything holding a reference to rescaleFilter->GetOutput() still references the previous image. Then would have to be redirected towards the new output of the rescale filter.
I think you can simplify your code using standard pipeline mechanics:
Set up a pipeline like
histeqFilter->SetInput( someInputImage );
rescaleFilter->SetInput( someInputImage );
note that both filters are operating on the same image.
When the user wants to use the histogram equalization, simply redefine the input to the rescaleFilter
rescaleFilter->SetInput( histeqFilter->GetOutput() );
If the user want to go back to not using histogram equalization, redefine the input to the rescaleFilter again
rescaleFilter->SetInput( someInputImage );
Jim
-----Original Message-----
From: insight-users-bounces+millerjv=crd.ge.com at itk.org [mailto:insight-users-bounces+millerjv=crd.ge.com at itk.org]On Behalf Of Renaud Isabelle
Sent: Friday, August 05, 2005 10:05 AM
To: Luis Ibanez
Cc: insight-users at itk.org
Subject: [Insight-users] Help with DisconnectPipeline()
Hi Luis,
I thought I understood how to use DisconnectPipeline() to grab a filter's output but it seems not to be the case. Could you put light on it please?
I just wanna offer the possibility to user to apply an histogram equalization on the displayed image and then return to the older image if desired. So, one way to do it, would be to keep the old image before any histogram equalization, thanks to DisconnectPipeline(), and then reuse it after histogram equalization. Here is what I did:
OnButton_HistogramEqualization()
{
if(HistEqBtn.GetCheck()) //back to the old image
{
rescaleFilter->SetInput(oldImage);
}
else // activate histogram equalization
{
//save the old image to return later to it
WorkImageType::Pointer oldImage = rescaleFilter->GetOutput();
oldImage->DisconnectPipeline();
histeqFilter->SetInput(oldImage);
histeqFilter->Update();
rescaleFilter->SetInput(histeqFilter->GetOutput());
}
rescaleFilter->Update();
}
But this doesn't work: my image is still the same before an d after button clicked. Yet, this code seems to be simple and I can't see what I miss.
Btw, could you tell me if:
histeqFilter->GetOutput()->ReleaseDataFlagOn();
rescaleFilter->GetOutput()->ReleaseDataFlagOn();
could interfere with rescaleFilter->GetOutput()->DisconnectPipeline()?
I really need your help,
Thanks in advance,
Isabelle
_____
Appel audio GRATUIT partout dans le monde avec le nouveau Yahoo! Messenger
Téléchargez <http://us.rd.yahoo.com/messenger/mail_taglines/default/*http://fr.messenger.yahoo.com> le ici !
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/insight-users/attachments/20050805/d1ef1cdc/attachment.htm
More information about the Insight-users
mailing list