Hi,<br><br>For a while I've been using the Chan & Vese level set segmentation classes from <a href="http://www.insight-journal.org/browse/publication/322" target="_blank">http://www.insight-journal.org/browse/publication/322</a> and <a href="http://www.insight-journal.org/browse/publication/323" target="_blank">http://www.insight-journal.org/browse/publication/323</a>. (kudos to the authors!)<br>
For anyone planning to use this code in the future, here are some bugs I noticed (I didn't really look at the sparse implementation, this is for the function/dense filter code only):<br><br>- itkAtanRegularizedHeavisideStepFunction.h - in CalculateDerivative: derivative should be 1/pi*1/epsilon*1/(1+(x/epsilon)^2), not 1/pi*1/(1+(x/epsilon)^2) (most people use epsilon==1 so there may be no noticable difference)<br>
<br>- itkRegionBasedLevelSetFunction.txx - in ComputeGlobalTerm: in the part that calculates the overlap term of the update, there's a call to ComputeOverlapParameters which is only calculated when the overlap penalty weight is non-zero. However ComputeOverlapParameters also calculates an extra value called 'product' in the code, which holds product_{ i != current function id } (1-Heaviside(level set i)). This term is required to calculate the background term of the update (u_0 - backgroundAverage)^2*product. This means that if the overlap penalty isn't 0 the background intensity term is calculated correctly, but if the overlap penalty is 0, then '1' is used for 'product' instead of product_{ i != current function id } (1-Heaviside(level set i)). Should be modified so that product is calculated regardless of the overlap penalty.<br>
<br>- itkMultiphaseDenseFiniteDifferenceImageFilter - in ApplyUpdate: has a variable m_ReinitializeCounter that is meant to reinitalise the level set function to a signed distance function every m_ReinitalizeCounter iterations. However at the moment if the filter doesn't reinitalize the level set function, it won't update it either. (It should update every iteration, reinitalize every m_ReinitializeCounter iterations instead of only update & reinitalize every m_ReinitializeCounter iterations, and do nothing on the other iterations). At the moment users won't notice a difference because you can't set m_ReinitializeCounter with public access.<br>
<br>- itkMultiphaseDenseFiniteDifferenceImageFilter - in CopyInputToOutput - at the moment calling GetOutput() on the dense level set filter will return the segmentation given by the highest-index level set function. It should really give the segmentation given by all level sets - according to the sparse filter, GetOutput() should return an image that is default 0, and takes the value i where the i'th level set indicates this region is foreground (value < 0). In the case of overlap the highest index wins. Just need to initialise the output with FillBuffer(0) and remove the 'else' clause from 'if (in.Get() < 0)'<br>
<br>- possibly want to make ComputeHessian virtual in itkRegionBasedLevelSetFunction.h so that subclasses could override it (debatable, not really a bug)<br><br>If unwilling to change the original files you could create a subclass and override the respective functions with the fixes.<br>
<br>cheers,<br>Amy<br><br>