vtkImageReslice execution speed difference

Hello, I’m using vtkImageReslice to make oblique mpr for my application. The other day I found out that it takes couple times longer for filter to extract sagittal slices than coronal. Is it expected behavior?

Yes, that’s normal. This is due to the way the memory is accessed.

When image data is stored, pixels that are adjacent to each other in a row of the image are also adjacent in memory.

When axial is resliced to coronal, pixels that are adjacent in memory for the coronal image are also adjacent in memory for the axial image.

When axial is resliced to sagittal, pixels that adjacent in memory for sagittal are in different rows (and therefore not adjacent in memory) for the axial image.

Since the CPU reads the memory in chunks (cache lines), it takes longer to iterate through pixels that aren’t adjacent in memory.

3 Likes