[Insight-users] MedianImageFunction -- questions

Robert.Atwood at diamond.ac.uk Robert.Atwood at diamond.ac.uk
Thu Mar 17 08:45:21 EDT 2011


Hi,
As far as I can tell, there is no method "SetNeighbourhoodRadius" in MedianImageFunction.
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.
Thanks for any further advice
Robert



Code/Common/itkMedianImageFunction.txx:

73   // Create an N-d neighborhood kernel, using a zeroflux boundary condition
74   typename InputImageType::SizeType kernelSize;
75   kernelSize.Fill( 1 );    //  <-- HERE the kernel size is set to 1 in all directions, no option seems to be available in this source code file.
76




My code excerpt:
14 #include "itkMedianImageFunction.h"

...

27   typedef itk::MedianImageFunction< ScalarImageType, float >   MedianFunctionType;
....

117   MedianFunctionType::Pointer mfunction = MedianFunctionType::New();
118   mfunction->SetNeighbourhoodRadius(2);


Cmake output:

Scanning dependencies of target itk_mreduce_rca
[ 33%] Building CXX object CMakeFiles/itk_mreduce_rca.dir/itk_mreduce_rca.cxx.o

/home/kny48981/progs/itk_progs/trunk/itk_mreduce_rca.cxx: In function 'int main(int, char**)':
/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'




From: robert tamburo [mailto:robert.tamburo at gmail.com]
Sent: 16 March 2011 16:02
To: Atwood, Robert (DLSLtd,RAL,DIA)
Cc: insight-users at itk.org
Subject: Re: [Insight-users] MedianImageFunction -- questions

Hi Robert,

The key function calls for MedianImageFunction are:
medianFunction->SetInputImage(img); // sets input image
medianFunction->SetNeighborhoodRadius(r); // sets neighborhood radius
medianFunction->EvaluateAtIndex(idx);  // returns median value of img pixels in a neighborhood of radius r centered at idx
On Wed, Mar 16, 2011 at 11:40 AM, <Robert.Atwood at diamond.ac.uk<mailto:Robert.Atwood at diamond.ac.uk>> wrote:
Hi,
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
However, I don't understand how to use this. How do you set the neighbourhood?
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

"
Calculate the median value in the neighborhood of a pixel.

Calculate the median pixel value over the standard 8, 26, etc. connected neighborhood. This calculation uses a ZeroFluxNeumannBoundaryCondition.
"

How do I access the "26,etc" neighbourhoods? Thanks
Robert


./ITK/Code/Common/itkMedianImageFunction.txx:


 73   // Create an N-d neighborhood kernel, using a zeroflux boundary condition
 74   typename InputImageType::SizeType kernelSize;
 75   kernelSize.Fill( 1 );
 76
 77   ConstNeighborhoodIterator<InputImageType>
 78     it(kernelSize, this->GetInputImage(), this->GetInputImage()->GetBufferedRegion());
 79

--
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.
Any opinions expressed within this e-mail are those of the individual and not necessarily of Diamond Light Source Ltd.
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.
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




_____________________________________
Powered by www.kitware.com<http://www.kitware.com>

Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html

Kitware offers ITK Training Courses, for more information visit:
http://www.kitware.com/products/protraining.html

Please keep messages on-topic and check the ITK FAQ at:
http://www.itk.org/Wiki/ITK_FAQ

Follow this link to subscribe/unsubscribe:
http://www.itk.org/mailman/listinfo/insight-users




-- 

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.

Any opinions expressed within this e-mail are those of the individual and not necessarily of Diamond Light Source Ltd. 

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.

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

 







-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20110317/fe0940a0/attachment.htm>


More information about the Insight-users mailing list