[Insight-users] Levelsets-v4 curvature term drives circles to squares (2-D) (+other issues)

Vaaksiainen vaaksiainen at gmail.com
Wed Dec 19 05:07:36 EST 2012


Hi Bill & Arnaud,

Attached (attachments are allowed on the list, right?) you will find a
fully compilable demo, which depicts the problem with curvature term
described earlier and also a successful use of Chan&Vese terms I
mentioned.

The funny part comes now: my code elaborately mixes OpenCV and ITK and
that is due to my actual code I ripped this example from. If an ITK
alternative for cv::circle exists (I couldn't find one by name), I can
rewrite this as a clean plain ITK sample without visualization. On the
other hand, I guess many are mixing the libraries and nevertheless ITK
code is well separated for debugging purposes.

Yes, I use release build. With 4-iteration cycles, this demo animates
through around one-second intervals (Intel Core i5-520M all cores
employed). I use dense levelset here, but I've tried Whitaker sparse
levelset as well without noticeable speed change (I never checked if
sparse one was multithreaded or not).

The image I used for testing is located at URL below. It depicts two
flying birds, but using it is not mandatory (in curvature case, it
only provides the image size).

https://lh4.googleusercontent.com/-LMAR5dhgL9k/UNGAQwv3cLI/AAAAAAAAAOA/m5GGoScWD_o/s800/eagle.png

Many thanks for digging into this problem,

-Vaaksiainen


2012/12/17 Bill Lorensen <bill.lorensen at gmail.com>:
> A simple example would make a great itk wiki example. We need some
> levelset examples. If you can post a fully compilable example, I'll be
> happy to add it to the wiki examples.
>
> On Mon, Dec 17, 2012 at 10:58 AM, Arnaud Gelas <arnaudgelas at gmail.com> wrote:
>> Hi Vaaksiainen,
>>
>> As Bill mentioned, to get the best performance make sure to build your
>> program in Release. It can make a huge difference.
>>
>> Now speaking about the performance of the v4 framework, it is not
>> multi-threaded for all level set representations as it was for the previous
>> implementation; and some there is still some work to be done on that matter.
>> Also for some of the sparse cases, there are still some optimizations to be
>> made in the code.
>>
>> I will try to look at some of these issues during the holidays...
>>
>> ---
>>
>> Meanwhile, could you make a minimal example with one image to reproduce this
>> behavior, please?
>>
>> Thanks,
>> Arnaud
>>
>>
>>
>> On 12/17/2012 04:45 PM, Bill Lorensen wrote:
>>>
>>> Make sure you build your program Release and not Debug.
>>>
>>> On Mon, Dec 17, 2012 at 10:02 AM, Vaaksiainen <vaaksiainen at gmail.com>
>>> wrote:
>>>>
>>>> Update to this question and some credit to authors :) now that I've
>>>> tried it, Chan-Vese levelset works nicely, and although a single
>>>> iteration is slowish, the convergence is very fast from the initial
>>>> circle initialization (~comparable with v3 snake in total time). I
>>>> remark, that default value of Heaviside epsilon is kinda high, so
>>>> changing that was my first solution. The original question with plain
>>>> curvature or geodesic active contour remains open still.
>>>>
>>>> I try not to profile spammer, so I also attach here my thanks to
>>>> Arnaud regarding my previous question
>>>> (LevelSetEquationTermContainer->SetInput() ? ).
>>>>
>>>> Best,
>>>>
>>>> -Vaaksiainen
>>>>
>>>> 2012/12/17 Vaaksiainen <vaaksiainen at gmail.com>:
>>>>>
>>>>> Hi,
>>>>>
>>>>> I'm learning Levelsets-v4 hard. Currently, after not getting the
>>>>> convergence appreciated, I tried the following:
>>>>>
>>>>> I set up LevelSetEvolution following the
>>>>> itkSingleLevelSetDenseImage2DTest -example, but I use only propagation
>>>>> or curvature terms one at a time. I set the feature images unitary,
>>>>> and initialize the levelset as small circles (equi-spaced).
>>>>>
>>>>> Problem: curvature term drives circles towards squares (really
>>>>> sharp-edged NxN pixel squares eventually), while obviously should not.
>>>>> Somewhat similar happens with the propagation term alone, where I find
>>>>> speed along coordinate axes to be dominative.
>>>>>
>>>>> What I might be doing wrong here?
>>>>>
>>>>> Another question, is it possible to obtain (approximately) similar
>>>>> behaviour using GeodesicActiveContourLevelSetImageFilter and
>>>>> Levelsets-v4 framework with propagation, curvature and advection
>>>>> terms. I tried, but obvious reasons (mentioned above) already
>>>>> cancelled this study. Also: number of iterations per time unit seems
>>>>> to be drastically lower (hundred folds) with the new framework.
>>>>>
>>>>> -V
>>>>
>>>> _____________________________________
>>>> 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.php
>>>>
>>>> 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
>>>
>>>
>>>
>>
>
>
>
> --
> Unpaid intern in BillsBasement at noware dot com
-------------- next part --------------
PROJECT(Foo)

CMAKE_MINIMUM_REQUIRED( VERSION 2.8 )

FIND_PACKAGE(OpenCV)
IF (NOT OpenCV_FOUND )
	MESSAGE(FATAL_ERROR "OpenCV not found.")
ENDIF(NOT OpenCV_FOUND)

FIND_PACKAGE(ITK)
IF (ITK_FOUND)
	INCLUDE(${ITK_USE_FILE})
ELSE(ITK_FOUND)
	MESSAGE(FATAL_ERROR "ITK not found.")
ENDIF(ITK_FOUND)
	
SET(SRCS
	main.cpp
)
SET(LIBS
	optimized opencv_core220
	optimized opencv_imgproc220
	optimized opencv_highgui220
	debug opencv_core220d
	debug opencv_imgproc220d
	debug opencv_highgui220d
	${ITK_LIBRARIES}
)
ADD_EXECUTABLE( Foo ${SRCS} )
TARGET_LINK_LIBRARIES(Foo ${LIBS} )
-------------- next part --------------
A non-text attachment was scrubbed...
Name: main_fooVaaksiainen.cpp
Type: text/x-c++src
Size: 8527 bytes
Desc: not available
URL: <http://www.itk.org/pipermail/insight-users/attachments/20121219/3f943078/attachment.cpp>


More information about the Insight-users mailing list