Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
MPBA Radiomics
RADLER
Commits
bd126a71
Commit
bd126a71
authored
Mar 19, 2020
by
Alessia Marcolini
Browse files
Better handling of features configuration path
parent
49658726
Changes
1
Show whitespace changes
Inline
Side-by-side
02_radiomics_features_extraction/extract_features_radiomics.py
View file @
bd126a71
#%%
import
os
from
pyradiomics_radler
import
MyRadiomicsFeaturesExtractor
as
RadiomicsFeatureExtractor
from
pathlib
import
Path
import
SimpleITK
as
sitk
import
numpy
as
np
import
pandas
as
pd
from
pathlib
import
Path
from
tqdm
import
tqdm
from
pyradiomics_radler
import
MyRadiomicsFeaturesExtractor
as
RadiomicsFeatureExtractor
from
multiproc
import
ListMultiprocessing
import
warnings
...
...
@@ -28,22 +28,32 @@ PIXEL_SPACING = [1.0, 2.0, 3.0, 4.0, 5.0]
#%%
DATADIR
=
Path
(
'data'
)
/
DATASET
/
'processed'
/
'bbox'
/
BBOX
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'
)
#%%
params_shape
=
'02_radiomics_features_extraction/shape.yaml'
# param file to use to create the extractor
extractor_shape
=
RadiomicsFeatureExtractor
(
params_shape
)
params_intensity_CT
=
'02_radiomics_features_extraction/intensity_CT.yaml'
# param file to use to create the extractor
extractor_intensity_CT
=
RadiomicsFeatureExtractor
(
params_intensity_CT
)
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_texture
=
'02_radiomics_features_extraction/texture.yaml'
# param file to use to create the extractor
extractor_texture
=
RadiomicsFeatureExtractor
(
params_texture
)
FEATURES_CONFIGURATION_FOLDER
=
Path
(
__file__
).
parent
.
resolve
()
params_shape
=
(
FEATURES_CONFIGURATION_FOLDER
/
'shape.yaml'
)
# param file to use to create the extractor
extractor_shape
=
RadiomicsFeatureExtractor
(
str
(
params_shape
))
params_intensity_CT
=
(
FEATURES_CONFIGURATION_FOLDER
/
'intensity_CT.yaml'
)
# param file to use to create the extractor
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'
)]
exclude_list
=
[]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment