open-discussion > Help_from nii.gz to json file
Showing 1-3 of 3 posts
Results per page:
Oct 3, 2023  03:10 PM | oihana
Help_from nii.gz to json file

Dear all, 

I would like to know if there is a way to obtain json file from nii.gz images. I need the json file but I do not have the previous DICOM archives to do the usual convertion.  Is there any possibility to get this?

Any sugestions would be helpful

Thank you in advance 



Oct 4, 2023  11:10 PM | Horsng Junn
RE: Help_from nii.gz to json file

Hi Oihana,

I'm not an expert but since nobody has replied to your enquiry yet I'd give it a try.

I'm afraid you're probably out of luck: nii files usually lack the rich medata dcm files provide you with. In case you're thinking of json files the kind of which dcm2niix emits along with the nii.gz files for example, it's precisely because the resulting nii files can't contain the metadata that the tool emits json files to begin with.

In fact, nii file format has the provision for metadata: you can have them between its header and voxel data portions (please refer to for more info), but personally I've never seen any such nii files with the metadata with them yet.

Just in case, you can check if your nii.gz file do contain the metadata by following this procedure in a terminal session (I'm assuming you're using a linux or a mac):

  1. First you need to unzip the .nii.gz and extract .nii by: `unzip yourfile.nii.gz`
  2. Then you can check its header portion by: `hexdump -x -n 112 yourfile.nii`

If your output ends with `0000    43b0` as in `00000060  (omitted) 0000    43b0` (which probaly will be) then it means your nii file doesn't contain any such metadata.

(nii files do have some minimal metadata in its standard header portion, but it's not enough to fill a full-fledged json.)

Horsng Junn

Oct 6, 2023  08:10 AM | oihana
RE: Help_from nii.gz to json file

Thank you so  much Horsng Junn, I´ll give it a try