processing Package

ExtractNLargestBlobsn Module

WORC.processing.ExtractNLargestBlobsn.ExtractNLargestBlobsn(binaryImage, numberToExtract=1)[source]

Extract N largest blobs from binary image.

Arguments:

binaryImage: boolean numpy array one or several contours. numberToExtract: number of blobs to extract (integer).

Returns:
binaryImage: boolean numpy are containing only the N

extracted blobs.

classes Module

class WORC.processing.classes.switch(value)[source]

Bases: object

Object to mimic the MATLAB switch - case statement.

__dict__ = mappingproxy({'__module__': 'WORC.processing.classes', '__doc__': ' Object to mimic the MATLAB switch - case statement.', '__init__': <function switch.__init__>, '__iter__': <function switch.__iter__>, 'match': <function switch.match>, '__dict__': <attribute '__dict__' of 'switch' objects>, '__weakref__': <attribute '__weakref__' of 'switch' objects>})
__init__(value)[source]

Initialize self. See help(type(self)) for accurate signature.

__iter__()[source]

Return the match method once, then stop

__module__ = 'WORC.processing.classes'
__weakref__

list of weak references to the object (if defined)

match(*args)[source]

Indicate whether or not to enter a case suite

label_processing Module

WORC.processing.label_processing.findlabeldata(patientinfo, label_type, filenames=None, objects=None, pids=None)[source]

Load the label data and match to the unage features.

Args:

patientinfo (string): file with patient label data label_type (string): name of the label read out from patientinfo filenames (list): names of the patient feature files, used for matching objects (np.array or list): array of objects you want to order as well

Returns:

label_data (dict): contains patient ids, their labels and the label name

WORC.processing.label_processing.load_config_XNAT(config_file_path)[source]

Configparser for retreiving patient data from XNAT.

WORC.processing.label_processing.load_label_XNAT(label_info)[source]

Load the patient IDs and label data from XNAT, Only works if you have a file /resources/GENETICS/files/genetics.json for each patient containing a single dictionary of all labels.

Args:

url (string): XNAT URL project: XNAT project ID

Returns:

label_names (numpy array): Names of the different labels patient_ID (numpy array): IDs of patients for which label data is

loaded

label_status (numpy array): The status of the different labels

for each patient

WORC.processing.label_processing.load_label_csv(input_file)[source]

Load the patient IDs and label data from the label file

Args:

input_file (string): Path of the label file

Returns:

label_names (numpy array): Names of the different labels patient_ID (numpy array): IDs of patients for which label data is

loaded

label_status (numpy array): The status of the different labels

for each patient

WORC.processing.label_processing.load_label_txt(input_file)[source]

Load the patient IDs and label data from the label file

Args:

input_file (string): Path of the label file

Returns:

label_names (numpy array): Names of the different labels patient_ID (numpy array): IDs of patients for which label data is

loaded

label_status (numpy array): The status of the different labels

for each patient

WORC.processing.label_processing.load_labels(label_file, label_type)[source]

Loads the label data from a label file

Args:

label_file (string): The path to the label file label_type (list): List of the names of the labels to load

Returns:
dict: A dict containing ‘patient_IDs’, ‘label’ and

‘label_type’

preprocessing Module

WORC.processing.preprocessing.preprocess(imagefile, config, metadata=None, mask=None)[source]

Apply preprocessing to an image to prepare it for feture extration

segmentix Module

WORC.processing.segmentix.dilate_contour(contour, radius=5)[source]

Dilate the contour

contour: numpy array

Array containing the contour

radius: int, default 5

Radius of ring to be extracted.

WORC.processing.segmentix.get_ring(contour, radius=5)[source]

Get a ring on the boundary of the contour.

contour: numpy array

Array containing the contour

radius: int, default 5

Radius of ring to be extracted.

WORC.processing.segmentix.mask_contour(contour, mask, method='multiply')[source]

Apply a mask to a contour.

contour: numpy array

Array containing the contour

mask: string

path referring to the mask used for the final segmentation. Should be a format compatible with ITK, e.g. .nii, .nii.gz, .mhd, .raw, .tiff, .nrrd.

method: string

How masking is applied: can be subtract or pairwise

WORC.processing.segmentix.segmentix(parameters, image=None, segmentation=None, output=None, metadata_file=None, mask=None)[source]

Segmentix is a mixture of processing methods that can be applied to agument a segmentation. Examples include selecting only the largest blob and the application of morphological operations.

parameters: string, mandatory

Contains the path referring to a .ini file in which the parameters to be used are specified. See the Github Wiki for more details on the format and content.

image: string, optional

Note implemented yet! Image to be used for automatic segmentation.

segmentation: string, currently mandatory

path referring to the input segmentation file. Should be a format compatible with ITK, e.g. .nii, .nii.gz, .mhd, .raw, .tiff, .nrrd.

output: string, mandatory

path referring to the output segmentation file. Should be a format compatible with ITK, e.g. .nii, .nii.gz, .mhd, .raw, .tiff, .nrrd.

metadata_file: string, optional

Note implemented yet! Path referring to the .dcm from which fields can be used as metadata for segmentation.

mask: string, optional

path referring to the mask used for the final segmentation. Should be a format compatible with ITK, e.g. .nii, .nii.gz, .mhd, .raw, .tiff, .nrrd.