nicetoolbox.detectors.feature_detectors.base_feature

A template class for Detectors.

Classes

BaseFeature

Abstract class to setup and run follow-up computations, called features detectors.

class nicetoolbox.detectors.feature_detectors.base_feature.BaseFeature(config, io, data, requires_out_folder=True)[source]

Abstract class to setup and run follow-up computations, called features detectors. Input is always the output of any method detector.

input_folders

A list of input folders.

Type:

list

input_files

A list of input files.

Type:

list

result_folders

A dictionary of result folders.

Type:

dict

out_folder

The output folder.

Type:

str

viz_folder

The visualization folder.

Type:

str

subjects_descr

The subjects description.

Type:

str

config_path

The path to the configuration file.

Type:

str

Sets up the input and output folders based on the provided configurations and handles any necessary file checks. Input folders contain the the results of the method detectors. Saves a copy of the configuration file for the feature detector.

Parameters:
  • config (dict) – The feature-specific configurations dictionary.

  • io (class) – A class instance that handles input and output folders.

  • data (class) – A class instance that contains the data.

  • requires_out_folder (bool, optional) – Whether the output folder is required. Defaults to True.

Returns:

None

abstract property algorithm

Abstract property that returns the algorithm of the feature detector.

This property should be implemented in the derived classes to specify the algorithm that the feature detector is associated with.

Returns:

A string representing the algorithm associated with the feature

detector.

Return type:

str

Raises:

NotImplementedError – If the property is not set in the derived classes.

abstract property components

Abstract property that returns the components of the feature.

This property should be implemented in the derived classes to specify the components that the feature detector is associated with.

Returns:

A list of strings representing the components associated with the

feature detector.

Return type:

list

Raises:

NotImplementedError – If the property is not set in the derived classes.

abstract compute()[source]

Compute the components associated to the given feature detector.

This method is responsible for performing the main computation logic of the feature detector. It should take the method detector output as input, process it, and generate the desired components.

abstract post_compute()[source]

Post-processing after computation.

This method is intended to perform any necessary post-processing tasks after the main computation method (compute) has been executed. It is designed to be overridden in derived classes to provide specific post-processing logic.

abstract visualization(data)[source]

Abstract method to visualize the output of the method, preferably as a video.

This method is intended to generate a visual representation of the feature detector’s output. The visualization should be saved in the self.viz_folder.

Parameters:

data (any) – The data to be visualized. The type and content of this parameter depend on the specific implementation of the feature detector.

Returns:

This method does not return any value. However, it should save the

visualization in the self.viz_folder.

Return type:

None

Raises:

NotImplementedError – If this method is not implemented in the derived classes.