[ITK-users] [ITK] Add Seed in SimpleITK.IsolatedConnectedImageFilter

Bradley Lowekamp blowekamp at mail.nih.gov
Wed May 14 08:44:17 EDT 2014


Dirk,

It appears I was confusing the interface more that I realized. This is likely a case where the SimpleITK interface needs to be a little different than the ITK interface. I'll see what I can do to make the SimpleITK IsolatedConnectedImageFilter closer to the other region growing Seed List interfaces.

Thanks for the discussion.

Brad

On May 13, 2014, at 3:16 PM, Padfield, Dirk R (GE Global Research) <padfield at research.ge.com> wrote:

> Hi Brad,
> 
> I can't find any "SetSeedList" methods in the ITK implementations of these region growing algorithms; in SimpleITK yes but not in ITK.  Am I missing something?  I agree that if there were such methods, AddSeed and ClearSeeds wouldn't be necessary.
> 
> The only difference I see in the API with IsolatedConnected is that it has a "1" or "2" after the names to distinguish the two sets of seed points.  Is there anything else?
> 
> Dirk
> 
> 
> On May 13, 2014, at 11:15 AM, Bradley Lowekamp <blowekamp at mail.nih.gov> wrote:
> 
>> See below...
>> 
>> On May 13, 2014, at 10:34 AM, Padfield, Dirk R (GE Global Research) <padfield at research.ge.com> wrote:
>> 
>>> Hi Brad and Chiara,
>>> 
>>> Thanks for the clarification.  I have a couple of thoughts: 
>>> 
>>> 1) The "SetSeed" methods are deprecated not the "AddSeed" methods.
>> 
>> Sorry for the confusion, I intended to say I like the SetSeed method.
>> 
>>> 
>>> 2) There is no need for SetSeed.  AddSeed does exactly the same thing.  The only difference is that, when AddSeed is called multiple times, it adds additional seeds.  This is also evident in the link you sent to the "Seed" interface (granted, SetSeed clears the seeds first, but the first time AddSeed is called, the list is also cleared already).
>> 
>> SetSeed is independent of the prior state of the filter parameter, unlike AddSeed. Also AddSeed and ClearSeeds are not needed either as the SetSeedList is sufficient. SimpleITK just uses the ITK's SetSeedList method for this class of filters.
>> 
>>> 
>>> 3) Along the same lines, having a seed list as the only option in SimpleITK seems sufficient to me because having only one seed is just a list with one entry.  For example, the functional interface to ConfidenceConnected uses the seedList: 
>>> ConfidenceConnected(Image imageA, VectorUIntList seedList, unsigned int numberOfIterations=4u, double multiplier=4.5, unsigned int initialNeighborhoodRadius=1u, uint8_t replaceValue=1u) -> Image
>> 
>> There have been a large number of users confused with this method because they are trying to pass a single seed for that argument. There may be a couple of reasons for this confusion though.
>> 
>> 
>>> 
>>> 4) Why does IsolatedConnected not have seed lists?  I can't see any reason why it shouldn't have the same methods as the others with the only difference being that it has two of each: one each for Seed1 and Seed2.  Note that Seed1 and Seed2 are defined differently here: they are seeds in two different regions of the image that need to be "isolated" from each other.  The other region growing algorithms only have one set of seeds.
>> 
>> If I recall correctly when I reviews the ITK filter to wrap it for SimpleITK, the filter appeared to have an incomplete Seed List interface. So the simpler single seed as parameter was chosen.
>> 
>> 
>>> 
>>> 5) According to http://www.itk.org/SimpleITKDoxygen/html/classitk_1_1simple_1_1IsolatedConnectedImageFilter.html, the documentation states that SetSeed is deprecated and that we should use AddSeed instead, but there are no AddSeed methods.  This is consistent with what Chiara was saying in the first place.  In the last email, you stated that IsolatedConnected has:
>>> 
>>> GetSeeds1
>>> ClearSeeds1
>>> AddSeed1
>>> SetSeed1
>>> 
>>> but it does not have AddSeed1 or AddSeed2.  
>> 
>> The SimpleITK doxygen is mostly just copied from ITK.
>> 
>> I was describing the missing methods in the ITK interface, it is an incomplete Seed List interface and missing methods when compared to other region growing methods and has a different naming convention. 
>> 
>> 
>> 
>>> 
>>> 6) There *might* be value to adding seed lists to the ITK versions of the filters.  This would enable us to call the algorithms without having to loop through the AddSeed method if we already have the seeds stored in a vector.
>>> 
>> 
>> The SeedList can be considered a parameter to the filter. It's convention to provide Set/Get methods to the parameter. It's uncommon for a filter to expose manipulator methods to a parameter such as the AddSeed, and ClearSeeds methods.
>> 
>>> Thanks,
>>> Dirk
>>> 
>>> 
>>> 
>>> On May 13, 2014, at 9:58 AM, Bradley Lowekamp <blowekamp at mail.nih.gov> wrote:
>>> 
>>>> Dirk,
>>>> 
>>>> Here is the SimpleITK template with the expected "Seed" interface:
>>>> 
>>>> https://github.com/SimpleITK/SimpleITK/blob/master/Code/BasicFilters/templates/sitkRegionGrowingImageFilterTemplate.h.in#L35-L66
>>>> 
>>>> The methods are as followed:
>>>> 
>>>> SetSeedList
>>>> GetSeedList
>>>> ClearSeeds
>>>> SetSeed
>>>> AddSeed
>>>> 
>>>> This template is used for ConfidenceConnected, ConnectedThreshold, NeighborhoodConnected and VectorConfidenceConnected
>>>> 
>>>> For the IsolatedConnected we have the following:
>>>> 
>>>> GetSeeds1
>>>> CearSeeds1
>>>> AddSeed1
>>>> SetSeed1
>>>> 
>>>> Notice the missing SetSeed1[List] method, and the missing "List" suffix.
>>>> 
>>>> The current marking of the deprecation of the AddSeed methods was not apparent to me. I do fine the method convenient, and I think it's common to use these filters with only one seed.
>>>> 
>>>> Brad
>>>> 
>>>> On May 13, 2014, at 9:36 AM, Padfield, Dirk R (GE Global Research) <padfield at research.ge.com> wrote:
>>>> 
>>>>> Hi Brad and Chiara,
>>>>> 
>>>>> In IsolatedConnected, the SetSeed1() and SetSeed2() are deprecated methods marked as such both in the doxygen and using the ITK_FUTURE_LEGACY_REMOVE in the code: http://www.itk.org/Doxygen/html/classitk_1_1IsolatedConnectedImageFilter.html.  When I recently was looking at this filter, I found that these methods were listed as deprecated, so I added the ITK_FUTURE_LEGACY_REMOVE blocks around them.  In the code, these methods simply call the corresponding AddSeed1() and AddSeed2() methods (after clearing the seeds).
>>>>> 
>>>>> Although I wasn't the one who initially marked these methods as deprecated, I can understand why they are.  AddSeed makes more sense because it enables the setting of multiple seeds for each of the two regions to be isolated from each other, and once you have AddSeed, there is no longer any reason to have SetSeed.
>>>>> 
>>>>> The SetSeed methods are also marked as deprecated in ConfidenceConnected.  They should be marked as deprecated in both ConnectedThreshold and NeighborhoodConnected.  In all cases, the SetSeed methods are just shells that call AddSeed.
>>>>> 
>>>>> It would be good to have an ITK patch that marks SetSeed as deprecated in all of these region growing algorithms and also adds corresponding ITK_FUTURE_LEGACY_REMOVE blocks around the code.
>>>>> 
>>>>> I have had success passing lists of seed points into ConfidenceConnected using SimpleITK, and it works very well.  The best approach for SimpleITK would probably be to enable this for all of these region growing filters and to get rid of SetSeed for all of them.
>>>>> 
>>>>> Dirk
>>>>> 
>>>>> 
>>>>> ________________________________
>>>>> From: Bradley Lowekamp [blowekamp at mail.nih.gov]
>>>>> Sent: Tuesday, May 13, 2014 9:09 AM
>>>>> To: Chiara Caborni
>>>>> Cc: insight-users at itk.org; community at itk.org; slicer-users at bwh.harvard.edu; Padfield, Dirk R (GE Global Research)
>>>>> Subject: Re: [ITK] Add Seed in SimpleITK.IsolatedConnectedImageFilter
>>>>> 
>>>>> Hello Chaira,
>>>>> 
>>>>> 1) I don't think those methods should be deprecated. I think that the Seed interfaces for the two filters you mentioned should match. That means this method should not be removed.
>>>>> 
>>>>> 2) The SimpleITK filter currently doesn't consider Seed1 and Seed2 to be list it's just treating them like single points. In my experience when I tries to use many seeds very frequently the filter would fail to find a valid value and fail.
>>>>> 
>>>>> I think it's most useful for the procedural method to stay as it is just accepting the two points. What could be done is to add a methods just to the class interface which allows for the Set/Get as a list. I would not be inclined to add the Clear and Add function methods as the interface.
>>>>> 
>>>>> What is your time frame on this?
>>>>> 
>>>>> Brad
>>>>> 
>>>>> On May 13, 2014, at 7:02 AM, Chiara Caborni <chiara.caborni at gmail.com<mailto:chiara.caborni at gmail.com>> wrote:
>>>>> 
>>>>> 
>>>>> Hello,
>>>>> 
>>>>> I'm using Slicer 4.3.1, which has SimpleFilters module in it.
>>>>> 
>>>>> I'm trying adding seeds (using methods SetSeed1/SetSeed2) to a SimpleITK.IsolatedConnectedImageFilter.
>>>>> 
>>>>> I succedeed adding a list of seeds as input to a SimpleITK.ConnectedThresholdImageFilter,
>>>>> using the method, AddSeed(), so that I can iteratively add seeds and then obtain a list of seeds with the method GetSeedList().
>>>>> 
>>>>> But since the IsolatedConnectedImageFilter has no method addSeed, but just SetSeed#, I can just add one seed using SetSeed1 and another one using SetSeed2.
>>>>> How can I specify more than one seed for both regions 1&2 to separate?
>>>>> 
>>>>> In the DOxygen page, http://www.itk.org/SimpleITKDoxygen/html/classitk_1_1simple_1_1IsolatedConnectedImageFilter.html
>>>>> , I read the method SetSeed1/2 is deprecated, please use AddSeed, but there's no AddSeed method in IsolatedConnectedImageFilter.
>>>>> 
>>>>> Any help appreciated, thank you
>>>>> kind regards
>>>>> Chiara
>>>>> --
>>>>> Chiara
>>>>> _______________________________________________
>>>>> Community mailing list
>>>>> Community at itk.org<mailto:Community at itk.org>
>>>>> http://public.kitware.com/cgi-bin/mailman/listinfo/community
>>>>> 
>>>> 
>>> 
>> 
> 



More information about the Insight-users mailing list