Open duduufonsecaa opened 2 years ago
I assume you're using the featureextractor? In the execute()
function, you can pass the value of the label. Best way to extract then would be:
extractor = featureextractor.RadiomicsFeatureExtractor(params)
results = {}
for case_idx, im, mask in cases:
labels = np.unique(sitk.GetArrayFromImage(mask))
for l in labels:
if l == 0:
continue # don't extract for the background
results[(case_idx, l) = extractor.execute(im, ma, label=l)
I've done a directory in my Computer to save the color labels (ROIs) (in my code is 'labels'), then I've done a loop to read the .txt files and get the labels. Here is my code. The masks and labels is getting from 3DSlicer erythemaROI.txt Thanks for your answer.
Hello everyone! I have several masks and several ROIs in each mask and I'm getting difficult to catch the number of labels (i.e some has 5 ROIs other 3, 2...). I'm doing an interative code to calculate the radiomics. I'm using windows 10, python 3.9 Thanks