[Insight-users] itkConstNeighborhoodIterator and degenerate regions (was RE: [Ins ight-users] Degenerated volumes question)

Miller, James V (Research) millerjv at crd . ge . com
Tue, 26 Aug 2003 16:23:45 -0400


Josh,

I put in a change to ConstNeighborhoodIterator::SetEndIndex() (which is
called 
by Initialize()) such that if a region has no pixels (because one of the
components
of the size is zero), then the EndIndex is set to the BeginIndex.  This
ensures
that IsAtEnd() is immediately satisfied on regions that have no pixels.

This will address a number of number of crashes when a face from the face
calculator 
has no pixels.

Jim

> -----Original Message-----
> From: Miller, James V (Research) [mailto:millerjv at crd . ge . com]
> Sent: Tuesday, August 26, 2003 4:05 PM
> To: 'Benjamin King'; Luis Ibanez; ITK
> Cc: Josh Cates (E-mail)
> Subject: RE: [Insight-users] Degenerated volumes question
> 
> 
> Benjamin,
> 
> I ran your test and it crashed for me.  Thanks for pulling 
> this together.
> I changed the line of code in the MorphologyImageFilter that 
> I suggested
> and your program does not crash for me anymore.
> 
> I checked in the change.  However, this does illustrate we 
> have a bug in the
> 
> NeighborhoodIterators when they are told to walk a region that has no
> pixels.
> The IsAtEnd condition should be immediately satisfied in this 
> case. I'll
> start
> looking at that next.
> 
> Thanks.
> Jim
> 
> > -----Original Message-----
> > From: Benjamin King [mailto:king . benjamin at mh-hannover . de]
> > Sent: Tuesday, August 26, 2003 11:51 AM
> > To: Miller, James V (Research); Luis Ibanez; ITK
> > Subject: Re: [Insight-users] Degenerated volumes question
> > 
> > 
> > Hello James and Luis,
> > 
> > thank you for your quick replies! I have attached code and 
> data that 
> > demonstrate the problem. The name of the image is hardcoded 
> into the 
> > program and I have added hopefully useful comments. In the 
> > current setup, I 
> > get a segfault for region 13. I also included a pad filter 
> > and if just some 
> > minimal padding is added then the program runs just fine. The 
> > try-catch 
> > block doesn't reveal anything, so I think that it's really a 
> > segmentation 
> > fault.
> > 
> > > Just saying
> > > you have a bug with small regions in ITK is not a very 
> > graceful way to
> > > report a bug.
> > 
> > =D
> > 
> > 
> > Best regards,
> >   Benjamin
> > 
> > 
> > -- 
> > Benjamin King
> > Institut fur Medizinische Informatik
> > Medizinische Hochschule Hannover
> > Tel.: +49  511  532-2663
> > 
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk . org
> http://www . itk . org/mailman/listinfo/insight-users
>