[Insight-users] Re: draft of adaptative threshold (itkConnectedThresholdImageFilter)

Luis Ibanez luis.ibanez@kitware.com
Wed, 19 Feb 2003 12:29:10 -0500


Hi Matheiu,


Could you please be more specific with your
statement that the process:

          "Doesn't work"

Do you mean:

1) doesn't compile ?
2) seg. faults ?
3) throws exceptions ?
4) produces a corrupted output image ?
5) produces a black image ?
6) ...?


----


 From your code example is not quite clear what you
want to do with the ConnectedThresholdImageFilter.

This filter applies a region growing algorithm.

It starts from your seed, and add connected pixels
under the rule that their intensities must be
inside the interval  defined by [lower,upper]
threshold.

The output of this filter is a binary image.

The filter is described in detail on the
SoftwareGuide.pdf

http://www.itk.org/ItkSoftwareGuide.pdf

Section 8.1.1, pdf pages 245-248.

You are not defining the Upper threshold in
your code...


---


I'm guessing that this is not the filter you are
intending to use here. Probably what you want is
a simple thresholder.  If this is the case, you
may want to look at the

      BinaryThresholdImageFilter

Described in the SoftwareGuide:


Section 5.1, pdf-pages 89-91.


This is a more typical pixe-wise thresholding filter.

Note that the output image is a binary image, for
which you have to provide the value to be used
inside and the value to be used outside.

Again, this is explained in detail in the SoftwareGuide.
Examples for these two filters are available under

Insight/Examples/Filtering/BinaryThresholdImageFilter.cxx

    and

Insight/Examples/Segmentation/ConnectedThresholdImageFilter.cxx



Please let us know if your have further questions
after reading these sections of the SoftwareGuide.



    Thanks



      Luis



BTW, if what you want to do is vessel segmentation,
you may find interesting the example of Curve2DExtraction
which is designed to extract the medial lines of vessels
from fluoroscopic images.


     http://www.itk.org/HTML/Curve2DExtraction.htm








================================================

Hi all,

   Before starting to write a new algorithm for adaptative threshold.  I
tried first to validate it with already existing filters.
   So here is the way I tried.

     First the user select a certain number of points *inside* the vessel
(30 for example). And then I try to threshold the whole
    image but region by region. I work 3 points at a time, the first one
is the left boundary,  the second one the seed for the
    threshold filter and the third one is the right boundary (the second
point is of course between the first one and the third one).

   As there is an intensity associated to each point (and I am sure it's
inside the vessel) I can give more accurate value for
   the threshold algorithm (compared to a global intensity value for the
whole image, I have here a local value for each region).

   So here is a part of my algorithm that doesn't work:


     //begining of code
     typedef itk::ExtractImageFilter<InternalImageType,
InternalImageType> ImageExtracter;
     ImageExtracter::Pointer extracter = ImageExtracter::New();
     typedef itk::ConnectedThresholdImageFilter<InternalImageType,
InternalImageType> ThresholdFilter;
     ThresholdFilter::Pointer threshold = ThresholdFilter::New();

     extracter->SetInput(.....);    //come from file reading
     threshold->SetInput(extracter->GetOutput());

     IndexType start;
     IndexType seed;
     SizeType  size;

     for(int i=0; i<numPoints; i+=2) {
         RegionType region;

         start[0] =  ...  //this is one of the user selected points
         start[1] =  ...  //...
         start[2] =  ...

         size[0] = ...
         size[1] = ...
         size[2] = ...

         seed[0] = ...
         seed[1] = ...
         seed[2] = ...

         region.SetIndex( start );
         region.SetSize( size );

         extracter->SetExtractionRegion( region );

         threshold->SetSeed( seed );
         threshold->SetLower(....);   //intensity at seed * coefficient

         //threshold->Modified();   //doesn't make any difference
         threshold->Update();
     }

    //end of code, where I would like to save threshold->GetOutput()


How can I force the pipeline to update the threshold filter at each loop.
If I am doing it the wrong way, could you please tell me what is the
right way to do it.

Thank you,
mathieu