pyushkevich / itksnap

ITK-SNAP medical image segmentation tool
http://www.itksnap.org
GNU General Public License v3.0
294 stars 86 forks source link

Image Origin inconsistent in ITK-snap and Nifti image #19

Closed hzz0033 closed 4 years ago

hzz0033 commented 4 years ago

Hello to anyone, I got an origin inconsistent problem. I defined 3D volume origin as (0,0,0) in NIFTI image file, however, when imported into ITK-snap software, its origin show as (-0.5, -0.5, 0.5). I would like to ask how this happened and how to fix this problem.

Here is the detail of the problem:

I used MATLAB "Tools for NIfTI and ANALYZE image" to create an example Nifti file, like this:

voxel_size = [0.5,0.5,0.5]; origin = [0,0,0]; % In make_nii file, it said this is AC origin, I would like to ask what is AC? nii = make_nii(bb.img,voxel_size,origin,datatype); save_nii(nii,'test.nii');

Its header information .hdr result shows like this: image

A better view of 'test.nii' header information in cmd is here: image

However, when importing 'test.nii' into ITK-snap 3.8 software, image information show like this: image

Origin changed from (0,0,0) to (-0.5, -0.5, 0.5). I would like to consult how this result come in ITK-snap, that bounding box calculation, and what should I do to correct this problem?

hzz0033 commented 4 years ago

Solved it myself by modifying srow_x/y/z matrix, origin input is voxel coordinate instead of world coordinate, and Nifti Image format orientation is different from the ITK