Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to select the ROI from multiple ROIs in one segmentation file? #802

Open
Leylaastro opened this issue Dec 14, 2022 · 1 comment
Open
Labels

Comments

@Leylaastro
Copy link

Hi,
For each study I have one 3D CT file and one segmentation file with multiple ROIs. I have two questions: 1- How can I know how many ROIs are in the segmenation file. 2- How can I extract radiomics for the ROIs one by one? I know that to select the desired ROI in which I am interested to extract the radiomics I should identify 'label', and each time I can only extract the radiomics for one ROI, right? But how can I know about the value of the labels? Imagine that I have 5 ROIs in one segmentation file and I only need to extract the features for the 2nd ROI or for the one which is labelled as 'Tumor' in the SEG dicom file. How can I specify it with 'label' in the execute function of pyradiomics?

@Ianyliu
Copy link

Ianyliu commented Jun 15, 2023

Hi @Leylaastro
I might be able to answer some of your questions.

  1. To know how many ROIs are in a segmentation file you might want to count the number of labels in the segmentation file.
  2. One way to extract radiomics for the ROI one by one is to separate the segmentation file into multiple files so that each file only has 1 label or ROI. Below is an example of in which I load the AAL atlas (consists of 116 labels/ROIs) and save them as separate masks/segmentation files.
# Load the AAL atlas
atlas_img = nib.load(aal_file_path)

# Get the atlas data
atlas_data = atlas_img.get_fdata()

# Loop through the region labels and create binary masks
for region in range(1, 117):
    # Create a binary mask for the current region
    mask = np.zeros_like(atlas_data)
    mask[atlas_data == region] = 1
    
    # Save the mask to a file
    nib.save(nib.Nifti1Image(mask, atlas_img.affine), f'{region}.nii.gz')

Regarding the other questions, such as how to determine which ROI is the one we're interested in, you might want to try opening up the semgentation file 3D Slicer, which has a SlicerRadiomics extension. In 3D Slicer, you should be able to visually see the labels of each ROI and conduct radiomics feature extraction on one of the segmentations. (If not then you might have to split the segmentation file into multiple files like aforementioned so that each file only has 1 label or ROI).

I'm not sure if this is directly related but I hope this helps!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants