<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2900.2722" name=GENERATOR></HEAD>
<BODY>
<DIV><SPAN class=387203918-06102005><FONT face=Arial color=#0000ff
size=2>Amitesh, </FONT></SPAN></DIV>
<DIV><SPAN class=387203918-06102005><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=387203918-06102005><FONT face=Arial color=#0000ff size=2>There
are several ways to do this:</FONT></SPAN></DIV>
<DIV><SPAN class=387203918-06102005><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=387203918-06102005><FONT face=Arial color=#0000ff size=2>1.
itk::VarianceImageFunction will compute the variance over a neighborhood.
You can specify different neighborhood sizes using the SetRadius()
method.</FONT></SPAN></DIV>
<DIV><SPAN class=387203918-06102005><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=387203918-06102005><FONT face=Arial color=#0000ff size=2>2.
itk::NoiseImageFilter will compute the variance over a neighborhood over a
complete image. The result is an image of standard deviations. The size of
the neighborhood can specified with the SetRadius() call.</FONT></SPAN></DIV>
<DIV><SPAN class=387203918-06102005><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=387203918-06102005><FONT face=Arial color=#0000ff size=2>Also,
you do not need to specify the offsets within a NeighborhoodIterator. They
are computed automatically for you. It is only the
ShapedNeighborhoodIterators that you need to turn on/off certain offsets.
</FONT></SPAN></DIV>
<DIV><SPAN class=387203918-06102005><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=387203918-06102005><FONT face=Arial color=#0000ff size=2>Here
is a snippet from the NoiseImageFilter that calculates the standard deviation at
one pixel (bit is a neighborhood iterator that is walking the input
image)</FONT></SPAN></DIV>
<DIV><SPAN class=387203918-06102005><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=387203918-06102005><FONT face=Arial color=#0000ff
size=2> bit =
ConstNeighborhoodIterator<InputImageType>(m_Radius, input,
*fit)</FONT></SPAN></DIV>
<DIV><SPAN class=387203918-06102005><FONT face=Arial color=#0000ff
size=2> unsigned int neighborhoodSize =
bit.Size();<BR></FONT></SPAN></DIV>
<DIV><SPAN class=387203918-06102005><FONT face=Arial color=#0000ff
size=2> ..........</DIV></FONT></SPAN>
<DIV><SPAN class=387203918-06102005><FONT face=Arial color=#0000ff
size=2><BR> sum =
NumericTraits<InputRealType>::Zero;<BR>
sumOfSquares =
NumericTraits<InputRealType>::Zero;<BR> for
(i = 0; i < neighborhoodSize;
++i)<BR>
{<BR> value =
static_cast<InputRealType>( bit.GetPixel(i)
);<BR> sum +=
value;<BR> sumOfSquares +=
(value*value);<BR>
}<BR> <BR> //
calculate the standard deviation value<BR> var =
(sumOfSquares - (sum*sum/num)) / (num - 1.0);<BR></DIV></FONT></SPAN>
<BLOCKQUOTE>
<DIV class=OutlookMessageHeader dir=ltr align=left><FONT face=Tahoma
size=2>-----Original Message-----<BR><B>From:</B>
insight-users-bounces+millerjv=crd.ge.com@itk.org
[mailto:insight-users-bounces+millerjv=crd.ge.com@itk.org]<B>On Behalf Of
</B>Amitesh Agarwal<BR><B>Sent:</B> Thursday, October 06, 2005 2:18
PM<BR><B>To:</B> Insight-users@itk.org<BR><B>Subject:</B> [Insight-users]
statical analysis on an image<BR><BR></FONT></DIV>Hi all,<BR><BR>I have a
small problem. I wanted to do a statical analysis on a 2D image for a
neighborhood size bigger than 3x3, say for a neighbourhood size 7x7 or higher
to find standard deviation at each pixel in the neighborhood. Is there already
a function or method to do that? If not, while using neighborhooditerator I
have noticed that i will have to define each of the offset saperately and for
a 7x7 naighborhood it would be 48 possible offsets and will increase for
bigger neighborhood sizes. I fell that may be quite cumbersome. Is there
anyway to circumvent that??<BR><BR>Thanks
<BR>Amitesh<BR></BLOCKQUOTE></BODY></HTML>