NorMIT-nav  2023.01.05-dev+develop.0da12
An IGT application
cx::GenericScriptFilter Class Reference

#include <cxGenericScriptFilter.h>

Inheritance diagram for cx::GenericScriptFilter:
cx::FilterImpl cx::Filter

Public Member Functions

 GenericScriptFilter (VisServicesPtr services)
 
virtual ~GenericScriptFilter ()
 
virtual QString getType () const
 
virtual QString getName () const
 
virtual QString getHelp () const
 
virtual bool execute ()
 
virtual bool postProcess ()
 
FilePathPropertyPtr getParameterFile (QDomElement root)
 
void setParameterFilePath (QString path)
 
FilePreviewPropertyPtr getIniFileOption (QDomElement root)
 
- Public Member Functions inherited from cx::FilterImpl
virtual ~FilterImpl ()
 
virtual QString getUid () const
 
virtual void initialize (QDomElement root, QString uid="")
 
virtual std::vector< PropertyPtrgetOptions ()
 
virtual std::vector< SelectDataStringPropertyBasePtrgetInputTypes ()
 
virtual std::vector< SelectDataStringPropertyBasePtrgetOutputTypes ()
 
virtual bool hasPresets ()
 
virtual PresetsPtr getPresets ()
 
virtual QDomElement generatePresetFromCurrentlySetOptions (QString name)
 
virtual void setActive (bool on)
 
virtual bool preProcess ()
 
- Public Member Functions inherited from cx::Filter
 Filter ()
 
virtual ~Filter ()
 

Public Attributes

PatientModelServicePtr mPatientModelService
 

Protected Slots

void scriptFileChanged ()
 
void processStateChanged ()
 
void processFinished (int code, QProcess::ExitStatus status)
 
void processError (QProcess::ProcessError error)
 
void processReadyRead ()
 
void processReadyReadError ()
 
bool createProcess ()
 
bool deleteProcess ()
 
bool disconnectProcess ()
 

Protected Member Functions

virtual void createOptions ()
 
virtual void createInputTypes ()
 
virtual void createOutputTypes ()
 
QString createCommandString (ImagePtr input)
 
bool runCommandStringAndWait (QString command)
 
QString getCustomPath ()
 
void setupOutputColors (QStringList colorList)
 
QColor createColor (QStringList color)
 
QColor getDefaultColor ()
 
void createOutputMesh (QColor color)
 
bool readGeneratedSegmentationFiles (bool createOutputVolume, bool createOutputMesh)
 
QString createImageName (QString parentName, QString filePath)
 
void createOutputVolume ()
 
void deleteNotUsedFiles (QString fileNameMhd, bool createOutputVolume)
 
QString getScriptPath ()
 
QString getInputFilePath (ImagePtr input)
 
QString getOutputFilePath (ImagePtr input)
 
CommandStringVariables createCommandStringVariables (ImagePtr input)
 
QString standardCommandString (CommandStringVariables variables)
 
bool isUsingDeepSintefEngine (CommandStringVariables variables)
 
QString deepSintefCommandString (CommandStringVariables variables)
 
bool environmentExist (QString path)
 
QString getEnvironmentPath (CommandStringVariables variables)
 
QString getEnvironmentBasePath (QString environmentPath)
 
QString findRequirementsFileLocation (QString path)
 
bool createVirtualPythonEnvironment (QString environmentPath, QString requirementsPath)
 
bool isVirtualEnvironment (QString path)
 
QString getFixedEnvironmentSubdir ()
 
- Protected Member Functions inherited from cx::FilterImpl
 FilterImpl (VisServicesPtr services)
 
ImagePtr getCopiedInputImage (int index=0)
 
void updateThresholdFromImageChange (QString uid, DoublePropertyPtr threshold)
 
void updateThresholdPairFromImageChange (QString uid, DoublePairPropertyPtr threshold)
 
PatientModelServicePtr patientService ()
 

Protected Attributes

FilePathPropertyPtr mScriptFile
 
FilePreviewPropertyPtr mScriptFilePreview
 
vtkImageDataPtr mRawResult
 
QString mOutputChannelName
 
QString mScriptPathAddition
 
ProcessWrapperPtr mCommandLine
 
QString mResultFileEnding
 
QStringList mOutoutOrgans
 
ImagePtr mOutputImage
 
QList< QColor > mOutputColors
 
QStringList mOutputClasses
 
SelectDataStringPropertyBasePtr mOutputImageSelectDataPtr
 
StringPropertySelectMeshPtr mOutputMeshSelectMeshPtr
 
BoolPropertyPtr mOutputMeshOption
 
- Protected Attributes inherited from cx::FilterImpl
std::vector< SelectDataStringPropertyBasePtrmInputTypes
 
std::vector< SelectDataStringPropertyBasePtrmOutputTypes
 
std::vector< PropertyPtrmOptionsAdapters
 
QDomElement mOptions
 
std::vector< DataPtrmCopiedInput
 
QDomElement mCopiedOptions
 
bool mActive
 
VisServicesPtr mServices
 

Additional Inherited Members

- Public Slots inherited from cx::FilterImpl
virtual void requestSetPresetSlot (QString name)
 
- Public Slots inherited from cx::Filter
virtual void requestSetPresetSlot (QString name)=0
 
- Signals inherited from cx::Filter
void changed ()
 

Detailed Description

Generic filter calling external filter script.

Date
Mar 10, 2020
Author
Torgrim Lie

Definition at line 56 of file cxGenericScriptFilter.h.

Constructor & Destructor Documentation

◆ GenericScriptFilter()

cx::GenericScriptFilter::GenericScriptFilter ( VisServicesPtr  services)

Definition at line 76 of file cxGenericScriptFilter.cpp.

◆ ~GenericScriptFilter()

cx::GenericScriptFilter::~GenericScriptFilter ( )
virtual

Definition at line 84 of file cxGenericScriptFilter.cpp.

Member Function Documentation

◆ createColor()

QColor cx::GenericScriptFilter::createColor ( QStringList  color)
protected

Definition at line 598 of file cxGenericScriptFilter.cpp.

◆ createCommandString()

QString cx::GenericScriptFilter::createCommandString ( ImagePtr  input)
protected

Definition at line 240 of file cxGenericScriptFilter.cpp.

◆ createCommandStringVariables()

CommandStringVariables cx::GenericScriptFilter::createCommandStringVariables ( ImagePtr  input)
protected

Definition at line 252 of file cxGenericScriptFilter.cpp.

◆ createImageName()

QString cx::GenericScriptFilter::createImageName ( QString  parentName,
QString  filePath 
)
protected

Definition at line 726 of file cxGenericScriptFilter.cpp.

◆ createInputTypes()

void cx::GenericScriptFilter::createInputTypes ( )
protectedvirtual

Implements cx::FilterImpl.

Definition at line 463 of file cxGenericScriptFilter.cpp.

◆ createOptions()

void cx::GenericScriptFilter::createOptions ( )
protectedvirtual

Implements cx::FilterImpl.

Definition at line 228 of file cxGenericScriptFilter.cpp.

◆ createOutputMesh()

void cx::GenericScriptFilter::createOutputMesh ( QColor  color)
protected

because the segmented image is 0..1

Definition at line 618 of file cxGenericScriptFilter.cpp.

◆ createOutputTypes()

void cx::GenericScriptFilter::createOutputTypes ( )
protectedvirtual

Implements cx::FilterImpl.

Definition at line 473 of file cxGenericScriptFilter.cpp.

◆ createOutputVolume()

void cx::GenericScriptFilter::createOutputVolume ( )
protected

Definition at line 740 of file cxGenericScriptFilter.cpp.

◆ createProcess

bool cx::GenericScriptFilter::createProcess ( )
protectedslot

Definition at line 512 of file cxGenericScriptFilter.cpp.

◆ createVirtualPythonEnvironment()

bool cx::GenericScriptFilter::createVirtualPythonEnvironment ( QString  environmentPath,
QString  requirementsPath 
)
protected

Definition at line 362 of file cxGenericScriptFilter.cpp.

◆ deepSintefCommandString()

QString cx::GenericScriptFilter::deepSintefCommandString ( CommandStringVariables  variables)
protected

Definition at line 284 of file cxGenericScriptFilter.cpp.

◆ deleteNotUsedFiles()

void cx::GenericScriptFilter::deleteNotUsedFiles ( QString  fileNameMhd,
bool  createOutputVolume 
)
protected

Definition at line 754 of file cxGenericScriptFilter.cpp.

◆ deleteProcess

bool cx::GenericScriptFilter::deleteProcess ( )
protectedslot

Definition at line 532 of file cxGenericScriptFilter.cpp.

◆ disconnectProcess

bool cx::GenericScriptFilter::disconnectProcess ( )
protectedslot

Definition at line 545 of file cxGenericScriptFilter.cpp.

◆ environmentExist()

bool cx::GenericScriptFilter::environmentExist ( QString  path)
protected

Definition at line 300 of file cxGenericScriptFilter.cpp.

◆ execute()

bool cx::GenericScriptFilter::execute ( )
virtual

Execute filter with the given inputs and produce an output. This method is threadable - can be executed in a secondary thread. Assumes preprocess has been called.

Returns
success.

Implements cx::Filter.

Definition at line 487 of file cxGenericScriptFilter.cpp.

◆ findRequirementsFileLocation()

QString cx::GenericScriptFilter::findRequirementsFileLocation ( QString  path)
protected

Definition at line 324 of file cxGenericScriptFilter.cpp.

◆ getCustomPath()

QString cx::GenericScriptFilter::getCustomPath ( )
protected

◆ getDefaultColor()

QColor cx::GenericScriptFilter::getDefaultColor ( )
protected

Definition at line 611 of file cxGenericScriptFilter.cpp.

◆ getEnvironmentBasePath()

QString cx::GenericScriptFilter::getEnvironmentBasePath ( QString  environmentPath)
protected

Definition at line 313 of file cxGenericScriptFilter.cpp.

◆ getEnvironmentPath()

QString cx::GenericScriptFilter::getEnvironmentPath ( CommandStringVariables  variables)
protected

Definition at line 305 of file cxGenericScriptFilter.cpp.

◆ getFixedEnvironmentSubdir()

QString cx::GenericScriptFilter::getFixedEnvironmentSubdir ( )
protected

Definition at line 383 of file cxGenericScriptFilter.cpp.

◆ getHelp()

QString cx::GenericScriptFilter::getHelp ( ) const
virtual

Return a help text describing algorithm usage.

Implements cx::Filter.

Definition at line 180 of file cxGenericScriptFilter.cpp.

◆ getIniFileOption()

FilePreviewPropertyPtr cx::GenericScriptFilter::getIniFileOption ( QDomElement  root)

Definition at line 212 of file cxGenericScriptFilter.cpp.

◆ getInputFilePath()

QString cx::GenericScriptFilter::getInputFilePath ( ImagePtr  input)
protected

Definition at line 411 of file cxGenericScriptFilter.cpp.

◆ getName()

QString cx::GenericScriptFilter::getName ( ) const
virtual

Return a descriptive name for this algorithm.

Implements cx::Filter.

Definition at line 170 of file cxGenericScriptFilter.cpp.

◆ getOutputFilePath()

QString cx::GenericScriptFilter::getOutputFilePath ( ImagePtr  input)
protected

Definition at line 419 of file cxGenericScriptFilter.cpp.

◆ getParameterFile()

FilePathPropertyPtr cx::GenericScriptFilter::getParameterFile ( QDomElement  root)

Definition at line 190 of file cxGenericScriptFilter.cpp.

◆ getScriptPath()

QString cx::GenericScriptFilter::getScriptPath ( )
protected

Definition at line 389 of file cxGenericScriptFilter.cpp.

◆ getType()

QString cx::GenericScriptFilter::getType ( ) const
virtual

Return the type of this algorithm. Need to match id string in user documentation

Implements cx::Filter.

Definition at line 175 of file cxGenericScriptFilter.cpp.

◆ isUsingDeepSintefEngine()

bool cx::GenericScriptFilter::isUsingDeepSintefEngine ( CommandStringVariables  variables)
protected

Definition at line 277 of file cxGenericScriptFilter.cpp.

◆ isVirtualEnvironment()

bool cx::GenericScriptFilter::isVirtualEnvironment ( QString  path)
protected

Definition at line 376 of file cxGenericScriptFilter.cpp.

◆ postProcess()

bool cx::GenericScriptFilter::postProcess ( )
virtual

Perform postprocessing tasks and set result from calculation into the output adapters.

Must be called from the main thread. Assumes execute() has been called.

Returns
success.

Implements cx::Filter.

Definition at line 558 of file cxGenericScriptFilter.cpp.

◆ processError

void cx::GenericScriptFilter::processError ( QProcess::ProcessError  error)
protectedslot

Definition at line 120 of file cxGenericScriptFilter.cpp.

◆ processFinished

void cx::GenericScriptFilter::processFinished ( int  code,
QProcess::ExitStatus  status 
)
protectedslot

Definition at line 114 of file cxGenericScriptFilter.cpp.

◆ processReadyRead

void cx::GenericScriptFilter::processReadyRead ( )
protectedslot

Definition at line 152 of file cxGenericScriptFilter.cpp.

◆ processReadyReadError

void cx::GenericScriptFilter::processReadyReadError ( )
protectedslot

Definition at line 161 of file cxGenericScriptFilter.cpp.

◆ processStateChanged

void cx::GenericScriptFilter::processStateChanged ( )
protectedslot

Definition at line 88 of file cxGenericScriptFilter.cpp.

◆ readGeneratedSegmentationFiles()

bool cx::GenericScriptFilter::readGeneratedSegmentationFiles ( bool  createOutputVolume,
bool  createOutputMesh 
)
protected

Definition at line 645 of file cxGenericScriptFilter.cpp.

◆ runCommandStringAndWait()

bool cx::GenericScriptFilter::runCommandStringAndWait ( QString  command)
protected

Definition at line 442 of file cxGenericScriptFilter.cpp.

◆ scriptFileChanged

void cx::GenericScriptFilter::scriptFileChanged ( )
protectedslot

Definition at line 235 of file cxGenericScriptFilter.cpp.

◆ setParameterFilePath()

void cx::GenericScriptFilter::setParameterFilePath ( QString  path)

Definition at line 206 of file cxGenericScriptFilter.cpp.

◆ setupOutputColors()

void cx::GenericScriptFilter::setupOutputColors ( QStringList  colorList)
protected

Definition at line 574 of file cxGenericScriptFilter.cpp.

◆ standardCommandString()

QString cx::GenericScriptFilter::standardCommandString ( CommandStringVariables  variables)
protected

Definition at line 266 of file cxGenericScriptFilter.cpp.

Member Data Documentation

◆ mCommandLine

ProcessWrapperPtr cx::GenericScriptFilter::mCommandLine
protected

Definition at line 115 of file cxGenericScriptFilter.h.

◆ mOutoutOrgans

QStringList cx::GenericScriptFilter::mOutoutOrgans
protected

Definition at line 117 of file cxGenericScriptFilter.h.

◆ mOutputChannelName

QString cx::GenericScriptFilter::mOutputChannelName
protected

Definition at line 113 of file cxGenericScriptFilter.h.

◆ mOutputClasses

QStringList cx::GenericScriptFilter::mOutputClasses
protected

Definition at line 120 of file cxGenericScriptFilter.h.

◆ mOutputColors

QList<QColor> cx::GenericScriptFilter::mOutputColors
protected

Definition at line 119 of file cxGenericScriptFilter.h.

◆ mOutputImage

ImagePtr cx::GenericScriptFilter::mOutputImage
protected

Definition at line 118 of file cxGenericScriptFilter.h.

◆ mOutputImageSelectDataPtr

SelectDataStringPropertyBasePtr cx::GenericScriptFilter::mOutputImageSelectDataPtr
protected

Definition at line 122 of file cxGenericScriptFilter.h.

◆ mOutputMeshOption

BoolPropertyPtr cx::GenericScriptFilter::mOutputMeshOption
protected

Definition at line 124 of file cxGenericScriptFilter.h.

◆ mOutputMeshSelectMeshPtr

StringPropertySelectMeshPtr cx::GenericScriptFilter::mOutputMeshSelectMeshPtr
protected

Definition at line 123 of file cxGenericScriptFilter.h.

◆ mPatientModelService

PatientModelServicePtr cx::GenericScriptFilter::mPatientModelService

Definition at line 75 of file cxGenericScriptFilter.h.

◆ mRawResult

vtkImageDataPtr cx::GenericScriptFilter::mRawResult
protected

Definition at line 112 of file cxGenericScriptFilter.h.

◆ mResultFileEnding

QString cx::GenericScriptFilter::mResultFileEnding
protected

Definition at line 116 of file cxGenericScriptFilter.h.

◆ mScriptFile

FilePathPropertyPtr cx::GenericScriptFilter::mScriptFile
protected

Definition at line 109 of file cxGenericScriptFilter.h.

◆ mScriptFilePreview

FilePreviewPropertyPtr cx::GenericScriptFilter::mScriptFilePreview
protected

Definition at line 110 of file cxGenericScriptFilter.h.

◆ mScriptPathAddition

QString cx::GenericScriptFilter::mScriptPathAddition
protected

Definition at line 114 of file cxGenericScriptFilter.h.


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