I am able to convert one .mhd file into .jpg.But unable to repeat the same operation for all the 10 subfolders in LUNA16 dataset.I am using python and SimpleITK to get the thing done.Basically,I got stuck with the repeat operation.
Not familiar with your software, but I will give you an example in "BASH" (the shell mostly used by linux/unix machines). In this code, I use the command "convert" to "cut to size" all the files with the extension "png" in a directory. In this particular example, all the png files are cropped to 2220 by 3012 pixels. To make it work you will need to figure out how to call your python script from bash (should not be too hard) . Otherwise you would need to find out how to list/read the filenames you want from python, stick them in a list and then work on that list in a for loop or whatever python uses for loops.
here it is:
for file in *.png;
do convert $file -gravity Center -crop 2220x3012+0+0 $file