Simple script to compare images. Let's assume we have the following three images:

FLAIR DWI b0 DWI b1000

Comparing an image with itself yields no differences.


In [1]:
medpy_diff.py resources/flair.nii.gz resources/flair.nii.gz


No other difference.

Comparing images with different dimensionality compares the meta-data but not the content.


In [2]:
medpy_diff.py resources/flair.nii.gz resources/b0.nii.gz


Dtype differs: float32 to uint16
Shape differs: (181, 217) to (1024, 1024)
The voxel content of images of different shape can not be compared. Exiting.

For fitting images, a summary of the content differences is provided.


In [4]:
medpy_diff.py resources/b0.nii.gz resources/b1000.nii.gz


Voxel differ: 1047071 of 1048576 total voxels
Max difference: 65535

In [ ]: