open_iA 2021.08
A tool for the visual analysis and processing of volumetric datasets, with a focus on industrial computed tomography.
Public Member Functions | Protected Member Functions | List of all members
iAFilter Class Referenceabstract

Base class for image filters. More...

#include <iAFilter.h>

Inheritance diagram for iAFilter:
[legend]
Collaboration diagram for iAFilter:
[legend]

Public Member Functions

 iAFilter (QString const &name, QString const &category, QString const &description="", unsigned int requiredInputs=1, unsigned int outputCount=1)
 Constructor initializing name, category and description of the filter. More...
 
virtual ~iAFilter ()
 Virtual destructor because of inheritance (mostly to avoid warnings about missing virtual destructor). More...
 
void abort () override
 Abort the filter. More...
 
virtual void adaptParametersToInput (QMap< QString, QVariant > &parameters, vtkSmartPointer< vtkImageData > img)
 if required, adapt (loaded/default) parameters to image only used from GUI for the moment if feature is implemented where parameters can be omitted (on command line), this could later also be used to provide useful defaults for parameters that need to adapt to input image More...
 
void addInput (iAConnector *con, QString const &fileName)
 Adds an image as input. More...
 
void addMsg (QString const &msg)
 Adds some message to the targeted output place for this filter. More...
 
void addOutputValue (QString const &name)
 Adds an output value name. More...
 
void addOutputValue (QString const &name, QVariant value)
 Adds an output value. More...
 
void addParameter (QString const &name, iAValueType valueType, QVariant defaultValue=0.0, double min=std::numeric_limits< double >::lowest(), double max=std::numeric_limits< double >::max())
 Adds the description of a parameter to the filter. More...
 
virtual bool canAbort () const
 Whether the filter supports aborting. More...
 
QString category () const
 Retrieve the "base" filter category. More...
 
virtual bool checkParameters (QMap< QString, QVariant > const &parameters)
 Check whether the filter can be run with the given parameters. More...
 
void clearInput ()
 Clears the list of input images to this filter. More...
 
bool defaultParameterCheck (QSharedPointer< iAAttributeDescriptor > param, QVariant const &paramValue)
 the default check for a single parameter descriptor & value combination More...
 
QString description () const
 Retrieve the filter description. More...
 
QVector< QString > const & fileNames () const
 
unsigned int firstInputChannels () const
 returns the number of input channels from the first input image. More...
 
QString fullCategory () const
 Retrieve the full category string (just as specified in the constructor). More...
 
QVector< iAConnector * > const & input () const
 input/output connectors. More...
 
QString inputName (unsigned int i) const
 Retrieve the name of the input image with given index. More...
 
itk::ImageIOBase::IOComponentType inputPixelType () const
 
iALoggerlogger ()
 Retrieve the logger used for log messages emitted by the filter. More...
 
QString name () const
 Retrieve the filter name. More...
 
QVector< iAConnector * > const & output () const
 
int outputCount () const
 The planned number of outputs the filter will produce. More...
 
QString outputName (unsigned int i, QString defaultName=QString()) const
 Retrieve the name of the output image with given index. More...
 
QVector< QString > const & outputValueNames () const
 Retrieve a list of names of the output values that this filter can produce. More...
 
QVector< QPair< QString, QVariant > > const & outputValues () const
 retrieve a list of output values. More...
 
iAAttributes const & parameters () const
 Retrieve a list of the filter parameters. More...
 
vtkSmartPointer< vtkPolyData > polyOutput () const
 Retrieves output mesh if existing. More...
 
iAProgressprogress ()
 Retrieve the progress reporting object for this filter. More...
 
int requiredInputs () const
 Returns the number of image inputs required by this filter. More...
 
bool run (QMap< QString, QVariant > const &parameters)
 Initialize and run the filter. More...
 
void setFirstInputChannels (unsigned int c)
 sets the first input channels. More...
 
void setLogger (iALogger *logger)
 Set the logger to be used for status output / error messages. More...
 
void setPolyOutput (vtkSmartPointer< vtkPolyData > poly)
 Sets the mesh output of this filter. More...
 
void setProgress (iAProgress *progress)
 Set the facility for progress reporting. More...
 
void addOutput (itk::ImageBase< 3 > *img)
 
void addOutput (vtkSmartPointer< vtkImageData > img)
 

Protected Member Functions

void setInputName (unsigned int i, QString const &name)
 Set the name of the input with the given index. More...
 
void setOutputName (unsigned int i, QString const &name)
 Set the name of the output with the given index. More...
 

Detailed Description

Base class for image filters.

Derived classes should:

Constructor & Destructor Documentation

◆ iAFilter()

iAFilter::iAFilter ( QString const &  name,
QString const &  category,
QString const &  description = "",
unsigned int  requiredInputs = 1,
unsigned int  outputCount = 1 
)

Constructor initializing name, category and description of the filter.

Parameters
nameThe name of the filter. It will be used in its menu entry, as part of the title of the result window, and as title for the parameter selection dialog.
categoryThe filter category. It will be used for putting the filter into a fitting submenu and for categorizing the filter parameters when storing them in the registry you can use the slash character ("/") to specify subcategories. A category of "Segmentation/Global Thresholding" for example would put menu, which in turn is added as submenu to the Filter menu. When left empty, the filter will be added directly in the Filter menu
descriptionAn (optional) description of the filter algorithm, and ideally its settings. Can contain HTML (e.g. links)
requiredInputsThe number of inputs required for this filter; by default, filters are assumed to require exactly one input image; you can override the number of inputs required for your filter with this parameter
outputCountthe number of outputs this filter creates. Set it to 0 to disable image output. If you don't know this yet at the time of creating the filter (because it for example depends on the number of input images or the parameters), you can always adapt it at a later point (e.g. during iAFilter::Run) by calling SetOutputCount; but if you have some image output, make sure that you leave it at the default value of 1 or set it to some value other than zero, because setting it to zero has immediate side effects (e.g. not opening a result window if configured, in the GUI).

◆ ~iAFilter()

iAFilter::~iAFilter ( )
virtual

Virtual destructor because of inheritance (mostly to avoid warnings about missing virtual destructor).

Member Function Documentation

◆ abort()

void iAFilter::abort ( )
overridevirtual

Abort the filter.

Implements iAAbortListener.

◆ adaptParametersToInput()

void iAFilter::adaptParametersToInput ( QMap< QString, QVariant > &  parameters,
vtkSmartPointer< vtkImageData >  img 
)
virtual

if required, adapt (loaded/default) parameters to image only used from GUI for the moment if feature is implemented where parameters can be omitted (on command line), this could later also be used to provide useful defaults for parameters that need to adapt to input image

◆ addInput()

void iAFilter::addInput ( iAConnector con,
QString const &  fileName 
)

Adds an image as input.

◆ addMsg()

void iAFilter::addMsg ( QString const &  msg)

Adds some message to the targeted output place for this filter.

Typically this will go into the log window of the result MdiChild

Parameters
msgthe message to print

◆ addOutput() [1/2]

void iAFilter::addOutput ( itk::ImageBase< 3 > *  img)

Adds an output image.

Parameters
imgoutput image from the filter

◆ addOutput() [2/2]

void iAFilter::addOutput ( vtkSmartPointer< vtkImageData >  img)

◆ addOutputValue() [1/2]

void iAFilter::addOutputValue ( QString const &  name)

Adds an output value name.

Call this method in the constructor of derived classes, to let the filter know which output values will later be added via the addOutputValue method with two parameters

Parameters
namethe name of the output value

◆ addOutputValue() [2/2]

void iAFilter::addOutputValue ( QString const &  name,
QVariant  value 
)

Adds an output value.

Parameters
namethe name of the output value
valuethe actual output value

◆ addParameter()

void iAFilter::addParameter ( QString const &  name,
iAValueType  valueType,
QVariant  defaultValue = 0.0,
double  min = std::numeric_limits<double>::lowest(),
double  max = std::numeric_limits<double>::max() 
)

Adds the description of a parameter to the filter.

Parameters
namethe parameter's name
valueTypethe type of value this parameter can have
defaultValuethe default value of the parameter; for Categorical valueTypes, this should be the list of possible values
minthe minimum value this parameter can have (inclusive).
maxthe maximum value this parameter can have (inclusive)

◆ canAbort()

bool iAFilter::canAbort ( ) const
virtual

Whether the filter supports aborting.

◆ category()

QString iAFilter::category ( ) const

Retrieve the "base" filter category.

If sub-categories were specified, this only returns the first one.

◆ checkParameters()

bool iAFilter::checkParameters ( QMap< QString, QVariant > const &  parameters)
virtual

Check whether the filter can be run with the given parameters.

If you need to perform special checks on your parameters, override this method. The standard implementation here just checks parameters with Discrete and Continuous value type for minimum and maximum values.

Parameters
parametersthe generic list of parameters that the filter will be called with
Returns
true if the given parameters are acceptable for the filter, false otherwise

◆ clearInput()

void iAFilter::clearInput ( )

Clears the list of input images to this filter.

Call this in case you are re-using a filter already called before, and you want to call it with new input images

◆ defaultParameterCheck()

bool iAFilter::defaultParameterCheck ( QSharedPointer< iAAttributeDescriptor param,
QVariant const &  paramValue 
)

the default check for a single parameter descriptor & value combination

◆ description()

QString iAFilter::description ( ) const

Retrieve the filter description.

◆ fileNames()

QVector< QString > const & iAFilter::fileNames ( ) const

◆ firstInputChannels()

unsigned int iAFilter::firstInputChannels ( ) const

returns the number of input channels from the first input image.

◆ fullCategory()

QString iAFilter::fullCategory ( ) const

Retrieve the full category string (just as specified in the constructor).

◆ input()

QVector< iAConnector * > const & iAFilter::input ( ) const

input/output connectors.

◆ inputName()

QString iAFilter::inputName ( unsigned int  i) const

Retrieve the name of the input image with given index.

◆ inputPixelType()

itk::ImageIOBase::IOComponentType iAFilter::inputPixelType ( ) const

◆ logger()

iALogger * iAFilter::logger ( )

Retrieve the logger used for log messages emitted by the filter.

◆ name()

QString iAFilter::name ( ) const

Retrieve the filter name.

◆ output()

QVector< iAConnector * > const & iAFilter::output ( ) const

◆ outputCount()

int iAFilter::outputCount ( ) const

The planned number of outputs the filter will produce.

◆ outputName()

QString iAFilter::outputName ( unsigned int  i,
QString  defaultName = QString() 
) const

Retrieve the name of the output image with given index.

◆ outputValueNames()

QVector< QString > const & iAFilter::outputValueNames ( ) const

Retrieve a list of names of the output values that this filter can produce.

◆ outputValues()

QVector< QPair< QString, QVariant > > const & iAFilter::outputValues ( ) const

retrieve a list of output values.

◆ parameters()

iAAttributes const & iAFilter::parameters ( ) const

Retrieve a list of the filter parameters.

◆ polyOutput()

vtkSmartPointer< vtkPolyData > iAFilter::polyOutput ( ) const

Retrieves output mesh if existing.

◆ progress()

iAProgress * iAFilter::progress ( )

Retrieve the progress reporting object for this filter.

◆ requiredInputs()

int iAFilter::requiredInputs ( ) const

Returns the number of image inputs required by this filter.

for typical image filters, this returns 1.

Returns
the number of images required as input

◆ run()

bool iAFilter::run ( QMap< QString, QVariant > const &  parameters)

Initialize and run the filter.

Parameters
parametersthe map of parameters to use in this specific filter run

◆ setFirstInputChannels()

void iAFilter::setFirstInputChannels ( unsigned int  c)

sets the first input channels.

◆ setInputName()

void iAFilter::setInputName ( unsigned int  i,
QString const &  name 
)
protected

Set the name of the input with the given index.

◆ setLogger()

void iAFilter::setLogger ( iALogger logger)

Set the logger to be used for status output / error messages.

◆ setOutputName()

void iAFilter::setOutputName ( unsigned int  i,
QString const &  name 
)
protected

Set the name of the output with the given index.

◆ setPolyOutput()

void iAFilter::setPolyOutput ( vtkSmartPointer< vtkPolyData >  poly)

Sets the mesh output of this filter.

◆ setProgress()

void iAFilter::setProgress ( iAProgress progress)

Set the facility for progress reporting.


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