AW: AW: AW: [Insight-users] Process Bar problem in ITK program
: FuzzyConnectedness
Luis Ibanez
luis . ibanez at kitware . com
Tue, 09 Dec 2003 13:43:00 -0500
Hi Chuyan,
Looking closer at the code of the FuzzyConnectedness filter,
we found the reason why your progress bar is not moving at all:
The filter is not invoking the UpdateProgress() method
during its execution in the GenerateData() method.
One of the difficulties for estimating the progress in
this filter is that it is growing a region and the inclusion
of new pixels is conditioned to the computation of affinity
among pixel pairs.
Probably the reasonable thing to do is to make an estimation
of a worst-case scenario for the number of pixels to visit,
and base the progress as a fraction of this number of pixels.
In practice what you will see is that the progress bar will
advance slowly and then suddenly jump to 100% because
most of the time the filter will finish earlier than the worst
case estimated time.
A first attempt for this estimation has been commited to
CVS. You will have to update your CVS checkout in order
to get this modification. Note that a lot of files have been
changed in ITK today, so you will probab ly end up recompiling
the entire toolkit, just to be safe.
Please let us know if you find any problems.
Thanks
Luis
------------------------
jiang wrote:
>Hi Luis,
>I tried some small data sets (as you said 2D data). FuzzyConnectedness works
>fine with them. I only set seed point in different position and the
>threshold value to observe the result. I have no idea about how to set
>parameters: m_ObjectMean and m_ObjectVariance. In the example,
>m_ObjectVariance = 2500.0;
>However the process bar still can not work with FuzzyConnectedness. Is it
>possible to solve this problem?
>
>Thank you very much for you help!
>
>Chunyan
>
>-----Ursprungliche Nachricht-----
>Von: insight-users-admin at itk . org [mailto:insight-users-admin at itk . org]Im
>Auftrag von Luis Ibanez
>Gesendet: Freitag, 5. Dezember 2003 17:32
>An: jiang; Insight-users at public . kitware . com
>Betreff: Re: AW: AW: [Insight-users] Process Bar problem in ITK program
>
>
>
>Hi Chuyan,
>
>Thanks for letting us know about the result of your experiment.
>
>Now we know that the Qt-ITK GUI connections are working fine.
>
>You should now follow Yinpeng's advice and try the FuzzyConnectedness
>filter with small data sets (preferably 2D) until you get familiar
>with the characteristics of the method, in particular with the
>heuristics for setting its parameters.
>
>Please let us know if you find further problems,
>
>
>Thanks,
>
>
> Luis
>
>
>----------------------
>jiang wrote:
>
>
>
>>Hi Luis,
>>I do the test as you said. And I use the itkMedianImageFilter as the
>>
>>
>example
>
>
>>in
>>
>>
>>
>\InsightToolkit-1.4.0\Testing\Code\BasicFilters\itkMedianImageFilterTest.cxx
>
>
>>. The process bar is exactly same as I used in FuzzyConnectedness filter.
>>This time process bar works fine. Since the MedianImageFilter processes
>>
>>
>very
>
>
>>fast, the process bar goes to full also very fast.
>>What should I do with FuzzyConnectedness then?
>>Thank you very much!
>>
>>
>>Chunyan Jiang
>>
>>-----Ursprungliche Nachricht-----
>>Von: Luis Ibanez [mailto:luis . ibanez at kitware . com]
>>Gesendet: Donnerstag, 4. Dezember 2003 18:34
>>An: jiang
>>Cc: ITK
>>Betreff: Re: AW: [Insight-users] Process Bar problem in ITK program
>>
>>
>>Hi Jiang,
>>
>>Could you please do the following simple test :
>>
>>Replace the FuzzyConnectedness filter with any
>>other filter. For example the itkMedianImageFilter
>>and run the application again to see if the progress
>>bar in the GUI advances or not.
>>
>>This will help to identify if the problem is related
>>to your GUI code or to the pace at which the Fuzzy
>>Connectedness filter is reporting its progress.
>>
>>Please let us know what you find.
>>
>>
>>Thanks
>>
>>
>> Luis
>>
>>
>>
>>------------------------
>>jiang wrote:
>>
>>
>>
>>
>>>Hi Luis,
>>>Thank you very much for your detailed answer. I read the documents as your
>>>hints, and integrate the QtITK's QtProcessBar into my code. However, when
>>>
>>>
>>I
>>
>>
>>
>>>run application, the progress bar doesn't work. The progress bar's frame
>>>
>>>
>>is
>>
>>
>>
>>>showed on the screen as I set in the program. But the progress bar doesn't
>>>go ahead even the whole application is over.
>>>The following is my code:
>>>
>>>
>>>
>>>void initializeProgressBar()
>>>{
>>>
>>> FilterPointer m_Filter;
>>> m_Filter=lg->GetFCFilter();//to get FuzzyConnectedness pointer. At this
>>>time, the pointer is just constructed, without any operations.
>>> // Connect the progress bar to the ITK processObject
>>> qs->Observe( m_Filter.GetPointer() );
>>>
>>> typedef itk::QtSlotAdaptor<FilterType> SlotAdaptorType;
>>> SlotAdaptorType slotAdaptor;
>>>
>>> // Connect the adaptor to a method of the ITK filter
>>> slotAdaptor.SetCallbackFunction( m_Filter, & FilterType::Update );
>>>
>>> // Connect the adaptor's Slot to the Qt Widget Signal
>>> connect( FuzzyConBt, SIGNAL(clicked()), &slotAdaptor, SLOT(Slot()) );
>>>
>>>lg->FCSegmentation();//Perform the FuzzyConnectedness segmentation
>>>
>>>}
>>>
>>>Call initializeProgressBar() when use clicks the command button.
>>>
>>>
>>>Is there something wrong in my code? Why progress bar doesn't run?
>>>
>>>With best regards,
>>>
>>>Chunyan
>>>
>>>-----Ursprungliche Nachricht-----
>>>Von: Luis Ibanez [mailto:luis . ibanez at kitware . com]
>>>Gesendet: Mittwoch, 3. Dezember 2003 01:33
>>>An: jiang
>>>Cc: ITK
>>>Betreff: Re: [Insight-users] Process Bar problem in ITK program
>>>
>>>
>>>Hi Chunyan,
>>>
>>>ITK filters use the paradigm of Event/Observers
>>>You will find a description of this concepts in
>>>the software guide
>>>
>>> http://www . itk . org/ItkSoftwareGuide . pdf
>>>
>>>please look at Chapter 3, "System Overview"
>>>pdf-page 45.
>>>
>>>Examples on the use of Observers are abundant on
>>>the Registration chapter.
>>>
>>>You will also find descriptions on how to use
>>>observers in the tutorial sessions:
>>>
>>>In particular in "ITK Architecture" :
>>>http://www . itk . org/CourseWare/Training/GettingStarted-III . pdf
>>>
>>>
>>>For code examples on how to integrate ITK with Qt,
>>>please look at the tutorial:
>>>
>>> "ITK and Graphical User Interface"
>>>http://www . itk . org/CourseWare/Training/GettingStarted-IV . pdf
>>>
>>>
>>>You will find code examples about interfacing Qt and ITK in
>>>
>>>
>>> InsightApplications/QtITK
>>>
>>>
>>>There is an explicit example on how to create a QtProgress
>>>bar that is connected as observer of the ProgressEvents
>>>sent by an ITK filter.
>>>
>>>Look at:
>>>
>>> itkQtProgressBar.h
>>> itkQtProgressBar.cxx
>>>
>>>
>>>
>>>
>>
>>
>http://www . itk . org/cgi-bin/cvsweb . cgi/InsightApplications/QtITK/?cvsroot=Ins
>
>
>>>ight
>>>
>>>
>>>
>>>
>>>Regards,
>>>
>>>
>>> Luis
>>>
>>>
>>>
>>>--------------------------------------
>>>jiang wrote:
>>>
>>>
>>>
>>>
>>>
>>>>Hi,
>>>>I can use FuzzyConnectedness to do segmentation in my program. However,
>>>>
>>>>
>>>the
>>>
>>>
>>>
>>>
>>>>segmenting process is a time consuming work. I want to use process bar to
>>>>indicate the progress. When I debug the code, I find that there is only
>>>>
>>>>
>>>one
>>>
>>>
>>>
>>>
>>>>line is very slow. It is m_Filter->Update(); This step occupies almost
>>>>
>>>>
>80%
>
>
>>>>process time.
>>>>How can I separate m_Filter->Update(); in several steps, or use other
>>>>
>>>>
>>>method
>>>
>>>
>>>
>>>
>>>>to show the process of the segmentation?
>>>>I use Qt as GUI.
>>>>
>>>>Thanks a lot!
>>>>
>>>>Chunyan
>>>>
>>>>_______________________________________________
>>>>Insight-users mailing list
>>>>Insight-users at itk . org
>>>>http://www . itk . org/mailman/listinfo/insight-users
>>>>
>>>>
>>>>
>>>
>>>
>>>_______________________________________________
>>>Insight-users mailing list
>>>Insight-users at itk . org
>>>http://www . itk . org/mailman/listinfo/insight-users
>>>
>>>
>>>
>>
>>
>>
>>
>>
>
>
>
>_______________________________________________
>Insight-users mailing list
>Insight-users at itk . org
>http://www . itk . org/mailman/listinfo/insight-users
>
>
>
>