[Insight-users] Problem with offset calculation in VOI

Luis Ibanez luis.ibanez at kitware.com
Wed Apr 23 12:31:44 EDT 2008


Hi Mikhail,


Thaks a lot for running the tests and posting the additional
information.

It seems that your code may be revealing the presence of a bug
in the pipeline computation of the ThresholdSegmentation filter.

The method that computes the requested region of an input image
is called:


         GenerateInputRequestedRegion()


This method, in the itkThresholdSegmentationLevelSetImageFilter
class is inherited from its base ancestor class from the following
hierarchy:


      itk::ProcessObject (implemented)
                     |
      itk::ImageSource
                     |
      itk::ImageToImageFilter (implemented)
                     |
      itk::InPlaceImageFilter
                     |
      itk::InPlaceImageFilter
                     |
      itk::FiniteDifferenceImageFilter (implemented)
                     |
      itk::SparseFieldLevelSetImageFilter
                     |
      itk::SegmentationLevelSetImageFilter
                     |
      itk::ThresholdSegmentationLevelSetImageFilter



The marks of "(implemented)" indicate the classes that
provide an implementation of the GenerateInputRequestedRegion()
method.


Could you please help us to identify in which one of this
levels the error is actually happening ?


It seems that Windows is your platform, is that right ?
If so, what you could do is to enable in your visual
studio to "break when exceptions" occurr. This is an
option that you will find in the Debug section of
the project Properties.

Enable to break on C++ exceptions,

Then rerun your minimal example, that has the ThresholdSegmentation
filter, and identify in what specific class, this exception is
being thrown. (your current report shows the DataObject, but that's
not necessarily where the error has originated).

Once the exception is generated, what we will like to see is the
callback sequence that led to it.

It will be great if you could post that callback sequence to the
mailing list.


     Thanks


         Luis


-----------------------
Mikhail Kirillov wrote:
> Hi Luis,
> First of all, thank you for showing interest in my problem!
>  
> I'm using ITK 3.4.0 (newest release 3.6.0 is being compiled as I write 
> this).
>  
> As I mentioned in my original post, I've tried using 
> itkExtractImageFilter and itkCropImageFilter instead of vtkExtractVOI, 
> but I still get the same error.
> If I don't apply any segmentation, and just extract VOI, pipeline it to 
> ITK, then immediately pipeline it back to VTK (without passing it 
> through any filters in between), and then try to render it using Ray 
> Casting, everything works fine. Besides, when I Print(cout) the image 
> after each connection, all the values are 100% consistent.
>  
> Back to your request.
>  
> 1. Done :)
> 2. I've tried to remove all filters and some of the filters in all 
> possible combinations (likely there are only 3 of them), and I noticed 
> that as soon as I remove itkThresholdSegmentationLevelSetImageFilter 
> from the pipeline, I don't get the error message anymore. Unfortunately, 
> I don't get any segmentation either :(
> 3. Done
> 4. Done
> 
> I've modified the code as you requested, and this is the output I get 
> (when not removing the threshold segmentation filter and thus getting 
> the exception):
>  
> // Requested region
> *ImageRegion (030BB284)
>   Dimension: 3
>   Index: [0, 0, 0]
>   Size: [351, 202, 2]*
> ** 
> // Largest possible region
> *ImageRegion (030BB268)
>   Dimension: 3
>   Index: [153, 171, 0]
>   Size: [351, 202, 2]*
> ** 
> It seems to me that itkThresholdSegmentationLevelSetImageFilter somehow 
> shifts the index of the region's origin to [0,0,0] on a global space, 
> and therefore tries to access something that is outside of the region.
> If I try to extract the whole slice (say XY plane), it works fine. But I 
> need to extract sub-volume.
> Also, if I select a region close enough to the origin of the volume, and 
> set seed pixel to the center of the selected region, I still get the 
> error, but I also get some segmentation results that appear close to the 
> side of the region (not in the center).
>  
> Is it possible to save extracted region as a completely separate 
> instance of itk::Image? With it's origin being defined at index = [0,0,0].
> I've tried using itkImadeDuplicator class, but it copies the index 
> information as well.
> Actually, after extracting the VOI, I don't really need the rest of the 
> data.
>  
> Kind regards,
> Mikhail.


More information about the Insight-users mailing list