[Insight-users] Degenerated volumes question

Luis Ibanez luis . ibanez at kitware . com
Tue, 26 Aug 2003 09:52:19 -0400


Hi Benjamin,

I agree with you in that a seg. fault shouldn't be
the response to degenerate volumes provided as inputs.

We should probably throw an exception instead.

The morphological filter should verify whether the
extent of the input image is large enough for holding
the structuring element or not. When the extent is not
large enough, an exception should be thrown.

 From the application point of view, that will not move
you any further, since after all, the response of you
application to this exception will probably be to pad
the degenerate input image with some region around and
then try it as input for the morphological operator.

You could prevent the entire situation from happening by
taking into account the radius of your structuring element
when you are computing the region to be extracted with
the RegionOfInterest filter.

---

BTW, are you certain that the error you get is a seg. fault
and not an exception ?

Note that the Morphological filters are already padding
the requested region at the input using the radius of
the structuring element. You will find this logic on the
file

Insight/Code/BasicFilters/itkMorphologyImageFilter.txx

in lines 63-85.




   Regards,


      Luis


--------------------
Benjamin King wrote:
> Hi all,
> 
> I'm working on a program that takes a labled volume and then finds the 
> minimal itk::Region that contains all voxels with a certain label. I 
> often get very small regions i.e. with a size of (1,8,4). Extracting 
> them with itk::RegionOfInterestImageFilter and afterwards applying 
> morphological operations often (but not always) results in segmentation 
> faults.
> 
> Padding the small regions will probably fix this but I was wondering if 
> it would be possible to hide this in the MorphologyImageFilter class. 
> After all these filters have to handle boundary conditions anyway, 
> haven't they?
> 
> I also think that a segmentation fault is not a very graceful way to 
> handle degenerated volumes.
> 
> 
> Best regards,
>  Benjamin
>