I was wondering if it is possible to extract the images and masks on which the feature calculation is based with Pyradiomics in command-line batch mode. I would like to make some comparisons on different mask validation, image discretization, and normalization procedures.
Currently, it is not possible to do so directly from the commandline. Still, PyRadiomcis is built fairly modular, so it shouldn’t be to much of a hassle to use the pre-processing functions directly.
Image pre-processing (e.g. normalization, resampling and application of filters) is all defined in imageoperations.py. Every functions accepts a **kwargs argument dict, which contains all configuration from the setting section in the parameter file (it doesn’t matter if there are settings in the dict that are intended for other functions, it just takes out those that are needed).
Image discretization is just as easy, but works on the numpy array extracted from the image. The function you’re looking for is imageoperations.binImage, which accepts the image_array, an optional mask_array and the **kwargs settings. In case the mask array (boolean array) is provided, the discretization is based only on the pixels inside the ROI (PyRadiomics default). If omitted, the entire image is discretized. Be aware that the selection of the label is done elsewhere, the mask array should have boolean datatype indicating only the active ROI.
thanks for your answers.
I managed to transform the images.
I was wondering, since the functions (such as imageoperations.getLoGImage) take the image and the segmentations but only output the transformed img could the segmentation (the region of interest) be effected by the transformation?
Or in other words do we need to refine the mask for transformed images (might be that the borders of the segmentation from the original image do not fit 100% on the transformed image)?