Post-Processing Module#

Module: pyradise.process.postprocess

General#

The postprocess module includes a single component filter class (i.e. SingleConnectedComponentFilter) which exclusively keeps the largest single component on the provided SegmentationImage s. Furthermore, this module provides a filter for alphabetically sorting the subject-associated SegmentationImage s via their Organ name. This functionality is essential if the Organ s in a subsequently generated DICOM-RTSS dataset must be sorted.

Class Overview#

The following classes are provided by the postprocess module:

Class

Description

SingleConnectedComponentFilterParams

Parameterization class for the SingleConnectedComponentFilter.

SingleConnectedComponentFilter

Filter to keep the single largest connected component on a SegmentationImage instance.

AlphabeticOrganSortingFilterParams

Parameterization class for the AlphabeticOrganSortingFilter.

AlphabeticOrganSortingFilter

Filter for alphabetic sorting of the SegmentationImage instance in a subject.

Details#

class SingleConnectedComponentFilterParams(excluded_organs=None)[source]#

Bases: FilterParams

A filter parameter class for the SingleConnectedComponentFilter class.

Parameters:

excluded_organs (Optional[Union[Organ, Tuple[Organ, ...]]]) – The organs to be excluded from the connected component filtering. If None all SegmentationImage instances will be filtered.

class SingleConnectedComponentFilter(warning_on_non_invertible=False)[source]#

Bases: Filter

A filter class for removing all but the largest connected component from the specified SegmentationImage instances in the provided Subject instance.

static is_invertible()[source]#

Return whether the filter is invertible or not.

Returns:

False because the SingleConnectedComponentFilter is not invertible.

Return type:

bool

execute(subject, params)[source]#

Execute the single connected component filter procedure.

Parameters:
Returns:

The Subject instance with filtered SegmentationImage instances.

Return type:

Subject

execute_inverse(subject, transform_info, target_image=None)[source]#

Return the provided Subject instance without any processing because the single connected component filtering procedure is not invertible.

Parameters:
  • subject (Subject) – The Subject instance to be returned.

  • transform_info (TransformInfo) – The transform information.

  • target_image (Optional[Union[SegmentationImage, IntensityImage]]) – The target image to which the inverse transformation should be applied. If None, the inverse transformation is applied to all images (default: None).

Returns:

The provided Subject instance.

Return type:

Subject

class AlphabeticOrganSortingFilterParams(ascending=True)[source]#

Bases: FilterParams

A filter parameter class for the AlphabeticOrganSortingFilter class.

Parameters:

ascending (bool) – If the organs should be sorted in ascending order or not (default: True).

class AlphabeticOrganSortingFilter(warning_on_non_invertible=False)[source]#

Bases: Filter

A filter class performing an alphabetic sorting of the SegmentationImage instances according to their assigned Organ names.

Note

This filter is helpful when ordering of the output matters such as for example if constructing a DICOM-RTSS Dataset instance.

static is_invertible()[source]#

Return whether the filter is invertible or not.

Returns:

False because the AlphabeticOrganSortingFilter is not invertible.

Return type:

bool

execute(subject, params)[source]#

Execute the alphabetical sorting of the SegmentationImage instances according to their associated Organ instances.

Parameters:
Returns:

The Subject instance with the alphabetically sorted SegmentationImage instances.

Return type:

Subject

execute_inverse(subject, transform_info, target_image=None)[source]#

Return the provided image without any processing because the alphabetical sorting procedure is not invertible.

Parameters:
  • subject (Subject) – The Subject instance to be returned.

  • transform_info (TransformInfo) – The transform information.

  • target_image (Optional[Union[SegmentationImage, IntensityImage]]) – The target image to which the inverse transformation should be applied. If None, the inverse transformation is applied to all images (default: None).

Returns:

The provided Subject instance.

Return type:

Subject