Xmipp  v3.23.11-Nereus
Public Member Functions | Static Public Member Functions | List of all members
DiffusionFilter Class Reference

#include <filters.h>

Inheritance diagram for DiffusionFilter:
Inheritance graph
[legend]
Collaboration diagram for DiffusionFilter:
Collaboration graph
[legend]

Public Member Functions

void readParams (XmippProgram *program)
 
void show ()
 
void apply (MultidimArray< double > &img)
 
- Public Member Functions inherited from XmippFilter
virtual ~XmippFilter ()
 

Static Public Member Functions

static void defineParams (XmippProgram *program)
 

Detailed Description

Definition at line 1538 of file filters.h.

Member Function Documentation

◆ apply()

void DiffusionFilter::apply ( MultidimArray< double > &  img)
virtual

Apply the filter to an image or volume

Implements XmippFilter.

Definition at line 3775 of file filters.cpp.

3776 {
3777  MultidimArray<double> surface_strength;
3778  MultidimArray<double> edge_strength;
3779  smoothingShah(img, surface_strength, edge_strength, Shah_weight, Shah_outer,
3780  Shah_inner, Shah_refinement);
3781  if (Shah_edge)
3782  img = edge_strength;
3783  else
3784  img = surface_strength;
3785 }
void smoothingShah(MultidimArray< double > &img, MultidimArray< double > &surface_strength, MultidimArray< double > &edge_strength, const Matrix1D< double > &W, int OuterLoops, int InnerLoops, int RefinementLoops, bool adjust_range)
Definition: filters.cpp:2720

◆ defineParams()

void DiffusionFilter::defineParams ( XmippProgram program)
static

Define the parameters for use inside an Xmipp program

Definition at line 3725 of file filters.cpp.

3726 {
3727  program->addParamsLine("== Anisotropic diffusion ==");
3728  program->addParamsLine(
3729  " [--diffusion] : Use anisotropic diffusion filter.");
3730  program->addParamsLine(
3731  " [--shah_iter+ <outer=10> <inner=1> <refinement=1>] : Diffusion outer, inner and refinement iterations");
3732  program->addParamsLine(" requires --diffusion;");
3733  program->addParamsLine(
3734  " [--shah_weight+ <w0=0> <w1=50> <w2=50> <w3=0.02>]:Diffusion weights");
3735  program->addParamsLine(
3736  " : w0 = data matching ");
3737  program->addParamsLine(
3738  " : w1 = 1st derivative smooth ");
3739  program->addParamsLine(
3740  " : w2 = edge strength ");
3741  program->addParamsLine(
3742  " : w3 = edge smoothness ");
3743  program->addParamsLine(" requires --diffusion;");
3744  program->addParamsLine(
3745  " [--shah_only_edge+] : Produce the edge image of the diffusion");
3746  program->addParamsLine(" requires --diffusion;");
3747 }
void addParamsLine(const String &line)

◆ readParams()

void DiffusionFilter::readParams ( XmippProgram program)
virtual

Read from program command line

Reimplemented from XmippFilter.

Definition at line 3750 of file filters.cpp.

3751 {
3752  Shah_weight.resizeNoCopy(4);
3753  Shah_outer = program->getIntParam("--shah_iter", 0);
3754  Shah_inner = program->getIntParam("--shah_iter", 1);
3755  Shah_refinement = program->getIntParam("--shah_iter", 2);
3756  Shah_weight(0) = program->getDoubleParam("--shah_weight", 0);
3757  Shah_weight(1) = program->getDoubleParam("--shah_weight", 1);
3758  Shah_weight(2) = program->getDoubleParam("--shah_weight", 2);
3759  Shah_weight(3) = program->getDoubleParam("--shah_weight", 3);
3760  Shah_edge = program->checkParam("--shah_only_edge");
3761 }
double getDoubleParam(const char *param, int arg=0)
void resizeNoCopy(int Xdim)
Definition: matrix1d.h:458
bool checkParam(const char *param)
int getIntParam(const char *param, int arg=0)

◆ show()

void DiffusionFilter::show ( )
virtual

Show parameters

Reimplemented from XmippFilter.

Definition at line 3763 of file filters.cpp.

3764 {
3765  std::cout << " Shah difussion\n" << " Outer iterations " << Shah_outer
3766  << std::endl << " Inner iterations " << Shah_inner << std::endl
3767  << " Refinement interations " << Shah_refinement << std::endl
3768  << " Weight " << Shah_weight.transpose() << std::endl;
3769  if (Shah_edge)
3770  std::cout << " Generating edge image\n";
3771 
3772 }
Matrix1D< T > transpose() const
Definition: matrix1d.cpp:644

The documentation for this class was generated from the following files: