[vtkusers] 2D/3D Threshold and link filters

Asad A. Abu-Tarif tarifa at rpi.edu
Thu Mar 1 15:54:37 EST 2001


Hello,
I sent the appended message to the list about a week ago but got rejected
because I attached
the source code with the message and the email got big.
Anyways, I put the classes in the following web-site for download. If anyone
is interested, you can
download them from the web.

Asad


Hi vtkers,
I developed two classes that threshold a gradient image and link it using
two thresholds, strong and weak thresholds. They are attached to this email.
Now, I'll start by describing the intuition behind those two classes and the
basic idea. Then, I'll show the old pipeline (the one that's usually used)
and the new one (using one of the two classes attached).

I hope that those clases will be helpful to someone. I'll be happy to answer
any questions!!

Regards,
Asad

       ___________________________________________________
     /                        Asad A. Abu-Tarif
\
     |   Computer Engineering.
|
     |   PhD Candidate, Rensselaer Polytechnic Institute (RPI).
|
     |   Research Assistant, NYS Center for Automated Technologies         |
     |   tarifa at rpi.edu
|
     |    Tel (O): 518-276-2991
|
     |    Fax:  313-557-6100
|
     \____________________________________________________/


================================================================
* Intuition and Basic Idea:
After finding the gradient of an image, thresholding is usually the next
step. However, in a lot of practical applications you can't find a single
threshold that can give satisfactory results. On the other hand, it is
usually easier to find a threshold value at which the resulting thresholded
image will have all correct edgels and no false ones but it won't find all
of the correct edgels (false negative, if you well). It is also possible to
find another smaller threshold value where all the good edgels are included
but you've added few false edgels in the mix (false positive).
Having said that, a more clever thresholding approach would be to threshold
using the strong threshold (that results in the false negative case). Then,
try to extend (link) the edgels using the weak threshold. Finally, for each
set of connected edgels, if the total number of edgels in that link
(connected set of edgels) is less than a certain length value, then discard
that link and all of its edgels.

The two attached classes perform exactly this operation. The difference
between the two is that vtkLinkIn2DandThreshold tries to extend (link)
edgels in the same slice. In other words, it links edgels in 2D. On the
other hand, vtkLinkIn3DandThreshold tries to extend (link) edgels in the
same volume. In other words, it links edgels in 3D.

It remains to say that in vtkLinkIn2DandThreshold I used 8 neighbors to
connectivity. In vtkLinkIn3DandThreshold I used 26 neighbors for
connectivity.


================================================================
* Old pipeline:
vtkImageGradient *gradient=vtkImageGradient::New();
gradient->SetInput(InputData);

vtkImageGradientMagnitude
*gradientmagnitude=vtkImageGradientMagnitude::New();
gradientmagnitude->SetInput(InputData);

vtkImageNonMaximumSuppression
*suppress=vtkImageNonMaximumSuppression::New();
suppress->SetVectorInput(gradient);
suppress->SetMagnitudeInput(gradientmagnitude);

vtkImageThreshold *theshold=vtkImageThreshold::New();
threshold->SetInput(suppress->GetOutput());
threshold->ThresholdByLower(thresholdvalue);
// then you can display the result or pass it through other filters.



================================================================
* New pipeline (using either vtkLinkIn2DandThreshold or
vtkLinkIn3DandThreshold):
vtkImageGradient *gradient=vtkImageGradient::New();
gradient->SetInput(InputData);

vtkImageGradientMagnitude
*gradientmagnitude=vtkImageGradientMagnitude::New();
gradientmagnitude->SetInput(InputData);

vtkImageNonMaximumSuppression
*suppress=vtkImageNonMaximumSuppression::New();
suppress->SetVectorInput(gradient);
suppress->SetMagnitudeInput(gradientmagnitude);

vtkLinkIn3DandThreshold *theshold=vtkLinkIn3DandThreshold::New();   // or
you can use vtkLinkIn2DandThreshold
threshold->SetInput(suppress->GetOutput());
threshold->SetStrongThreshold(strong_threshold_value);
threshold->SetWeakThreshold(weak_threshold_value);
threshold->SetShortestLink(shortest_link_value);
// then you can display the result or pass it through other filters.





More information about the vtkusers mailing list