How do I get the volumes of 3d binary images in certain resolutions located in subdirectories?

1 view (last 30 days)
Dear experts,
I'm sorry if my question is a bit vague. I have the following problem. I have a directory with patient data. The subdirectories are named with patient initials and hospital codes. For all these patients I have files in these subdirectories and I am interested in files that contain '*label.nii' in the name. For these files I want to calculate the volume. These files are all binary (tumor segmentations). The volume depends on the resolution of the original scan. But even if I do not take the resolution into account and I only calculate the number of elements (nonzeros) in the binary image, I can determine the factor to multiply with to get the volume, if I have the segmentation file name in my output (the filenames containing *label.nii in the name). The problem is mostly the different subdirectory names, working with the functions Dir and DirList and looping the functions is kind of confusing. Any help is appreciated.
p.s.: I don't have the image processing toolbox, but I have spm.

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!