[Insight-users] Questions about ITK4

Arnaud Gelas Arnaud_Gelas at hms.harvard.edu
Wed Oct 5 10:23:10 EDT 2011


Dear Hui Tang,

You can definitively modify existing code to add your own term, and  
that was one of the reason we came up with this new design for ITKv4:  
to be able to add easily new terms to any kind of PDE...

Can't help very much here...

Good luck,
Arnaud

On Oct 5, 2011, at 4:18 PM, Hui Tang wrote:

> Dear Arnaud,
>
> Thanks for the very quick reply; So I am right, there is no GAC in  
> v4 yet:)
>
> I am not meaning combining v4 with v3, but modify v3 by adding a new  
> term on PDE.  I will try and let you know if I succeed:)
>
> Thanks a lot
>
> Best,
>
> Hui
>
> On Wed, Oct 5, 2011 at 4:14 PM, Arnaud Gelas <Arnaud_Gelas at hms.harvard.edu 
> > wrote:
> Dear Hui Tang,
>
> The ITKv4 level-set framework is not backward compatible with the  
> ITKv3's one!
>
> So it is not possible to mix v3 implementation with v4 ones.  
> Especially the notion of terms did not exist back then...
> We are in the process of reimplementing GAC in the v4 framework, but  
> it is not yet available (even on the master branch).
> I can keep you informed whenever it gets implemented, or if you want  
> you could get involved in the development process and help in the  
> implementation (which should not be too complicated at this point).
>
> Best,
> Arnaud
>
> On Oct 5, 2011, at 4:05 PM, Hui Tang wrote:
>
>> Dear Arnaud,
>>
>> I managed to modify that in  
>> itkLevelSetEquationChanAndVeseInternalTerm, but in update function  
>> but in there the m_Mean is used.
>>
>> No I find if I should combine regional term with GAC, I will go  
>> back to ITK3 and modify that in
>> itkGeodesicActiveContourAndRegionLevelSetFunction 
>> ::CalculateSpeedImage(), the regional term in PDE will be -(I- 
>> Imean)^2
>>
>> Is that right to do it in  
>> itkGeodesicActiveContourAndRegionLevelSetFunction?
>>
>> Thanks:)
>>
>> Best,
>>
>> Hui
>>
>> On Oct 3, 2011, at 3:55 AM, Hui Tang wrote:
>>
>>> Dear Arnaud,
>>>
>>> Thanks for the reply!!
>>> I left yestoday for washing and sleeeping, I am sorry for not  
>>> reply immediately.
>>> I am hacking itkLevelSetEquationChanAndVeseInternalTerm.*, but so  
>>> far I did not succeed yet, I will let you know and contribute my  
>>> code when it works properly!
>>> Thanks again.
>>>
>>> Best,
>>>
>>> Hui
>>>
>>> On Sun, Oct 2, 2011 at 10:20 PM, Arnaud Gelas <arnaud_gelas at hms.harvard.edu 
>>> > wrote:
>>> Dear Hui,
>>>
>>> In ITK3, the "evolution" class inherits from a ProcessObject and  
>>> you are right this is the typical way to add one more input to a  
>>> filter, to benefit from ITK's pipeline architecture.
>>>
>>> Here, LevelSetEquationChanAndVeseInternalTerm inherits from  
>>> LevelSetEquationTermBase, which inherits from Object. Thus a term  
>>> is not a filter, there is no input, no output.
>>> You can also add as many internal members. You can now decide what  
>>> is going to be inside your term.
>>>
>>> You can definitively add another InputImagePointer m_MeanImage.
>>>
>>> BTW, are you hacking itkLevelSetEquationChanAndVeseInternalTerm.* ?
>>>
>>> Arnaud
>>>
>>>
>>> On 10/02/2011 04:03 PM, Hui Tang wrote:
>>>>
>>>> Dear Arnaud,
>>>>
>>>> thanks for the quick reply!!!
>>>>
>>>> Yes you are very right, I need to do that by m_Mean = m_MeanImage- 
>>>> >GetPixel( iP ).
>>>>
>>>> By the way in ITK3 I used this- 
>>>> >ProcessObject::SetNthInput(1,InputImageType* image) to add one  
>>>> more image as input, but in ITK 4, it seems that ProcessObject is  
>>>> not a member function of  
>>>> itkLevelSetEquationChanAndVeseInternalTerm or
>>>> LevelSetEquationTermBase.
>>>>
>>>> I guess I can add one more  class member InputImageType*  
>>>> m_MeanImage?
>>>>
>>>> Thanks again for the reply.
>>>>
>>>>
>>>> Best,
>>>>
>>>>
>>>> Hui
>>>>
>>>>
>>>> Please, let us know if it works.
>>>>
>>>>
>>>> On Sun, Oct 2, 2011 at 9:21 PM, Arnaud Gelas <Arnaud_Gelas at hms.harvard.edu 
>>>> > wrote:
>>>> Hi Hui,
>>>>
>>>> The principle of Chan and Vese formulation is to assume there are  
>>>> two parts in your image: background and foreground and each of  
>>>> them are represented by a constant mean value.
>>>> In the implementation, we did follow the same principle, e.g. the  
>>>> mean is a scalar if you are working with scalar images, a vector  
>>>> if you are working with vector images, etc.
>>>>
>>>> So, now you want to create a new term / formulation (there might  
>>>> be a specific name for that, but I am not aware of it).
>>>> Once you provide the mean image, you need to replace m_Mean by  
>>>> the pixel value for the given input location iP. In your special  
>>>> case, most likely you would only need to change m_Mean by  
>>>> m_MeanImage->GetPixel( iP )
>>>>
>>>> Please, let us know if it works.
>>>>
>>>> Best,
>>>> Arnaud
>>>>
>>>>
>>>> On Oct 2, 2011, at 1:55 PM, Hui Tang wrote:
>>>>
>>>>> Dear Arnaud,
>>>>>
>>>>> That works!!Thanks!
>>>>> Now may I ask if my mean intensity is a constant over time but  
>>>>> varies in the image, so I will have a mean intensity image, how  
>>>>> can I add that to interal term? I know how to get and set image  
>>>>> to get the mean intensity image, but in update(), it seems that  
>>>>> this->mean can only be a scalar.......
>>>>>
>>>>> Do you have any idea on solve this?
>>>>>
>>>>> thanks,
>>>>>
>>>>> Best,
>>>>>
>>>>> Hui
>>>>>
>>>>>
>>>>>
>>>>> On Fri, Sep 30, 2011 at 3:14 PM, Arnaud Gelas <arnaud_gelas at hms.harvard.edu 
>>>>> > wrote:
>>>>> Hi Hui,
>>>>>
>>>>> Sorry, there was a typo in my previous email :-/...
>>>>>
>>>>> Here you go:
>>>>>
>>>>>     $ git checkout -t origin/v4.0b01
>>>>>
>>>>> Here are the *.h you are looking for
>>>>>
>>>>> $ find . | grep itkBinaryImageToWhitakerSparseLevelSetAdaptor.h
>>>>> ./Modules/Segmentation/LevelSetsv4/include/ 
>>>>> itkBinaryImageToWhitakerSparseLevelSetAdaptor.hxx
>>>>> ./Modules/Segmentation/LevelSetsv4/include/ 
>>>>> itkBinaryImageToWhitakerSparseLevelSetAdaptor.h
>>>>>
>>>>> To be able to use the LevelSetsv4, you should either build ITK  
>>>>> with all modules, or explicitly turn on the LevelSetsv4 one  
>>>>> (which is part of the Segmentation group).
>>>>>
>>>>> Please keep the conversation on the mailing list, other users  
>>>>> may have the same problem.
>>>>>
>>>>> Best,
>>>>> Arnaud
>>>>>
>>>>>
>>>>> On 09/30/2011 09:06 AM, Hui Tang wrote:
>>>>>>
>>>>>> Dear Arnaud,
>>>>>>
>>>>>> Thanks for your help.  I still can not find  
>>>>>> itkBinaryImageToWhitakerSparseLevelSetAdaptor.h in v4.0b1.
>>>>>> git shows the version number, so it should be right.....
>>>>>> Best,
>>>>>>
>>>>>> Hui
>>>>>> On Thu, Sep 29, 2011 at 7:05 PM, Hui Tang  
>>>>>> <tanghui.seu at gmail.com> wrote:
>>>>>> Hi arnaud thanks a loooooot for this! I will try, I will let  
>>>>>> you know how it works:) best hui
>>>>>>
>>>>>> Op 29 sep. 2011 18:55 schreef "Gelas, Arnaud Joel Florent" <Arnaud_Gelas at hms.harvard.edu 
>>>>>> > het volgende:
>>>>>>
>>>>>> > Hi Hui Tang,
>>>>>> >
>>>>>> > I am really happy to see you are interested and are testing  
>>>>>> the new level set infrastructure!
>>>>>> >
>>>>>> > If you get this error, I can only assume that you are now  
>>>>>> using the git master version of ITK, this file has been remove  
>>>>>> recently from the repository...
>>>>>> > I would strongly recommend to stick to ITK tags, since API  
>>>>>> keeps on changing all around the place in the toolkit.
>>>>>> >
>>>>>> > Here is how you'd get the last tagged version:
>>>>>> >
>>>>>> > $ git fetch --all
>>>>>> > $ git checkout -t origin/v4.0b1
>>>>>> >
>>>>>> > With this version, you should be able to find  
>>>>>> itkBinaryImageToWhitakerSparseLevelSetAdaptor.h
>>>>>> >
>>>>>> > If you are more adventurous, and want to be part of the  
>>>>>> development, you can use master, but expect API / files / class  
>>>>>> name to change.
>>>>>> > You can also create a gerrit account to review patches  
>>>>>> (instructions are on the wiki). Note that all contributions /  
>>>>>> inputs on this effort are welcome!!
>>>>>> >
>>>>>> > Now regarding your question, this is really easy to make it  
>>>>>> happened in the v4 infrastructure. You have two possibilities:
>>>>>> >
>>>>>> > 1- grab the code from iternal or external term (depending on  
>>>>>> your case); copy the code; you modify and remove the part in  
>>>>>> which the mean gets updated.
>>>>>> > and you add itkSetMacro to set the mean at the beginning.
>>>>>> >
>>>>>> > 2- you inherit, might need to change some method to virtual  
>>>>>> (if needed, let me know that'd be easy to fix).
>>>>>> >
>>>>>> > If you need more details on how to proceed for 1 or 2, just  
>>>>>> let me know, we can definitively give you some more details on  
>>>>>> how to proceed.
>>>>>> >
>>>>>> > Thanks,
>>>>>> >
>>>>>> > Best,
>>>>>> > Arnaud
>>>>>> >
>>>>>> > ________________________________________
>>>>>> > From: Hui Tang [tanghui.seu at gmail.com]
>>>>>> > Sent: Thursday, September 29, 2011 12:20 PM
>>>>>> > To: Gelas, Arnaud Joel Florent
>>>>>> > Subject: Questions about ITK4
>>>>>> >
>>>>>> > Dear Arnaud,
>>>>>> >
>>>>>> > How are you?
>>>>>> > I am using ITK4, but this headfile  
>>>>>> "itkBinaryImageToWhitakerSparseLevelSetAdaptor.h" can not be  
>>>>>> found in ITK4. Did I do anything wrong?
>>>>>> > And maybe you could help me with another question:) in  
>>>>>> chanvase model, if my I would like to have a fixed average  
>>>>>> intensity ("c1") for the foreground how can I implement that  
>>>>>> using ITK4?
>>>>>> >
>>>>>> > Thanks so much.
>>>>>> >
>>>>>> > Looking forward to your reply.
>>>>>> >
>>>>>> > Best,
>>>>>> >
>>>>>> > Hui Tang
>>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20111005/fc9caa6c/attachment.htm>


More information about the Insight-users mailing list