Hi,
I want to calculate average pet intensity within given ROI. I have two images: (1) PET registered on CT and (2) ROI registered on CT. I can do this in MATLAB but I want to try with python. Does anyone have python solution similar to this? I am new to python.
Here is the MATLAB code:
pet_image = niftiread(‘pet_on_ct.nii.gz’);
roi_image = niftiread(‘ROI_MNI_on_ct.nii.gz’);
index_all = unique(roi_image(:));
result=[];
for i = 1:length(index_all)
index = index_all(i)
pet_intensity_within_given_roi=pet_image(find(roi_image==index));
result=[result; mean(pet_intensity_within_given_roi)];
end;
Thanks.