Hey Robert, <div><br></div><div>I forgot about this bug. There's a fix here: <a href="http://www.itk.org/Bug/view.php?id=10970">http://www.itk.org/Bug/view.php?id=10970</a></div><div><br></div><div><a href="http://www.itk.org/Bug/view.php?id=10970"></a>-Robert<br>
<div><br><div class="gmail_quote">On Thu, Mar 17, 2011 at 8:45 AM, <span dir="ltr"><<a href="mailto:Robert.Atwood@diamond.ac.uk">Robert.Atwood@diamond.ac.uk</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div lang="EN-GB" link="blue" vlink="purple">
<div>
<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D">Hi,</span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D">As far as I can tell, there is no method “SetNeighbourhoodRadius” in MedianImageFunction.
</span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D">I looked at the Doxygen, and the source code, but in case I was not understanding all the inheritances I tried compiling code accessing this function, and
the compiler agrees. The test function does not attempt to set the radius and so the test succeeds, the radius appears to be set internally to the constant value 1 in the filter source code.</span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D">Thanks for any further advice</span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D">Robert</span></p><div class="im">
<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D"> </span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D"> </span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D"> </span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D">Code/Common/itkMedianImageFunction.txx:</span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D"> </span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D">73 // Create an N-d neighborhood kernel, using a zeroflux boundary condition</span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D">74 typename InputImageType::SizeType kernelSize;</span></p>
</div><p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D">75 kernelSize.Fill( 1 ); // </span><span style="font-size:11.0pt;font-family:Wingdings;color:#1F497D">ß</span><span style="font-size:11.0pt;color:#1F497D">
HERE the kernel size is set to 1 in all directions, no option seems to be available in this source code file.</span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D">76</span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D"> </span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D"> </span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D"> </span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D"> </span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D">My code excerpt:</span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D">14 #include "itkMedianImageFunction.h"</span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D"> </span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D">…</span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D"> </span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D">27 typedef itk::MedianImageFunction< ScalarImageType, float > MedianFunctionType;</span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D">….</span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D"> </span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D">117 MedianFunctionType::Pointer mfunction = MedianFunctionType::New();</span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D">118 mfunction->SetNeighbourhoodRadius(2);</span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D"> </span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D"> </span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D">Cmake output:</span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D"> </span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D">Scanning dependencies of target itk_mreduce_rca</span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D">[ 33%] Building CXX object CMakeFiles/itk_mreduce_rca.dir/itk_mreduce_rca.cxx.o</span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D"> </span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D">/home/kny48981/progs/itk_progs/trunk/itk_mreduce_rca.cxx: In function 'int main(int, char**)':</span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D">/home/kny48981/progs/itk_progs/trunk/itk_mreduce_rca.cxx:118: error: 'class itk::MedianImageFunction<itk::Image<short unsigned int, 3u>, float>' has no member
named 'SetNeighbourhoodRadius'</span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D"> </span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D"> </span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D"> </span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D"> </span></p>
<div style="border:none;border-left:solid blue 1.5pt;padding:0cm 0cm 0cm 4.0pt">
<div>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span lang="EN-US" style="font-size:10.0pt">From:</span></b><span lang="EN-US" style="font-size:10.0pt"> robert tamburo [mailto:<a href="mailto:robert.tamburo@gmail.com" target="_blank">robert.tamburo@gmail.com</a>]
<br>
<b>Sent:</b> 16 March 2011 16:02<br>
<b>To:</b> Atwood, Robert (DLSLtd,RAL,DIA)<br>
<b>Cc:</b> <a href="mailto:insight-users@itk.org" target="_blank">insight-users@itk.org</a><br>
<b>Subject:</b> Re: [Insight-users] MedianImageFunction -- questions</span></p>
</div>
</div><div><div></div><div class="h5">
<p class="MsoNormal"> </p>
<div>
<p class="MsoNormal">Hi Robert,</p>
</div>
<div>
<p class="MsoNormal"> </p>
</div>
<p class="MsoNormal">The key function calls for MedianImageFunction are:</p>
<div>
<p class="MsoNormal">medianFunction->SetInputImage(img); // sets input image</p>
<div>
<p class="MsoNormal">medianFunction->SetNeighborhoodRadius(r); // sets neighborhood radius</p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt">medianFunction->EvaluateAtIndex(idx); // returns median value of img pixels in a neighborhood of radius r centered at idx</p>
<div>
<p class="MsoNormal">On Wed, Mar 16, 2011 at 11:40 AM, <<a href="mailto:Robert.Atwood@diamond.ac.uk" target="_blank">Robert.Atwood@diamond.ac.uk</a>> wrote:</p>
<p class="MsoNormal">Hi,<br>
I want to evaluate the median at several points in the image, rather than median filter the whole image and query those points. This would be simple if I could use itk::MedianImageFunction<br>
However, I don't understand how to use this. How do you set the neighbourhood?<br>
The doxygen does not seem to show me any function for setting this, and inspecting the code I find this segment, as far as I can tell it always creates a 1x1x1 kernel? That's not what I want , do I misunderstand? The Doxygen states<br>
<br>
"<br>
Calculate the median value in the neighborhood of a pixel.<br>
<br>
Calculate the median pixel value over the standard 8, 26, etc. connected neighborhood. This calculation uses a ZeroFluxNeumannBoundaryCondition.<br>
"<br>
<br>
How do I access the "26,etc" neighbourhoods? Thanks<br>
Robert<br>
<br>
<br>
./ITK/Code/Common/itkMedianImageFunction.txx:<br>
<br>
<br>
73 // Create an N-d neighborhood kernel, using a zeroflux boundary condition<br>
74 typename InputImageType::SizeType kernelSize;<br>
75 kernelSize.Fill( 1 );<br>
76<br>
77 ConstNeighborhoodIterator<InputImageType><br>
78 it(kernelSize, this->GetInputImage(), this->GetInputImage()->GetBufferedRegion());<br>
79<br>
<br>
--<br>
This e-mail and any attachments may contain confidential, copyright and or privileged material, and are for the use of the intended addressee only. If you are not the intended addressee or an authorised recipient of the addressee please notify us of receipt
by returning the e-mail and do not use, copy, retain, distribute or disclose the information in or attached to the e-mail.<br>
Any opinions expressed within this e-mail are those of the individual and not necessarily of Diamond Light Source Ltd.<br>
Diamond Light Source Ltd. cannot guarantee that this e-mail or any attachments are free from viruses and we cannot accept liability for any damage which you may sustain as a result of software viruses which may be transmitted in or with the message.<br>
Diamond Light Source Limited (company no. 4375679). Registered in England and Wales with its registered office at Diamond House, Harwell Science and Innovation Campus, Didcot, Oxfordshire, OX11 0DE, United Kingdom<br>
<br>
<br>
<br>
<br>
_____________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at<br>
<a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Kitware offers ITK Training Courses, for more information visit:<br>
<a href="http://www.kitware.com/products/protraining.html" target="_blank">http://www.kitware.com/products/protraining.html</a><br>
<br>
Please keep messages on-topic and check the ITK FAQ at:<br>
<a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a></p>
</div>
<p class="MsoNormal"> </p>
</div>
</div>
</div></div></div>
</div>
<br><p align="justify"> </p>
<p align="justify">-- </p><div class="im">
<p align="justify">This e-mail and any attachments may contain confidential, copyright and or privileged material, and are for the use of the intended addressee only. If you are not the intended addressee or an authorised recipient of the addressee please notify us of receipt by returning the e-mail and do not use, copy, retain, distribute or disclose the information in or attached to the e-mail.<br>
Any opinions expressed within this e-mail are those of the individual and not necessarily of Diamond Light Source Ltd. <br>Diamond Light Source Ltd. cannot guarantee that this e-mail or any attachments are free from viruses and we cannot accept liability for any damage which you may sustain as a result of software viruses which may be transmitted in or with the message.<br>
Diamond Light Source Limited (company no. 4375679). Registered in England and Wales with its registered office at Diamond House, Harwell Science and Innovation Campus, Didcot, Oxfordshire, OX11 0DE, United Kingdom<br> </p>
<br></div></div>
</blockquote></div><br></div></div>