Commit bd126a71 authored by Alessia Marcolini's avatar Alessia Marcolini
Browse files

Better handling of features configuration path

parent 49658726
#%% #%%
import os import os
from pyradiomics_radler import MyRadiomicsFeaturesExtractor as RadiomicsFeatureExtractor from pathlib import Path
import SimpleITK as sitk import SimpleITK as sitk
import numpy as np import numpy as np
import pandas as pd import pandas as pd
from pathlib import Path
from tqdm import tqdm from tqdm import tqdm
from pyradiomics_radler import MyRadiomicsFeaturesExtractor as RadiomicsFeatureExtractor
from multiproc import ListMultiprocessing from multiproc import ListMultiprocessing
import warnings import warnings
...@@ -28,22 +28,32 @@ PIXEL_SPACING = [1.0, 2.0, 3.0, 4.0, 5.0] ...@@ -28,22 +28,32 @@ PIXEL_SPACING = [1.0, 2.0, 3.0, 4.0, 5.0]
#%% #%%
DATADIR = Path('data') / DATASET / 'processed' / 'bbox' / BBOX DATADIR = Path('data') / DATASET / 'processed' / 'bbox' / BBOX
OUTDIR = Path('data') / DATASET / 'processed' OUTDIR = Path('data') / DATASET / 'processed'
OUTFILE = f'radiomics_features_{BBOX}.csv' # output file name OUTFILE = f'radiomics_features_{BBOX}_1.csv' # output file name
clinical = pd.read_csv(Path('data') / DATASET / 'processed' / f'clinical_{DATASET}.csv') clinical = pd.read_csv(Path('data') / DATASET / 'processed' / f'clinical_{DATASET}.csv')
#%% #%%
params_shape = '02_radiomics_features_extraction/shape.yaml' # param file to use to create the extractor FEATURES_CONFIGURATION_FOLDER = Path(__file__).parent.resolve()
extractor_shape = RadiomicsFeatureExtractor(params_shape)
params_shape = (
params_intensity_CT = '02_radiomics_features_extraction/intensity_CT.yaml' # param file to use to create the extractor FEATURES_CONFIGURATION_FOLDER / 'shape.yaml'
extractor_intensity_CT = RadiomicsFeatureExtractor(params_intensity_CT) ) # param file to use to create the extractor
extractor_shape = RadiomicsFeatureExtractor(str(params_shape))
params_intensity_PET = '02_radiomics_features_extraction/intensity_PET.yaml' # param file to use to create the extractor
extractor_intensity_PET = RadiomicsFeatureExtractor(params_intensity_PET) params_intensity_CT = (
FEATURES_CONFIGURATION_FOLDER / 'intensity_CT.yaml'
params_texture = '02_radiomics_features_extraction/texture.yaml' # param file to use to create the extractor ) # param file to use to create the extractor
extractor_texture = RadiomicsFeatureExtractor(params_texture) extractor_intensity_CT = RadiomicsFeatureExtractor(str(params_intensity_CT))
params_intensity_PET = (
FEATURES_CONFIGURATION_FOLDER / 'intensity_PET.yaml'
) # param file to use to create the extractor
extractor_intensity_PET = RadiomicsFeatureExtractor(str(params_intensity_PET))
params_texture = (
FEATURES_CONFIGURATION_FOLDER / 'texture.yaml'
) # param file to use to create the extractor
extractor_texture = RadiomicsFeatureExtractor(str(params_texture))
filenames = [f for f in os.listdir(DATADIR) if f.endswith('.npy')] filenames = [f for f in os.listdir(DATADIR) if f.endswith('.npy')]
exclude_list = [] exclude_list = []
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment