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>, '__annotations__': {}})¶
- __module__ = 'WORC.processing.classes'¶
- __weakref__¶
list of weak references to the object (if defined)
helpers
Module¶
- WORC.processing.helpers.check_image_orientation(image)[source]¶
Check the orientation of an ITK image.
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=None)[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.bias_correct_image(img, usemask=False)[source]¶
Apply N4 Bias Correction.
- WORC.processing.preprocessing.clip_image(image, lowerbound=- 1000.0, upperbound=3000.0)[source]¶
Clip intensity range of an image.
Parameters image: ITK Image
Image to normalize
- lowerbound: float, default -1000.0
lower bound of clipping range
- upperbound: float, default 3000.0
lower bound of clipping range
- imageITK Image
Output image.
- WORC.processing.preprocessing.normalize_image(image, mask=None, method='z_score', Normalize_ROI='Full', Dilate_ROI='True', ROI_dilate_radius=5, ROIDetermine='Provided', AssumeSameImageAndMaskMetadata=True)[source]¶
Apply normalization to an image.
- image: ITK Image
Image to normalize
- mask: None or ITK Image
Optional: mask to be used for normalization
- method: string, default z_score
Method to be used for normalization.
- Normalize_ROI: string, default Full
ROI to use for normalization, Can be Full or True
- Dilate_ROI: string, default True
Whether to dilate the ROI or not
- ROI_dilate_radius: int, default 5
Radius to use for ROI dilation.
- ROIDetermine: string, default provided
Whether mask is used as ROI or it is determined, e.g. through Otsu.
- AssumeSameImageAndMaskMetadata: boolean
If True, copy metadata from image to mask.
- imageITK Image
Output image.
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]¶
Alter a segmentation.
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.