[Insight-users] ITK-VTK pipeline progress bar help
Luis Ibanez
luis.ibanez at kitware.com
Sun Apr 25 11:04:08 EDT 2010
Hi Somi,
1) Yes, if you are using iterators in order to process data from
and image, you must encapsulate such processing inside
a new ITK filter.
You may find useful to look at the following tutorial:
http://www.na-mic.org/Wiki/images/b/bc/Insight-Writing-a-New-Filter.ppt
2) You have a point, that if the pipeline end up being
re-executed every time (due to the intermediate memory
release) then there is no advantage on using a pipeline
versus using a procedural approach with iterators.
but... there is no disadvantage either :-)
So, you could certainly go either way.
My suggestion will be to, at least, create a C++ class
that encapsulates the whole of your processing, and
then implement each one of the processing steps as
methods of that larger class.
Sometimes we focus too much on the use of the
pipeline and forget that basic OOP and C++ offer
natural ways of organizing the code.
Regards
Luis
---------------------------------------------------------------------------------------------
On Thu, Apr 22, 2010 at 10:57 PM, somi <seesomi at gmail.com> wrote:
> Hi Luis,
> Thanks for your reply. It was very helpful.
> My application has the following flow:
>
> a)User specifies ROI interactively
> b) Do segmentation in the specified region to get region A and B
> c) Based on user specified thickness, label the boundary of the A and B as
> a new label C (of thickness specified by user)
> d) Visualize the segmentation
>
> Currently I have set this up as a series of ITK and VTK filters. Note that
> due to size of dataset I release data on all filters, so the whole pipeline
> is re-executed every time.
>
> Currently I use neighborhood iterators for (c) . Should I wrap the
> functionality into a filter ?
> As the whole pipeline is re-executed everytime, what would be the
> disadvantage of using iterators instead of a filter ?
>
> Thanks,
> Somi
>
>
>
> On Thu, Apr 22, 2010 at 10:52 AM, Luis Ibanez <luis.ibanez at kitware.com>wrote:
>
>>
>> Hi Somi,
>>
>> You may want to look at the example:
>>
>> InsightApplications/QtITK/
>> CMakeLists.txt
>> itkQtAdaptor.h
>> itkQtLightIndicator.h
>> itkQtProgressBar.cxx
>> itkQtProgressBar.h
>> qtITK.cxx
>>
>> http://www.itk.org/cgi-bin/viewcvs.cgi/QtITK/?root=InsightApplications
>>
>> It show how to update a Qt progress bar by
>> capturing progress events sent from an ITK
>> filter.
>>
>> More specifically about your questions:
>>
>>
>> a) In order to integrate a single progress value
>> by composing the progress reported by each
>> individual filter in a pipeline, you can use the
>> helper class:
>>
>> Insight/Code/Common/
>> itkProgressAccumulator.h
>> itkProgressAccumulator.cxx
>>
>> you need to register all the ITK filters with it
>> and you must come up with a percentage of
>> how much each filter contributes to the total
>> progress of the pipeline.
>>
>> For examples of use, look at any of the following
>> filters:
>>
>> Insight/Code/BasicFilters/
>> itkOpeningByReconstructionImageFilter.txx
>> itkOrientImageFilter.txx
>> itkSignedDanielssonDistanceMapImageFilter.txx
>> itkSignedMaurerDistanceMapImageFilter.txx
>> itkSmoothingRecursiveGaussianImageFilter.txx
>> itkZeroCrossingBasedEdgeDetectionImageFilter.txx
>>
>>
>> b) Since ITK and VTK are independent toolkits you
>> will have to write specific command observers for
>> each family of filters.
>>
>> and you may have to write a customized Progress
>> Accumulator that can take contributions from both
>> ITK and VTK. Strictly speaking the progress
>> accumulator doesn't even need to know that filters
>> are involved in the process. It just needs to know
>> about relative contributions of every stage of
>> processing.
>>
>>
>> c) Why would you use iterators in the pipeline ?
>>
>> Iterators are usually hidden from the
>> view of mortals inside the protective
>> enclosure of filters :-)
>>
>>
>> Regards,
>>
>>
>> Luis
>>
>>
>> -------------------------------------------------------------------
>> On Tue, Apr 20, 2010 at 3:39 PM, somi <seesomi at gmail.com> wrote:
>>
>>> Hi,
>>> I have a Qt based application where I load some image using ITK, do
>>> segmentation, extract subsurface and display using vtk.
>>> I need some help displaying the progress events.
>>>
>>> I have connected the ITK and VTK pipelines . I want to show progress of
>>> individual as well as total progress in separate Qt progress bars.
>>>
>>> a) How can I get the progress of the whole pipeline ? Do I have to use
>>> QProgressDialog progress + progress.setValue(n) + qApp->processEvents();
>>> manually setting value of n after every filter ?
>>>
>>> b) For individual filter progress update do I use two different classes
>>> one overriding itk::Command and other vtk::Command ? Do I have to use
>>> separate progress bar for ITK/VTK
>>>
>>> c) What changes do I have to do if I use iterators in my pipeline ?
>>>
>>>
>>> Thanks,
>>> Somi
>>>
>>>
>>>
>>>
>>> _____________________________________
>>> Powered by www.kitware.com
>>>
>>> Visit other Kitware open-source projects at
>>> http://www.kitware.com/opensource/opensource.html
>>>
>>> Kitware offers ITK Training Courses, for more information visit:
>>> http://www.kitware.com/products/protraining.html
>>>
>>> Please keep messages on-topic and check the ITK FAQ at:
>>> http://www.itk.org/Wiki/ITK_FAQ
>>>
>>> Follow this link to subscribe/unsubscribe:
>>> http://www.itk.org/mailman/listinfo/insight-users
>>>
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20100425/e227ee16/attachment.htm>
More information about the Insight-users
mailing list