Basically if you read the dicoms using SimpleITK.ReadImage or VTK the tool loads the files in the same order your list is in (usually alphabetical order). The mapping between the slices and the files are not in alphabetical order and are instead in a random order. This causes the Slice Spacing (a tag that is missing in these data) to be computed incorrectly since it is the difference in position between file 0 and 1. It also causes brain slices to turn up between two lung slices and other strange artifacts.
The solution is to presort the files using the GetGDCMSeriesFileNames
function.
# noinspection PyPep8Naming
import SimpleITK as sitk
def safe_sitk_read(img_list, *args, **kwargs):
dir_name = os.path.dirname(img_list[0])
s_img_list = sitk.ImageSeriesReader().GetGDCMSeriesFileNames(dir_name)
return sitk.ReadImage(s_img_list, *args, **kwargs)