[Insight-users] SimpleFuzzyConnectednessScalarImageFilter
Zein Salah
salah@gris.uni-tuebingen.de
Fri, 27 Sep 2002 16:49:03 +0200
This is a multi-part message in MIME format.
------=_NextPart_000_0177_01C26645.C9318EC0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Thanks Luis, I have discovered it by debugging my program.
Interesting Note:
I have read the paper (In the paper (Fuzzy Connectedness and Object =
Definition: Theory, Algorithms, and Applications in Image=20
Segmentation", J. Udupa and S. Samarasekera), page 259, it is stated =
that there are two version of the algorithm. One requires on some =
machine about 20 min for an image of 256x256x64, and the other version =
requires only 2 minutes for the same image.=20
I have tried to discover which version is implemented in the ITK filter. =
I think it is the slow algorithm.=20
However I tried to modify the code in the =
itkSimpleFuzzyConnectednessImageFilterBase.txx file to the faster =
implementation
I just added an if statement, just like the fast algorithm in the paper. =
The filter with this modification required 1.5 minute instead of about =
40 minutes. Here is what I have done:
the original code:
template <class TInputImage, class TOutputImage>
void=20
SimpleFuzzyConnectednessImageFilterBase<TInputImage,TOutputImage>
::GenerateData()
{...
...
...
while(! m_Queue.empty()) {
current =3D m_Queue.front();
m_Queue.pop();
fmax =3D (unsigned short)(FindStrongPath(current));
if(fmax > m_FuzzyScene->GetPixel(current)) {
m_FuzzyScene->SetPixel(current,fmax);
PushNeighbors(current);
}
}
MakeSegmentObject();
}
The new code is:
template <class TInputImage, class TOutputImage>
void=20
SimpleFuzzyConnectednessImageFilterBase<TInputImage,TOutputImage>
::GenerateData()
{...
...
...
while(! m_Queue.empty()) {
current =3D m_Queue.front();
m_Queue.pop();
=20
// this is just what I did, something like what the paper suggests
if ( m_FuzzyScene->GetPixel(current) < 1.0 ) { =20
fmax =3D (unsigned short)(FindStrongPath(current));
if(fmax > m_FuzzyScene->GetPixel(current)) {
m_FuzzyScene->SetPixel(current,fmax);
PushNeighbors(current);
}
}
}
MakeSegmentObject();
}
The resulter segmented image is somehow not correct. some areas are =
segmented good, others are not. I have expreimnted with different values =
intead of of the 0.1, The result did not improve.=20
Do you have an idea what could the problem be? Could you please test the =
new code on 3D- images. Perhaps you can see the results and compare the =
times.=20
What could be done to get the correct value for this if-statement.
Thanks,
Zein
->8<------------->8<------------->8<------------->8<------------->8<-----=
-------->8<-
Zein I. Salah=20
Universit=E4t T=FCbingen, WSI-GRIS=20
Sand 14=20
72076 T=FCbingen=20
Email: salah@gris.uni-tuebingen.de / zeinsalah@hotmail.com
Tel.: (07071) 29 75465 (GRIS) , (07071) 96 44 39 (privat)=20
Fax: (07071) 29 54 66
------=_NextPart_000_0177_01C26645.C9318EC0
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 5.50.4807.2300" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>
<DIV>Thanks Luis, I have discovered it by debugging my program.</DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV><STRONG><FONT size=3D3><U>Interesting =
Note:</U></FONT></STRONG></DIV>
<DIV> </DIV>
<DIV>I have read the paper (In the paper (Fuzzy Connectedness and Object =
Definition: Theory, Algorithms, and Applications in Image=20
<BR>Segmentation", J. Udupa and S. Samarasekera), page 259, it is =
stated=20
that there are two version of the algorithm. One requires on some =
machine=20
about 20 min for an image of 256x256x64, and the other version =
requires=20
only 2 minutes for the same image. </DIV>
<DIV>I have tried to discover which version is implemented in the ITK =
filter. I=20
think it is the slow algorithm. </DIV>
<DIV>However I tried to modify the code in the=20
itkSimpleFuzzyConnectednessImageFilterBase.txx file to the faster=20
implementation</DIV>
<DIV>I just added an if statement, just like the fast algorithm in the =
paper.=20
The filter with this modification required <U>1.5 minute</U> instead of =
about=20
<U>40 minutes</U>. Here is what I have done:</DIV>
<DIV> </DIV>
<DIV>the original code:</DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV><FONT color=3D#0000ff>template <class TInputImage, class=20
TOutputImage><BR>void=20
<BR>SimpleFuzzyConnectednessImageFilterBase<TInputImage,TOutputImage&g=
t;<BR>::GenerateData()<BR>{...</FONT></DIV>
<DIV><FONT color=3D#0000ff>...</FONT></DIV>
<DIV><FONT color=3D#0000ff>...</FONT></DIV>
<DIV><FONT color=3D#0000ff> while(! m_Queue.empty()) =
{<BR> =20
current =3D m_Queue.front();<BR> =20
m_Queue.pop();<BR><BR> fmax =3D =
(unsigned=20
short)(FindStrongPath(current));<BR> =
if(fmax=20
> m_FuzzyScene->GetPixel(current))=20
{<BR> =20
m_FuzzyScene->SetPixel(current,fmax);<BR>  =
; =20
PushNeighbors(current);<BR> =
}</FONT></DIV>
<DIV><FONT color=3D#0000ff> }</FONT></DIV>
<DIV><FONT color=3D#0000ff></FONT> </DIV>
<DIV><FONT color=3D#0000ff> MakeSegmentObject();<BR>}</FONT></DIV>
<DIV> </DIV>
<DIV>The new code is:</DIV>
<DIV> </DIV>
<DIV>
<DIV><FONT color=3D#0000ff>template <class TInputImage, class=20
TOutputImage><BR>void=20
<BR>SimpleFuzzyConnectednessImageFilterBase<TInputImage,TOutputImage&g=
t;<BR>::GenerateData()<BR>{...</FONT></DIV>
<DIV><FONT color=3D#0000ff>...</FONT></DIV>
<DIV><FONT color=3D#0000ff>...</FONT></DIV>
<DIV><FONT color=3D#0000ff> while(! m_Queue.empty()) =
{<BR> =20
current =3D m_Queue.front();<BR> =
m_Queue.pop();</FONT></DIV>
<DIV><FONT color=3D#0000ff><FONT =
color=3D#ff0000> </FONT></FONT></DIV>
<DIV><FONT color=3D#0000ff><FONT color=3D#ff0000> // =
this is just=20
what I did, something like what the paper suggests</FONT><BR><FONT=20
color=3D#ff0000> if ( =
m_FuzzyScene->GetPixel(current) <=20
<U>1.0</U> )=20
{ =
</FONT> =20
</FONT></DIV>
<DIV><FONT color=3D#0000ff> fmax =3D =
(unsigned=20
short)(FindStrongPath(current));<BR> =
if(fmax=20
> m_FuzzyScene->GetPixel(current))=20
{<BR> =20
m_FuzzyScene->SetPixel(current,fmax);<BR>  =
; =20
PushNeighbors(current);<BR> =
}<BR><FONT=20
color=3D#ff0000> }<BR></FONT> }</FONT></DIV>
<DIV><FONT color=3D#0000ff></FONT> </DIV>
<DIV><FONT color=3D#0000ff> =
MakeSegmentObject();<BR>}</FONT></DIV></DIV>
<DIV><FONT color=3D#0000ff></FONT> </DIV>
<DIV>The resulter segmented image is somehow not correct. some areas are =
segmented good, others are not. I have expreimnted with different values =
intead=20
of of the <FONT color=3D#ff0000><U>0.1</U></FONT>, The result did not =
improve.=20
</DIV>
<DIV> </DIV>
<DIV>Do you have an idea what could the problem be? Could you please =
test the=20
new code on 3D- images. Perhaps you can see the results and compare the =
times.=20
</DIV>
<DIV>What could be done to get the correct value for this =
if-statement.</DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV>Thanks,</DIV>
<DIV>Zein</DIV>
<DIV> </DIV>
<DIV> </DIV></FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial=20
size=3D2>->8<------------->8<------------->8<----------=
--->8<------------->8<------------->8<-<BR>Zein=20
I. Salah <BR>Universit=E4t T=FCbingen, WSI-GRIS <BR>Sand 14 <BR>72076 =
T=FCbingen=20
<BR>Email: <A=20
href=3D"mailto:salah@gris.uni-tuebingen.de">salah@gris.uni-tuebingen.de</=
A> =20
/ <A =
href=3D"mailto:zeinsalah@hotmail.com">zeinsalah@hotmail.com</A><BR>Tel.: =
(07071) 29 75465 (GRIS) , (07071) 96 44 39 (privat) <BR>Fax: (07071) 29 =
54=20
66</FONT></DIV></BODY></HTML>
------=_NextPart_000_0177_01C26645.C9318EC0--