<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Generator" CONTENT="MS Exchange Server version 6.5.7654.12">
<TITLE>RE: [Insight-users] itkScalarChanAndVeseSparseLevelSetImageFilter</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/plain format -->
<P><FONT SIZE=2>Hello,<BR>
thank you. You are right, changing the epsilon parameter makes my results closer to the expected ones.<BR>
Based on the CVS realease before 10 days:<BR>
1. RMS Change values are very high. Have you already fixed this?<BR>
2. Concerning the observer:<BR>
I use<BR>
LevelSetType::Pointer levelSetFilter = LevelSetType::New();<BR>
levelSetFilter->SetFunctionCount( 1 );<BR>
levelSetFilter->SetFeatureImage( InputImage );<BR>
levelSetFilter->SetLevelSet( 0, InitialLevelSet );<BR>
levelSetFilter->SetNumberOfIterations( nb_iteration );<BR>
levelSetFilter->SetMaximumRMSError( rms );<BR>
levelSetFilter->SetUseImageSpacing( 1 );<BR>
<BR>
typedef itk::AtanRegularizedHeavisideStepFunction< InputPixelType, InputPixelType > DomainFunctionType;<BR>
DomainFunctionType::Pointer domainFunction = DomainFunctionType::New();<BR>
domainFunction->SetEpsilon( epsilon );<BR>
levelSetFilter->GetDifferenceFunction(0)->SetDomainFunction( domainFunction );<BR>
levelSetFilter->GetDifferenceFunction(0)->SetCurvatureWeight( mu );<BR>
levelSetFilter->GetDifferenceFunction(0)->SetAreaWeight( nu );<BR>
levelSetFilter->GetDifferenceFunction(0)->SetLambda1( l1 );<BR>
levelSetFilter->GetDifferenceFunction(0)->SetLambda2( l2 );<BR>
<BR>
typedef CommandIterationUpdate ObserverType;<BR>
ObserverType::Pointer pObserver = ObserverType::New();<BR>
pObserver->SetInput(renWin, inter, ren);<BR>
levelSetFilter->AddObserver( itk::IterationEvent() , pObserver);<BR>
levelSetFilter->Update();<BR>
<BR>
<BR>
and inside the observer:<BR>
<BR>
void Execute(itk::Object *caller, const itk::EventObject & event)<BR>
{<BR>
//Execute( (const itk::Object *)caller, event);<BR>
<BR>
LevelSetFilterPointer LevelSetFilter =<BR>
dynamic_cast< LevelSetFilterPointer >( caller );<BR>
if( ! itk::IterationEvent().CheckEvent( &event ) )<BR>
{<BR>
return;<BR>
}<BR>
<BR>
//to binary volume<BR>
LevelSetVesselSegmentation::InputImageType::Pointer currentLevelSet = LevelSetFilter->GetLevelSet(0);<BR>
typedef itk::BinaryThresholdImageFilter< LevelSetVesselSegmentation::InputImageType, LevelSetVesselSegmentation::OutputImageType > ThresholdingFilterType;<BR>
ThresholdingFilterType::Pointer thresholder = ThresholdingFilterType::New();<BR>
thresholder->SetInput(currentLevelSet);<BR>
thresholder->SetUpperThreshold( 0.0 );<BR>
thresholder->SetOutsideValue( 0 );<BR>
thresholder->SetInsideValue( 255 );<BR>
thresholder->Update();<BR>
LevelSetVesselSegmentation::OutputImageType::Pointer thresholded_image = thresholder->GetOutput();<BR>
<BR>
but I dint get correct results between the iterations<BR>
<BR>
Thank you very much<BR>
<BR>
Regards,<BR>
Eleni<BR>
<BR>
<BR>
<BR>
-----Original Message-----<BR>
From: Kishore Mosaliganti [<A HREF="mailto:kishoreraom@gmail.com">mailto:kishoreraom@gmail.com</A>]<BR>
Sent: Tue 6/16/2009 5:19 AM<BR>
To: Sgouritsa, Eleni<BR>
Cc: insight-users@itk.org<BR>
Subject: Re: [Insight-users] itkScalarChanAndVeseSparseLevelSetImageFilter<BR>
<BR>
HI Eleni,<BR>
<BR>
Between the IJ and the Review code, we made one significant modification.<BR>
The heaviside regularization function was not being correctly applied in the<BR>
formula to compute the global constants. So, we changed that.<BR>
<BR>
This will change the boundary of your segmentation in a minor way. I think<BR>
that is what you are observing. If you were to change the SetEpsilon( 1 ) to<BR>
SetEpsilon(0.1), you will probably see the old result.<BR>
<BR>
In your previous email, you reported problems with using the Observer and<BR>
negative origins. Is that working out now? If not, can you elaborate your<BR>
experience. This will help us.<BR>
<BR>
Thanks,<BR>
Kishore<BR>
<BR>
<BR>
On Sun, Jun 14, 2009 at 11:29 PM, Sgouritsa, Eleni<BR>
<esgourit@central.uh.edu>wrote:<BR>
<BR>
> Hello Kishore,<BR>
> I tried the new filter (latest CVS) also in more data. In all it works well<BR>
> but the segmentation is always an augmented version of the correct<BR>
> segmentation.As we discussed, the filter now gives a very good result, but<BR>
> still the segmentation expands outside the real boundary of the data (see<BR>
> dataset 1). We could probably think that this is not a problem because<BR>
> probably that is the result that Chan and Vese method can give. However, the<BR>
> insight journal code gave the correct segmentation so I was wondering if<BR>
> there is still a bug or a difference between insight code and itk last<BR>
> release.<BR>
> Thank you for the help.<BR>
><BR>
> Regards,<BR>
> Eleni<BR>
><BR>
> -----Original Message-----<BR>
> From: Kishore Mosaliganti [<A HREF="mailto:kishoreraom@gmail.com">mailto:kishoreraom@gmail.com</A><kishoreraom@gmail.com><BR>
> ]<BR>
> Sent: Mon 6/8/2009 1:02 PM<BR>
> To: Sgouritsa, Eleni<BR>
> Cc: insight-users@itk.org<BR>
> Subject: Re: [Insight-users] itkScalarChanAndVeseSparseLevelSetImageFilter<BR>
><BR>
> Hi Eleni,<BR>
><BR>
> Can you update your ITK code repository and try your data again. We made<BR>
> several modifications over the weekend and also took care of 2 important<BR>
> bugs. The first bug related to the computation of the foreground constant<BR>
> and the second bug related the Halt() method that you pointed out.<BR>
> Currently, we are looking into the negative origin issue.<BR>
><BR>
> The first bug is critical and that definitely is one reason why your output<BR>
> differs from the Insight journal submission.<BR>
><BR>
><BR>
> Kishore<BR>
><BR>
> On Sun, Jun 7, 2009 at 4:30 PM, Sgouritsa, Eleni <esgourit@central.uh.edu<BR>
> >wrote:<BR>
><BR>
> > Hello,<BR>
> > thank you very much for the help. Unfortunately I work with medical data<BR>
> > that I am not supposed to give.<BR>
> > Can you explain a little more point 2. You mean that I have to define my<BR>
> > level set as inside positive and outside negative to have the opposite<BR>
> > propagation direction?<BR>
> > I tried it but it did not work. I both cases, if I initialize the LS<BR>
> inside<BR>
> > the boundary of my data, it shrinks. I use mu=0, nu=0, l1=1 and l2=1. Do<BR>
> I<BR>
> > need negative l1?When I initialize almost the whole LS outside my data it<BR>
> > seems to work in some cases.Generally, I get different results from the<BR>
> > insight journal that I was getting correct.<BR>
> ><BR>
> > Thank you,<BR>
> > Eleni<BR>
> ><BR>
> ><BR>
> > -----Original Message-----<BR>
> > From: Kishore Mosaliganti [<A HREF="mailto:kishoreraom@gmail.com">mailto:kishoreraom@gmail.com</A><kishoreraom@gmail.com><BR>
> <kishoreraom@gmail.com><BR>
> > ]<BR>
> > Sent: Fri 6/5/2009 1:02 PM<BR>
> > To: Sgouritsa, Eleni<BR>
> > Cc: Luis Ibanez; insight-users@itk.org<BR>
> > Subject: Re: [Insight-users]<BR>
> itkScalarChanAndVeseSparseLevelSetImageFilter<BR>
> ><BR>
> > Hi Eleni,<BR>
> ><BR>
> > Thank you for pointing out these problems. You are right that the Review<BR>
> > code is not very stable as yet. We are working on fixing them. During the<BR>
> > transfer from the IJ paper to the Review directory, a lot of<BR>
> modifications<BR>
> > were made. We might have inadvertently introduced new errors.<BR>
> ><BR>
> > Regarding your problems:<BR>
> ><BR>
> > 2. The level-set function is defined by convention as inside is negative<BR>
> > and<BR>
> > outside is positive. So the negative values become your foreground and<BR>
> > positive values become the background. This controls the propagation<BR>
> > direction.<BR>
> ><BR>
> > 3. I am looking at the Halt function. Looks like the boundary case of 0<BR>
> > iterations is not coded right.<BR>
> ><BR>
> > 4. Regarding the high RMS values, the level-set function is<BR>
> re-initialized<BR>
> > to a signed distance function after every few iterations. It so happens<BR>
> > that<BR>
> > the default setting is 1 iteration. Hence, the RMS change is being<BR>
> > calculated after the reinitialization while it needs to be done before.<BR>
> We<BR>
> > are also working on correcting this. Thank you for pointing this out.<BR>
> ><BR>
> ><BR>
> > Is it possible for you to post a small sample of your data for us to work<BR>
> > on<BR>
> > the errors.<BR>
> ><BR>
> ><BR>
> > Kishore<BR>
> ><BR>
> > On Tue, Jun 2, 2009 at 11:24 AM, Sgouritsa, Eleni<BR>
> > <esgourit@central.uh.edu>wrote:<BR>
> ><BR>
> > > Hello,<BR>
> > > I m sorry if my point was not clear. The problems that I am facing<BR>
> using<BR>
> > > this class to segment 3D data are the following:<BR>
> > ><BR>
> > > 1. My data has negative origin (for example (-100, -100, -60). Unless I<BR>
> > do<BR>
> > > SetOrigin(0,0,0) (or I guess any origin >=0) my program crashes. I have<BR>
> > to<BR>
> > > set my negative origin as zero for my program to run. Does the class<BR>
> > assumes<BR>
> > > positive origin of the input image?<BR>
> > ><BR>
> > > 2. I initialize my level set inside (so the evolution should be<BR>
> > outwards).<BR>
> > > In this case I can not make my level set expand (it can just shrink, or<BR>
> > not<BR>
> > > move). I think I should use something like SetReverseExpansionDirection<BR>
> > to<BR>
> > > control the propagation direction, but I can not find this option in<BR>
> the<BR>
> > > class public members. (This is currently my main problem where I am<BR>
> > stuck,<BR>
> > > any help would be very useful!)<BR>
> > ><BR>
> > > 3. The maximum RMS Error serves (along with the number of iterations)<BR>
> as<BR>
> > a<BR>
> > > stopping criteria inside the Halt function (of<BR>
> > > itkMultiphaseFiniteDifferenceImageFilter.txx file).<BR>
> > > Lets say I set maximum RMS Error = 0.01.<BR>
> > > The Halt function returns the following:<BR>
> > > return ( (this->GetElapsedIterations() >= this->m_NumberOfIterations)<BR>
> ||<BR>
> > > ( this->GetMaximumRMSError() >= m_RMSChange ) );<BR>
> > > While the Halt function returns false the evolution continues.<BR>
> > > However, in iteration 0, I get m_RMSChange = 0, so the evolution always<BR>
> > > stops doing 0 iterations (since the condition<BR>
> this->GetMaximumRMSError()<BR>
> > >=<BR>
> > > m_RMSChange becomes true)<BR>
> > > If I modify the Halt function to returm the following:<BR>
> > > if(this->GetElapsedIterations()==0)<BR>
> > > return false;<BR>
> > > else<BR>
> > > return ( (this->GetElapsedIterations() >=<BR>
> > > this->m_NumberOfIterations) || ( this->GetMaximumRMSError() >=<BR>
> > m_RMSChange )<BR>
> > > );<BR>
> > > then it works.<BR>
> > > The other problem is that RMSChange in the next iterations (1,2,3...)<BR>
> has<BR>
> > > very big values (like 5000) even near convergence. So the only way to<BR>
> > stop<BR>
> > > the evolution is through the iterations number.<BR>
> > ><BR>
> > > I am still investigating the class and I am not absolutely sure about<BR>
> the<BR>
> > > points mentioned but I would like to share with you for more advice.<BR>
> > ><BR>
> > ><BR>
> > > Thank you very much,<BR>
> > > Lena<BR>
> > ><BR>
> > ><BR>
> > ><BR>
> > ><BR>
> > > -----Original Message-----<BR>
> > > From: Luis Ibanez [<A HREF="mailto:luis.ibanez@kitware.com">mailto:luis.ibanez@kitware.com</A><luis.ibanez@kitware.com><BR>
> <luis.ibanez@kitware.com><BR>
> > <luis.ibanez@kitware.com><BR>
> > > ]<BR>
> > > Sent: Mon 6/1/2009 8:39 PM<BR>
> > > To: Sgouritsa, Eleni<BR>
> > > Cc: alex gouaillard; insight-users@itk.org<BR>
> > > Subject: Re: [Insight-users]<BR>
> > itkScalarChanAndVeseSparseLevelSetImageFilter<BR>
> > ><BR>
> > ><BR>
> > > Hi Lena,<BR>
> > ><BR>
> > > Could you please be more specific about your problem report on<BR>
> > > item (2) ?<BR>
> > ><BR>
> > > Is there a chance that you can report this in a form that<BR>
> > > we could reproduce ?<BR>
> > ><BR>
> > ><BR>
> > > Thanks<BR>
> > ><BR>
> > ><BR>
> > > Luis<BR>
> > ><BR>
> > ><BR>
> > > -----------------------------<BR>
> > > Sgouritsa, Eleni wrote:<BR>
> > > > Hi,<BR>
> > > ><BR>
> > > > I have two more questions.<BR>
> > > > 1. In the insight journal code there was an option<BR>
> > > > SetReverseExpansionDirection to control if the expansion of the level<BR>
> > > > set will be inwards or outwards. How can I do it using the<BR>
> > > > itkScalarChanAndVeseSparseLevelSetImageFilter of 3.14 release?<BR>
> > > ><BR>
> > > > 2. I still have a problem when my 3D data have negative origin.<BR>
> > > ><BR>
> > > > Thanks and regards,<BR>
> > > > Lena<BR>
> > > ><BR>
> > > > -----Original Message-----<BR>
> > > > From: Sgouritsa, Eleni<BR>
> > > > Sent: Mon 6/1/2009 4:00 AM<BR>
> > > > To: alex gouaillard<BR>
> > > > Cc: insight-users@itk.org<BR>
> > > > Subject: RE: [Insight-users]<BR>
> > > itkScalarChanAndVeseSparseLevelSetImageFilter<BR>
> > > ><BR>
> > > > Hello,<BR>
> > > > finally the second issue was my fault (I just had a problem while<BR>
> > > > including the header files of the review folder).<BR>
> > > > For the first, the inconsistency is just a matter of name. The code<BR>
> > runs<BR>
> > > > correctly, just the name assignement in the txx is a little<BR>
> misleading.<BR>
> > > ><BR>
> > > > Thank you very much,<BR>
> > > > Lena<BR>
> > > ><BR>
> > > ><BR>
> > > > -----Original Message-----<BR>
> > > > From: alex gouaillard [<A HREF="mailto:alexandre_gouaillard@hms.harvard.edu">mailto:alexandre_gouaillard@hms.harvard.edu</A><alexandre_gouaillard@hms.harvard.edu><BR>
> <alexandre_gouaillard@hms.harvard.edu><BR>
> > <alexandre_gouaillard@hms.harvard.edu><BR>
> > > ]<BR>
> > > > Sent: Sun 5/31/2009 11:34 PM<BR>
> > > > To: Sgouritsa, Eleni<BR>
> > > > Cc: insight-users@itk.org<BR>
> > > > Subject: Re: [Insight-users]<BR>
> > > itkScalarChanAndVeseSparseLevelSetImageFilter<BR>
> > > ><BR>
> > > > hi eleni,<BR>
> > > ><BR>
> > > > we'll take a look tomorrow.<BR>
> > > ><BR>
> > > > thanks for the feedback.<BR>
> > > ><BR>
> > > > alex.<BR>
> > > ><BR>
> > > > On May 31, 2009, at 11:52 PM, Sgouritsa, Eleni wrote:<BR>
> > > ><BR>
> > > > > Hello,<BR>
> > > > > I know that the review folder of the new release (3.14) is not<BR>
> > > > > stable yet but I would just like to give two comments:<BR>
> > > > ><BR>
> > > > > 1. I found an inconsistency between the template arguments of the<BR>
> > > > > itkScalarChanAndVeseSparseLevelSetImageFilter.h and the<BR>
> > > > > itkScalarChanAndVeseSparseLevelSetImageFilter.txx.<BR>
> > > > > Specifically, in the header file, the template is :<BR>
> > > > > template < class TInputImage, class TFeatureImage, class<BR>
> > > > > TOutputImage, class TFunction,<BR>
> > > > > class TSharedData, typename TIdCell = unsigned int ><BR>
> > > > > whereas in the txx it is:<BR>
> > > > > template < class TInput, class TFeature, class TFunction,<BR>
> > > > > class TOutputPixel, class TSharedData, typename TIdCell ><BR>
> > > > > There is a change in the order of the 3rd and 4th argument.<BR>
> > > > ><BR>
> > > > > 2. I can not find this class<BR>
> > > > > (itkScalarChanAndVeseSparseLevelSetImageFilter) incuded in the<BR>
> > > > > CMakeLists of the review folder<BR>
> > > > ><BR>
> > > > > Regards,<BR>
> > > > > Lena<BR>
> > > > ><BR>
> > > > > <ATT00001.txt><BR>
> > > ><BR>
> > > ><BR>
> > > ><BR>
> > > ><BR>
> > > ><BR>
> > ------------------------------------------------------------------------<BR>
> > > ><BR>
> > > > _____________________________________<BR>
> > > > Powered by www.kitware.com<BR>
> > > ><BR>
> > > > Visit other Kitware open-source projects at<BR>
> > > > <A HREF="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/opensource/opensource.html</A><BR>
> > > ><BR>
> > > > Please keep messages on-topic and check the ITK FAQ at:<BR>
> > > <A HREF="http://www.itk.org/Wiki/ITK_FAQ">http://www.itk.org/Wiki/ITK_FAQ</A><BR>
> > > ><BR>
> > > > Follow this link to subscribe/unsubscribe:<BR>
> > > > <A HREF="http://www.itk.org/mailman/listinfo/insight-users">http://www.itk.org/mailman/listinfo/insight-users</A><BR>
> > ><BR>
> > ><BR>
> > > _____________________________________<BR>
> > > Powered by www.kitware.com<BR>
> > ><BR>
> > > Visit other Kitware open-source projects at<BR>
> > > <A HREF="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/opensource/opensource.html</A><BR>
> > ><BR>
> > > Please keep messages on-topic and check the ITK FAQ at:<BR>
> > > <A HREF="http://www.itk.org/Wiki/ITK_FAQ">http://www.itk.org/Wiki/ITK_FAQ</A><BR>
> > ><BR>
> > > Follow this link to subscribe/unsubscribe:<BR>
> > > <A HREF="http://www.itk.org/mailman/listinfo/insight-users">http://www.itk.org/mailman/listinfo/insight-users</A><BR>
> > ><BR>
> > ><BR>
> ><BR>
> ><BR>
><BR>
><BR>
<BR>
</FONT>
</P>
</BODY>
</HTML>