Vous avez reçu un message "Your GitLab account has been locked ..." ? Pas d'inquiétude : lisez cet article https://docs.gricad-pages.univ-grenoble-alpes.fr/help/unlock/

Commit 67ceed0d authored by saubatn's avatar saubatn
Browse files

FEATURE 193 Properties updated.

git-svn-id: svn+ssh://scm.forge.imag.fr/var/lib/gforge/chroot/scmrepos/svn/camitk/trunk/camitk@1618 ec899d31-69d1-42ba-9299-647d76f65fb3
parent f2669359
......@@ -22,13 +22,18 @@
*
* $CAMITK_LICENCE_END$
****************************************************************************/
// CamiTK includes
#include "MeanFilter.h"
#include <Application.h>
#include <ItkProgressObserver.h>
#include <Property.h>
// Qt includes
#include <QMessageBox>
#include <QString>
#include <QTextStream>
// Itk includes
#include <itkImageToVTKImageFilter.h>
#include <itkVTKImageToImageFilter.h>
#include <itkMeanImageFilter.h>
......@@ -41,18 +46,18 @@ MeanFilter::MeanFilter(ActionExtension * extension) : Action(extension) {
// Setting name, description and input component
setName("Mean Filter");
setDescription("<br>\
The <b>mean</b> filter is commonly used for noise reduction. <br> \
This filter computes the value of each output pixel by finding the statistical mean of the neighborhood of the corresponding input pixel. The following figure illustrates the local effect of the <b>mean</b> filter in 2D case.<br>\
______________ <br> \
| 28 | 26 | 50 | <br> \
|----|-----|----| <br> \
| 27 | 25 | 29 | -> 30.22 -> 30<br> \
|----|-----|----| <br> \
| 25 | 30 | 32 | <br> \
--------------- <br> \
<i>Note that this algorithm is sensitive to the presence of outliers in the neighborhood. </i><br>\
<br> \
The <b>parameters</b> are the size of the neighborhood along X, Y and Z directions. The value on each direction is used as the semi-size of a rectangular box. For example in <i>2D</i> a size of 1 in X direction and 2 in Y direction results in a 3x5 neighborhood.<br> \
The <b>mean</b> filter is commonly used for noise reduction. <br/><br/> \
This filter computes the value of each output pixel by finding the statistical mean of the neighborhood of the corresponding input pixel. The following figure illustrates the local effect of the <b>mean</b> filter in 2D case.<br/>\
______________ <br/> \
| 28 | 26 | 50 | <br/> \
|-----|-----|------| <br/> \
| 27 | 25 | 29 | -> 30.22 -> 30<br/> \
|-----|-----|------| <br/> \
| 25 | 30 | 32 | <br/> \
-------------------- <br/> \
<i>Note that this algorithm is sensitive to the presence of outliers in the neighborhood. </i><br/>\
<br/> \
The <b>parameters</b> are the size of the neighborhood along X, Y and Z directions. <br/>The value on each direction is used as the semi-size of a rectangular box. For example in <i>2D</i> a size of 1 in X direction and 2 in Y direction results in a 3x5 neighborhood.<br/> \
");
setComponent("ImageComponent");
......@@ -63,9 +68,23 @@ The <b>parameters</b> are the size of the neighborhood along X, Y and Z directio
this->addTag("Neighborhood Filter");
// Setting parameters default values
setProperty("halfNeighborhoodSizeX", QVariant(1));
setProperty("halfNeighborhoodSizeY", QVariant(1));
setProperty("halfNeighborhoodSizeZ", QVariant(1));
Property* halfNeighborhoodSizeProp_X = new Property(tr("Half neighborhood size along X"), 1, tr("Half the size of the X direction of the neighborhood taken into account for the mean computation. \nFor instance, a value of 2 will create a windows of size 4 along the X direction."), "");
halfNeighborhoodSizeProp_X->setAttribute("minimum", 1);
halfNeighborhoodSizeProp_X->setAttribute("maximum", 100);
halfNeighborhoodSizeProp_X->setAttribute("singleStep", 1);
addParameter(halfNeighborhoodSizeProp_X);
Property* halfNeighborhoodSizeProp_Y = new Property(tr("Half neighborhood size along Y"), 1, tr("Half the size of the Y direction of the neighborhood taken into account for the mean computation. \nFor instance, a value of 2 will create a windows of size 4 along the Y direction."), "");
halfNeighborhoodSizeProp_X->setAttribute("minimum", 1);
halfNeighborhoodSizeProp_X->setAttribute("maximum", 100);
halfNeighborhoodSizeProp_X->setAttribute("singleStep", 1);
addParameter(halfNeighborhoodSizeProp_Y);
Property* halfNeighborhoodSizeProp_Z = new Property(tr("Half neighborhood size along Z"), 1, tr("Half the size of the Z direction of the neighborhood taken into account for the mean computation. \nFor instance, a value of 2 will create a windows of size 4 along the Z direction."), "");
halfNeighborhoodSizeProp_X->setAttribute("minimum", 1);
halfNeighborhoodSizeProp_X->setAttribute("maximum", 100);
halfNeighborhoodSizeProp_X->setAttribute("singleStep", 1);
addParameter(halfNeighborhoodSizeProp_Z);
}
// --------------- destructor -------------------
......@@ -84,9 +103,9 @@ Action::ApplyStatus MeanFilter::apply() {
void MeanFilter::process(ImageComponent * comp) {
// Get the parameters
halfNeighborhoodSizeX = property("halfNeighborhoodSizeX").toInt();
halfNeighborhoodSizeY = property("halfNeighborhoodSizeY").toInt();
halfNeighborhoodSizeZ = property("halfNeighborhoodSizeZ").toInt();
this->halfNeighborhoodSizeX = property("Half neighborhood size along X").toInt();
this->halfNeighborhoodSizeY = property("Half neighborhood size along Y").toInt();
this->halfNeighborhoodSizeZ = property("Half neighborhood size along Z").toInt();
// ITK filter implementation using templates
vtkSmartPointer<vtkImageData> inputImage = comp->getImageData();
vtkSmartPointer<vtkImageData> outputImage = implementProcess (inputImage);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment